mirror of
https://github.com/idrawjs/idraw
synced 2026-05-24 10:08:34 +00:00
chore: upgrade version to 0.4.0-alpha.1
This commit is contained in:
parent
4411284f29
commit
85e87ab2d9
11 changed files with 106 additions and 33 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "root",
|
||||
"private": false,
|
||||
"version": "0.4.0-alpha.1",
|
||||
"scripts": {
|
||||
"postinstall": "npm run build",
|
||||
"dev": "vite-node ./scripts/dev.ts",
|
||||
|
|
@ -23,7 +23,8 @@
|
|||
"prepush": "npm run lint",
|
||||
"clear:jest": "rm -rf ./packages/*/__tests__/__snapshots__",
|
||||
"pu": "pnpm i && npm run build && lerna publish --force-publish",
|
||||
"pu2": "lerna version && npm run build && lerna publish from-git --force-publish"
|
||||
"pu2": "lerna version && npm run build && lerna publish from-git --force-publish",
|
||||
"upgrade:version": "vite-node ./scripts/upgrade-version.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.22.19",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@idraw/board",
|
||||
"version": "0.4.0-alpha.0",
|
||||
"version": "0.4.0-alpha.1",
|
||||
"description": "",
|
||||
"main": "dist/esm/index.js",
|
||||
"module": "dist/esm/index.js",
|
||||
|
|
@ -24,11 +24,11 @@
|
|||
"@idraw/types": "^0.4.0-alpha.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@idraw/util": "^0.4.0-alpha.0",
|
||||
"@idraw/renderer": "^0.4.0-alpha.0"
|
||||
"@idraw/util": "^0.4.0-alpha.1",
|
||||
"@idraw/renderer": "^0.4.0-alpha.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "5cc462b9206ea0e4e70b5183771dfbf694402483"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@idraw/core",
|
||||
"version": "0.4.0-alpha.0",
|
||||
"version": "0.4.0-alpha.1",
|
||||
"description": "",
|
||||
"main": "dist/esm/index.js",
|
||||
"module": "dist/esm/index.js",
|
||||
|
|
@ -24,12 +24,12 @@
|
|||
"@idraw/types": "^0.4.0-alpha.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@idraw/board": "^0.4.0-alpha.0",
|
||||
"@idraw/renderer": "^0.4.0-alpha.0",
|
||||
"@idraw/util": "^0.4.0-alpha.0"
|
||||
"@idraw/board": "^0.4.0-alpha.1",
|
||||
"@idraw/renderer": "^0.4.0-alpha.1",
|
||||
"@idraw/util": "^0.4.0-alpha.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "5cc462b9206ea0e4e70b5183771dfbf694402483"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "idraw",
|
||||
"version": "0.4.0-alpha.0",
|
||||
"version": "0.4.0-alpha.1",
|
||||
"description": "",
|
||||
"main": "dist/esm/index.js",
|
||||
"module": "dist/esm/index.js",
|
||||
|
|
@ -24,11 +24,11 @@
|
|||
"@idraw/types": "^0.4.0-alpha.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@idraw/core": "^0.4.0-alpha.0",
|
||||
"@idraw/util": "^0.4.0-alpha.0"
|
||||
"@idraw/core": "^0.4.0-alpha.1",
|
||||
"@idraw/util": "^0.4.0-alpha.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "5cc462b9206ea0e4e70b5183771dfbf694402483"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"name": "@idraw/lab",
|
||||
"version": "0.4.0-alpha.0",
|
||||
"version": "0.4.0-alpha.1",
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^5.1.3",
|
||||
"@idraw/core": "^0.4.0-alpha.0",
|
||||
"@idraw/util": "^0.4.0-alpha.0",
|
||||
"@idraw/core": "^0.4.0-alpha.1",
|
||||
"@idraw/util": "^0.4.0-alpha.1",
|
||||
"antd": "^5.5.0",
|
||||
"classnames": "^2.3.2",
|
||||
"react": "^18.2.0",
|
||||
|
|
@ -15,4 +15,4 @@
|
|||
"@types/react": "^18.2.0",
|
||||
"@types/react-dom": "^18.2.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@idraw/renderer",
|
||||
"version": "0.4.0-alpha.0",
|
||||
"version": "0.4.0-alpha.1",
|
||||
"description": "",
|
||||
"main": "dist/esm/index.js",
|
||||
"module": "dist/esm/index.js",
|
||||
|
|
@ -24,10 +24,10 @@
|
|||
"@idraw/types": "^0.4.0-alpha.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@idraw/util": "^0.4.0-alpha.0"
|
||||
"@idraw/util": "^0.4.0-alpha.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "5cc462b9206ea0e4e70b5183771dfbf694402483"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@idraw/types",
|
||||
"version": "0.4.0-alpha.0",
|
||||
"version": "0.4.0-alpha.1",
|
||||
"description": "",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
|
|
@ -23,4 +23,4 @@
|
|||
"access": "public"
|
||||
},
|
||||
"gitHead": "5cc462b9206ea0e4e70b5183771dfbf694402483"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@idraw/util",
|
||||
"version": "0.4.0-alpha.0",
|
||||
"version": "0.4.0-alpha.1",
|
||||
"description": "",
|
||||
"main": "dist/esm/index.js",
|
||||
"module": "dist/esm/index.js",
|
||||
|
|
@ -27,4 +27,4 @@
|
|||
"access": "public"
|
||||
},
|
||||
"gitHead": "5cc462b9206ea0e4e70b5183771dfbf694402483"
|
||||
}
|
||||
}
|
||||
38
scripts/upgrade-version.ts
Normal file
38
scripts/upgrade-version.ts
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import { readJSONFile, writeJSONFile } from './util/file';
|
||||
import { getRootPackageJSON, getAllSubPackageDirs } from './util/project';
|
||||
const pkg = getRootPackageJSON();
|
||||
const version = pkg.version;
|
||||
async function run() {
|
||||
const pkgDirs = getAllSubPackageDirs();
|
||||
console.log('version ===== ', version);
|
||||
console.log('pkgDirs ===== ', pkgDirs);
|
||||
const allPkgMap: Record<string, { file: string; json: any }> = {};
|
||||
pkgDirs.forEach((dir) => {
|
||||
const file = ['packages', dir, 'package.json'].join('/');
|
||||
const json = readJSONFile('packages', dir, 'package.json');
|
||||
allPkgMap[json.name] = { file, json };
|
||||
});
|
||||
for (const key in allPkgMap) {
|
||||
if (allPkgMap.hasOwnProperty(key)) {
|
||||
console.log(`Upgrade [${key}] from ${allPkgMap[key].json.version} to ${version}`);
|
||||
allPkgMap[key].json.version = version;
|
||||
if (allPkgMap[key]?.json?.dependencies) {
|
||||
for (const depName in allPkgMap[key].json.dependencies) {
|
||||
if (allPkgMap.hasOwnProperty(depName)) {
|
||||
allPkgMap[key].json.dependencies[depName] = `^${version}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
writeJSONFile(allPkgMap[key].file, allPkgMap[key].json);
|
||||
}
|
||||
}
|
||||
|
||||
run()
|
||||
.then(() => {
|
||||
console.log(`[@idraw]: Upgrade all packages version ${version} success!`);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
throw err;
|
||||
});
|
||||
|
|
@ -1,10 +1,27 @@
|
|||
import fs from 'fs';
|
||||
// import path from 'path';
|
||||
import path from 'path';
|
||||
|
||||
function removeFullDir(dirPath: string) {
|
||||
export function removeFullDir(dirPath: string) {
|
||||
if (fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory()) {
|
||||
fs.rmSync(dirPath, { recursive: true });
|
||||
}
|
||||
}
|
||||
|
||||
export { removeFullDir };
|
||||
export function projectRootPath(...args: string[]) {
|
||||
const pathList = Array.from(args);
|
||||
const baseDir = path.join(__dirname, '..', '..');
|
||||
return path.join(baseDir, ...pathList);
|
||||
}
|
||||
|
||||
export function readJSONFile(...args: string[]) {
|
||||
const filePath = projectRootPath(...args);
|
||||
const jsonStr = fs.readFileSync(filePath, { encoding: 'utf8' });
|
||||
const json = JSON.parse(jsonStr);
|
||||
return json;
|
||||
}
|
||||
|
||||
export function writeJSONFile(filePath: string, json: any) {
|
||||
const fullPath = projectRootPath(filePath);
|
||||
const jsonStr = JSON.stringify(json, null, 2);
|
||||
fs.writeFileSync(fullPath, jsonStr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { globSync } from 'glob';
|
||||
import { projectRootPath } from './file';
|
||||
|
||||
export function joinPackagePath(...args: string[]) {
|
||||
const pathList = Array.from(args);
|
||||
|
|
@ -8,9 +10,7 @@ export function joinPackagePath(...args: string[]) {
|
|||
}
|
||||
|
||||
export function joinProjectPath(...args: string[]) {
|
||||
const pathList = Array.from(args);
|
||||
const baseDir = path.join(__dirname, '..', '..');
|
||||
return path.join(baseDir, ...pathList);
|
||||
return projectRootPath(...args);
|
||||
}
|
||||
|
||||
export function getTsConfig() {
|
||||
|
|
@ -20,8 +20,25 @@ export function getTsConfig() {
|
|||
return config;
|
||||
}
|
||||
|
||||
export function getRootPackageJSON() {
|
||||
const configPath = joinProjectPath('package.json');
|
||||
const configStr = fs.readFileSync(configPath, { encoding: 'utf8' });
|
||||
const config = JSON.parse(configStr);
|
||||
return config;
|
||||
}
|
||||
|
||||
export function getAllSubPackageDirs() {
|
||||
const pkgDirs = globSync('*', {
|
||||
cwd: joinProjectPath('packages'),
|
||||
absolute: false
|
||||
});
|
||||
return pkgDirs;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
joinProjectPath,
|
||||
joinPackagePath,
|
||||
getTsConfig
|
||||
getTsConfig,
|
||||
getRootPackageJSON,
|
||||
getAllSubPackageDirs
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue