Skip to content

Commit 8fd7e59

Browse files
Merge pull request #111 from bertdeblock/use-pnpm-workspaceyaml-instead-of-npmrc
Use `pnpm-workspace.yaml` instead of `.npmrc`
2 parents 64c4152 + 5fe7ecd commit 8fd7e59

10 files changed

Lines changed: 29 additions & 19 deletions

File tree

.npmrc

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Docs: https://pnpm.io/npmrc
1+
# Docs: https://pnpm.io/settings
22
# https://github.com/emberjs/rfcs/pull/907
33

44
# we don't want addons to be bad citizens of the ecosystem
5-
auto-install-peers=false
5+
autoInstallPeers: false
66

77
# we want true isolation,
88
# if a dependency is not declared, we want an error
9-
resolve-peers-from-workspace-root=false
9+
resolvePeersFromWorkspaceRoot: false

index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ module.exports = {
6262
files = files.filter((file) => file.indexOf('.github') < 0);
6363
}
6464

65+
if (!isPnpm(options)) {
66+
let ignoredFiles = ['pnpm-workspace.yaml'];
67+
68+
files = files.filter((filename) => !ignoredFiles.includes(filename));
69+
}
70+
6571
if (!options.typescript) {
6672
let ignoredFiles = ['tsconfig.json'];
6773

pnpm-workspace.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
autoInstallPeers: false
2+
resolvePeersFromWorkspaceRoot: false
13
packages:
24
- '.'
35
- 'tests'
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Docs: https://pnpm.io/npmrc
1+
# Docs: https://pnpm.io/settings
22
# https://github.com/emberjs/rfcs/pull/907
33

44
# we don't want addons to be bad citizens of the ecosystem
5-
auto-install-peers=false
5+
autoInstallPeers: false
66

77
# we want true isolation,
88
# if a dependency is not declared, we want an error
9-
resolve-peers-from-workspace-root=false
9+
resolvePeersFromWorkspaceRoot: false
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Docs: https://pnpm.io/npmrc
1+
# Docs: https://pnpm.io/settings
22
# https://github.com/emberjs/rfcs/pull/907
33

44
# we don't want addons to be bad citizens of the ecosystem
5-
auto-install-peers=false
5+
autoInstallPeers: false
66

77
# we want true isolation,
88
# if a dependency is not declared, we want an error
9-
resolve-peers-from-workspace-root=false
9+
resolvePeersFromWorkspaceRoot: false

tests/smoke-tests/--addon-only.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ describe.skip('--addon-only', () => {
2020
it('has all the files', async () => {
2121
let rootContents = await dirContents(helper.projectRoot);
2222

23-
await matchesFixture('.npmrc', { cwd: helper.projectRoot, scenario: 'pnpm-addon-only' });
23+
await matchesFixture('pnpm-workspace.yaml', {
24+
cwd: helper.projectRoot,
25+
scenario: 'pnpm-addon-only',
26+
});
2427

2528
expect(rootContents).to.include('.editorconfig');
2629
expect(rootContents).to.include('eslint.config.mjs');
2730
expect(rootContents).to.include('.gitignore');
28-
expect(rootContents).to.include('.npmrc');
31+
expect(rootContents).to.include('pnpm-workspace.yaml');
2932
expect(rootContents).to.include('.prettierignore');
3033
expect(rootContents).to.include('.prettierrc.cjs');
3134
expect(rootContents).to.include('.template-lintrc.cjs');

tests/smoke-tests/--typescript.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) {
5353
})`${localEmberCli} addon ${addonName} -b ${blueprintPath} --skip-npm --prefer-local true --${packageManager} --typescript`;
5454
// Have to use --force because NPM is *stricter* when you use tags in package.json
5555
// than pnpm (in that tags don't match any specified stable version)
56-
await execa({
57-
cwd: addonDir,
58-
})`${packageManager} install ${packageManager === 'npm' ? '--force' : ''}`;
56+
if (packageManager === 'npm') {
57+
await execa({ cwd: addonDir })`npm install --force`;
58+
} else if (packageManager === 'pnpm') {
59+
await execa({ cwd: addonDir })`pnpm install`;
60+
}
5961
});
6062

6163
it('was generated correctly', async () => {

tests/smoke-tests/defaults.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) {
7373
cwd: addonDir,
7474
scenario: 'pnpm',
7575
});
76-
await matchesFixture('.npmrc', {
76+
await matchesFixture('pnpm-workspace.yaml', {
7777
cwd: addonDir,
7878
scenario: 'pnpm',
7979
});

tests/smoke-tests/within-existing-monorepo/custom-locations.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe.skip('custom locations', () => {
6363
it('ignores root files', async () => {
6464
expect(
6565
fixturify.readSync(cwd, {
66-
ignore: ['addons', 'tests', 'node_modules', 'pnpm-lock.yaml', '.npmrc'],
66+
ignore: ['addons', 'tests', 'node_modules', 'pnpm-lock.yaml', 'pnpm-workspace.yaml'],
6767
}),
6868
'root files have not been touched',
6969
).toEqual(rootFiles);

0 commit comments

Comments
 (0)