mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-27 20:46:00 +00:00
set current version
This commit is contained in:
@@ -1,5 +1,23 @@
|
||||
const fs = require('fs');
|
||||
const packageJson = fs.readFileSync('app/package.json', { encoding: 'utf-8' });
|
||||
const path = require('path');
|
||||
|
||||
function changeDependencies(deps, version) {
|
||||
if (!deps) return;
|
||||
for (const key of Object.keys(deps)) {
|
||||
if (key.startsWith('dbate-')) deps[key] = version;
|
||||
}
|
||||
}
|
||||
|
||||
function changePackageFile(path, version) {
|
||||
const text = fs.readFileSync(path.join(path, 'package.json'), { encoding: 'utf-8' });
|
||||
const json = JSON.parse(packageJson);
|
||||
json.version = version;
|
||||
changeDependencies(json.dependencies, version);
|
||||
changeDependencies(json.devDependencies, version);
|
||||
fs.writeFileSync(path.join(path, 'package.json'), JSON.stringify(json, null, 2), { encoding: 'utf-8' });
|
||||
}
|
||||
|
||||
const packageJson = fs.readFileSync('package.json', { encoding: 'utf-8' });
|
||||
const json = JSON.parse(packageJson);
|
||||
|
||||
const text = `
|
||||
@@ -10,3 +28,10 @@ module.exports = {
|
||||
`;
|
||||
|
||||
fs.writeFileSync('packages/api/src/currentVersion.js', text);
|
||||
|
||||
changePackageFile('app', json.version);
|
||||
changePackageFile('packages/api', json.version);
|
||||
changePackageFile('packages/sqltree', json.version);
|
||||
changePackageFile('packages/types', json.version);
|
||||
changePackageFile('packages/tools', json.version);
|
||||
changePackageFile('packages/web', json.version);
|
||||
|
||||
Reference in New Issue
Block a user