Skip to content

Commit

Permalink
chore: update publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
Mini-ghost committed Nov 19, 2022
1 parent 8a37759 commit 9871b77
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"play": "cd playground && pnpm dev",
"prepare": "husky install",
"test": "vitest run",
"test:coverage": "vitest run --coverage"
"test:coverage": "vitest run --coverage",
"publish:ci": "esno scripts/publish.ts"
},
"lint-staged": {
"{packages}/**/*.{js,ts}": [
Expand Down
9 changes: 7 additions & 2 deletions packages/core/scripts/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ const { name, version } = readJSONSync(
'utf-8',
);

const isBeta: boolean = version.includes('beta');
const readmePath = path.join(resolve(__dirname, '..'), 'README.md');

copyFileSync(
path.join(resolve(__dirname, '../../..'), 'README.md'),
readmePath,
);

exec(`${command}${isBeta ? ' --tag beta' : ''}`, { stdio: 'inherit' });
const tag = version.includes('beta')
? 'beta'
: version.includes('rc')
? 'rc'
: null;

exec(`${command}${tag ? ` --tag ${tag}` : ''}`, { stdio: 'inherit' });

removeSync(readmePath);
consola.success(`Published ${name} v${version}`);
8 changes: 6 additions & 2 deletions packages/resolvers/scripts/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ const { name, version } = readJSONSync(
'utf-8',
);

const isBeta: boolean = version.includes('beta');
const tag = version.includes('beta')
? 'beta'
: version.includes('rc')
? 'rc'
: null;

exec(`${command}${isBeta ? ' --tag beta' : ''}`, { stdio: 'inherit' });
exec(`${command}${tag ? ` --tag ${tag}` : ''}`, { stdio: 'inherit' });

consola.success(`Published ${name} v${version}`);
4 changes: 4 additions & 0 deletions scripts/publish.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { execSync as exec } from 'child_process';

exec('pnpm --filter @vorms/core publish:ci', { stdio: 'inherit' });
exec('pnpm --filter @vorms/resolvers publish:ci', { stdio: 'inherit' });

0 comments on commit 9871b77

Please sign in to comment.