Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump replace-in-file from 7.2.0 to 8.0.1 #22

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions build.js → build.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const replace = require('replace-in-file');
const crypto = require('crypto');
const pkg = require('./package.json');
const pkgLock = require('./package-lock.json');
import {replaceInFile} from 'replace-in-file'
import crypto from 'crypto';
import { readFile } from 'fs/promises';

simplifyVersion = version => version.replace(/^[=<>~^]/g, '');
majorMinorVersion = version => version.split('.').slice(0, -1).join('.');
const pkg = JSON.parse(await readFile(new URL('./package.json', import.meta.url)));
const pkgLock = JSON.parse(await readFile(new URL('./package-lock.json', import.meta.url)));

const simplifyVersion = version => version.replace(/^[=<>~^]/g, '');
const majorMinorVersion = version => version.split('.').slice(0, -1).join('.');

const urls = {
'bootstrap_js': 'https://cdn.jsdelivr.net/npm/bootstrap@' + simplifyVersion(pkgLock.packages["node_modules/bootstrap"].version) + '/dist/js/bootstrap.bundle.min.js',
Expand Down Expand Up @@ -41,6 +43,6 @@ async function calculateSris(urls) {
to: [majorMinorVersion(process.env.npm_package_version), process.env.INLINE_CSS, process.env.INLINE_JS, ...Object.values(urls), ...sris],
countMatches: true,
};
})().then(options => replace(options)
})().then(options => replaceInFile(options)
.then(results => results.every(result => (! result.hasChanged || result.numReplacements !== options.from.length) && (() => { throw new Error('error during build: no replacements done in file ' + result.file) })()))
);
139 changes: 56 additions & 83 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "moneymoney-sankey",
"description": "An extension for the great MoneyMoney app to export an interactive HTML Sankey Chart based on the transaction categories",
"version": "1.2.0",
"private": true,
"dependencies": {
"bootstrap": "^5.3.2",
"highcharts": "^11.4.3"
Expand All @@ -10,7 +11,7 @@
"clean-css-cli": "^5.6.3",
"html-validate": "^8.20.1",
"npm-run-all": "^4.1.5",
"replace-in-file": "^7.2.0",
"replace-in-file": "^8.0.1",
"terser": "^5.31.1",
"typescript": "^5.5.2"
},
Expand All @@ -19,7 +20,7 @@
"scripts": {
"build:css": "cleancss src/*.css",
"build:js": "tsc && terser --compress --mangle -- $npm_package_config_outputDir/*.js",
"build": "mkdir -p $npm_package_config_outputDir && cp src/SankeyChart.lua $npm_package_config_outputDir && INLINE_CSS=`npm run build:css --silent` INLINE_JS=`npm run build:js --silent` node ./build.js",
"build": "mkdir -p $npm_package_config_outputDir && cp src/SankeyChart.lua $npm_package_config_outputDir && INLINE_CSS=`npm run build:css --silent` INLINE_JS=`npm run build:js --silent` node ./build.mjs",
"test": "npm-run-all test:*",
"test:compile-validate": "lua ./src/SankeyChartTest.lua | html-validate --stdin",
"test:placeholder": "grep -qE '{{ ([a-zA-Z_]+) }}' $npm_package_config_outputDir/*.lua && (echo 'error: placeholders have not been replaced in dist!' && exit 1) || exit 0"
Expand Down
Loading