mirror of
https://github.com/nostalgic-css/NES.css.git
synced 2025-08-22 13:52:48 +02:00
refactor: Move SCSS functions and abstract build data retrieval
I've moved the SCSS functions file into the `scripts` directory where I think it makes a bit more sense. I've also abstracted most of the functionality from it so I can also use it in `semantic-release`'s preparation step.
This commit is contained in:
26
scripts/getBuildData.js
Normal file
26
scripts/getBuildData.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const git = require('git-rev-sync'); /* eslint-disable-line import/no-extraneous-dependencies */
|
||||
|
||||
module.exports = (isCompiled = false) => {
|
||||
let buildData = '';
|
||||
|
||||
if (git.branch() !== 'master') {
|
||||
buildData += '\n';
|
||||
|
||||
if (isCompiled) {
|
||||
buildData += `
|
||||
Build Date: ${(new Date()).toISOString()}
|
||||
Node Version: ${process.version}`;
|
||||
}
|
||||
|
||||
buildData += `
|
||||
Branch: ${git.branch()}
|
||||
Commit: ${git.long()}`;
|
||||
|
||||
if (process.env.CIRCLECI) {
|
||||
buildData += `
|
||||
Build Number (CircleCI): ${process.env.CIRCLE_BUILD_NUM}`;
|
||||
}
|
||||
}
|
||||
|
||||
return buildData.replace(/\n/, '').replace(/^ +/gm, ' ');
|
||||
};
|
7
scripts/scssFunctions.js
Normal file
7
scripts/scssFunctions.js
Normal file
@@ -0,0 +1,7 @@
|
||||
const { types } = require('node-sass'); /* eslint-disable-line import/no-extraneous-dependencies */
|
||||
|
||||
const getBuildData = require('./getBuildData');
|
||||
|
||||
module.exports = {
|
||||
'build-data()': () => types.String(getBuildData(true)),
|
||||
};
|
Reference in New Issue
Block a user