Skip to content

Commit

Permalink
works for pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Jan 9, 2025
1 parent 4593741 commit 1051fb9
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions scripts/test-package-manager.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ async function fixManifest(projectDir) {
delete json.dependenciesMeta;
delete json.volta;

json.resolutions ||= {};
json.pnpm ||= {};
json.pnpm.overrides ||= {};

function tarByPrefix(hyphenated) {
return tars.find((name) => name.startsWith(hyphenated));
}
Expand All @@ -93,7 +97,21 @@ async function fixManifest(projectDir) {

let local = tarByPrefix(depName.replace('@', '').replace('/', '-'));

json.devDependencies[depName] = local;
if (!local) {
console.warn(`
Could not find ${depName} in list of tarballs:
${tars.map((x) => `\t${x}\n`).join('')}
${depName} will be omitted from this test project.
`);
delete json.devDependencies[depName];
continue;
}

let fileProtocol = `file:./${local}`;
json.devDependencies[depName] = fileProtocol;
json.resolutions[depName] = fileProtocol;
json.pnpm.overrides[depName] = fileProtocol;
}

writeFileSync(manifestPath, JSON.stringify(json, null, 2));
Expand All @@ -116,8 +134,8 @@ async function fixTSConfig(projectDir) {
json.compilerOptions.types = [
'ember-source/types',
'@embroider/core/virtual',
'ember-data/unstable-preview-types',
'@ember-data/request/unstable-preview-types',
// 'ember-data/unstable-preview-types',
// '@ember-data/request/unstable-preview-types',
// TODO: etc
];

Expand Down

0 comments on commit 1051fb9

Please sign in to comment.