Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"jest-snapshot-serializer-ansi": "^1.0.0",
"lerna": "^7.1.4",
"lint-staged": "^10.0.7",
"mock-fs": "^5.1.2",
"mock-fs": "^5.5.0",
"next-ignite": "^0.10.11",
"patch-package": "^6.2.2",
"prettier": "^2.2.1",
Expand Down
56 changes: 56 additions & 0 deletions plugins/npm/__tests__/npm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1705,6 +1705,62 @@ describe("makeRelease", () => {
true
);
});

test("dry-run should return undefined to prevent afterRelease hooks", async () => {
mockFs({
"lerna.json": `
{ "name": "test", "version": "independent" }
`,
});

const plugin = new NPMPlugin();
const hooks = makeHooks();

// Mock exec calls for independent mode
execPromise.mockReturnValue("@packages/a\n@packages/b");
getLernaPackages.mockReturnValueOnce(monorepoPackagesResult);

const publish = jest.fn();
plugin.apply({
config: { prereleaseBranches: ["next"] },
hooks,
remote: "origin",
baseBranch: "main",
logger: dummyLog(),
prefixRelease: (str) => str,
git: { publish } as any,
inOldVersionBranch: (bool: boolean) => bool,
release: {
makeChangelog: () => ({
generateReleaseNotes: (commits: IExtendedCommit[]) =>
Promise.resolve(commits.map((c) => c.subject).join("\n")),
}),
} as any,
} as Auto.Auto);

// During dry-run, makeRelease should return undefined (not an empty array)
// to prevent afterRelease hooks from being triggered
const result = await hooks.makeRelease.promise({
dryRun: true,
newVersion: "0.1.2",
from: "",
to: "",
isPrerelease: false,
fullReleaseNotes: "",
commits: [
{
subject: "update package 1",
hash: "123",
labels: [],
files: ["packages/a/package.json"],
authors: [{ username: "Jeff", hash: "123" }],
},
],
});

expect(result).toBeUndefined();
expect(publish).not.toHaveBeenCalled();
});
});

describe("beforeCommitChangelog", () => {
Expand Down
2 changes: 1 addition & 1 deletion plugins/npm/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,7 @@ export default class NPMPlugin implements IPlugin {
"The above versions reflect the current git tags pointing at the HEAD commit. During the normal release flow these tags would reflect the latest released version."
);

return [];
return;
}

const packagePaths = lernaPackages.map((p) => p.path);
Expand Down
77 changes: 64 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
integrity sha512-K1kQv1BZVtMXQqdpNZt9Pgh85KwamsWX9gYyq1xG4cpyb+EacfMiNfumrju16piFXanCUrCR0P1DowPjV2qV/A==

"@auto-it/bot-list@link:packages/bot-list":
version "11.3.0"
version "11.3.6"

"@auto-it/core@link:packages/core":
version "11.3.0"
version "11.3.6"
dependencies:
"@auto-it/bot-list" "link:packages/bot-list"
"@endemolshinegroup/cosmiconfig-typescript-loader" "^3.0.2"
Expand Down Expand Up @@ -60,7 +60,7 @@
url-join "^4.0.0"

"@auto-it/npm@link:plugins/npm":
version "11.3.0"
version "11.3.6"
dependencies:
"@auto-it/core" "link:packages/core"
"@auto-it/package-json-utils" "link:packages/package-json-utils"
Expand All @@ -78,13 +78,13 @@
user-home "^2.0.0"

"@auto-it/package-json-utils@link:packages/package-json-utils":
version "11.3.0"
version "11.3.6"
dependencies:
parse-author "^2.0.0"
parse-github-url "1.0.2"

"@auto-it/released@link:plugins/released":
version "11.3.0"
version "11.3.6"
dependencies:
"@auto-it/bot-list" "link:packages/bot-list"
"@auto-it/core" "link:packages/core"
Expand All @@ -94,7 +94,7 @@
tslib "2.1.0"

"@auto-it/version-file@link:plugins/version-file":
version "11.3.0"
version "11.3.6"
dependencies:
"@auto-it/core" "link:packages/core"
fp-ts "^2.5.3"
Expand Down Expand Up @@ -2203,7 +2203,7 @@
dependencies:
defer-to-connect "^2.0.0"

"@tailwindcss/postcss7-compat@^2.0.2", "tailwindcss@npm:@tailwindcss/postcss7-compat":
"@tailwindcss/postcss7-compat@^2.0.2":
version "2.1.2"
resolved "https://registry.yarnpkg.com/@tailwindcss/postcss7-compat/-/postcss7-compat-2.1.2.tgz#4ae2a3a3c05622ee04307997b0f8bea5c8dbc2b6"
integrity sha512-bH2kw6uyqLnDMP8wzDUsis5ovrsRzfHEyiL1McADvqlW54g6y0KVHX1xzO7PH8Fl5s0Sq8vDOAp4+3V8MEcZ9g==
Expand Down Expand Up @@ -10369,10 +10369,10 @@ mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@~0.5.1:
dependencies:
minimist "^1.2.5"

mock-fs@^5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/mock-fs/-/mock-fs-5.1.2.tgz#6fa486e06d00f8793a8d2228de980eff93ce6db7"
integrity sha512-YkjQkdLulFrz0vD4BfNQdQRVmgycXTV7ykuHMlyv+C8WCHazpkiQRDthwa02kSyo8wKnY9wRptHfQLgmf0eR+A==
mock-fs@^5.5.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/mock-fs/-/mock-fs-5.5.0.tgz#94a46d299aaa588e735a201cbe823c876e91f385"
integrity sha512-d/P1M/RacgM3dB0sJ8rjeRNXxtapkPCUnMGmIN0ixJ16F/E4GUZCvWcSGfWGz8eaXYvn1s9baUwNjI4LOPEjiA==

modern-normalize@^1.0.0:
version "1.1.0"
Expand Down Expand Up @@ -14016,7 +14016,7 @@ string-length@^4.0.1:
char-regex "^1.0.2"
strip-ansi "^6.0.0"

"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand All @@ -14042,6 +14042,15 @@ string-width@^1.0.1:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^4.0.0"

"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.1.0, string-width@^4.2.0:
version "4.2.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.2.tgz#dafd4f9559a7585cfba529c6a0a4f73488ebd4c5"
Expand Down Expand Up @@ -14110,7 +14119,7 @@ stringify-object@^3.3.0:
is-obj "^1.0.1"
is-regexp "^1.0.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -14138,6 +14147,13 @@ strip-ansi@^4.0.0:
dependencies:
ansi-regex "^3.0.0"

strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.0.1.tgz#61740a08ce36b61e50e65653f07060d000975fb2"
Expand Down Expand Up @@ -14357,6 +14373,41 @@ table@^6.0.4:
string-width "^4.2.0"
strip-ansi "^6.0.0"

"tailwindcss@npm:@tailwindcss/postcss7-compat":
version "2.1.2"
resolved "https://registry.yarnpkg.com/@tailwindcss/postcss7-compat/-/postcss7-compat-2.1.2.tgz#4ae2a3a3c05622ee04307997b0f8bea5c8dbc2b6"
integrity sha512-bH2kw6uyqLnDMP8wzDUsis5ovrsRzfHEyiL1McADvqlW54g6y0KVHX1xzO7PH8Fl5s0Sq8vDOAp4+3V8MEcZ9g==
dependencies:
"@fullhuman/postcss-purgecss" "^3.1.3"
autoprefixer "^9"
bytes "^3.0.0"
chalk "^4.1.0"
chokidar "^3.5.1"
color "^3.1.3"
detective "^5.2.0"
didyoumean "^1.2.1"
dlv "^1.1.3"
fast-glob "^3.2.5"
fs-extra "^9.1.0"
html-tags "^3.1.0"
lodash "^4.17.21"
lodash.topath "^4.5.2"
modern-normalize "^1.0.0"
node-emoji "^1.8.1"
normalize-path "^3.0.0"
object-hash "^2.1.1"
parse-glob "^3.0.4"
postcss "^7"
postcss-functions "^3"
postcss-js "^2"
postcss-nested "^4"
postcss-selector-parser "^6.0.4"
postcss-value-parser "^4.1.0"
pretty-hrtime "^1.0.3"
quick-lru "^5.1.1"
reduce-css-calc "^2.1.8"
resolve "^1.20.0"

tapable@^1.0.0, tapable@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2"
Expand Down