Skip to content

Commit e4500eb

Browse files
committed
chore: migrated scripts from yarn to pnpm
1 parent ae63c55 commit e4500eb

File tree

8 files changed

+21
-39
lines changed

8 files changed

+21
-39
lines changed

.github/renovate.json5

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@
4444
},
4545

4646
postUpdateOptions: [
47-
// Run yarn dedupe to cleanup the lockfile after updates.
48-
'yarnDedupeHighest',
47+
'pnpmDedupe',
4948
],
5049

5150
// By default renovate will auto-rebase whenever the dep pranch falls behind main.

packages/integration-tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ These tests are setup to run within temporary folders to ensure that each test i
2727
);
2828
```
2929

30-
1. Run your integration test with `yarn test-integration ./tests/integration/tests/your-file.test.ts`
30+
1. Run your integration test with `pnpm run test-integration ./tests/integration/tests/your-file.test.ts`
3131
- This will generate your snapshot output for the lint run which is a JSON representation of your ESLint run.

packages/integration-tests/tools/integration-test-base.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function eslintIntegrationTest(
3535
let stderr = '';
3636
try {
3737
await execFile(
38-
'yarn',
38+
'pnpx',
3939
[
4040
'eslint',
4141
'--format',
@@ -93,7 +93,7 @@ export function typescriptIntegrationTest(
9393
): void {
9494
integrationTest(testName, testFilename, async testFolder => {
9595
const [result] = await Promise.allSettled([
96-
execFile('yarn', ['tsc', '--noEmit', '--skipLibCheck', ...tscArgs], {
96+
execFile('pnpx', ['tsc', '--noEmit', '--skipLibCheck', ...tscArgs], {
9797
cwd: testFolder,
9898
shell: true,
9999
}),

packages/integration-tests/tools/pack-packages.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ export const FIXTURES_DESTINATION_DIR = path.join(
4040
FIXTURES_DIR_BASENAME,
4141
);
4242

43-
const YARN_RC_CONTENT = 'nodeLinker: node-modules\n\nenableGlobalCache: true\n';
44-
4543
const FIXTURES_DIR = path.join(__dirname, '..', FIXTURES_DIR_BASENAME);
4644

4745
const TAR_FOLDER = path.join(INTEGRATION_TEST_DIR, 'tarballs');
@@ -118,10 +116,6 @@ export const setup = async (project: TestProject): Promise<void> => {
118116
encoding: 'utf-8',
119117
});
120118

121-
await fs.writeFile(path.join(temp, '.yarnrc.yml'), YARN_RC_CONTENT, {
122-
encoding: 'utf-8',
123-
});
124-
125119
await fs.writeFile(
126120
path.join(temp, 'package.json'),
127121
JSON.stringify(
@@ -136,14 +130,14 @@ export const setup = async (project: TestProject): Promise<void> => {
136130
),
137131
{ encoding: 'utf-8' },
138132
);
139-
133+
// TODO!: Rewrite
140134
// We install the tarballs here once so that yarn can cache them globally.
141135
// This solves 2 problems:
142136
// 1. Tests can be run concurrently because they won't be trying to install
143137
// the same tarballs at the same time.
144138
// 2. Installing the tarballs for each test becomes much faster as Yarn can
145139
// grab them from the global cache folder.
146-
await execFile('yarn', ['install', '--no-immutable'], {
140+
await execFile('pnpm', ['install', '--no-frozen-lockfile'], {
147141
cwd: temp,
148142
shell: true,
149143
});
@@ -187,15 +181,9 @@ export const setup = async (project: TestProject): Promise<void> => {
187181
{ encoding: 'utf-8' },
188182
);
189183

190-
await fs.writeFile(
191-
path.join(testFolder, '.yarnrc.yml'),
192-
YARN_RC_CONTENT,
193-
{ encoding: 'utf-8' },
194-
);
195-
196184
const { stderr, stdout } = await execFile(
197-
'yarn',
198-
['install', '--no-immutable'],
185+
'pnpm',
186+
['install', '--no-frozen-lockfile'],
199187
{
200188
cwd: testFolder,
201189
shell: true,

packages/types/tools/copy-ast-spec.mts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,14 @@ async function copyFile(
6363
encoding: 'utf-8',
6464
});
6565

66-
await execAsync(
67-
'yarn',
68-
['run', '--top-level', 'prettier', '--write', outpath],
69-
{},
70-
);
66+
await execAsync('pnpx', ['prettier', '--write', outpath], {});
7167

7268
console.log('Copied', fileName);
7369
}
7470

7571
if (process.env.SKIP_AST_SPEC_REBUILD) {
7672
// ensure the package is built
77-
await execAsync('yarn', ['build'], { cwd: AST_SPEC_PATH });
73+
await execAsync('pnpm run', ['build'], { cwd: AST_SPEC_PATH });
7874
}
7975

8076
await copyFile('dist', 'ast-spec.ts', code =>

packages/website/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"scripts": {
1515
"build": "docusaurus build",
1616
"clear": "docusaurus clear",
17-
"clean": "rimraf dist/ build/ .docusaurus/ && yarn run clear",
17+
"clean": "rimraf dist/ build/ .docusaurus/ && pnpm run clear",
1818
"format": "yarn run -T format",
1919
"generate-website-dts": "tsx ./tools/generate-website-dts.mts",
2020
"stylelint": "stylelint \"src/**/*.css\"",

tools/release/release.mts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ const { projectsVersionData, workspaceVersion } = await releaseVersion({
4343

4444
// Update the lock file after the version bumps and stage it ready to be committed by the changelog step
4545
if (!options.dryRun) {
46-
console.log('⏳ Updating yarn.lock...');
47-
execaSync(`yarn`, [`install`], {
46+
console.log('⏳ Updating pnpm-lock.yaml...');
47+
execaSync(`pnpm`, [`install`], {
4848
env: { ...process.env, SKIP_POSTINSTALL: 'true' },
4949
});
50-
execaSync(`git`, [`add`, `yarn.lock`]);
51-
console.log('✅ Updated and staged yarn.lock\n');
50+
execaSync(`git`, [`add`, `pnpm-lock.yaml`]);
51+
console.log('✅ Updated and staged pnpm-lock.yaml\n');
5252
}
5353

5454
// This will create a release on GitHub

tools/scripts/postinstall.mts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { $ as $_config } from 'execa';
22

33
const $ = $_config({
44
env: {
5+
// TODO!: Check it out and, if necessary, rewrite it
56
/**
67
* Do not apply the special GitHub Actions group markers within the
78
* postinstall logging, it cannot work correctly when nested within
@@ -29,19 +30,17 @@ if (process.env.SKIP_POSTINSTALL) {
2930
}
3031

3132
// make sure we're running from the workspace root
32-
const {
33-
default: { workspaceRoot },
34-
} = await import('@nx/devkit');
33+
const { workspaceRoot } = await import('@nx/devkit');
3534
process.chdir(workspaceRoot);
3635

3736
// Install git hooks
38-
await $`yarn husky`;
37+
await $`pnpx husky`;
3938

4039
if (!process.env.SKIP_POSTINSTALL_BUILD) {
4140
// Clean any caches that may be invalid now
42-
await $`yarn clean`;
41+
await $`pnpm run clean`;
4342

4443
// Build all the packages ready for use
45-
await $`yarn build`;
46-
await $`yarn nx typecheck ast-spec`;
44+
await $`pnpm run build`;
45+
await $`pnpx nx typecheck ast-spec`;
4746
}

0 commit comments

Comments
 (0)