1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Rename various build script functions (#15317)

Some of the functions in `development/build/scripts.js` have been
renamed to better describe their function, and to be more consistent
with other similar functions.
This commit is contained in:
Mark Stacey 2022-07-21 19:33:28 -04:00 committed by GitHub
parent 61783bbe89
commit 4c942aa008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -196,22 +196,22 @@ function createScriptTasks({
// internal tasks // internal tasks
const core = { const core = {
// dev tasks (live reload) // dev tasks (live reload)
dev: createTasksForBuildJsExtension({ dev: createTasksForScriptBundles({
taskPrefix: 'scripts:core:dev', taskPrefix: 'scripts:core:dev',
devMode: true, devMode: true,
}), }),
testDev: createTasksForBuildJsExtension({ testDev: createTasksForScriptBundles({
taskPrefix: 'scripts:core:test-live', taskPrefix: 'scripts:core:test-live',
devMode: true, devMode: true,
testing: true, testing: true,
}), }),
// built for CI tests // built for CI tests
test: createTasksForBuildJsExtension({ test: createTasksForScriptBundles({
taskPrefix: 'scripts:core:test', taskPrefix: 'scripts:core:test',
testing: true, testing: true,
}), }),
// production // production
prod: createTasksForBuildJsExtension({ taskPrefix: 'scripts:core:prod' }), prod: createTasksForScriptBundles({ taskPrefix: 'scripts:core:prod' }),
}; };
// high level tasks // high level tasks
@ -219,7 +219,7 @@ function createScriptTasks({
const { dev, test, testDev, prod } = core; const { dev, test, testDev, prod } = core;
return { dev, test, testDev, prod }; return { dev, test, testDev, prod };
function createTasksForBuildJsExtension({ taskPrefix, devMode, testing }) { function createTasksForScriptBundles({ taskPrefix, devMode, testing }) {
const standardEntryPoints = ['background', 'ui', 'content-script']; const standardEntryPoints = ['background', 'ui', 'content-script'];
const standardSubtask = createTask( const standardSubtask = createTask(
`${taskPrefix}:standardEntryPoints`, `${taskPrefix}:standardEntryPoints`,
@ -246,19 +246,19 @@ function createScriptTasks({
// because inpage bundle result is included inside contentscript // because inpage bundle result is included inside contentscript
const contentscriptSubtask = createTask( const contentscriptSubtask = createTask(
`${taskPrefix}:contentscript`, `${taskPrefix}:contentscript`,
createTaskForBundleContentscript({ devMode, testing }), createContentscriptBundle({ devMode, testing }),
); );
// this can run whenever // this can run whenever
const disableConsoleSubtask = createTask( const disableConsoleSubtask = createTask(
`${taskPrefix}:disable-console`, `${taskPrefix}:disable-console`,
createTaskForBundleDisableConsole({ devMode, testing }), createDisableConsoleBundle({ devMode, testing }),
); );
// this can run whenever // this can run whenever
const installSentrySubtask = createTask( const installSentrySubtask = createTask(
`${taskPrefix}:sentry`, `${taskPrefix}:sentry`,
createTaskForBundleSentry({ devMode, testing }), createSentryBundle({ devMode, testing }),
); );
// task for initiating browser livereload // task for initiating browser livereload
@ -296,7 +296,7 @@ function createScriptTasks({
return composeParallel(initiateLiveReload, ...allSubtasks); return composeParallel(initiateLiveReload, ...allSubtasks);
} }
function createTaskForBundleDisableConsole({ devMode, testing }) { function createDisableConsoleBundle({ devMode, testing }) {
const label = 'disable-console'; const label = 'disable-console';
return createNormalBundle({ return createNormalBundle({
browserPlatforms, browserPlatforms,
@ -313,7 +313,7 @@ function createScriptTasks({
}); });
} }
function createTaskForBundleSentry({ devMode, testing }) { function createSentryBundle({ devMode, testing }) {
const label = 'sentry-install'; const label = 'sentry-install';
return createNormalBundle({ return createNormalBundle({
browserPlatforms, browserPlatforms,
@ -331,7 +331,7 @@ function createScriptTasks({
} }
// the "contentscript" bundle contains the "inpage" bundle // the "contentscript" bundle contains the "inpage" bundle
function createTaskForBundleContentscript({ devMode, testing }) { function createContentscriptBundle({ devMode, testing }) {
const inpage = 'inpage'; const inpage = 'inpage';
const contentscript = 'contentscript'; const contentscript = 'contentscript';
return composeSeries( return composeSeries(
@ -391,7 +391,7 @@ const postProcessServiceWorker = (
// Function generates app-init.js for browsers chrome, brave and opera. // Function generates app-init.js for browsers chrome, brave and opera.
// It dynamically injects list of files generated in the build. // It dynamically injects list of files generated in the build.
async function bundleMV3AppInitialiser({ async function createManifestV3AppInitializationBundle({
jsBundles, jsBundles,
browserPlatforms, browserPlatforms,
buildType, buildType,
@ -622,7 +622,7 @@ function createFactoredBuild({
...commonSet.values(), ...commonSet.values(),
...groupSet.values(), ...groupSet.values(),
].map((label) => `./${label}.js`); ].map((label) => `./${label}.js`);
await bundleMV3AppInitialiser({ await createManifestV3AppInitializationBundle({
jsBundles, jsBundles,
browserPlatforms, browserPlatforms,
buildType, buildType,
@ -655,7 +655,7 @@ function createFactoredBuild({
} }
}); });
await bundleIt(buildConfiguration, { reloadOnChange }); await createBundle(buildConfiguration, { reloadOnChange });
}; };
} }
@ -717,7 +717,7 @@ function createNormalBundle({
}); });
}); });
await bundleIt(buildConfiguration, { reloadOnChange }); await createBundle(buildConfiguration, { reloadOnChange });
}; };
} }
@ -872,7 +872,7 @@ function setupSourcemaps(buildConfiguration, { devMode }) {
}); });
} }
async function bundleIt(buildConfiguration, { reloadOnChange }) { async function createBundle(buildConfiguration, { reloadOnChange }) {
const { label, bundlerOpts, events } = buildConfiguration; const { label, bundlerOpts, events } = buildConfiguration;
const bundler = browserify(bundlerOpts); const bundler = browserify(bundlerOpts);