From 4e6b5eefb55c244a57c90723a439b75fb7497cb0 Mon Sep 17 00:00:00 2001 From: Steven John Date: Thu, 26 Dec 2024 10:19:33 +0530 Subject: [PATCH] feat(publish): add vue package --- publish.js | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/publish.js b/publish.js index af22288..a4bae76 100644 --- a/publish.js +++ b/publish.js @@ -1,11 +1,10 @@ -import { readdirSync } from 'fs'; import { spawn } from 'child_process'; import { readFileSync, writeFileSync } from 'fs'; // This publish process automatically replaces workspace:* with the actual version number of other packages currently in the repo // The packages to publish – this will run in order and await each package before moving on -const packages = ['shaders', 'shaders-react']; +const packages = ['shaders', 'shaders-react', 'shaders-vue']; const isDryRun = process.argv.includes('--dry-run'); // Extract the tag value from the command line arguments @@ -22,9 +21,7 @@ if (tag) { const packageVersionMap = {}; // Loop through all the packages and get the current version of each for (const pkg of packages) { - const packageJson = JSON.parse( - readFileSync(`packages/${pkg}/package.json`, 'utf8') - ); + const packageJson = JSON.parse(readFileSync(`packages/${pkg}/package.json`, 'utf8')); // Get the name of the package const name = packageJson.name; const currentVersion = packageJson.version; @@ -36,10 +33,7 @@ async function publish(pkg) { console.log(`Publishing ${pkg}...`); // ----- Update any workspace dependencies with the current version ----- // - const originalPackageJson = readFileSync( - `${packagePath}/package.json`, - 'utf8' - ); + const originalPackageJson = readFileSync(`${packagePath}/package.json`, 'utf8'); const packageJson = JSON.parse(originalPackageJson); // Search the package.json for any packages in our packageVersionMap and replace the version with the current version for (const [key, value] of Object.entries(packageJson.dependencies)) { @@ -48,10 +42,7 @@ async function publish(pkg) { } } // Write the updated package.json - writeFileSync( - `${packagePath}/package.json`, - JSON.stringify(packageJson, null, 2) - ); + writeFileSync(`${packagePath}/package.json`, JSON.stringify(packageJson, null, 2)); // ----- Publish the package ----- // const args = ['publish', '--access', 'public']; @@ -70,9 +61,7 @@ async function publish(pkg) { child.on('close', (code) => { if (code !== 0) { - console.log( - `Skipping ${pkg}: Publication failed or package is already up to date` - ); + console.log(`Skipping ${pkg}: Publication failed or package is already up to date`); } else { console.log(`Published ${pkg}`); }