Commit 14482da4 authored by Mathias Chouet's avatar Mathias Chouet 🍝
Browse files

Fix #258 - add npm script to update dist/index.html mimetypes

parent 567efd8b
......@@ -11,15 +11,16 @@
"ng": "ng",
"lint": "ng lint",
"e2e": "ng e2e",
"electron": "electron .",
"electron-builder": "electron-builder",
"electron": "npm run update-dist-index-mimetypes && electron .",
"electron-builder": "npm run update-dist-index-mimetypes && electron-builder",
"start": "npm run preprocess && ng serve --host 0.0.0.0 --poll 5000",
"prod": "npm run preprocess && ng serve --host 0.0.0.0 --prod",
"build": "npm run preprocess && ng build --prod --build-optimizer=false",
"build-cordova": "npm run preprocess && ng build --prod --build-optimizer=false && npm run add-cordova-js",
"build-cordova": "npm run preprocess && ng build --prod --build-optimizer=false && npm run update-dist-index-mimetypes && npm run add-cordova-js",
"add-cordova-js": "sed -i '/<\\/title>/a <script type=\"text/javascript\" src=\"cordova.js\"></script>' dist/index.html",
"release-linux": "npm run build && electron-builder",
"release-windows": "rd /s /q release & ng build --prod --build-optimizer=false && npm run electron-builder",
"update-dist-index-mimetypes": "nodejs ./update-dist-index-mimetypes.js",
"release-linux": "npm run build && npm run update-dist-index-mimetypes && electron-builder",
"release-windows": "rd /s /q release & ng build --prod --build-optimizer=false && npm run update-dist-index-mimetypes && npm run electron-builder",
"release-android": "npm run build-cordova && cordova platform add android; rm dist/assets/docs-fr/sitemap.xml.gz && cordova build android && mv platforms/android/app/build/outputs/apk/debug/app-debug.apk release/cassiopee.apk",
"e2equick": "ng e2e --dev-server-target=",
"jalhyd": "rm -f node_modules/jalhyd && cd ../jalhyd && npm run build && cd ../nghyd && npm install ../jalhyd",
......
const fs = require('fs');
const path = "./dist/index.html";
const contents = fs.readFileSync(path, "utf-8");
fs.writeFileSync(path, contents.replace(/type="module"/g, 'type="text/javascript"'));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment