rev-web-assets
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -25,4 +25,2 @@ #!/usr/bin/env node | ||
import { revWebAssets } from '../dist/rev-web-assets.js'; | ||
import chalk from 'chalk'; | ||
import log from 'fancy-log'; | ||
@@ -35,20 +33,2 @@ // Parameters and flags | ||
// Reporting | ||
const printReport = (results) => { | ||
const name = chalk.gray('rev-web-assets'); | ||
const source = chalk.blue.bold(results.source); | ||
const target = chalk.magenta(results.target); | ||
const arrow = { big: chalk.gray.bold(' ⟹ '), little: chalk.gray.bold('→') }; | ||
const infoColor = results.count ? chalk.white : chalk.red.bold; | ||
const info = infoColor(`(files: ${results.count}, ${results.duration}ms)`); | ||
log(name, source, arrow.big, target, info); | ||
const logDetail = (detail) => { | ||
const origin = chalk.white(detail.origin.substring(results.source.length + 1)); | ||
const dest = chalk.green(detail.destPath.substring(results.target.length + 1)); | ||
log(name, origin, arrow.little, dest); | ||
}; | ||
if (!cli.flagOn.summary) | ||
results.manifest.forEach(logDetail); | ||
}; | ||
// Revision Web Assets | ||
@@ -71,2 +51,2 @@ const error = | ||
if (!cli.flagOn.quiet) | ||
printReport(results); | ||
revWebAssets.reporter(results, { summaryOnly: cli.flagOn.summary }); |
@@ -1,2 +0,2 @@ | ||
//! rev-web-assets v1.3.2 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License | ||
//! rev-web-assets v1.3.3 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License | ||
@@ -32,2 +32,5 @@ export type Settings = { | ||
}; | ||
export type ReporterSettings = { | ||
summaryOnly: boolean; | ||
}; | ||
declare const revWebAssets: { | ||
@@ -43,3 +46,4 @@ manifest(source: string, target: string): ManifestDetail[]; | ||
revision(sourceFolder: string, targetFolder: string, options?: Partial<Settings>): Results; | ||
reporter(results: Results, options?: Partial<ReporterSettings>): Results; | ||
}; | ||
export { revWebAssets }; |
@@ -1,5 +0,7 @@ | ||
//! rev-web-assets v1.3.2 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License | ||
//! rev-web-assets v1.3.3 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License | ||
import chalk from 'chalk'; | ||
import crypto from 'crypto'; | ||
import fs from 'fs'; | ||
import log from 'fancy-log'; | ||
import path from 'path'; | ||
@@ -158,3 +160,24 @@ import slash from 'slash'; | ||
}, | ||
reporter(results, options) { | ||
const defaults = { | ||
summaryOnly: false, | ||
}; | ||
const settings = { ...defaults, ...options }; | ||
const name = chalk.gray('rev-web-assets'); | ||
const source = chalk.blue.bold(results.source); | ||
const target = chalk.magenta(results.target); | ||
const arrow = { big: chalk.gray.bold(' ⟹ '), little: chalk.gray.bold('→') }; | ||
const infoColor = results.count ? chalk.white : chalk.red.bold; | ||
const info = infoColor(`(files: ${results.count}, ${results.duration}ms)`); | ||
log(name, source, arrow.big, target, info); | ||
const logDetail = (detail) => { | ||
const origin = chalk.white(detail.origin.substring(results.source.length + 1)); | ||
const dest = chalk.green(detail.destPath.substring(results.target.length + 1)); | ||
log(name, origin, arrow.little, dest); | ||
}; | ||
if (!settings.summaryOnly) | ||
results.manifest.forEach(logDetail); | ||
return results; | ||
}, | ||
}; | ||
export { revWebAssets }; |
{ | ||
"name": "rev-web-assets", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "Revision web asset filenames with cache busting content hash fingerprints", | ||
@@ -22,3 +22,6 @@ "license": "MIT", | ||
}, | ||
"repository": "github:center-key/rev-web-assets", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/center-key/rev-web-assets.git" | ||
}, | ||
"homepage": "https://github.com/center-key/rev-web-assets", | ||
@@ -87,9 +90,9 @@ "bugs": "https://github.com/center-key/rev-web-assets/issues", | ||
"@types/fancy-log": "~2.0", | ||
"@types/node": "~20.5", | ||
"@typescript-eslint/eslint-plugin": "~6.5", | ||
"@typescript-eslint/parser": "~6.5", | ||
"add-dist-header": "~1.2", | ||
"@types/node": "~20.9", | ||
"@typescript-eslint/eslint-plugin": "~6.10", | ||
"@typescript-eslint/parser": "~6.10", | ||
"add-dist-header": "~1.3", | ||
"assert-deep-strict-equal": "~1.1", | ||
"copy-file-util": "~1.1", | ||
"eslint": "~8.48", | ||
"eslint": "~8.53", | ||
"jshint": "~2.13", | ||
@@ -100,4 +103,4 @@ "mocha": "~10.2", | ||
"typescript": "~5.2", | ||
"w3c-html-validator": "~1.4" | ||
"w3c-html-validator": "~1.6" | ||
} | ||
} |
@@ -58,4 +58,7 @@ # rev-web-assets | ||
Examples: | ||
- `rev-web-assets web/source web/target`<br> | ||
Revisions the files in the **web/source** folder and saves the new files to the **web/target** folder. | ||
- `rev-web-assets --cd=web source target`<br> | ||
Same as: `rev-web-assets web/source web/target` | ||
Identical to the previous example. | ||
@@ -68,5 +71,10 @@ - `rev-web-assets source target --quiet`<br> | ||
- `rev-web-assets source 'target/Web Files' --summary`<br> | ||
Save the target files to a folder that has a space in its name. | ||
- `rev-web-assets source target --meta-content-base=https://example.net`<br> | ||
Prepends the base to `<meta>` URLs. | ||
_**Note:** Single quotes in commands are normalized so they work cross-platform and avoid the errors often encountered on Microsoft Windows._ | ||
URLs in `<meta>` tag `content` attributes generally need to be absolute URLs. | ||
@@ -140,3 +148,3 @@ Setting the `--meta-content-base` flag to `https://example.net` will transform the line of HTML from: | ||
--- | ||
**CLI Build Tools** | ||
**CLI Build Tools for package.json** | ||
- 🎋 [add-dist-header](https://github.com/center-key/add-dist-header): _Prepend a one-line banner comment (with license notice) to distribution files_ | ||
@@ -143,0 +151,0 @@ - 📄 [copy-file-util](https://github.com/center-key/copy-file-util): _Copy or rename a file with optional package version number_ |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
23392
272
160
1