Skip to content

Commit 955072b

Browse files
committed
Path fixes for spawn, reduce noise on npm i
1 parent cdffb83 commit 955072b

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/frameworks/index.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ export const build = async (config: DeployConfig | Required<DeployConfig>, getPr
7171
const path = version.split(':')[1];
7272
if (await access(path).catch(() => true)) continue;
7373
const stats = await stat(path);
74-
console.log(`Packing file-system dependency on ${path} for Cloud Functions`);
7574
if (stats.isDirectory()) {
7675
const result = spawnSync(Commands.NPM, ['pack', relative(functionsDist, path)], { cwd: functionsDist });
7776
if (!result.stdout) continue;
@@ -90,7 +89,6 @@ export const build = async (config: DeployConfig | Required<DeployConfig>, getPr
9089
const path = version.split(':')[1];
9190
if (await access(path).catch(() => true)) continue;
9291
const stats = await stat(path);
93-
console.log(`Packing file-system dependency on ${path} for Cloud Functions`);
9492
if (stats.isDirectory()) {
9593
const result = spawnSync(Commands.NPM, ['pack', relative(functionsDist, path)], { cwd: functionsDist });
9694
if (!result.stdout) continue;
@@ -119,11 +117,7 @@ export const build = async (config: DeployConfig | Required<DeployConfig>, getPr
119117

120118
await copyFile(getProjectPath('package-lock.json'), join(functionsDist, 'package-lock.json')).catch(() => {});
121119

122-
await spawn(Commands.NPM, ['i', '--only', 'production', '--no-audit'], { cwd: functionsDist }, (stdoutChunk: any) => {
123-
console.log(stdoutChunk.toString());
124-
}, (errChunk: any) => {
125-
console.error(errChunk.toString());
126-
});
120+
await spawn(Commands.NPM, ['i', '--omit', 'dev', '--no-audit'], { cwd: functionsDist });
127121

128122
if (bootstrapScript) {
129123
await writeFile(join(functionsDist, 'bootstrap.js'), bootstrapScript);

src/utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
import { exec as execCallback, spawn as spawnCallback, ExecOptions, SpawnOptionsWithoutStdio, spawnSync } from 'child_process';
16+
import { join } from 'path';
1617

1718
export const exec = (command: string, options: ExecOptions={}) => new Promise((resolve, reject) =>
1819
execCallback(command, options, (error, stdout) => {
@@ -75,6 +76,6 @@ export const findDependency = (name: string, cwd=process.cwd()) => {
7576

7677
export const Commands = {
7778
NPM: process.platform === 'win32' ? 'npm.cmd' : 'npm',
78-
next: process.platform === 'win32' ? 'next.cmd' : 'next',
79-
ng: process.platform === 'win32' ? 'ng.cmd' : 'ng',
79+
next: join('node_modules', '.bin', process.platform === 'win32' ? 'next.cmd' : 'next'),
80+
ng: join('node_modules', '.bin', process.platform === 'win32' ? 'ng.cmd' : 'ng'),
8081
};

0 commit comments

Comments
 (0)