rev-web-assets
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -28,6 +28,7 @@ #!/usr/bin/env node | ||
// Parameters | ||
const validFlags = ['cd', 'manifest', 'meta-content-base', 'quiet', 'summary']; | ||
const validFlags = ['cd', 'manifest', 'meta-content-base', 'note', 'quiet', 'summary']; | ||
const args = process.argv.slice(2); | ||
const flags = args.filter(arg => /^--/.test(arg)); | ||
const flagMap = Object.fromEntries(flags.map(flag => flag.replace(/^--/, '').split('='))); | ||
const flagOn = Object.fromEntries(validFlags.map(flag => [flag, flag in flagMap])); | ||
const invalidFlag = Object.keys(flagMap).find(key => !validFlags.includes(key)); | ||
@@ -39,10 +40,5 @@ const params = args.filter(arg => !/^--/.test(arg)); | ||
const target = params[1]; | ||
const mode = { | ||
manifest: 'manifest' in flagMap, | ||
quiet: 'quiet' in flagMap, | ||
summary: 'summary' in flagMap, | ||
}; | ||
// Reporting | ||
const printReport = (results, summaryOnly) => { | ||
const printReport = (results) => { | ||
const name = chalk.gray('rev-web-assets'); | ||
@@ -60,3 +56,3 @@ const source = chalk.blue.bold(results.source); | ||
}; | ||
if (!summaryOnly) | ||
if (!flagOn.summary) | ||
results.manifest.forEach(logDetail); | ||
@@ -77,6 +73,6 @@ }; | ||
metaContentBase: flagMap['meta-content-base'] ?? null, | ||
saveManifest: mode.manifest, | ||
saveManifest: flagOn.manifest, | ||
}; | ||
const results = revWebAssets.revision(source, target, options); | ||
if (!mode.quiet) | ||
printReport(results, mode.summary); | ||
if (!flagOn.quiet) | ||
printReport(results); |
@@ -1,2 +0,2 @@ | ||
//! rev-web-assets v0.1.1 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License | ||
//! rev-web-assets v0.1.2 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License | ||
@@ -3,0 +3,0 @@ export declare type Settings = { |
@@ -1,2 +0,2 @@ | ||
//! rev-web-assets v0.1.1 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License | ||
//! rev-web-assets v0.1.2 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License | ||
@@ -3,0 +3,0 @@ import crypto from 'crypto'; |
{ | ||
"name": "rev-web-assets", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Revision web asset filenames with cache busting content hash fingerprints", | ||
@@ -61,11 +61,15 @@ "license": "MIT", | ||
}, | ||
"runScriptsConfig": { | ||
"build": [ | ||
"rimraf build dist spec/fixtures/target **/.DS_Store", | ||
"jshint . --exclude-path .gitignore", | ||
"eslint --max-warnings 0 . --ext .ts", | ||
"tsc", | ||
"tsc --module UMD --outDir build/umd", | ||
"copy-file build/umd/rev-web-assets.js build/rev-web-assets.umd.cjs", | ||
"add-dist-header build dist" | ||
] | ||
}, | ||
"scripts": { | ||
"step:01": "rimraf build dist spec/fixtures/target **/.DS_Store", | ||
"step:02": "jshint . --exclude-path .gitignore", | ||
"step:03": "eslint --max-warnings 0 . --ext .ts", | ||
"step:04": "tsc", | ||
"step:05": "tsc --module UMD --outDir build/umd", | ||
"step:06": "copy-file build/umd/rev-web-assets.js build/rev-web-assets.umd.cjs", | ||
"step:07": "add-dist-header build dist", | ||
"pretest": "npm-run-all step:*", | ||
"pretest": "run-scripts build", | ||
"test": "mocha spec/*.spec.js", | ||
@@ -75,3 +79,3 @@ "posttest": "html-validator spec/fixtures" | ||
"dependencies": { | ||
"chalk": "~5.0", | ||
"chalk": "~5.1", | ||
"fancy-log": "~2.0", | ||
@@ -82,16 +86,16 @@ "slash": "~5.0" | ||
"@types/fancy-log": "~2.0", | ||
"@types/node": "~18.8", | ||
"@typescript-eslint/eslint-plugin": "~5.39", | ||
"@typescript-eslint/parser": "~5.39", | ||
"@types/node": "~18.11", | ||
"@typescript-eslint/eslint-plugin": "~5.42", | ||
"@typescript-eslint/parser": "~5.42", | ||
"add-dist-header": "~0.3", | ||
"assert-deep-strict-equal": "~1.0", | ||
"copy-file-util": "~0.1", | ||
"eslint": "~8.24", | ||
"eslint": "~8.27", | ||
"jshint": "~2.13", | ||
"mocha": "~10.0", | ||
"npm-run-all2": "~6.0", | ||
"mocha": "~10.1", | ||
"rimraf": "~3.0", | ||
"run-scripts-util": "~0.1", | ||
"typescript": "~4.8", | ||
"w3c-html-validator": "~1.1" | ||
"w3c-html-validator": "~1.2" | ||
} | ||
} |
@@ -11,3 +11,4 @@ # rev-web-assets | ||
**rev-web-assets** updates the asset filenames of a website to contain a eight-digit hex hash. The command's console output includes a timestamp and formatting helpful in build systems. | ||
**rev-web-assets** updates the asset filenames of a website to contain a eight-digit hex hash. | ||
The command's console output includes a timestamp and formatting helpful in build systems. | ||
@@ -27,4 +28,5 @@ <img src=https://raw.githubusercontent.com/center-key/rev-web-assets/main/screenshot.png | ||
The **first** parameter is the *source* folder. | ||
The **second** parameter is the *target* folder. | ||
Parameters: | ||
* The **first** parameter is the *source* folder. | ||
* The **second** parameter is the *target* folder. | ||
@@ -37,3 +39,2 @@ Example **package.json** scripts: | ||
``` | ||
Try out the first script with the command: `npm run revision` | ||
@@ -56,2 +57,3 @@ ### 2. Global | ||
| `--meta-content-base` | Make og:image or other url absolute | **string** | | ||
| `--note` | Place to add a comment only for humans. | **string** | | ||
| `--quiet` | Suppress informational messages. | N/A | | ||
@@ -77,3 +79,3 @@ | `--summary` | Only print out the single line summary message. | N/A | | ||
## C) Application Code | ||
Even though **rev-web-assets** is primarily intended for build scripts, the package can easily be used in ESM and TypeScript projects. | ||
Even though **rev-web-assets** is primarily intended for build scripts, the package can easily be used programmatically in ESM and TypeScript projects. | ||
@@ -93,7 +95,9 @@ Example: | ||
--- | ||
**Build Tools** | ||
**CLI Build Tools** | ||
- 🎋 [add-dist-header](https://github.com/center-key/add-dist-header): _Prepend a one-line banner comment (with license notice) to distribution files_ | ||
- 📄 [copy-file-util](https://github.com/center-key/copy-file-util): _Copy or rename a file (CLI tool designed for use in npm scripts)_ | ||
- 📂 [copy-folder-cli](https://github.com/center-key/copy-folder-cli): _Recursively copy a folder (CLI tool designed for use in npm scripts)_ | ||
- 📄 [copy-file-util](https://github.com/center-key/copy-file-util): _Copy or rename a file with optional package version number_ | ||
- 📂 [copy-folder-util](https://github.com/center-key/copy-folder-util): _Recursively copy files from one folder to another folder_ | ||
- 🔍 [replacer-util](https://github.com/center-key/replacer-util): _Find and replace strings or template outputs in text files_ | ||
- 🔢 [rev-web-assets](https://github.com/center-key/rev-web-assets): _Revision web asset filenames with cache busting content hash fingerprints_ | ||
- 🚆 [run-scripts-util](https://github.com/center-key/run-scripts-util): _Organize npm scripts into named groups of easy to manage commands_ | ||
- 🚦 [w3c-html-validator](https://github.com/center-key/w3c-html-validator): _Check the markup validity of HTML files using the W3C validator_ | ||
@@ -100,0 +104,0 @@ |
Sorry, the diff of this file is not supported yet
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
29953
103
432
+ Addedchalk@5.1.2(transitive)
- Removedchalk@5.0.1(transitive)
Updatedchalk@~5.1