Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pack #3102

Merged
merged 1 commit into from
Jan 15, 2025
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
31 changes: 30 additions & 1 deletion configuration/vite-config/src/scripts/prepack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { getShortName, type PackageName } from '../package';
import type { PackageJson } from 'type-fest';
import { validateBuildArtifacts } from '../validation/validateBuildArtifacts';
import { readPackageJson } from '../packageJson';
import { LocalPackageJson, readPackageJson } from '../packageJson';

Check failure on line 7 in configuration/vite-config/src/scripts/prepack.ts

View workflow job for this annotation

GitHub Actions / lint (vite-config)

Import "LocalPackageJson" is only used as types
import { listInstalledPackages } from '../installedPackages';

prepack();
Expand All @@ -13,10 +13,39 @@
console.info('*** Starting prepack. ***');
referenceCopiedProtectedPackages();
validateBuildArtifacts();
removeDevDependenciesFromProtectedPackages();
validatePrepack();
console.info('*** Ending prepack. ***');
}

/**
* @remarks
*

Check failure on line 23 in configuration/vite-config/src/scripts/prepack.ts

View workflow job for this annotation

GitHub Actions / lint (vite-config)

Delete `·`
* Remove the devDependencies for the copied protected packages.
* This is to fix a bug where subsequent installs of the consuming
* package fail because it tries to read the devDependencies
*/
function removeDevDependenciesFromProtectedPackages () {

Check failure on line 28 in configuration/vite-config/src/scripts/prepack.ts

View workflow job for this annotation

GitHub Actions / lint (vite-config)

Delete `·`
const packageJson = fse.readJSONSync('./package.json') as LocalPackageJson;

const protectedPackageNames = listInstalledPackages(

Check failure on line 31 in configuration/vite-config/src/scripts/prepack.ts

View workflow job for this annotation

GitHub Actions / lint (vite-config)

Replace `⏎····packageJson,⏎···` with `packageJson,`
packageJson,
{
filter: { scope: 'protected', dependencyType: 'dependencies' },

Check failure on line 34 in configuration/vite-config/src/scripts/prepack.ts

View workflow job for this annotation

GitHub Actions / lint (vite-config)

Delete `··`
}

Check failure on line 35 in configuration/vite-config/src/scripts/prepack.ts

View workflow job for this annotation

GitHub Actions / lint (vite-config)

Replace `··}⏎··).map(installedPackage` with `}).map((installedPackage)`
).map(installedPackage => installedPackage.name);

protectedPackageNames.forEach(protectedPackageName => {

Check failure on line 38 in configuration/vite-config/src/scripts/prepack.ts

View workflow job for this annotation

GitHub Actions / lint (vite-config)

Replace `protectedPackageName` with `(protectedPackageName)`
const protectedPackageShortName = getShortName(

Check failure on line 39 in configuration/vite-config/src/scripts/prepack.ts

View workflow job for this annotation

GitHub Actions / lint (vite-config)

Replace `⏎······protectedPackageName⏎····` with `protectedPackageName`
protectedPackageName
);
const jsonPath = `./dist/${protectedPackageShortName}/package.json`;
const json = fse.readJSONSync(jsonPath) as PackageJson;
json.devDependencies = {};
fse.writeJSONSync(jsonPath, json, { spaces: 2 });
});
}

/**
* @remarks
*
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

Loading