Skip to content

Commit

Permalink
chore($release): config update
Browse files Browse the repository at this point in the history
  • Loading branch information
iq9891 committed Oct 22, 2021
1 parent 88a8d79 commit 9395833
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions scripts/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ function updateVersion(pkgFile: string, version: string) {
fs.writeFileSync(pkgFile, `${JSON.stringify(pkg, null, 2)}\n`);
}

async function publishPackage(
pkgName: string,
version: string,
runIfNotDry: Function,
) {
async function publishPackage(pkgName: string, version: string) {
const publicArgs = [
'publish',
'--no-git-tag-version',
Expand All @@ -51,7 +47,7 @@ async function publishPackage(
'public',
];
try {
await runIfNotDry('yarn', publicArgs);
await run('yarn', publicArgs);
log(`发布成功 ${pkgName}@${version}`);
} catch (e: any) {
if (e.stderr.match(/previously published/)) {
Expand Down Expand Up @@ -128,7 +124,7 @@ export async function goRelease(targetPackageName: TGenType, version: string) {
const confirmChangelog = await prompts({
type: 'confirm',
name: 'yes',
message: `确定生成 changelog 吗?`,
message: `确定生成 CHANGELONG 吗?`,
});

if (!confirmChangelog.yes) {
Expand All @@ -152,7 +148,7 @@ export async function goRelease(targetPackageName: TGenType, version: string) {

const { stdout } = await run('git', ['diff'], { stdio: 'pipe' });
if (stdout) {
log('\nCommitting changes...');
log('\n提交 GIT ...');
await runIfNotDry('git', ['add', '-A']);
await runIfNotDry('git', ['commit', '-m', `release($bump): ${tag}`]);
} else {
Expand All @@ -162,15 +158,15 @@ export async function goRelease(targetPackageName: TGenType, version: string) {
const confirmRelease = await prompts({
type: 'confirm',
name: 'yes',
message: `确定发布吗?`,
message: `确定发布 ${pkgName}${targetVersion} 版本吗?`,
});

if (!confirmRelease.yes) {
return;
}

log(`\n ${pkg.name} 发布中...`);
await publishPackage(pkgName, targetVersion, runIfNotDry);
await publishPackage(pkgName, targetVersion);

log('\n 提交到 GitHub...');

Expand Down

0 comments on commit 9395833

Please sign in to comment.