Skip to content

Commit

Permalink
ci: use manually specified packages
Browse files Browse the repository at this point in the history
  • Loading branch information
BearToCode committed Nov 7, 2023
1 parent a7352bc commit 8231dc5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"dev": "cd demo && npm run dev",
"check": "cd packages/carta-md && npm run check",
"build": "node scripts/build.js",
"publish": "node scripts/publish.js",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write .",
"prepare": "husky install",
"commit": "cz",
"publish": "pnpm -r --workspace-concurrency=1 exec -- npx --no-install semantic-release -e semantic-release-monorepo"
"commit": "cz"
},
"devDependencies": {
"@types/node": "^18.16.3",
Expand Down
10 changes: 7 additions & 3 deletions scripts/packages.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import * as childProcess from 'child_process';
import { stderr, stdout } from 'process';

export const execAsync = (command, cwd = undefined) =>
export const execAsync = (command, cwd = undefined, options = { showLog: false }) =>
new Promise((resolve, reject) => {
const child = childProcess.spawn(command, { cwd, shell: true });
let out = '';

child.stdout.setEncoding('utf8');
child.stdout.on('data', function (data) {
out += 'stdout: ' + data.toString();
if (options?.showLog) stdout(data);
else out += 'stdout: ' + data.toString();
});

child.stderr.setEncoding('utf8');
child.stderr.on('data', function (data) {
out += 'stderr: ' + data.toString();
if (options?.showLog) stderr(data);
else out += 'stderr: ' + data.toString();
});

child.on('error', (e) => {
if (options?.showLog) return;
console.log(out);
console.log(e);
});
Expand Down
9 changes: 9 additions & 0 deletions scripts/publish.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { execAsync, packages } from './packages';

for (const pkg of packages) {
await execAsync(
`npx --no-install semantic-release -e semantic-release-monorepo`,
`packages/${pkg}`,
{ showLog: true }
);
}

0 comments on commit 8231dc5

Please sign in to comment.