refactor: convert commonjs files to esm
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 3 Oct 2023 14:41:33 +0000 (16:41 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 3 Oct 2023 14:41:33 +0000 (16:41 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
.eslintignore
build-requirements.js [moved from build-requirements.mjs with 100% similarity]
docker/Dockerfile
package.json
prepare.js [moved from prepare.cjs with 55% similarity]
rollup.config.js [moved from rollup.config.mjs with 100% similarity]
skip-preinstall.js [moved from skip-preinstall.cjs with 83% similarity]

index b4a13ad4ce9cc2fd7c30b3743d99991756f06d03..3895cf42aced7f31b20296cc51a9a5955e03a3e8 100644 (file)
@@ -1,3 +1,3 @@
 dist/
 # FIXME: ESM import parse error
-build-requirements.mjs
+build-requirements.js
similarity index 100%
rename from build-requirements.mjs
rename to build-requirements.js
index 96d856ecfa371087ec46a162803d9dfb0caa1a6c..593b11b2ee608e92bd1676bb9c54a5bbf692947e 100644 (file)
@@ -2,7 +2,7 @@ FROM node:lts-alpine AS builder
 
 # Build simulator
 WORKDIR /usr/builder
-COPY .npmrc package.json pnpm-lock.yaml tsconfig.json rollup.config.mjs build-requirements.mjs skip-preinstall.cjs prepare.cjs ./
+COPY .npmrc package.json pnpm-lock.yaml tsconfig.json rollup.config.js build-requirements.js skip-preinstall.js prepare.js ./
 COPY src ./src
 COPY docker/config.json ./src/assets/config.json
 COPY docker/idtags.json ./src/assets/idtags.json
index 3b7cf95063db26c496fbf22ce219a6327ef424a7..f57e6b77a71b09a4b6dd20695d76c8b0fd2e1948 100644 (file)
@@ -53,9 +53,9 @@
     "useTsNode": true
   },
   "scripts": {
-    "preinstall": "node skip-preinstall.cjs || npx --yes only-allow pnpm",
-    "prepare": "node prepare.cjs",
-    "build-requirements": "node --no-warnings build-requirements.mjs",
+    "preinstall": "node skip-preinstall.js || npx --yes only-allow pnpm",
+    "prepare": "node prepare.js",
+    "build-requirements": "node --no-warnings build-requirements.js",
     "start": "pnpm build && cross-env NODE_ENV=production node dist/start.js",
     "start:dev": "pnpm build:dev && cross-env NODE_ENV=development node -r source-map-support/register dist/start.js",
     "start:dev:debug": "pnpm build:dev && cross-env NODE_ENV=development node -r source-map-support/register --inspect dist/start.js",
similarity index 55%
rename from prepare.cjs
rename to prepare.js
index 6038d204336ac9032b5976f3f42c8f3221c500e8..8c299a6214bb5ff469ebc0d1cdf205829281f845 100644 (file)
@@ -1,8 +1,10 @@
-const { env } = require('node:process');
+import { env } from 'node:process';
+
+// eslint-disable-next-line n/no-unpublished-import
+import { install } from 'husky';
 
 const isCIEnvironment = env.CI !== undefined;
 const isCFEnvironment = env.VCAP_APPLICATION !== undefined;
 if (isCFEnvironment === false && isCIEnvironment === false) {
-  // eslint-disable-next-line n/no-unpublished-require
-  require('husky').install();
+  install();
 }
similarity index 100%
rename from rollup.config.mjs
rename to rollup.config.js
similarity index 83%
rename from skip-preinstall.cjs
rename to skip-preinstall.js
index 5be82290ac7a28cd41dfc6554bcdf9ae3e47dc5c..8f5c9d5543ea7c16d3a451bd1abb48e83529113e 100644 (file)
@@ -1,4 +1,4 @@
-const { env, exit } = require('node:process');
+import { env, exit } from 'node:process';
 
 const skipPreinstall = env.SKIP_PREINSTALL || env.VCAP_APPLICATION !== undefined;
 if (skipPreinstall) {