Skip to content

Commit

Permalink
fix: template version not sync
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Nov 6, 2024
1 parent ca510a8 commit 7dce9a2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 13 additions & 0 deletions scripts/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ import 'zx/globals';
JSON.stringify(pkg, null, 2) + '\n',
);

console.log('update templates');
const templateDir = path.join(__dirname, '../templates');
const templateDirs = fs
.readdirSync(templateDir)
.filter((dir) => fs.statSync(path.join(templateDir, dir)).isDirectory());
for (const dir of templateDirs) {
const pkgPath = path.join(templateDir, dir, 'package.json');
const content = fs.readFileSync(pkgPath, 'utf-8');
const pkg = JSON.parse(content);
pkg.version = version;
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
}

console.log('commit & tag');
await $`git commit --all --message "release: ${version}"`;
await $`git tag ${version}`;
Expand Down
5 changes: 3 additions & 2 deletions templates/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
"private": true,
"scripts": {
"build": "tnf build",
"dev": "tnf dev"
"dev": "tnf dev",
"preview": "tnf preview"
},
"dependencies": {
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@umijs/tnf": "0.0.0-alpha.4"
"@umijs/tnf": "0.0.0-alpha.5"
},
"devDependencies": {
"@total-typescript/tsconfig": "^1.0.4",
Expand Down

0 comments on commit 7dce9a2

Please sign in to comment.