Skip to content

Commit

Permalink
Create a patch for Changesets to allow legacy tags (#2964)
Browse files Browse the repository at this point in the history
  • Loading branch information
carbonrobot authored Nov 13, 2024
1 parent 69d1296 commit 7eafe76
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 2,214 deletions.
3 changes: 2 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"changelog": ["../scripts/changelog.js", { "repo": "FormidableLabs/victory" }],
"access": "public",
"baseBranch": "main",
"fixed": [["victory*"]]
"fixed": [["victory*"]],
"ignore": ["rn-demo", "victory-docs"]
}
2,198 changes: 0 additions & 2,198 deletions CHANGELOG.md

This file was deleted.

5 changes: 0 additions & 5 deletions demo/rn/CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion demo/rn/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rn-demo",
"version": "1.0.2",
"version": "1.0.0",
"sideEffects": false,
"main": "App.tsx",
"scripts": {
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
"eslint-plugin-jest": "^28.9.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-promise": "^7.1.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"fork-ts-checker-webpack-plugin": "^8.0.0",
"fs-extra": "^10.0.0",
"glob": "8.0.3",
Expand Down Expand Up @@ -119,6 +119,9 @@
"pnpm": {
"overrides": {
"@types/eslint": "8.4.3"
},
"patchedDependencies": {
"@changesets/[email protected]": "patches/@[email protected]"
}
},
"browserslist": [
Expand Down
118 changes: 118 additions & 0 deletions patches/@[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
diff --git a/dist/cli.cjs.dev.js b/dist/cli.cjs.dev.js
index 55665d53b92288d89b71aab0c231b82bb8cb5ff1..a24dc555b52e95a2cb1232d8c8a0a37e7dbd3fcf 100644
--- a/dist/cli.cjs.dev.js
+++ b/dist/cli.cjs.dev.js
@@ -807,7 +807,6 @@ async function internalPublish(pkgName, opts, twoFactorState) {
} // Due to a super annoying issue in yarn, we have to manually override this env variable
// See: https://github.com/yarnpkg/yarn/issues/2935#issuecomment-355292633

-
const envOverride = {
npm_config_registry: getCorrectRegistry()
};
@@ -921,8 +920,9 @@ async function publishPackages({
}

return Promise.all(unpublishedPackagesInfo.map(pkgInfo => {
- let pkg = packagesByName.get(pkgInfo.name);
- return publishAPackage(pkg, access, twoFactorState, getReleaseTag(pkgInfo, preState, tag));
+ const pkg = packagesByName.get(pkgInfo.name);
+ const publishTag = (pkg.packageJson.publishConfig && pkg.packageJson.publishConfig.tag) || tag;
+ return publishAPackage(pkg, access, twoFactorState, getReleaseTag(pkgInfo, preState, publishTag));
}));
}

@@ -933,7 +933,7 @@ async function publishAPackage(pkg, access, twoFactorState, tag) {
publishConfig
} = pkg.packageJson;
const localAccess = publishConfig === null || publishConfig === void 0 ? void 0 : publishConfig.access;
- logger.info(`Publishing ${chalk__default['default'].cyan(`"${name}"`)} at ${chalk__default['default'].green(`"${version}"`)}`);
+ logger.info(`Publishing ${chalk__default['default'].cyan(`"${name}"`)} at ${chalk__default['default'].green(`"${version}@${tag}"`)}`);
const publishDir = (publishConfig === null || publishConfig === void 0 ? void 0 : publishConfig.directory) ? path.join(pkg.dir, publishConfig.directory) : pkg.dir;
const publishConfirmation = await publish(name, {
cwd: publishDir,
@@ -1221,6 +1221,7 @@ async function run$1(cwd) {
}

async function run$2(input, flags, cwd) {
+ logger.warn("This is a patched version of @changesets/cli");
if (input[0] === "init") {
await init(cwd);
return;
diff --git a/dist/cli.cjs.prod.js b/dist/cli.cjs.prod.js
index fa6dd7c6365b814e44a253c4868b315de481d691..05f6f8beb9d2e26730bdb9450a6e68abedee7633 100644
--- a/dist/cli.cjs.prod.js
+++ b/dist/cli.cjs.prod.js
@@ -508,13 +508,20 @@ async function publishPackages({packages: packages, access: access, otp: otp, pr
otp: otp,
publicPackages: publicPackages
}), unpublishedPackagesInfo = await getUnpublishedPackages(publicPackages, preState);
- return 0 === unpublishedPackagesInfo.length && logger.warn("No unpublished packages to publish"),
- Promise.all(unpublishedPackagesInfo.map((pkgInfo => publishAPackage(packagesByName.get(pkgInfo.name), access, twoFactorState, getReleaseTag(pkgInfo, preState, tag)))));
+ if (unpublishedPackagesInfo.length === 0) {
+ warn("No unpublished packages to publish");
+ }
+
+ return Promise.all(unpublishedPackagesInfo.map(pkgInfo => {
+ const pkg = packagesByName.get(pkgInfo.name);
+ const publishTag = (pkg.packageJson.publishConfig && pkg.packageJson.publishConfig.tag) || tag;
+ return publishAPackage(pkg, access, twoFactorState, getReleaseTag(pkgInfo, preState, publishTag));
+ }));
}

async function publishAPackage(pkg, access, twoFactorState, tag) {
const {name: name, version: version, publishConfig: publishConfig} = pkg.packageJson, localAccess = null == publishConfig ? void 0 : publishConfig.access;
- logger.info(`Publishing ${chalk__default.default.cyan(`"${name}"`)} at ${chalk__default.default.green(`"${version}"`)}`);
+ logger.info(`Publishing ${chalk__default['default'].cyan(`"${name}"`)} at ${chalk__default['default'].green(`"${version}@${tag}"`)}`);
const publishDir = (null == publishConfig ? void 0 : publishConfig.directory) ? path.join(pkg.dir, publishConfig.directory) : pkg.dir;
return {
name: name,
@@ -661,6 +668,7 @@ async function run$1(cwd) {
}

async function run$2(input, flags, cwd) {
+ logger.warn("This is a patched version of @changesets/cli");
if ("init" === input[0]) return void await init(cwd);
if (!fs__default.default.existsSync(path__default.default.resolve(cwd, ".changeset"))) throw logger.error("There is no .changeset folder. "),
logger.error("If this is the first time `changesets` have been used in this project, run `yarn changeset init` to get set up."),
diff --git a/dist/cli.esm.js b/dist/cli.esm.js
index 4e319be77ee8a563803649324b7fc364bc05be6b..cb2a2bef5c4f75a2cfe59ce7f402078d89f1f778 100644
--- a/dist/cli.esm.js
+++ b/dist/cli.esm.js
@@ -784,7 +784,6 @@ async function internalPublish(pkgName, opts, twoFactorState) {
} // Due to a super annoying issue in yarn, we have to manually override this env variable
// See: https://github.com/yarnpkg/yarn/issues/2935#issuecomment-355292633

-
const envOverride = {
npm_config_registry: getCorrectRegistry()
};
@@ -898,8 +897,9 @@ async function publishPackages({
}

return Promise.all(unpublishedPackagesInfo.map(pkgInfo => {
- let pkg = packagesByName.get(pkgInfo.name);
- return publishAPackage(pkg, access, twoFactorState, getReleaseTag(pkgInfo, preState, tag));
+ const pkg = packagesByName.get(pkgInfo.name);
+ const publishTag = (pkg.packageJson.publishConfig && pkg.packageJson.publishConfig.tag) || tag;
+ return publishAPackage(pkg, access, twoFactorState, getReleaseTag(pkgInfo, preState, publishTag));
}));
}

@@ -910,7 +910,7 @@ async function publishAPackage(pkg, access, twoFactorState, tag) {
publishConfig
} = pkg.packageJson;
const localAccess = publishConfig === null || publishConfig === void 0 ? void 0 : publishConfig.access;
- info(`Publishing ${chalk.cyan(`"${name}"`)} at ${chalk.green(`"${version}"`)}`);
+ info(`Publishing ${chalk.cyan(`"${name}"`)} at ${chalk.green(`"${version}@${tag}"`)}`);
const publishDir = (publishConfig === null || publishConfig === void 0 ? void 0 : publishConfig.directory) ? join(pkg.dir, publishConfig.directory) : pkg.dir;
const publishConfirmation = await publish(name, {
cwd: publishDir,
@@ -1198,6 +1198,7 @@ async function run$1(cwd) {
}

async function run$2(input, flags, cwd) {
+ logger.warn("This is a patched version of @changesets/cli");
if (input[0] === "init") {
await init(cwd);
return;
10 changes: 8 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions website/CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "victory-docs",
"version": "37.3.2",
"version": "1.0.0",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
Expand Down

0 comments on commit 7eafe76

Please sign in to comment.