-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathPreBuild.js
More file actions
23 lines (17 loc) · 838 Bytes
/
Copy pathPreBuild.js
File metadata and controls
23 lines (17 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const path = require('path');
const colors = require('colors/safe');
const fs = require('fs');
const dada = require.resolve('./package.json');
const appVersion = require('./package.json').version;
console.log(colors.cyan('\nRunning pre-build tasks'));
const versionFilePath = path.join(__dirname + '/src/environments/version.ts');
const src = `export const APP_VERSION = '${appVersion}';`;
console.log(colors.green(`Dada ${colors.yellow(dada)}`));
// ensure version module pulls value from package.json
fs.writeFile(versionFilePath, src, { flat: 'w' }, function (err) {
if (err) {
return console.log(colors.red(err));
}
console.log(colors.green(`Updating application version ${colors.yellow(appVersion)}`));
console.log(`${colors.green('Writing version module to ')}${colors.yellow(versionFilePath)}\n`);
});