2020-12-10 12:31:37 +00:00
|
|
|
const fs = require('fs');
|
2021-02-07 08:56:50 +00:00
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
function changeDependencies(deps, version) {
|
|
|
|
if (!deps) return;
|
|
|
|
for (const key of Object.keys(deps)) {
|
2021-04-17 07:24:46 +00:00
|
|
|
if (key.startsWith('dbgate-') && key != 'dbgate-plugin-tools') deps[key] = `^${version}`;
|
2021-02-07 08:56:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-07 08:58:57 +00:00
|
|
|
function changePackageFile(packagePath, version) {
|
|
|
|
const text = fs.readFileSync(path.join(packagePath, 'package.json'), { encoding: 'utf-8' });
|
2021-02-07 09:01:15 +00:00
|
|
|
const json = JSON.parse(text);
|
2021-02-07 08:56:50 +00:00
|
|
|
json.version = version;
|
|
|
|
changeDependencies(json.dependencies, version);
|
|
|
|
changeDependencies(json.devDependencies, version);
|
2021-02-07 08:58:57 +00:00
|
|
|
fs.writeFileSync(path.join(packagePath, 'package.json'), JSON.stringify(json, null, 2), { encoding: 'utf-8' });
|
2021-02-07 08:56:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const packageJson = fs.readFileSync('package.json', { encoding: 'utf-8' });
|
2020-12-10 12:31:37 +00:00
|
|
|
const json = JSON.parse(packageJson);
|
|
|
|
|
|
|
|
const text = `
|
|
|
|
module.exports = {
|
|
|
|
version: '${json.version}',
|
|
|
|
buildTime: '${new Date().toISOString()}'
|
|
|
|
};
|
|
|
|
`;
|
|
|
|
|
|
|
|
fs.writeFileSync('packages/api/src/currentVersion.js', text);
|
2021-02-07 08:56:50 +00:00
|
|
|
|
|
|
|
changePackageFile('app', json.version);
|
2021-04-15 15:56:35 +00:00
|
|
|
|
2021-02-07 08:56:50 +00:00
|
|
|
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);
|
2021-02-08 16:15:08 +00:00
|
|
|
changePackageFile('packages/datalib', json.version);
|
|
|
|
changePackageFile('packages/dbgate', json.version);
|
|
|
|
changePackageFile('packages/filterparser', json.version);
|
2021-04-15 15:56:35 +00:00
|
|
|
|
|
|
|
changePackageFile('plugins/dbgate-plugin-csv', json.version);
|
|
|
|
changePackageFile('plugins/dbgate-plugin-excel', json.version);
|
|
|
|
changePackageFile('plugins/dbgate-plugin-mssql', json.version);
|
|
|
|
changePackageFile('plugins/dbgate-plugin-mysql', json.version);
|
|
|
|
changePackageFile('plugins/dbgate-plugin-mongo', json.version);
|
|
|
|
changePackageFile('plugins/dbgate-plugin-postgres', json.version);
|
2021-05-20 08:59:06 +00:00
|
|
|
changePackageFile('plugins/dbgate-plugin-sqlite', json.version);
|