From ed99ce9d3bea5b49c4919908b5c9680feb5fd2ab Mon Sep 17 00:00:00 2001 From: Lukas Spirig Date: Fri, 20 Sep 2024 10:32:02 +0200 Subject: [PATCH] fix: assign correct dependency versions for published packages (#3102) Closes #3100 --- tools/vite/package-json-template.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/vite/package-json-template.ts b/tools/vite/package-json-template.ts index 00cfb64373..9e90398565 100644 --- a/tools/vite/package-json-template.ts +++ b/tools/vite/package-json-template.ts @@ -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];