Skip to content

Commit f525bfd

Browse files
committed
feat: add cnpm sync command
1 parent eb73eac commit f525bfd

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/publish.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,25 @@ async function runGithubRelease(opts: ReleaseOptions) {
183183

184184
logger.success(`${chalk.blue(pkg.name)} github release: ${chalk.green(repoUrl.toString())}`);
185185

186-
console.log();
187-
logger.success(
188-
`${chalk.blue(pkg.name)} npm sync: ${chalk.green(`https://npmmirror.com/sync/${pkg.name}`)}`,
189-
);
190-
console.log();
186+
if (!opts.dryRun) {
187+
await open(repoUrl.toString());
188+
}
189+
191190
logger.success(
192191
`${chalk.blue(pkg.name)} npm site: ${chalk.green(`https://www.npmjs.com/package/${pkg.name}`)}`,
193192
);
194193

195-
if (!opts.dryRun) {
196-
await open(repoUrl.toString());
194+
const author = pkg.packageJson.author;
195+
if (author) {
196+
if ((typeof author === 'string' && author.includes('tom@tomgao.cc'))
197+
|| (typeof author === 'object' && author.email && author.email.includes('tom@tomgao.cc'))) {
198+
try {
199+
await run(`cnpm sync ${pkg.name}`, { spinner: 'sync to npmmirror.com' });
200+
}
201+
catch (e) {
202+
logger.error(e);
203+
}
204+
}
197205
}
198206
}
199207
}

0 commit comments

Comments
 (0)