Skip to content

Commit

Permalink
feat: add skipNpmInstall option (#339)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerZade committed Nov 14, 2023
1 parent 3b7cad0 commit 606645e
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export interface BuildOptions {
* @default false
*/
skipSourceOutput?: boolean;
/** Skip running `npm install`
* @default false
*/
skipNpmInstall?: boolean;
/** Root directory to find test files in. Defaults to the cwd. */
rootTestDir?: string;
/** Glob pattern to use to find tests files. Defaults to `deno test`'s pattern. */
Expand Down Expand Up @@ -229,12 +233,14 @@ export async function build(options: BuildOptions): Promise<void> {
createNpmIgnore();

// install dependencies in order to prepare for checking TS diagnostics
log(`Running ${packageManager} install...`);
const npmInstallPromise = runNpmCommand({
bin: packageManager,
args: ["install"],
cwd: options.outDir,
});
if (!options.skipNpmInstall) log(`Running ${packageManager} install...`);
const npmInstallPromise = options.skipNpmInstall
? Promise.resolve()
: runNpmCommand({
bin: packageManager,
args: ["install"],
cwd: options.outDir,
});
if (options.typeCheck || options.declaration) {
// Unfortunately this can't be run in parallel to building the project
// in this case because TypeScript will resolve the npm packages when
Expand Down

0 comments on commit 606645e

Please sign in to comment.