1
0
mirror of https://github.com/nostalgic-css/NES.css.git synced 2025-05-08 23:05:21 +02:00
nes.css/scripts/updatePackageHeader.js
ダーシノ 3eacba9c99 Add components dir and split css file ()
* refactor: add components directory

ref 

* build: split nes.scss into nes.css and nes-core.css

and change npm scripts for build

ref 

* docs(readme.md): add nes-core.css link

* docs: add components directory path

and minor modification of the document
2018-12-29 01:00:31 +02:00

30 lines
894 B
JavaScript
Executable File

#!/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');