diff --git a/package.json b/package.json index d1caa25..50debd5 100644 --- a/package.json +++ b/package.json @@ -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}": [ diff --git a/packages/core/scripts/publish.ts b/packages/core/scripts/publish.ts index 1c7ba82..18fecaa 100644 --- a/packages/core/scripts/publish.ts +++ b/packages/core/scripts/publish.ts @@ -12,7 +12,6 @@ const { name, version } = readJSONSync( 'utf-8', ); -const isBeta: boolean = version.includes('beta'); const readmePath = path.join(resolve(__dirname, '..'), 'README.md'); copyFileSync( @@ -20,7 +19,13 @@ copyFileSync( 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}`); diff --git a/packages/resolvers/scripts/publish.ts b/packages/resolvers/scripts/publish.ts index 1bbab06..7b29b06 100644 --- a/packages/resolvers/scripts/publish.ts +++ b/packages/resolvers/scripts/publish.ts @@ -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}`); diff --git a/scripts/publish.ts b/scripts/publish.ts new file mode 100644 index 0000000..e5e4ebe --- /dev/null +++ b/scripts/publish.ts @@ -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' });