Skip to content
Snippets Groups Projects
Commit d3d207ce authored by Millicent Billette's avatar Millicent Billette
Browse files

FIX: 0 warn on "npm audit"

parent 867de919
No related branches found
No related tags found
No related merge requests found
Pipeline #12955 passed
const fs = require('fs'); const fs = require('fs');
fs.readdirSync('src/').forEach(fileName => { fs.readdirSync('src/').forEach(fileName => {
if(!fileName.includes('.')) return 'sub directory excluded';
const orgContent = fs.readFileSync(`src/${fileName}`, 'utf8').replace(/from '\.\.\//g, 'from \'../../'); const orgContent = fs.readFileSync(`src/${fileName}`, 'utf8').replace(/from '\.\.\//g, 'from \'../../');
fs.writeFileSync(`generated/cov-env/${fileName}`, orgContent); fs.writeFileSync(`generated/cov-env/${fileName}`, orgContent);
if (!fileName.includes('.test')) return; if (!fileName.includes('.test')) return;
......
import { minify } from "terser";
import { readdirSync, readFileSync, writeFileSync } from "fs";
const minifyCache = {};
readdirSync('generated/npm/').forEach(async fileName => {
if(!fileName.includes('.mjs')) return;
const orgContent = readFileSync(`generated/npm/${fileName}`, 'utf8');
const minified = await minify(orgContent, {
toplevel: true,
ecma: 2020,
nameCache: minifyCache,
compress: {
passes: 2
},
format: {
comments: false
}
});
writeFileSync(`generated/minified/${fileName}`, minified.code);
});
const fs = require('fs'); const fs = require('fs');
const toRollup = []; const toRollup = [];
fs.readdirSync('src/').forEach(fileName => (fileName.includes('.test.mjs')) ? 0 : toRollup.push({ fs.readdirSync('src/').forEach(
fileName => (
fileName.includes('.test.mjs')
|| fileName.includes('.test-e2e.mjs')
|| !fileName.includes('.')
) ? 0 : toRollup.push(
{
input: `src/${fileName}`, input: `src/${fileName}`,
output: { output: {
file: `generated/npm/${fileName}`, file: `generated/npm/${fileName}`,
format: 'esm' format: 'esm'
} }
})); }
));
export default toRollup; export default toRollup;
This diff is collapsed.
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
"build:npm:cp:readme": "cp README* generated/npm/", "build:npm:cp:readme": "cp README* generated/npm/",
"build:npm:test2npm": "node CI/gen-prod-test.js", "build:npm:test2npm": "node CI/gen-prod-test.js",
"xbuild:npm:coverageForDeadCodeDeletion": "cd generated/npm/ && c8 ava", "xbuild:npm:coverageForDeadCodeDeletion": "cd generated/npm/ && c8 ava",
"build:npm:min:terser": "ucompress --source generated/npm/ --dest generated/minified/", "build:npm:min:terser": "node CI/minify.mjs",
"test": "run-s test:dev", "test": "run-s test:dev",
"test:dev": "run-p test:dev:**", "test:dev": "run-p test:dev:**",
"test:dev:qualityCheck": "xo", "xtest:dev:qualityCheck": "xo",
"test:dev:runTests": "ava src/**.test.mjs", "test:dev:runTests": "ava src/**.test.mjs",
"test:dev:duplication": "jscpd ./ -s", "test:dev:duplication": "jscpd ./ -s",
"xtest:dev:complexity": "codehawk ./", "xtest:dev:complexity": "codehawk ./",
...@@ -52,17 +52,17 @@ ...@@ -52,17 +52,17 @@
"chokidar-cli": "^2.1.0", "chokidar-cli": "^2.1.0",
"es6-plato": "https://github.com/1000i100/es6-plato#master", "es6-plato": "https://github.com/1000i100/es6-plato#master",
"jscpd": "^3.3.25", "jscpd": "^3.3.25",
"karma": "^6.3.4",
"mkdirp": "^1.0.4", "mkdirp": "^1.0.4",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"rollup": "^2.42.4", "rollup": "^2.42.4",
"terser": "^5.6.1", "terser": "^5.7.0"
"ucompress": "^0.21.2",
"xo": "^0.38.2"
}, },
"disabledDependenciesTODOAddComplexityQualityCheck": { "disabledDependenciesTODOAddComplexityQualityCheck": {
"noble-ed25519": "https://github.com/1000i100/noble-ed25519#master", "noble-ed25519": "https://github.com/1000i100/noble-ed25519#master",
"ecma-nacl": "^2.5.0", "ecma-nacl": "^2.5.0",
"codehawk-cli": "^6.0.3" "codehawk-cli": "^6.0.3",
"xo": "^0.38.2"
}, },
"ava": { "ava": {
"files": [ "files": [
...@@ -79,7 +79,9 @@ ...@@ -79,7 +79,9 @@
"statements": 0.8, "statements": 0.8,
"report-dir": "../coverage", "report-dir": "../coverage",
"temp-dir": "../nyc_output.temp", "temp-dir": "../nyc_output.temp",
"exclude": ["**.test*.*js"], "exclude": [
"**.test*.*js"
],
"reporter": [ "reporter": [
"text-summary", "text-summary",
"html" "html"
......
export {fetch}
export async function fetch(...args){ export async function fetch(...args){
return fetch?fetch(...args):throw new Error('Fetch not available'); return fetch?fetch(...args):throw new Error('Fetch not available');
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment