Skip to content
Merged
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
refactor!: stop removing old .pnp.js files when migrating
  • Loading branch information
paul-soporan committed Aug 17, 2022
commit c31caa77e3678e63d4419f96bc10afe580c16f8f
23 changes: 23 additions & 0 deletions .yarn/versions/db20fa43.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
releases:
"@yarnpkg/cli": major
"@yarnpkg/plugin-pnp": major

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-nm"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnpm"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- "@yarnpkg/builder"
- "@yarnpkg/core"
- "@yarnpkg/doctor"
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Yarn now accepts sponsorships! Please give a look at our [OpenCollective](https:
- `yarn workspaces foreach` now automatically enables the `-v,--verbose` flag in interactive terminal environments.
- `yarn npm audit` no longer takes into account publish registries. Use [`npmAuditRegistry`](https://yarnpkg.com/configuration/yarnrc#npmAuditRegistry) instead.
- The `--assume-fresh-project` flag of `yarn init` has been removed. Should only affect people initializing Yarn 4+ projects using a Yarn 2 binary.
- Yarn will no longer remove the old Yarn 2.x `.pnp.js` file when migrating.

### **API Changes**

Expand Down
4 changes: 2 additions & 2 deletions packages/acceptance-tests/pkg-tests-specs/sources/pnp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,9 +952,9 @@ describe(`Plug'n'Play`, () => {
async ({path, run, source}) => {
await run(`install`);

const pnpJs = await readFile(`${path}/.pnp.cjs`, `utf8`);
const pnpCjs = await readFile(`${path}/.pnp.cjs`, `utf8`);

expect(pnpJs.replace(/(\r\n|\r|\n).*/s, ``)).toMatch(/^#!foo$/);
expect(pnpCjs.replace(/(\r\n|\r|\n).*/s, ``)).toMatch(/^#!foo$/);
},
),
);
Expand Down
6 changes: 0 additions & 6 deletions packages/plugin-pnp/sources/PnpLinker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,6 @@ export class PnpInstaller implements Installer {

const pnpPath = getPnpPath(this.opts.project);

if (xfs.existsSync(pnpPath.cjsLegacy)) {
this.opts.report.reportWarning(MessageName.UNNAMED, `Removing the old ${formatUtils.pretty(this.opts.project.configuration, Filename.pnpJs, formatUtils.Type.PATH)} file. You might need to manually update existing references to reference the new ${formatUtils.pretty(this.opts.project.configuration, Filename.pnpCjs, formatUtils.Type.PATH)} file. If you use Editor SDKs, you'll have to rerun ${formatUtils.pretty(this.opts.project.configuration, `yarn sdks`, formatUtils.Type.CODE)}.`);

await xfs.removePromise(pnpPath.cjsLegacy);
}

if (!this.isEsmEnabled())
await xfs.removePromise(pnpPath.esmLoader);

Expand Down
1 change: 0 additions & 1 deletion packages/plugin-pnp/sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export {pnpUtils};
export const getPnpPath = (project: Project) => {
return {
cjs: ppath.join(project.cwd, Filename.pnpCjs),
cjsLegacy: ppath.join(project.cwd, Filename.pnpJs),
esmLoader: ppath.join(project.cwd, `.pnp.loader.mjs` as Filename),
};
};
Expand Down