Skip to content

Commit bd1c2d8

Browse files
authored
fix: update npm utility dependencies and related packages (lerna#4033)
1 parent 81370f1 commit bd1c2d8

File tree

138 files changed

+4640
-2314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+4640
-2314
lines changed

.eslintrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
],
2727
"checkDynamicDependenciesExceptions": [".*"]
2828
}
29+
],
30+
"no-restricted-imports": [
31+
"error",
32+
{
33+
"name": "npmlog",
34+
"message": "Please use the inlined core utility instead."
35+
}
2936
]
3037
}
3138
},

e2e/publish/src/from-git-recover-from-error.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ describe("lerna-publish-from-git-recover-from-error", () => {
7979
lerna WARN ENOLICENSE Packages test-1 and test-2 are missing a license.
8080
lerna WARN ENOLICENSE One way to fix this is to add a LICENSE.md file to the root of this repository.
8181
lerna WARN ENOLICENSE See https://choosealicense.com for additional guidance.
82+
lerna WARN publish Package is already published: [email protected]
8283
lerna success published test-2 XX.XX.XX
8384
lerna notice
8485
lerna notice 📦 [email protected]
@@ -96,7 +97,6 @@ describe("lerna-publish-from-git-recover-from-error", () => {
9697
lerna notice integrity: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
9798
lerna notice total files: 3
9899
lerna notice
99-
lerna WARN publish Package is already published: [email protected]
100100
Successfully published:
101101
102102
lerna success published 1 package

jest.preset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const nxPreset = require("@nx/jest/preset").default;
44
module.exports = {
55
...nxPreset,
66
clearMocks: true,
7-
modulePathIgnorePatterns: ["/__fixtures__/"],
7+
modulePathIgnorePatterns: ["/__fixtures__/", "<rootDir>/dist/"],
88
testEnvironment: "node",
99
/* TODO: Update to latest Jest snapshotFormat
1010
* By default Nx has kept the older style of Jest Snapshot formats

libs/commands/add/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class AddCommand extends Command {
226226
Array.from(node.localDependencies.values()).some((resolved) => resolved.type === "directory")
227227
);
228228

229-
if (fetchSpec === "latest") {
229+
if (fetchSpec === "latest" || fetchSpec === "*") {
230230
return true;
231231
}
232232

libs/commands/add/src/lib/add-command.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ describe("AddCommand", () => {
8484
expect.objectContaining({
8585
// an npm-package-arg Result
8686
name: "tiny-tarball",
87-
fetchSpec: "latest",
87+
fetchSpec: "*",
8888
registry: true,
89-
type: "tag",
89+
type: "range",
9090
}),
9191
expect.objectContaining({
9292
// an npm-conf snapshot

libs/commands/add/src/lib/get-range-to-reference.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ module.exports.getRangeToReference = getRangeToReference;
1515
*/
1616
function getRangeToReference(spec, deps, loc, prefix) {
1717
const current = deps[spec.name];
18-
const resolved = spec.type === "tag" ? `${prefix}${spec.version}` : spec.fetchSpec;
18+
const resolved =
19+
spec.type === "tag" || (spec.type === "range" && spec.fetchSpec === "*")
20+
? `${prefix}${spec.version}`
21+
: spec.fetchSpec;
1922

2023
if (spec.saveRelativeFileSpec) {
2124
// "version" has been resolved to pkg.location in getPackageVersion()

libs/commands/bootstrap/src/lib/has-dependency-installed.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import log from "npmlog";
1+
import { log } from "@lerna/core";
22
import Arborist from "@npmcli/arborist";
33
import semver from "semver";
44

libs/commands/create/src/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ class CreateCommand extends Command {
132132
this.conf.set("silent", true);
133133
}
134134

135-
// save read-package-json the trouble
136135
if (this.binFileName) {
137136
this.conf.set("bin", {
138137
[this.binFileName]: `bin/${this.binFileName}`,
@@ -274,10 +273,12 @@ class CreateCommand extends Command {
274273
return `${savePrefix}${depNode.version}`;
275274
}
276275

277-
if (spec.type === "tag" && spec.fetchSpec === "latest") {
278-
// resolve the latest version
276+
if (
277+
(spec.type === "tag" && spec.fetchSpec === "latest") ||
278+
(spec.type === "range" && spec.fetchSpec === "*")
279+
) {
280+
// resolve the latest version from local external dependency
279281
if (exts.has(spec.name)) {
280-
// from local external dependency
281282
return exts.get(spec.name);
282283
}
283284

libs/commands/create/src/lib/cat-file.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ module.exports.catFile = catFile;
99
* @param {string} content
1010
* @param {string | import('fs-extra').WriteFileOptions} [opts]
1111
*/
12-
function catFile(baseDir, fileName, content, opts = "utf8") {
12+
function catFile(baseDir, fileName, content, opts = "utf8" as const) {
1313
return fs.writeFile(path.join(baseDir, fileName), `${content}\n`, opts);
1414
}

libs/commands/diff/src/lib/get-last-commit.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { ExecOptions } from "@lerna/core";
2-
import log from "npmlog";
31
import * as childProcess from "@lerna/child-process";
2+
import { ExecOptions, log } from "@lerna/core";
43

54
/**
65
*

0 commit comments

Comments
 (0)