Skip to content

Commit 343c06e

Browse files
committed
chore: add sync max script
1 parent 6a99f19 commit 343c06e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

scripts/syncMako.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import 'zx/globals';
2+
3+
(async () => {
4+
let pkgName = '@umijs/bundler-mako';
5+
let version = await (async () => {
6+
if (argv.version) return argv.version;
7+
let version = (await $`npm show ${pkgName} version`).stdout.trim();
8+
return version;
9+
})();
10+
console.log(`Syncing ${pkgName}@${version}...`);
11+
12+
let pkgPath = 'packages/preset-umi/package.json';
13+
let pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
14+
pkg.dependencies[pkgName] = version;
15+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf-8');
16+
console.log(`Updated ${pkgPath}`);
17+
18+
await $`pnpm install`;
19+
console.log(`Installed with pnpm`);
20+
21+
await $`git commit -am "dep(@umijs/preset-umi): ${pkgName}@${version}"`;
22+
await $`git push`;
23+
})().catch(e => {
24+
console.error(e);
25+
process.exit(1);
26+
});

0 commit comments

Comments
 (0)