MCPcopy
hub / github.com/electron/forge / runCommand

Function runCommand

tools/verdaccio/spawn-verdaccio.ts:134–169  ·  view source on GitHub ↗
(args: string[])

Source from the content-addressed store, hash-verified

132}
133
134async function runCommand(args: string[]) {
135 process.env.COREPACK_ENABLE_STRICT = '0';
136 console.log('🗑️ Pruning pnpm store before running command');
137 await spawnPromise('pnpm', ['store', 'prune']);
138
139 /**
140 * Avoid polluting the global yarn cache.
141 */
142 const tempYarnGlobal = path.join(STORAGE_PATH, '.yarn-global');
143 fs.promises.mkdir(tempYarnGlobal, { recursive: true });
144
145 console.log(`🏃 Running: ${args.join(' ')}`);
146 console.log(` Using registry: ${VERDACCIO_URL}`);
147
148 await spawnPromise(args[0], args.slice(1), {
149 cwd: FORGE_ROOT_DIR,
150 stdio: 'inherit',
151 env: {
152 ...process.env,
153 // https://docs.npmjs.com/cli/v9/using-npm/config#registry
154 // https://pnpm.io/settings#registry
155 NPM_CONFIG_REGISTRY: VERDACCIO_URL,
156 // https://yarnpkg.com/configuration/yarnrc#npmRegistryServer
157 YARN_NPM_REGISTRY_SERVER: VERDACCIO_URL,
158 // https://yarnpkg.com/configuration/yarnrc#unsafeHttpWhitelist
159 YARN_UNSAFE_HTTP_WHITELIST: LOCALHOST,
160 // Isolate package manager caches so Verdaccio packages
161 // don't corrupt the global caches. These directories live
162 // under STORAGE_PATH and get cleaned up on next run.
163 // https://yarnpkg.com/configuration/yarnrc#globalFolder
164 YARN_GLOBAL_FOLDER: tempYarnGlobal,
165 // https://yarnpkg.com/configuration/yarnrc#enableGlobalCache
166 YARN_ENABLE_GLOBAL_CACHE: 'false',
167 },
168 });
169}
170
171async function main(): Promise<void> {
172 const args = process.argv.slice(2);

Callers 1

mainFunction · 0.85

Calls 1

logMethod · 0.80

Tested by

no test coverage detected