Merge pull request #930 from monalisamsteccentric/fix/post-install

post-intall script added
This commit is contained in:
Manoj Vivek 2023-06-16 17:13:06 +05:30 committed by GitHub
commit 48033a22bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 1063 additions and 1 deletions

View file

@ -27,7 +27,7 @@
"build": "concurrently \"yarn run build:main\" \"yarn run build:renderer\"",
"build:main": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.main.prod.ts",
"build:renderer": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.prod.ts",
"postinstall": "yarn rimraf --glob node_modules/browser-sync/dist/**/*.map && yarn replace '\"network-throttle\".*' '' node_modules/browser-sync-ui/lib/UI.js && ts-node .erb/scripts/check-native-dep.js && replace-in-file '/// <reference types=\"howler\" />' \"import { Howl } from 'howler';\" node_modules/use-sound/dist/types.d.ts && electron-builder install-app-deps && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts",
"postinstall": "yarn rimraf --glob node_modules/browser-sync/dist/**/*.map && ts-node .erb/scripts/check-native-dep.js && ts-node postinstall.ts && electron-builder install-app-deps && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts",
"lint": "cross-env NODE_ENV=development eslint . --ext .js,.jsx,.ts,.tsx",
"package": "ts-node ./.erb/scripts/clean.js dist && yarn run build && electron-builder build --publish never",
"prepare": "cd .. && husky install desktop-app/.husky && chmod a+x desktop-app/.husky/pre-commit",

View file

@ -0,0 +1,31 @@
import { replaceInFile } from 'replace-in-file';
async function performReplacements() {
const replaceOptions = {
files: 'node_modules/browser-sync-ui/lib/UI.js',
from: /"network-throttle".*/,
to: '',
};
const howlerOptions = {
files: 'node_modules/use-sound/dist/types.d.ts',
from: '/// <reference types="howler" />',
to: 'import { Howl } from "howler";',
};
try {
await replaceInFile(replaceOptions);
console.log('Replacement in UI.js completed successfully.');
await replaceInFile(howlerOptions);
console.log('Replacement in types.d.ts completed successfully.');
} catch (error) {
console.error('Error occurred during replacements:', error);
}
}
async function performPostInstall() {
await performReplacements();
}
performPostInstall();

File diff suppressed because it is too large Load diff