From f143eedaa29fbde969c5f27652da97243d2afbe0 Mon Sep 17 00:00:00 2001 From: reggi Date: Thu, 17 Oct 2024 16:08:35 -0400 Subject: [PATCH] feat!: adds `--ignore-scripts` flag to `pack` BREAKING CHANGE: `--ignore-scripts` now applies to all lifecycle scripts, include `prepare` --- lib/commands/pack.js | 1 + tap-snapshots/test/lib/docs.js.test.cjs | 3 ++- workspaces/arborist/lib/arborist/rebuild.js | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/commands/pack.js b/lib/commands/pack.js index 6a1bb53acb8aa..bd190d88d82b6 100644 --- a/lib/commands/pack.js +++ b/lib/commands/pack.js @@ -15,6 +15,7 @@ class Pack extends BaseCommand { 'workspace', 'workspaces', 'include-workspace-root', + 'ignore-scripts', ] static usage = [''] diff --git a/tap-snapshots/test/lib/docs.js.test.cjs b/tap-snapshots/test/lib/docs.js.test.cjs index 8e1c57be0bf93..9a75dd12b04bb 100644 --- a/tap-snapshots/test/lib/docs.js.test.cjs +++ b/tap-snapshots/test/lib/docs.js.test.cjs @@ -3680,7 +3680,7 @@ npm pack Options: [--dry-run] [--json] [--pack-destination ] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] [--include-workspace-root] [--ignore-scripts] Run "npm help pack" for more info @@ -3694,6 +3694,7 @@ npm pack #### \`workspace\` #### \`workspaces\` #### \`include-workspace-root\` +#### \`ignore-scripts\` ` exports[`test/lib/docs.js TAP usage ping > must match snapshot 1`] = ` diff --git a/workspaces/arborist/lib/arborist/rebuild.js b/workspaces/arborist/lib/arborist/rebuild.js index 82f84772f9a85..3340ddaa67067 100644 --- a/workspaces/arborist/lib/arborist/rebuild.js +++ b/workspaces/arborist/lib/arborist/rebuild.js @@ -154,7 +154,9 @@ module.exports = cls => class Builder extends cls { // links should run prepare scripts and only link bins after that if (type === 'links') { - await this.#runScripts('prepare') + if (!this.options.ignoreScripts) { + await this.#runScripts('prepare') + } } if (this.options.binLinks) { await this.#linkAllBins()