Skip to content
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

breaking: fix audit failures; node 10+ #2680

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -21,7 +21,7 @@ composer.lock
*.swo

# Project Specific
/node_modules
node_modules
*.log
/lib
tmp
Expand Down
28 changes: 3 additions & 25 deletions .travis.yml
Expand Up @@ -7,40 +7,18 @@ git:
language: node_js

node_js:
- "14"
- "12"
- "10"
- "8"

os:
- linux
- windows

env:
global:
- NO_UPDATE_NOTIFIER=1
- NODE_NO_WARNINGS=1
- LERNA_CI_SCRIPT=ci

matrix:
fast_finish: true
# only run windows tests on latest node
include:
# run publish/version tests first (slower, higher priority)
- os: windows
node_js: "12"
name: "Windows Tests (publish)"
env:
- LERNA_CI_SCRIPT="ci:windows"
- LERNA_CI_TYPE="publish"

# and then the rest of the tests (quicker, lower priority)
- os: windows
node_js: "12"
name: "Windows Tests (non-publish)"
env:
- LERNA_CI_SCRIPT="ci:windows"
- LERNA_CI_TYPE="non-publish"

cache: npm

before_install:
- |
Expand All @@ -62,4 +40,4 @@ before_script:
- yarn --version

script:
- npm run $LERNA_CI_SCRIPT
- npm run ci
2 changes: 1 addition & 1 deletion commands/__mocks__/@lerna/conventional-commits.js
@@ -1,6 +1,6 @@
"use strict";

const fs = require.requireActual("fs-extra");
const fs = jest.requireActual("fs-extra");
const path = require("path");
const semver = require("semver");

Expand Down
2 changes: 1 addition & 1 deletion commands/__mocks__/load-json-file.js
Expand Up @@ -3,7 +3,7 @@
const path = require("path");
const normalizePath = require("normalize-path");

const loadJsonFile = require.requireActual("load-json-file");
const loadJsonFile = jest.requireActual("load-json-file");
const asyncRegistry = new Map();
const syncRegistry = new Map();

Expand Down
2 changes: 1 addition & 1 deletion commands/__mocks__/write-pkg.js
@@ -1,6 +1,6 @@
"use strict";

const writePkg = require.requireActual("write-pkg");
const writePkg = jest.requireActual("write-pkg");
const registry = new Map();

// by default, act like a spy that populates registry
Expand Down
2 changes: 1 addition & 1 deletion commands/add/package.json
Expand Up @@ -19,7 +19,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion commands/bootstrap/package.json
Expand Up @@ -19,7 +19,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion commands/changed/package.json
Expand Up @@ -18,7 +18,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion commands/clean/package.json
Expand Up @@ -18,7 +18,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion commands/create/package.json
Expand Up @@ -19,7 +19,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion commands/diff/package.json
Expand Up @@ -19,7 +19,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion commands/exec/package.json
Expand Up @@ -18,7 +18,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion commands/import/package.json
Expand Up @@ -18,7 +18,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion commands/info/package.json
Expand Up @@ -18,7 +18,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion commands/init/package.json
Expand Up @@ -18,7 +18,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion commands/link/package.json
Expand Up @@ -18,7 +18,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion commands/list/package.json
Expand Up @@ -18,7 +18,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion commands/publish/package.json
Expand Up @@ -20,7 +20,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion commands/run/package.json
Expand Up @@ -18,7 +18,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
98 changes: 38 additions & 60 deletions commands/version/__tests__/version-bump-prerelease.test.js
Expand Up @@ -24,11 +24,8 @@ const gitAdd = require("@lerna-test/git-add");
const gitTag = require("@lerna-test/git-tag");
const gitCommit = require("@lerna-test/git-commit");
const getCommitMessage = require("@lerna-test/get-commit-message");
const Tacks = require("tacks");
const tempy = require("tempy");

const { File, Dir } = Tacks;

// test command
const lernaVersion = require("@lerna-test/command-runner")(require("../command"));

Expand Down Expand Up @@ -118,34 +115,24 @@ test("version prerelease with immediate graduation", async () => {

test("independent version prerelease does not bump on every unrelated change", async () => {
const cwd = tempy.directory();
const fixture = new Tacks(
Dir({
"lerna.json": File({
version: "independent",
}),
"package.json": File({
name: "unrelated-bumps",
}),
packages: Dir({
"pkg-a": Dir({
"package.json": File({
name: "pkg-a",
version: "1.0.0",
}),
}),
"pkg-b": Dir({
"package.json": File({
name: "pkg-b",
version: "1.0.0-bumps.1",
// TODO: (major) make --no-private the default
private: true,
}),
}),
}),
})
);

fixture.create(cwd);
fs.writeJsonSync(path.join(cwd, "lerna.json"), {
version: "independent",
});
fs.writeJsonSync(path.join(cwd, "package.json"), {
name: "unrelated-bumps",
});
fs.mkdirpSync(path.join(cwd, "packages/pkg-a"));
fs.writeJsonSync(path.join(cwd, "packages/pkg-a/package.json"), {
name: "pkg-a",
version: "1.0.0",
});
fs.mkdirpSync(path.join(cwd, "packages/pkg-b"));
fs.writeJsonSync(path.join(cwd, "packages/pkg-b/package.json"), {
name: "pkg-b",
version: "1.0.0-bumps.1",
// TODO: (major) make --no-private the default
private: true,
});

await gitInit(cwd, ".");
await gitAdd(cwd, "-A");
Expand Down Expand Up @@ -185,35 +172,26 @@ Publish

test("independent version prerelease respects --no-private", async () => {
const cwd = tempy.directory();
const fixture = new Tacks(
Dir({
"lerna.json": File({
version: "independent",
}),
"package.json": File({
name: "no-private-versioning",
}),
packages: Dir({
"pkg-1": Dir({
"package.json": File({
name: "pkg-1",
version: "1.0.0",
devDependencies: {
"pkg-2": "^2.0.0",
},
}),
}),
"pkg-2": Dir({
"package.json": File({
name: "pkg-2",
version: "2.0.0",
private: true,
}),
}),
}),
})
);
fixture.create(cwd);
fs.writeJsonSync(path.join(cwd, "lerna.json"), {
version: "independent",
});
fs.writeJsonSync(path.join(cwd, "package.json"), {
name: "no-private-versioning",
});
fs.mkdirpSync(path.join(cwd, "packages/pkg-1"));
fs.writeJsonSync(path.join(cwd, "packages/pkg-1/package.json"), {
name: "pkg-1",
version: "1.0.0",
devDependencies: {
"pkg-2": "^2.0.0",
},
});
fs.mkdirpSync(path.join(cwd, "packages/pkg-2"));
fs.writeJsonSync(path.join(cwd, "packages/pkg-2/package.json"), {
name: "pkg-2",
version: "2.0.0",
private: true,
});

await gitInit(cwd, ".");
await gitAdd(cwd, "-A");
Expand Down
2 changes: 1 addition & 1 deletion commands/version/__tests__/version-command.test.js
Expand Up @@ -34,7 +34,7 @@ const getCommitMessage = require("@lerna-test/get-commit-message");
const lernaVersion = require("@lerna-test/command-runner")(require("../command"));

// certain tests need to use the real thing
const collectUpdatesActual = require.requireActual("@lerna/collect-updates");
const collectUpdatesActual = jest.requireActual("@lerna/collect-updates");

// assertion helpers
const listDirty = cwd =>
Expand Down
2 changes: 1 addition & 1 deletion commands/version/package.json
Expand Up @@ -20,7 +20,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion core/child-process/package.json
Expand Up @@ -17,7 +17,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion core/cli/package.json
Expand Up @@ -17,7 +17,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion core/command/package.json
Expand Up @@ -18,7 +18,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand Down
8 changes: 4 additions & 4 deletions core/conventional-commits/package.json
Expand Up @@ -18,7 +18,7 @@
],
"main": "index.js",
"engines": {
"node": ">= 6.9.0"
"node": ">=10"
},
"publishConfig": {
"access": "public"
Expand All @@ -33,9 +33,9 @@
},
"dependencies": {
"@lerna/validation-error": "file:../validation-error",
"conventional-changelog-angular": "^5.0.3",
"conventional-changelog-core": "^3.1.6",
"conventional-recommended-bump": "^5.0.0",
"conventional-changelog-angular": "^5.0.11",
"conventional-changelog-core": "^4.1.8",
"conventional-recommended-bump": "^6.0.9",
"fs-extra": "^8.1.0",
"get-stream": "^4.0.0",
"lodash.template": "^4.5.0",
Expand Down