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: assign correct dependency versions for published packages #3102

Merged
merged 1 commit into from
Sep 20, 2024
Merged
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
14 changes: 7 additions & 7 deletions tools/vite/package-json-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ export function packageJsonTemplate(
const rootPackageJsonPath = './package.json';
const packageJsonTemplatePath = options.templatePath ?? './package.json';
const rootPackageJson = JSON.parse(readFileSync(new URL(rootPackageJsonPath, root), 'utf8'));
const litMajorVersion = +rootPackageJson.dependencies.lit.match(/\d+/);
const litObserversMajorVersion =
+rootPackageJson.devDependencies['@lit-labs/observers'].match(/\d+/);
const litVersion = rootPackageJson.dependencies.lit.match(/\d+\.\d+\.\d+/);
const litObserversVersion =
rootPackageJson.devDependencies['@lit-labs/observers'].match(/\d+\.\d+\.\d+/);
const reactMajorVersion = +rootPackageJson.devDependencies.react.match(/\d+/);
const litReactMajorVersion = +rootPackageJson.devDependencies['@lit/react'].match(/\d+/);
const litReactVersion = rootPackageJson.devDependencies['@lit/react'].match(/\d+\.\d+\.\d+/);
const packageJsonTemplate = readFileSync(
join(viteConfig.root, packageJsonTemplatePath),
'utf8',
);
const packageJsonContent = packageJsonTemplate
.replaceAll('0.0.0-PLACEHOLDER', rootPackageJson.version)
.replaceAll('0.0.0-LITREACT', `^${litReactMajorVersion}.0.0`)
.replaceAll('0.0.0-LITOBSERVERS', `^${litObserversVersion}`)
.replaceAll('0.0.0-LITREACT', `^${litReactVersion}`)
.replaceAll('0.0.0-REACT', `^${reactMajorVersion}.0.0`)
.replaceAll('0.0.0-LIT', `^${litMajorVersion}.0.0`)
.replaceAll('0.0.0-LITOBSERVERS', `^${litObserversMajorVersion}.0.0`);
.replaceAll('0.0.0-LIT', `^${litVersion}`);
const packageJson = JSON.parse(packageJsonContent);
for (const key of ['author', 'license', 'repository', 'bugs']) {
packageJson[key] = rootPackageJson[key];
Expand Down
Loading