add-dist-header
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -1,2 +0,2 @@ | ||
//! add-dist-header v1.1.1 ~~ https://github.com/center-key/add-dist-header ~~ MIT License | ||
//! add-dist-header v1.1.2 ~~ https://github.com/center-key/add-dist-header ~~ MIT License | ||
@@ -3,0 +3,0 @@ export type Settings = { |
@@ -1,2 +0,2 @@ | ||
//! add-dist-header v1.1.1 ~~ https://github.com/center-key/add-dist-header ~~ MIT License | ||
//! add-dist-header v1.1.2 ~~ https://github.com/center-key/add-dist-header ~~ MIT License | ||
@@ -10,3 +10,3 @@ import { isBinary } from 'istextorbinary'; | ||
prepend(filename, options) { | ||
var _a, _b, _c; | ||
var _a, _b, _c, _d; | ||
const defaults = { | ||
@@ -22,2 +22,3 @@ dist: 'dist', | ||
throw Error('[add-dist-header] Must specify the "filename" option.'); | ||
const doctypeLine = /^<(!doctype|\?xml).*\n/i; | ||
const commentStyle = { | ||
@@ -45,6 +46,7 @@ js: { start: '//! ', end: '' }, | ||
const out2 = settings.replaceComment ? out1.replace(firstLine[type], '') : out1; | ||
const doctype = mlStyle && ((_b = out2.match(doctypeLine)) === null || _b === void 0 ? void 0 : _b[0]) || ''; | ||
const out3 = mlStyle && doctype ? out2.replace(doctype, '') : out2; | ||
const versionPattern = /{{pkg[.]version}}/g; | ||
const deprecated = /~~~version~~~/g; | ||
const out3 = settings.setVersion ? out2.replace(versionPattern, pkg.version).replace(deprecated, pkg.version) : out2; | ||
const info = (_c = (_b = pkg.homepage) !== null && _b !== void 0 ? _b : pkg.docs) !== null && _c !== void 0 ? _c : pkg.repository; | ||
const out4 = settings.setVersion ? out3.replace(versionPattern, pkg.version) : out3; | ||
const info = (_d = (_c = pkg.homepage) !== null && _c !== void 0 ? _c : pkg.docs) !== null && _d !== void 0 ? _d : pkg.repository; | ||
const unlicensed = !pkg.license || pkg.license === 'UNLICENSED'; | ||
@@ -58,6 +60,6 @@ const license = unlicensed ? 'All Rights Reserved' : pkg.license + ' License'; | ||
const outputPath = slash(path.format({ dir: settings.dist, name: inputFile.name, ext: fileExt })); | ||
const isMinified = outputPath.includes('.min.') || out3.indexOf('\n') === out3.length - 1; | ||
const isMinified = outputPath.includes('.min.') || out4.indexOf('\n') === out4.length - 1; | ||
const spacerLines = isMinified || mlStyle ? '\n' : '\n\n'; | ||
const leadingBlanks = /^\s*\n/; | ||
const final = header + spacerLines + out3.replace(leadingBlanks, ''); | ||
const final = doctype + header + spacerLines + out4.replace(leadingBlanks, ''); | ||
if (!invalidContent) | ||
@@ -64,0 +66,0 @@ fs.writeFileSync(outputPath, final); |
{ | ||
"name": "add-dist-header", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Prepend a one-line banner comment (with license notice) to distribution files", | ||
@@ -84,4 +84,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"chalk": "~5.2", | ||
"cli-argv-util": "~1.1", | ||
"chalk": "~5.3", | ||
"cli-argv-util": "~1.2", | ||
"fancy-log": "~2.0", | ||
@@ -96,9 +96,9 @@ "glob": "~10.3", | ||
"@types/glob": "~8.1", | ||
"@types/node": "~20.3", | ||
"@typescript-eslint/eslint-plugin": "~5.60", | ||
"@typescript-eslint/parser": "~5.60", | ||
"@types/node": "~20.4", | ||
"@typescript-eslint/eslint-plugin": "~6.0", | ||
"@typescript-eslint/parser": "~6.0", | ||
"assert-deep-strict-equal": "~1.1", | ||
"copy-file-util": "~1.1", | ||
"copy-folder-util": "~1.1", | ||
"eslint": "~8.43", | ||
"eslint": "~8.44", | ||
"jshint": "~2.13", | ||
@@ -105,0 +105,0 @@ "mocha": "~10.2", |
@@ -8,3 +8,2 @@ # Add Dist Header | ||
[![npm](https://img.shields.io/npm/v/add-dist-header.svg)](https://www.npmjs.com/package/add-dist-header) | ||
[![Vulnerabilities](https://snyk.io/test/github/center-key/add-dist-header/badge.svg)](https://snyk.io/test/github/center-key/add-dist-header) | ||
[![Build](https://github.com/center-key/add-dist-header/workflows/build/badge.svg)](https://github.com/center-key/add-dist-header/actions/workflows/run-spec-on-push.yaml) | ||
@@ -11,0 +10,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16690
159
129
+ Addedchalk@5.3.0(transitive)
+ Addedcli-argv-util@1.2.6(transitive)
- Removedchalk@5.2.0(transitive)
- Removedcli-argv-util@1.1.0(transitive)
Updatedchalk@~5.3
Updatedcli-argv-util@~1.2