add-dist-header
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -21,2 +21,3 @@ #!/usr/bin/env node | ||
// $ npm install | ||
// $ npm test | ||
// $ node bin/cli.js "spec/fixtures/source" "spec/fixtures/target" | ||
@@ -40,11 +41,11 @@ // $ node bin/cli.js --no-version | ||
// Prepend | ||
const normalize = (name) => path.normalize(name.endsWith(path.sep) ? name.slice(0, -1) : name); | ||
const origin = normalize(source); | ||
const targetRoot = normalize(target); | ||
const isFolder = fs.existsSync(origin) && fs.statSync(origin).isDirectory(); | ||
const wildcard = cli.flagOn.recursive ? '/**/*' : '/*'; | ||
const pattern = slash(isFolder ? origin + wildcard : origin); | ||
const extensions = cli.flagMap.ext?.split(',') ?? null; | ||
const keep = (filename) => !extensions || extensions.includes(path.extname(filename)); | ||
const filenames = globSync(pattern, { nodir: true }).filter(keep).sort(); | ||
const normalize = (name) => path.normalize(name.endsWith(path.sep) ? name.slice(0, -1) : name); | ||
const origin = normalize(source); | ||
const targetRoot = normalize(target); | ||
const isFolder = fs.existsSync(origin) && fs.statSync(origin).isDirectory(); | ||
const wildcard = cli.flagOn.recursive ? '/**/*' : '/*'; | ||
const pattern = slash(isFolder ? origin + wildcard : origin); | ||
const extensions = cli.flagMap.ext?.split(',') ?? null; | ||
const keep = (filename) => !extensions || extensions.includes(path.extname(filename)); | ||
const filenames = globSync(pattern, { nodir: true }).filter(keep).sort(); | ||
const error = | ||
@@ -51,0 +52,0 @@ cli.invalidFlag ? cli.invalidFlagMsg : |
@@ -1,2 +0,2 @@ | ||
//! add-dist-header v1.3.2 ~~ https://github.com/center-key/add-dist-header ~~ MIT License | ||
//! add-dist-header v1.3.3 ~~ 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.3.2 ~~ https://github.com/center-key/add-dist-header ~~ MIT License | ||
//! add-dist-header v1.3.3 ~~ https://github.com/center-key/add-dist-header ~~ MIT License | ||
@@ -73,3 +73,3 @@ import { isBinary } from 'istextorbinary'; | ||
header: isTextFile ? header : null, | ||
source: filename, | ||
source: slash(filename), | ||
file: outputPath, | ||
@@ -76,0 +76,0 @@ length: isTextFile ? final.length : null, |
{ | ||
"name": "add-dist-header", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "Prepend a one-line banner comment (with license notice) to distribution files", | ||
@@ -77,10 +77,13 @@ "license": "MIT", | ||
"eslint --max-warnings 0 . --ext .ts", | ||
"tsc", | ||
"tsc" | ||
], | ||
"dist": [ | ||
"copy-file build/add-dist-header.js --folder dist", | ||
"node bin/cli.js --no-version build dist" | ||
"node bin/cli.js --no-version build dist", | ||
"html-validator spec" | ||
] | ||
}, | ||
"scripts": { | ||
"pretest": "run-scripts clean build", | ||
"test": "mocha spec/*.spec.js && w3c-html-validator" | ||
"pretest": "run-scripts clean build dist", | ||
"test": "mocha spec/*.spec.js" | ||
}, | ||
@@ -91,4 +94,4 @@ "dependencies": { | ||
"fancy-log": "~2.0", | ||
"glob": "10.3.6", | ||
"istextorbinary": "~6.0", | ||
"glob": "~10.3", | ||
"istextorbinary": "~7.0", | ||
"make-dir": "~4.0", | ||
@@ -100,9 +103,9 @@ "slash": "~5.1" | ||
"@types/glob": "~8.1", | ||
"@types/node": "~20.6", | ||
"@typescript-eslint/eslint-plugin": "~6.7", | ||
"@typescript-eslint/parser": "~6.7", | ||
"@types/node": "~20.9", | ||
"@typescript-eslint/eslint-plugin": "~6.10", | ||
"@typescript-eslint/parser": "~6.10", | ||
"assert-deep-strict-equal": "~1.1", | ||
"copy-file-util": "~1.1", | ||
"copy-folder-util": "~1.1", | ||
"eslint": "~8.50", | ||
"eslint": "~8.53", | ||
"jshint": "~2.13", | ||
@@ -113,4 +116,4 @@ "mocha": "~10.2", | ||
"typescript": "~5.2", | ||
"w3c-html-validator": "~1.5" | ||
"w3c-html-validator": "~1.6" | ||
} | ||
} |
@@ -107,5 +107,10 @@ # Add Dist Header | ||
- `add-dist-header build dist --no-version '--delimiter= --- '`<br> | ||
Specify a delimiter with a leading and trailing space. | ||
- `add-dist-header build dist --ext=.js,.css --recursive`<br> | ||
Process only JavaScript and CSS files in the **build** folder and its subfolders. | ||
_**Note:** Single quotes in commands are normalized so they work cross-platform and avoid the errors often encountered on Microsoft Windows._ | ||
## C) Application Code | ||
@@ -112,0 +117,0 @@ Even though **add-dist-header** is primarily intended for build scripts, the package can be used programmatically in ESM and TypeScript projects. |
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
19337
182
149
+ Addedglob@10.3.16(transitive)
+ Addedistextorbinary@7.0.0(transitive)
+ Addedjackspeak@3.4.3(transitive)
- Removedglob@10.3.6(transitive)
- Removedistextorbinary@6.0.0(transitive)
- Removedjackspeak@2.3.6(transitive)
Updatedglob@~10.3
Updatedistextorbinary@~7.0