10 examples of 'yarn run build' in JavaScript

Every line of 'yarn run build' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
9async run() {
10 // Read the config file
11 const config = new Config('hereditas.json')
12 try {
13 await config.load()
14 }
15 catch (e) {
16 this.error(`The current directory ${process.cwd()} doesn't contain a valid Hereditas project`)
17 return this.exit(1)
18 }
19
20 // Make sure that we have an Auth0 client id
21 const clientId = config.get('auth0.hereditasClientId')
22 if (!clientId) {
23 this.error('The Hereditas application hasn\'t been configured on Auth0 yet. Please run `hereditas auth0:sync` first')
24 return this.exit(1)
25 }
26
27 // Check if we have a passphrase passed as environmental variable (useful for development only)
28 let passphrase
29 if (process.env.HEREDITAS_PASSPHRASE) {
30 passphrase = process.env.HEREDITAS_PASSPHRASE
31 this.warn('Passphrase set through the HEREDITAS_PASSPHRASE environmental variable; this should be used for development only')
32 }
33 else {
34 // Ask for the user passphrase
35 passphrase = await cli.prompt('User passphrase', {type: 'mask'})
36 }
37 if (!passphrase || passphrase.length < 8) {
38 this.error('Passphrase needs to be at least 8 characters long')
39 return this.exit(1)
40 }
41
42 // Timer
43 const startTime = Date.now()
44
45 // Build the project
46 const builder = new Builder(passphrase, config)
47 await builder.build()
48
49 // Done!
50 const duration = (Date.now() - startTime) / 1000
51
52 if (!builder.hasErrors) {
53 this.log(`Finished building project in ${config.get('distDir')} (took ${duration} seconds)`)
54 }
55 else {
56 this.error(`Build failed (took ${duration} seconds)`)
57 }
58}
6function runYarn(yarn, cwd, command = "") {
7 child_process.execSync(yarnShellCommand(yarn, cwd, command), {
8 stdio: "inherit"
9 });
10}
19async run() {
20 const { args, flags } = this.parse(Build);
21 const options: Options = {
22 analyze: !!flags.analyze,
23 config: JSON.parse(flags.config || '{}'),
24 debug: !!flags.debug,
25 docker: !!flags.docker
26 };
27 return build(args.PLATFORM, options);
28}
12async function build() {
13 const env = getEnv()
14 await run(clean)
15 await run(copyEnvConfig, env)
16 await run(copyPublic)
17 await run(copyPkg)
18 await run(buildClient, env)
19 await run(copyAssets)
20 await run(buildServer, env)
21}
52export function npmRunBuild(packageFolderPath: string): void {
53 execute("npm run build", packageFolderPath);
54}
72function runBuild(buildConf, buildManager) {
73 let timer = new Timer();
74 timer.start();
75
76 let {appType, logger, root: rootDir, configPath} = buildConf;
77
78 logger.info('build start...');
79 logger.info('build app type:', colors.cyan(appType));
80 logger.info(
81 'load process files from',
82 colors.cyan(getRelativePath(rootDir))
83 );
84
85 if (configPath) {
86 logger.info(
87 'build by config',
88 colors.cyan(getRelativePath(configPath))
89 );
90 }
91 else if (buildConf.useDefaultConfig) {
92 logger.info('build using default inner config');
93 }
94
95 // load build files
96 let result = buildManager.loadFiles();
97 if (!(result instanceof Promise)) {
98 result = Promise.resolve();
99 }
100
101 return result.then(() => {
102 logger.info('load process files done, file count:',
103 colors.cyan(buildManager.getProcessFileCount()) + ', load time:',
104 colors.gray(timer.tick())
105 );
106 logger.info('build for', colors.cyan(buildManager.getBuildEnv()), 'env');
107
108 return buildProject(timer, buildConf, buildManager);
109 });
110}
32function build() {
33 console.log();
34 console.log(chalk.green("-> building"));
35 shelljs.exec("cross-env NODE_ENV=production && npx babel src --out-dir lib --copy-files");
36 console.log(chalk.green("-> build finished"));
37}
251function run_built_app() {
252
253 var spawn = require('child_process').spawn;
254 spawn('open', [ project.getBuildFile() ]);
255
256}
673function executeAppBuilder(args) {
674 return new Promise((resolve, reject) => {
675 const command = _appBuilderBin().appBuilderPath;
676
677 const env = Object.assign({
678 // before process.env to allow customize by user
679 SNAP_USE_HARD_LINKS_IF_POSSIBLE: _isCi().default.toString()
680 }, process.env, {
681 SZA_PATH: _zipBin().path7za
682 });
683 const cacheEnv = process.env.ELECTRON_BUILDER_CACHE;
684
685 if (cacheEnv != null && cacheEnv.length > 0) {
686 env.ELECTRON_BUILDER_CACHE = path.resolve(cacheEnv);
687 }
688
689 handleProcess("close", doSpawn(command, args, {
690 env,
691 stdio: ["ignore", "pipe", process.stdout]
692 }), command, resolve, reject);
693 });
694}
9async handle() {
10 try {
11 const configPath = require.resolve('@app/webpack.config');
12
13 spawnSync('webpack', ['-p', '--config', configPath], {
14 cwd: dirname(configPath),
15 stdio: 'inherit',
16 env: {
17 ...process.env,
18 NODE_ENV: 'production',
19 },
20 });
21 } catch (err) {}
22}

Related snippets