Skip to content

Disable pruning by default #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ You can then run `npm run spec` to generate your spec file in an environment whe

### Pruning dependencies

To minimise the final RPM size, your development dependencies (dependencies added with the --save-dev flag) are automatically [pruned](https://docs.npmjs.com/cli/prune) so that they're not shipped with your production code.
> :warning: **DEPRECATION WANRING** Pruning is deprecated in Speulate v4.0.0 and is turned off by default. To enable you must set the following option to `true`. In NPM 8.6+ internet access is required to perform pruning which may not be available in all build environments, in which case the RPM build stage may stall before failing.

To minimise the final RPM size, you should remove development dependencies (dependencies added with the --save-dev flag) are automatically [pruned](https://docs.npmjs.com/cli/prune) so that they're not shipped with your production code.

If for some reason you need to package your dev dependencies with your production code you can explicity tell speculate not to prune by adding the following to your `package.json`:

Expand Down
2 changes: 1 addition & 1 deletion lib/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module.exports = function (pkg, release) {
nodeVersion: getValueFromSpec(pkg.spec, 'nodeVersion'),
version: getVersionNumber(pkg),
license: pkg.license,
prune: getValueFromSpec(pkg.spec, 'prune', true),
prune: getValueFromSpec(pkg.spec, 'prune', false),
rebuild: getValueFromSpec(pkg.spec, 'rebuild', true)
},
getExecutableFiles(pkg),
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/my-cool-api-7.spec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ My Cool API
%setup -q -c -n %{name}

%build
NODE_ENV=production npm prune
npm rebuild

%pre
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/my-cool-api-no-rebuild.spec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ My Cool API
%setup -q -c -n %{name}

%build
NODE_ENV=production npm prune

%pre
getent group my-cool-api >/dev/null || groupadd -r my-cool-api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"author": "[email protected]",
"license": "MIT",
"spec": {
"prune": false
"prune": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ My Cool API
%setup -q -c -n %{name}

%build
# Setting NODE_ENV is the same as --production or --omit=dev. Using NODE_ENV here as pruning has slightly different behaviour in newer versions.
# See https://docs.npmjs.com/cli/v8/commands/npm-prune compared to https://docs.npmjs.com/cli/v6/commands/npm-prune
NODE_ENV=production npm prune
npm rebuild

%pre
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/my-cool-api-with-buildrequires.spec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ My Cool API
%setup -q -c -n %{name}

%build
NODE_ENV=production npm prune
npm rebuild

%pre
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/my-cool-api-with-diff-licence.spec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ My Cool API
%setup -q -c -n %{name}

%build
NODE_ENV=production npm prune
npm rebuild

%pre
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/my-cool-api-with-executable.spec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ My Cool API
%setup -q -c -n %{name}

%build
NODE_ENV=production npm prune
npm rebuild

%pre
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/my-cool-api-with-hyphenated-version.spec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ My Cool API
%setup -q -c -n %{name}

%build
NODE_ENV=production npm prune
npm rebuild

%pre
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/my-cool-api-with-node-version.spec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ My Cool API
%setup -q -c -n %{name}

%build
NODE_ENV=production npm prune
npm rebuild

%pre
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/my-cool-api-with-post.spec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ My Cool API
%setup -q -c -n %{name}

%build
NODE_ENV=production npm prune
npm rebuild

%pre
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/my-cool-api-with-requires-noescape.spec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ My Cool API
%setup -q -c -n %{name}

%build
NODE_ENV=production npm prune
npm rebuild

%pre
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/my-cool-api-with-requires.spec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ My Cool API
%setup -q -c -n %{name}

%build
NODE_ENV=production npm prune
npm rebuild

%pre
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ My Cool API
%setup -q -c -n %{name}

%build
NODE_ENV=production npm prune
npm rebuild

%pre
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ My Cool API
%setup -q -c -n %{name}

%build
NODE_ENV=production npm prune
npm rebuild

%pre
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/my-cool-api.spec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ My Cool API
%setup -q -c -n %{name}

%build
NODE_ENV=production npm prune
npm rebuild

%pre
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/my-super-long-long-long-long-cat-api.spec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ My Super Long Long Long Long Cat API
%setup -q -c -n %{name}

%build
NODE_ENV=production npm prune
npm rebuild

%pre
Expand Down
6 changes: 3 additions & 3 deletions test/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ describe('spec', () => {
assert.equal(spec, expected);
});

it('removes the prune step when specified', () => {
const pkg = require('./fixtures/my-cool-api-no-prune');
const expected = loadFixture('my-cool-api-no-prune.spec');
it('adds the prune step when specified', () => {
const pkg = require('./fixtures/my-cool-api-prune');
const expected = loadFixture('my-cool-api-prune.spec');
const spec = createSpecFile(pkg);

assert.equal(spec, expected);
Expand Down