ci: add NPM publish

This commit is contained in:
Morten Olsen
2024-01-12 14:42:52 +01:00
parent 59d6faaafc
commit 5154fbb4a5
14 changed files with 93 additions and 34 deletions

View File

@@ -1,7 +1,9 @@
import { findWorkspacePackages } from '@pnpm/find-workspace-packages';
import { writeFile } from 'fs/promises';
import { readFile, writeFile } from 'fs/promises';
import { join } from 'path';
const sharedData = JSON.parse(await readFile(join(process.cwd(), 'scripts/shared-data.json')));
const version = process.argv[2];
if (!version) {
throw new Error('Version is required');
@@ -11,6 +13,9 @@ const packages = await findWorkspacePackages(process.cwd());
for (const { manifest, dir } of packages) {
console.log(dir, version);
for (let [key, value] of Object.entries(sharedData || {})) {
manifest[key] = value;
}
manifest.version = version;
await writeFile(join(dir, 'package.json'), JSON.stringify(manifest, null, 2));
}

8
scripts/shared-data.json Normal file
View File

@@ -0,0 +1,8 @@
{
"license": "GPL-3.0",
"homepage": "https://github.com/morten-olsen/mini-loader",
"repository": {
"type": "git",
"url": "https://github.com/morten-olsen/mini-loader"
}
}