forked from nostalgic-css/NES.css
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdatePackageHeader.js
More file actions
executable file
·29 lines (19 loc) · 894 Bytes
/
updatePackageHeader.js
File metadata and controls
executable file
·29 lines (19 loc) · 894 Bytes
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
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const getBuildData = require('./getBuildData');
const nextVersion = process.argv[2];
if (!nextVersion) {
throw new Error('This script requires a version number to be provided');
}
// Update the SCSS Package Header
const SCSSFilePath = path.resolve('scss', 'nes-core.scss');
let SCSSFile = fs.readFileSync(SCSSFilePath, 'utf8');
SCSSFile = SCSSFile.replace(/^ {2}Version: development/m, ` Version: ${nextVersion}`);
SCSSFile = SCSSFile.replace(/^#{build-data\(\)}/m, getBuildData());
fs.writeFileSync(SCSSFilePath, SCSSFile, 'utf8');
// Update the SCSS Package Header
const CSSFilePath = path.resolve('css', 'nes.css');
let CSSFile = fs.readFileSync(CSSFilePath, 'utf8');
CSSFile = CSSFile.replace(/^ {2}Version: development/m, ` Version: ${nextVersion}`);
fs.writeFileSync(CSSFilePath, CSSFile, 'utf8');