rev-web-assets
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -13,3 +13,3 @@ #!/usr/bin/env node | ||
// Usage from command line: | ||
// $ npm install --global rev-web-assets | ||
// $ npm install --save-dev rev-web-assets | ||
// $ rev-web-assets build/web-app dist/web-app | ||
@@ -16,0 +16,0 @@ // |
@@ -1,2 +0,2 @@ | ||
//! rev-web-assets v1.3.0 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License | ||
//! rev-web-assets v1.3.1 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License | ||
@@ -3,0 +3,0 @@ export type Settings = { |
@@ -1,2 +0,2 @@ | ||
//! rev-web-assets v1.3.0 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License | ||
//! rev-web-assets v1.3.1 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License | ||
@@ -10,3 +10,3 @@ import crypto from 'crypto'; | ||
const files = fs.readdirSync(source, { recursive: true }) | ||
.map(file => path.join(source, file.toString())) | ||
.map(file => slash(path.join(source, file.toString()))) | ||
.filter(file => fs.statSync(file).isFile()) | ||
@@ -73,3 +73,3 @@ .sort(); | ||
}; | ||
return (assetDetail === null || assetDetail === void 0 ? void 0 : assetDetail.hash) ? pre + hashedUri() + post : matched; | ||
return assetDetail?.hash ? pre + hashedUri() + post : matched; | ||
}; | ||
@@ -97,7 +97,6 @@ return replacer; | ||
const process = (detail) => { | ||
var _a; | ||
const content = fs.readFileSync(detail.origin, 'utf-8'); | ||
const hashedContent = content | ||
.replace(urlPattern, revWebAssets.hashAssetPath(manifest, detail, settings)); | ||
detail.destPath = detail.destFolder + '/' + ((_a = detail.hashedFilename) !== null && _a !== void 0 ? _a : detail.filename); | ||
detail.destPath = detail.destFolder + '/' + (detail.hashedFilename ?? detail.filename); | ||
fs.mkdirSync(detail.destFolder, { recursive: true }); | ||
@@ -110,4 +109,3 @@ fs.writeFileSync(detail.destPath, hashedContent); | ||
const process = (detail) => { | ||
var _a; | ||
detail.destPath = detail.destFolder + '/' + ((_a = detail.hashedFilename) !== null && _a !== void 0 ? _a : detail.filename); | ||
detail.destPath = detail.destFolder + '/' + (detail.hashedFilename ?? detail.filename); | ||
fs.mkdirSync(detail.destFolder, { recursive: true }); | ||
@@ -125,3 +123,3 @@ fs.copyFileSync(detail.origin, detail.destPath); | ||
}; | ||
const settings = Object.assign(Object.assign({}, defaults), options); | ||
const settings = { ...defaults, ...options }; | ||
const startTime = Date.now(); | ||
@@ -128,0 +126,0 @@ const normalize = (folder) => !folder ? '' : slash(path.normalize(folder)).replace(/\/$/, ''); |
{ | ||
"name": "rev-web-assets", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Revision web asset filenames with cache busting content hash fingerprints", | ||
@@ -64,5 +64,7 @@ "license": "MIT", | ||
], | ||
"lint": [ | ||
"jshint . --exclude-path .gitignore", | ||
"eslint --max-warnings 0 . --ext .ts" | ||
], | ||
"build": [ | ||
"jshint . --exclude-path .gitignore", | ||
"eslint --max-warnings 0 . --ext .ts", | ||
"tsc", | ||
@@ -73,3 +75,3 @@ "add-dist-header build dist" | ||
"scripts": { | ||
"pretest": "run-scripts clean build", | ||
"pretest": "run-scripts clean lint build", | ||
"test": "mocha spec/*.spec.js", | ||
@@ -86,9 +88,9 @@ "posttest": "html-validator spec/fixtures" | ||
"@types/fancy-log": "~2.0", | ||
"@types/node": "~20.4", | ||
"@typescript-eslint/eslint-plugin": "~6.2", | ||
"@typescript-eslint/parser": "~6.2", | ||
"add-dist-header": "~1.1", | ||
"@types/node": "~20.5", | ||
"@typescript-eslint/eslint-plugin": "~6.4", | ||
"@typescript-eslint/parser": "~6.4", | ||
"add-dist-header": "~1.2", | ||
"assert-deep-strict-equal": "~1.1", | ||
"copy-file-util": "~1.1", | ||
"eslint": "~8.46", | ||
"eslint": "~8.47", | ||
"jshint": "~2.13", | ||
@@ -95,0 +97,0 @@ "mocha": "~10.2", |
@@ -37,10 +37,9 @@ # rev-web-assets | ||
### 2. Global | ||
You can install **rev-web-assets** globally and then run it anywhere directly from the terminal. | ||
### 2. Command-line npx | ||
Example terminal commands: | ||
```shell | ||
$ npm install --global rev-web-assets | ||
$ rev-web-assets rev-web-assets build/dev/web-app build/prod/web-app | ||
$ npm install --save-dev rev-web-assets | ||
$ npx rev-web-assets build/dev/web-app build/prod/web-app | ||
``` | ||
You can also install **rev-web-assets** globally (`--global`) and then run it anywhere directly from the terminal. | ||
@@ -144,2 +143,3 @@ ### 3. CLI flags | ||
- 📂 [copy-folder-util](https://github.com/center-key/copy-folder-util): _Recursively copy files from one folder to another folder_ | ||
- 🪺 [recursive-exec](https://github.com/center-key/recursive-exec): _Run a command on each file in a folder and its subfolders_ | ||
- 🔍 [replacer-util](https://github.com/center-key/replacer-util): _Find and replace strings or template outputs in text files_ | ||
@@ -146,0 +146,0 @@ - 🔢 [rev-web-assets](https://github.com/center-key/rev-web-assets): _Revision web asset filenames with cache busting content hash fingerprints_ |
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
22431
261