mirror of
https://github.com/nostalgic-css/NES.css.git
synced 2025-08-24 22:55:48 +02:00
ci(semantic-release): Add package header updating to CI
I've add a script to handle automatically updating bot the CSS and SCSS headers with the relevant information before publishing. This update is handled as part of `semantic-release`'s preparation step.
This commit is contained in:
29
scripts/updatePackageHeader.js
Executable file
29
scripts/updatePackageHeader.js
Executable file
@@ -0,0 +1,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.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');
|
Reference in New Issue
Block a user