Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}),
pluginTypeChecker({
shortenFilenames: true,
basePath: "./",
...tsConfigTypeCheckerMixin,
...overlayConfig.typeChecker,
skipTsErrors: [
5055,
2354 /* false-positive config error of overriding input files when writing and tslib */,
2403 /* TestCafe/Jest subsequent type overrides (both declare a global test function) */,
],
}),
],
};
const fuse = fusebox(config);
if (prod) {
await fuse.runProd();
const distWebIndexFile = path.resolve(process.cwd(), config.output || "dist", "index.html");
let index = readFileSync(distWebIndexFile, "utf8");
index = index.replace(/src="\//g, 'src="');
writeFileSync(distWebIndexFile, index);
resolve();
} else {
await fuse.runDev();
resolve();
}
})();
getRendererConfig() {
return fusebox({
output: 'dist/renderer/$name-$hash',
target: 'electron',
homeDir: 'src/renderer/app',
entry: 'index.tsx',
useSingleBundle: true,
dependencies: {
include: ['tslib'],
ignorePackages: ['react-native', 'electron'],
},
logging: { level: 'succinct' },
webIndex: {
publicPath: './',
template: 'static/pages/app.html',
},
cache: {
enabled: false,
getMainConfig() {
return fusebox({
output: 'dist/main/$name-$hash',
target: 'electron',
homeDir: 'src/main',
entry: 'index.ts',
useSingleBundle: true,
dependencies: {
ignoreAllExternal: false,
ignorePackages: ['react-native', 'electron'],
},
logging: { level: 'succinct' },
cache: {
enabled: true,
root: '.cache/main',
},
});
}
getDistConfig() {
return fusebox({
target: 'browser',
homeDir: '../',
output: `dist`,
entry: `integration-todo/src/index.module.ts`,
webIndex: {
template: `src/index.html`
},
paths: {
"@springtype*": ["packages*"]
},
logging: { level: 'verbose' },
dependencies: {
include: ['tslib']
},
plugins: []
});
getDevConfig() {
return fusebox({
target: 'browser',
homeDir: '../../',
output: `dev`,
entry: `material-ui/doc/TestApp.tsx`,
webIndex: {
template: `index.html`
},
paths: {
"@springtype*": ["packages*"]
},
logging: { level: 'verbose' },
dependencies: {
include: ['tslib']
},
cache: {
FTL: true
getDevConfig() {
return fusebox({
target: 'browser',
homeDir: '../',
output: `dev`,
entry: `integration-todo/src/index.module.ts`,
webIndex: {
template: `src/index.html`
},
paths: {
"@springtype*": ["packages*"]
},
logging: { level: 'verbose' },
dependencies: {
include: ['tslib']
},
cache: {
FTL: true
turboMode: true,
logging: { level: 'disabled' } as IFuseLoggerProps,
cache: { enabled: true, FTL: true, root: '.fusebox' },
plugins: [
...this.aot ? [] : [
pluginAngular('*.component.ts'),
pluginCSS('*.component.css', { asText: true })
],
pluginReplace(/fusing.module.(ts|js)/, {
"__APP_VERSION__": packageJson.version,
"__NODE_DEBUG__": `${process.env.NODE_DEBUG}`
}),
]
}
fusebox = {
server: fusebox({
target: 'server',
entry: this.aot ? 'ngc/common/server/server.js' : 'src/server/server.ts',
devServer: false,
dependencies: this.prod
? { ignorePackages: packageJson.fusebox.ignore.server, ignoreAllExternal: false }
: {},
...this.shared,
plugins: this.shared.plugins
}),
browser: fusebox({
target: 'browser',
output: 'dist/wwwroot/assets/js',
entry: this.aot
? this.prod ? 'ngc/esnext/browser/main.aot.prod.js' : 'ngc/esnext/browser/main.aot.js'
: this.prod ? 'src/browser/main.prod.ts' : 'src/browser/main.ts',
webIndex: { template: 'src/browser/index.pug', distFileName: '../../index.html', publicPath: '/assets/js' },
{
path: "/",
options: {
target: `http://localhost:${this.ngServerPort}`,
changeOrigin: true,
followRedirects: true
}
}
]
},
env: { pwa: this.pwa ? "true": "false" },
...this.shared,
plugins: [pluginConsolidate('pug', { ...pugSharedLocals, isElectron: false }), ...this.shared.plugins]
}),
electron: {
renderer: fusebox({
target: 'browser',
output: 'dist/desktop/wwwroot/assets/js',
entry: this.aot
? this.prod ? 'ngc/esnext/electron/angular/main.aot.prod.js' : 'ngc/esnext/electron/angular/main.aot.js'
: this.prod ? 'src/electron/angular/main.prod.ts' : 'src/electron/angular/main.ts',
webIndex: { template: 'src/browser/index.pug', distFileName: '../../index.html', publicPath: '/assets/js' },
dependencies: { ignorePackages: packageJson.fusebox.ignore.browser },
codeSplitting: { useHash: false, maxPathLength: 0 },
devServer: false,
env: Object
.keys(process.env)
.filter(k => k.includes('NG_'))
.reduce((acc, curr) => ({ ...acc, [curr.replace('NG_', '')]: process.env[curr] }), {
NG_SERVER_HOST: maybe(process.env.HOSTNAME).valueOr(`http://localhost:${this.ngServerPort}`)
}),
...this.shared,
"__NODE_DEBUG__": `${process.env.NODE_DEBUG}`
}),
]
}
fusebox = {
server: fusebox({
target: 'server',
entry: this.aot ? 'ngc/common/server/server.js' : 'src/server/server.ts',
devServer: false,
dependencies: this.prod
? { ignorePackages: packageJson.fusebox.ignore.server, ignoreAllExternal: false }
: {},
...this.shared,
plugins: this.shared.plugins
}),
browser: fusebox({
target: 'browser',
output: 'dist/wwwroot/assets/js',
entry: this.aot
? this.prod ? 'ngc/esnext/browser/main.aot.prod.js' : 'ngc/esnext/browser/main.aot.js'
: this.prod ? 'src/browser/main.prod.ts' : 'src/browser/main.ts',
webIndex: { template: 'src/browser/index.pug', distFileName: '../../index.html', publicPath: '/assets/js' },
dependencies: { ignorePackages: packageJson.fusebox.ignore.browser },
codeSplitting: { useHash: false, maxPathLength: 0 },
hmr: this.watch,
devServer: !this.serve ? false : {
hmrServer: this.watch ? { port: this.devServerPort } : false,
httpServer: this.watch ? { port: this.devServerPort } : false,
proxy: !this.watch ? [] : [
{
path: "/",
options: {
? this.prod ? 'ngc/esnext/electron/angular/main.aot.prod.js' : 'ngc/esnext/electron/angular/main.aot.js'
: this.prod ? 'src/electron/angular/main.prod.ts' : 'src/electron/angular/main.ts',
webIndex: { template: 'src/browser/index.pug', distFileName: '../../index.html', publicPath: '/assets/js' },
dependencies: { ignorePackages: packageJson.fusebox.ignore.browser },
codeSplitting: { useHash: false, maxPathLength: 0 },
devServer: false,
env: Object
.keys(process.env)
.filter(k => k.includes('NG_'))
.reduce((acc, curr) => ({ ...acc, [curr.replace('NG_', '')]: process.env[curr] }), {
NG_SERVER_HOST: maybe(process.env.HOSTNAME).valueOr(`http://localhost:${this.ngServerPort}`)
}),
...this.shared,
plugins: [pluginConsolidate('pug', { ...pugSharedLocals, isElectron: true }), ...this.shared.plugins]
}),
main: fusebox({
target: 'electron',
entry: 'src/electron/app.ts',
output: 'dist/desktop',
useSingleBundle: true,
devServer: false,
sourceMap: false,
dependencies: {
ignoreAllExternal: false,
ignorePackages: packageJson.fusebox.ignore.electron
},
...this.shared
})
},
serveHandler: (handler: UserHandler) => {
if (this.serve) {
this.killServer()