mirror of
https://github.com/morten-olsen/mini-loader.git
synced 2026-02-08 01:36:26 +01:00
ci: add NPM publish
This commit is contained in:
@@ -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
8
scripts/shared-data.json
Normal 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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user