2019-12-24 15:40:03 +03:00
|
|
|
const path = require('path')
|
|
|
|
const nodeExternals = require('webpack-node-externals')
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
entry: {
|
2021-01-30 18:15:47 +03:00
|
|
|
'api/cli': './src/api/cli.ts',
|
2019-12-28 02:34:24 +03:00
|
|
|
'api/tauricon': './src/api/tauricon.ts',
|
2020-07-16 00:01:37 +03:00
|
|
|
'api/dependency-manager': './src/api/dependency-manager/index.ts',
|
2021-01-30 18:15:47 +03:00
|
|
|
'helpers/spawn': './src/helpers/spawn.ts',
|
2021-04-14 04:09:13 +03:00
|
|
|
'helpers/rust-cli': './src/helpers/rust-cli.ts',
|
|
|
|
'helpers/download-cli': './src/helpers/download-cli.ts'
|
2019-12-24 15:40:03 +03:00
|
|
|
},
|
|
|
|
mode: process.env.NODE_ENV || 'development',
|
|
|
|
devtool: 'source-map',
|
|
|
|
module: {
|
2020-08-19 05:36:46 +03:00
|
|
|
rules: [
|
|
|
|
{
|
2019-12-24 15:40:03 +03:00
|
|
|
test: /\.tsx?$/,
|
|
|
|
use: 'ts-loader',
|
|
|
|
exclude: /node_modules/
|
2020-03-09 23:57:27 +03:00
|
|
|
},
|
|
|
|
{
|
2020-06-27 18:20:00 +03:00
|
|
|
test: /(templates|api)[\\/].+\.js/,
|
2020-03-09 23:57:27 +03:00
|
|
|
use: 'raw-loader'
|
2020-06-18 19:53:41 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.toml?$/,
|
|
|
|
use: 'toml-loader'
|
2019-12-24 15:40:03 +03:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
node: false,
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.ts', '.js']
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
library: 'tauri',
|
|
|
|
libraryTarget: 'umd',
|
|
|
|
filename: '[name].js',
|
|
|
|
path: path.resolve(__dirname, 'dist')
|
|
|
|
},
|
|
|
|
externals: [nodeExternals()],
|
2021-02-20 17:36:17 +03:00
|
|
|
target: 'node'
|
2020-07-07 21:42:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function schemaParser(schemaName, content) {
|
|
|
|
const lines = content.split('\n')
|
|
|
|
const output = []
|
|
|
|
|
|
|
|
for (const line of lines) {
|
|
|
|
if (line === `export const ${schemaName} = {`) {
|
|
|
|
output.push('{')
|
|
|
|
} else if (output.length) {
|
2021-01-30 18:15:47 +03:00
|
|
|
if (line === '}') {
|
2020-07-07 21:42:15 +03:00
|
|
|
output.push('}')
|
|
|
|
break
|
|
|
|
}
|
|
|
|
output.push(line)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-30 18:15:47 +03:00
|
|
|
const json = output.join('\n')
|
|
|
|
const object = eval(`(${json})`)
|
|
|
|
return JSON.stringify(object, null, 2)
|
2019-12-24 15:40:03 +03:00
|
|
|
}
|