From 1c390599f3c9f60edb9886d6c123ea51be904761 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 26 Apr 2023 22:41:06 +0300 Subject: [PATCH] Switch build/vnu-jar.js to a module (#370) --- .eslintrc.json | 5 +---- build/{vnu-jar.js => vnu-jar.mjs} | 6 ++---- package.json | 4 ++-- 3 files changed, 5 insertions(+), 10 deletions(-) rename build/{vnu-jar.js => vnu-jar.mjs} (92%) diff --git a/.eslintrc.json b/.eslintrc.json index efc2ee546..50eef44ec 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -6,7 +6,7 @@ }, "parserOptions": { "ecmaVersion": 2019, - "sourceType": "script" + "sourceType": "module" }, "extends": "eslint:recommended", "rules": { @@ -30,9 +30,6 @@ "env": { "browser": true, "node": false - }, - "parserOptions": { - "sourceType": "module" } } ] diff --git a/build/vnu-jar.js b/build/vnu-jar.mjs similarity index 92% rename from build/vnu-jar.js rename to build/vnu-jar.mjs index d725a378c..fe9661f66 100644 --- a/build/vnu-jar.js +++ b/build/vnu-jar.mjs @@ -6,10 +6,8 @@ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ -'use strict' - -const { execFile, spawn } = require('node:child_process') -const vnu = require('vnu-jar') +import { execFile, spawn } from 'node:child_process' +import vnu from 'vnu-jar' execFile('java', ['-version'], (error, stdout, stderr) => { if (error) { diff --git a/package.json b/package.json index db1f90aaa..037a6cc65 100644 --- a/package.json +++ b/package.json @@ -24,12 +24,12 @@ "serve": "hugo server --port 4000 --disableFastRender", "serve-only": "npx sirv-cli _site --port 4000", "test": "npm-run-all build --parallel --continue-on-error --aggregate-output test-*", - "test-eslint": "eslint --ignore-path .gitignore --cache --cache-location .cache/.eslintcache --report-unused-disable-directives .", + "test-eslint": "eslint --ignore-path .gitignore --cache --cache-location .cache/.eslintcache --report-unused-disable-directives --ext .js,.mjs .", "test-fusv": "fusv src/assets/scss/", "test-stylelint": "stylelint src/assets/scss/ --cache --cache-location .cache/.stylelintcache", "test-markdownlint": "markdownlint-cli2 \"**/*.md\" \"!**/node_modules/**\"", "test-linkinator": "linkinator _site --recurse --silent --skip \"^(?!http://localhost)\"", - "test-vnu": "node build/vnu-jar.js", + "test-vnu": "node build/vnu-jar.mjs", "test-lockfile-lint": "lockfile-lint --allowed-hosts npm --allowed-schemes https: --empty-hostname false --type npm --path package-lock.json", "netlify": "cross-env-shell HUGO_BASEURL=$DEPLOY_PRIME_URL npm run build" },