-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-package.js
34 lines (29 loc) · 1.53 KB
/
update-package.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const fs = require('fs');
const packagePath = 'digital-form-builder/runner/package.json';
const packageRunnerPath = 'runner/package.json';
const packageModelPath = 'digital-form-builder/model/package.json';
const packageQueueModelPath = 'digital-form-builder/queue-model/package.json';
// Read package.json
const packageRunnerJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
const packageAdapterRunnerJson = JSON.parse(fs.readFileSync(packageRunnerPath, 'utf8'));
const packageJsonModel = JSON.parse(fs.readFileSync(packageModelPath, 'utf8'));
const packageJsonQueueModel = JSON.parse(fs.readFileSync(packageQueueModelPath, 'utf8'));
// Modify package.json
packageRunnerJson.devDependencies = {
...packageRunnerJson.devDependencies,
'@xgovformbuilder/model': packageJsonModel.version,
'@xgovformbuilder/queue-model': packageJsonQueueModel.version,
'joi': packageAdapterRunnerJson.dependencies.joi
};
packageJsonModel.dependencies = {
...packageJsonModel.dependencies,
'joi': packageAdapterRunnerJson.dependencies.joi
};
packageRunnerJson.installConfig = {}
// Write package.json back to file
fs.writeFileSync(packagePath, JSON.stringify(packageRunnerJson, null, 2));
console.log('runner package.json updated successfully model:['
+ packageJsonModel.version + '] queue-model:[' + packageJsonQueueModel.version + "]");
// Write package.json back to file
fs.writeFileSync(packageModelPath, JSON.stringify(packageJsonModel, null, 2));
console.log('model package.json updated successfully joi:[' + packageAdapterRunnerJson.dependencies.joi + ']');