From a34cac4aca088e50010ea12465cdf40bb26bd901 Mon Sep 17 00:00:00 2001 From: Trezy Date: Sun, 16 Dec 2018 21:12:04 -0600 Subject: [PATCH 1/7] build: Make build versions dynamic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hehehehe, this is really cool. I've removed the hardcoded version number from `nes.scss` and replaced it with a custom function. This function does all sorts of cool stuff. 1. **Injects the framework version from `package.json` This prevents us from having to inject the version number manually. 2. **Adds build info…** The branch that the CSS was built from, when it was built, what version of Node was used… All of the useful information that we could possibly provide. If it’s built on CircleCI, it even includes the build number. 3. **…but not too much build info** If the build is running against the `master` branch, we only inject the framework version. No need to bloat production builds with all the other junk. 😁 --- package.json | 3 ++- scss/functions.js | 28 ++++++++++++++++++++++++++++ scss/nes.scss | 6 +++--- 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 scss/functions.js diff --git a/package.json b/package.json index 65c7598..a062190 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "stylelint": "stylelint scss/**/*.scss", "build:stylelint": "npm run stylelint -- --fix", "build:clean": "rimraf css", - "build:sass": "node-sass --output-style expanded --source-map true scss/nes.scss css/nes.css", + "build:sass": "node-sass --output-style expanded --source-map true --functions scss/functions.js scss/nes.scss css/nes.css", "build:autoprefix": "postcss --use autoprefixer --map false --output css/nes.css css/nes.css", "build:cleancss": "cleancss -o css/nes.min.css css/nes.css", "storybook": "start-storybook -p 6006", @@ -50,6 +50,7 @@ "eslint-config-airbnb-base": "^13.1.0", "eslint-plugin-import": "^2.14.0", "file-loader": "^2.0.0", + "git-rev-sync": "^1.12.0", "husky": "^1.0.0", "lint-staged": "^7.3.0", "node-sass": "^4.9.3", diff --git a/scss/functions.js b/scss/functions.js new file mode 100644 index 0000000..468d277 --- /dev/null +++ b/scss/functions.js @@ -0,0 +1,28 @@ +const git = require('git-rev-sync'); /* eslint-disable-line import/no-extraneous-dependencies */ +const { types } = require('node-sass'); /* eslint-disable-line import/no-extraneous-dependencies */ + +module.exports = { + 'version()': () => { + const packageData = require('../package.json'); /* eslint-disable-line global-require */ + + let buildData = ` + NES.css Framework + Version: ${(git.branch() === 'develop') ? 'development' : `v${packageData.version}`} + `; + + if (git.branch() !== 'master') { + buildData += ` + Build Date: ${(new Date()).toISOString()} + Node Version: ${process.version} + Branch: ${git.branch()} + Commit: ${git.long()}`; + } + + if (process.env.CIRCLECI) { + buildData += ` + Build Number (CircleCI): ${process.env.CIRCLE_BUILD_NUM}`; + } + + return types.String(buildData.replace(/\n/, '').replace(/^ +/gm, ' ')); + }, +}; diff --git a/scss/nes.scss b/scss/nes.scss index 0cb94c0..f1936ab 100644 --- a/scss/nes.scss +++ b/scss/nes.scss @@ -1,8 +1,8 @@ @charset "utf-8"; -/*! -* NES.css v0.0.2(alpha) -*/ +/*****************************************************************************\ +#{version()} +\*****************************************************************************/ @import "base/_index.scss"; @import "utilities/_index.scss"; From 81914e66c7cddc2b47634e84bf575c5ba75b404c Mon Sep 17 00:00:00 2001 From: Trezy Date: Sun, 16 Dec 2018 22:42:43 -0600 Subject: [PATCH 2/7] chore: Remove version from `package.json` The `version` field in the `package.json` file doesn't serve any real purpose for us since `semantic-release will handle adding and updating it automatically. --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index a062190..d6d1c47 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,5 @@ { "name": "nes.css", - "version": "0.0.0-development", "description": "NES.css is NES-style CSS Framework.", "scripts": { "watch": "npm run build:sass -- --watch", From 69fb58eccb3080f95d9c2d8b82d6eec45b1b76d0 Mon Sep 17 00:00:00 2001 From: Trezy Date: Sun, 16 Dec 2018 22:48:53 -0600 Subject: [PATCH 3/7] 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. --- package.json | 2 +- scripts/getBuildData.js | 26 ++++++++++++++++++++++++++ scripts/scssFunctions.js | 7 +++++++ scss/functions.js | 28 ---------------------------- scss/nes.scss | 4 +++- 5 files changed, 37 insertions(+), 30 deletions(-) create mode 100644 scripts/getBuildData.js create mode 100644 scripts/scssFunctions.js delete mode 100644 scss/functions.js diff --git a/package.json b/package.json index d6d1c47..b92f346 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "stylelint": "stylelint scss/**/*.scss", "build:stylelint": "npm run stylelint -- --fix", "build:clean": "rimraf css", - "build:sass": "node-sass --output-style expanded --source-map true --functions scss/functions.js scss/nes.scss css/nes.css", + "build:sass": "node-sass --output-style expanded --source-map true --functions scripts/scssFunctions.js scss/nes.scss css/nes.css", "build:autoprefix": "postcss --use autoprefixer --map false --output css/nes.css css/nes.css", "build:cleancss": "cleancss -o css/nes.min.css css/nes.css", "storybook": "start-storybook -p 6006", diff --git a/scripts/getBuildData.js b/scripts/getBuildData.js new file mode 100644 index 0000000..369d1ef --- /dev/null +++ b/scripts/getBuildData.js @@ -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, ' '); +}; diff --git a/scripts/scssFunctions.js b/scripts/scssFunctions.js new file mode 100644 index 0000000..d18960a --- /dev/null +++ b/scripts/scssFunctions.js @@ -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)), +}; diff --git a/scss/functions.js b/scss/functions.js deleted file mode 100644 index 468d277..0000000 --- a/scss/functions.js +++ /dev/null @@ -1,28 +0,0 @@ -const git = require('git-rev-sync'); /* eslint-disable-line import/no-extraneous-dependencies */ -const { types } = require('node-sass'); /* eslint-disable-line import/no-extraneous-dependencies */ - -module.exports = { - 'version()': () => { - const packageData = require('../package.json'); /* eslint-disable-line global-require */ - - let buildData = ` - NES.css Framework - Version: ${(git.branch() === 'develop') ? 'development' : `v${packageData.version}`} - `; - - if (git.branch() !== 'master') { - buildData += ` - Build Date: ${(new Date()).toISOString()} - Node Version: ${process.version} - Branch: ${git.branch()} - Commit: ${git.long()}`; - } - - if (process.env.CIRCLECI) { - buildData += ` - Build Number (CircleCI): ${process.env.CIRCLE_BUILD_NUM}`; - } - - return types.String(buildData.replace(/\n/, '').replace(/^ +/gm, ' ')); - }, -}; diff --git a/scss/nes.scss b/scss/nes.scss index f1936ab..19c622f 100644 --- a/scss/nes.scss +++ b/scss/nes.scss @@ -1,7 +1,9 @@ @charset "utf-8"; /*****************************************************************************\ -#{version()} + NES.css Framework + Version: development +#{build-data()} \*****************************************************************************/ @import "base/_index.scss"; From a7899d838d833b81a1644461a1311ae00387b2fc Mon Sep 17 00:00:00 2001 From: Trezy Date: Sun, 16 Dec 2018 22:55:15 -0600 Subject: [PATCH 4/7] 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. --- package-lock.json | 123 +++++++++++++++++++++++++++------ package.json | 12 ++++ scripts/updatePackageHeader.js | 29 ++++++++ 3 files changed, 144 insertions(+), 20 deletions(-) create mode 100755 scripts/updatePackageHeader.js diff --git a/package-lock.json b/package-lock.json index 1371fb5..ee9fa94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1124,6 +1124,59 @@ "integrity": "sha512-9Tj/qn+y2j+sjCI3Jd+qseGtHjOAeg7dU2/lVcqIQ9TV3QDaDXDYXcoOHU+7o2Hwh8L8ymL4gfuO7KxDs3q2zg==", "dev": true }, + "@semantic-release/exec": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@semantic-release/exec/-/exec-3.3.0.tgz", + "integrity": "sha512-6a5nMGLyYJUl5me4orEIA89mf1Roz1jEVlv0GgIJv1k/yjEcmWicYQ76PrPfUzh81sVtfHfK0zLN5Vikz8f5oA==", + "dev": true, + "requires": { + "@semantic-release/error": "^2.1.0", + "aggregate-error": "^1.0.0", + "debug": "^4.0.0", + "execa": "^1.0.0", + "lodash": "^4.17.4", + "parse-json": "^4.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + } + } + }, "@storybook/addon-knobs": { "version": "4.0.12", "resolved": "https://registry.npmjs.org/@storybook/addon-knobs/-/addon-knobs-4.0.12.tgz", @@ -4332,7 +4385,7 @@ "dependencies": { "domelementtype": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", "dev": true } @@ -5092,7 +5145,7 @@ }, "expand-range": { "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "resolved": "http://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", "dev": true, "requires": { @@ -6456,7 +6509,7 @@ }, "get-stream": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, @@ -6532,6 +6585,36 @@ } } }, + "git-rev-sync": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/git-rev-sync/-/git-rev-sync-1.12.0.tgz", + "integrity": "sha1-RGhAbH5sO6TPRYeZnhrbKNnRr1U=", + "dev": true, + "requires": { + "escape-string-regexp": "1.0.5", + "graceful-fs": "4.1.11", + "shelljs": "0.7.7" + }, + "dependencies": { + "graceful-fs": { + "version": "4.1.11", + "resolved": "http://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "shelljs": { + "version": "0.7.7", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.7.tgz", + "integrity": "sha1-svXHfvlxSPS09uImguELuoZnz/E=", + "dev": true, + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + } + } + }, "glob": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", @@ -6660,7 +6743,7 @@ }, "globby": { "version": "8.0.1", - "resolved": "https://registry.npmjs.org/globby/-/globby-8.0.1.tgz", + "resolved": "http://registry.npmjs.org/globby/-/globby-8.0.1.tgz", "integrity": "sha512-oMrYrJERnKBLXNLVTqhm3vPEdJ/b2ZE28xN4YARiix1NOIOBPEpOUnm844K1iu/BkphCaf2WNFwMszv8Soi1pw==", "dev": true, "requires": { @@ -7930,7 +8013,7 @@ }, "jest-get-type": { "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz", + "resolved": "http://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz", "integrity": "sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w==", "dev": true }, @@ -9092,7 +9175,7 @@ "dependencies": { "semver": { "version": "5.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "resolved": "http://registry.npmjs.org/semver/-/semver-5.3.0.tgz", "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", "dev": true } @@ -12809,7 +12892,7 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, @@ -12834,7 +12917,7 @@ }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -12871,7 +12954,7 @@ }, "p-is-promise": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=", "dev": true }, @@ -13056,7 +13139,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -13873,7 +13956,7 @@ }, "pretty-hrtime": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", + "resolved": "http://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=", "dev": true }, @@ -14496,7 +14579,7 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -15038,7 +15121,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, "requires": { @@ -15110,7 +15193,7 @@ "dependencies": { "source-map": { "version": "0.4.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "resolved": "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { @@ -16313,7 +16396,7 @@ }, "staged-git-files": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/staged-git-files/-/staged-git-files-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/staged-git-files/-/staged-git-files-1.1.1.tgz", "integrity": "sha512-H89UNKr1rQJvI1c/PIR3kiAMBV23yvR7LItZiV74HWZwzt7f3YHuujJ9nJZlt58WlFox7XQsOahexwk7nTe69A==", "dev": true }, @@ -16462,7 +16545,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -16494,7 +16577,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -16509,7 +16592,7 @@ }, "strip-eof": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, @@ -16709,7 +16792,7 @@ }, "stylelint-order": { "version": "0.8.1", - "resolved": "https://registry.npmjs.org/stylelint-order/-/stylelint-order-0.8.1.tgz", + "resolved": "http://registry.npmjs.org/stylelint-order/-/stylelint-order-0.8.1.tgz", "integrity": "sha512-8mp1P2wnI9XShYXVXDsxVigE2eXnc0C2O4ktbwUvTBwjCP4xZskIbUVxp1evSG3OK4R7hXVNl/2BnJCZkrcc/w==", "dev": true, "requires": { @@ -16913,7 +16996,7 @@ }, "tar": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "resolved": "http://registry.npmjs.org/tar/-/tar-2.2.1.tgz", "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { diff --git a/package.json b/package.json index b92f346..771f6b0 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "devDependencies": { "@commitlint/cli": "^7.2.1", "@commitlint/config-conventional": "^7.1.2", + "@semantic-release/exec": "^3.3.0", "@storybook/addon-knobs": "^4.0.11", "@storybook/html": "^4.0.11", "autoprefixer": "^9.1.5", @@ -105,6 +106,17 @@ "prettier": { "printWidth": 100 }, + "release": { + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/npm", + "@semantic-release/github", + ["@semantic-release/exec", { + "prepareCmd": "./scripts/update-version ${nextRelease.version}" + }] + ] + }, "stylelint": { "plugins": [ "stylelint-scss", diff --git a/scripts/updatePackageHeader.js b/scripts/updatePackageHeader.js new file mode 100755 index 0000000..9b531db --- /dev/null +++ b/scripts/updatePackageHeader.js @@ -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'); From cc288d44150e2ee89b26fade1b9a37c330ca1fde Mon Sep 17 00:00:00 2001 From: Trezy Date: Mon, 17 Dec 2018 08:44:48 -0600 Subject: [PATCH 5/7] build: Preserve package header during minification --- package-lock.json | 3 +-- scss/nes.scss | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index ee9fa94..f9811e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,7 @@ { "name": "nes.css", - "version": "0.0.0-development", - "lockfileVersion": 1, "requires": true, + "lockfileVersion": 1, "dependencies": { "@babel/code-frame": { "version": "7.0.0", diff --git a/scss/nes.scss b/scss/nes.scss index 19c622f..3522d18 100644 --- a/scss/nes.scss +++ b/scss/nes.scss @@ -1,6 +1,6 @@ @charset "utf-8"; -/*****************************************************************************\ +/*!***************************************************************************\ NES.css Framework Version: development #{build-data()} From 5f0ec9128fba517087d069ab7475fc3043d2fc6b Mon Sep 17 00:00:00 2001 From: Trezy Date: Mon, 17 Dec 2018 14:30:41 -0600 Subject: [PATCH 6/7] refactor: Remove superfluous newline --- scripts/getBuildData.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/getBuildData.js b/scripts/getBuildData.js index 369d1ef..c9a18e8 100644 --- a/scripts/getBuildData.js +++ b/scripts/getBuildData.js @@ -4,7 +4,7 @@ module.exports = (isCompiled = false) => { let buildData = ''; if (git.branch() !== 'master') { - buildData += '\n'; + buildData += ''; if (isCompiled) { buildData += ` @@ -22,5 +22,5 @@ module.exports = (isCompiled = false) => { } } - return buildData.replace(/\n/, '').replace(/^ +/gm, ' '); + return buildData.replace(/^ +/gm, ' '); }; From b789e22121020919d1798b7fafe4c1ea2dae4605 Mon Sep 17 00:00:00 2001 From: Trezy Date: Mon, 17 Dec 2018 14:44:16 -0600 Subject: [PATCH 7/7] refactor: Remove superfluous empty string concatenation --- scripts/getBuildData.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/getBuildData.js b/scripts/getBuildData.js index c9a18e8..9a52330 100644 --- a/scripts/getBuildData.js +++ b/scripts/getBuildData.js @@ -4,8 +4,6 @@ module.exports = (isCompiled = false) => { let buildData = ''; if (git.branch() !== 'master') { - buildData += ''; - if (isCompiled) { buildData += ` Build Date: ${(new Date()).toISOString()}