mirror of
https://github.com/The-Low-Code-Foundation/OpenNoodl.git
synced 2026-01-11 14:52:55 +01:00
Initial commit
Co-Authored-By: Eric Tuvesson <eric.tuvesson@gmail.com> Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com> Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com> Co-Authored-By: Anders Larsson <64838990+anders-topp@users.noreply.github.com> Co-Authored-By: Johan <4934465+joolsus@users.noreply.github.com> Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com> Co-Authored-By: victoratndl <99176179+victoratndl@users.noreply.github.com>
This commit is contained in:
9
packages/noodl-viewer-cloud/webpack-configs/constants.js
Normal file
9
packages/noodl-viewer-cloud/webpack-configs/constants.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
// Allows to define the output path of the files built by the viewer.
|
||||
//
|
||||
// For example in the CLI, we will also build this, just with a different output path.
|
||||
outPath: process.env.OUT_PATH || path.resolve(__dirname, '../../noodl-editor/src/external'),
|
||||
runtimeVersion: 'cloud-runtime-' + require('../package.json').version.replaceAll('.', '-')
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
//config shared for both regular viewer and deploy versions
|
||||
|
||||
module.exports = {
|
||||
externals: {},
|
||||
resolve: {
|
||||
extensions: ['.ts', '.js']
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: 'ts-loader',
|
||||
exclude: /node_modules/
|
||||
}
|
||||
]
|
||||
},
|
||||
performance: {
|
||||
hints: false,
|
||||
maxEntrypointSize: 512000,
|
||||
maxAssetSize: 512000
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
const viewer = require('./webpack.viewer.dev');
|
||||
const isolate = require('./webpack.isolate.dev');
|
||||
|
||||
module.exports = [viewer, isolate];
|
||||
@@ -0,0 +1,34 @@
|
||||
const path = require('path');
|
||||
const { runtimeVersion } = require('./constants.js');
|
||||
const webpack = require('webpack');
|
||||
|
||||
const prefix = `const _noodl_cloud_runtime_version = "${runtimeVersion}";`;
|
||||
|
||||
module.exports = {
|
||||
//mode: 'production',
|
||||
mode: 'development',
|
||||
watch: true,
|
||||
entry: './src/sandbox.isolate.js',
|
||||
target: 'node',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: 'ts-loader',
|
||||
exclude: /node_modules/
|
||||
}
|
||||
]
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.ts', '.js']
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../dist')
|
||||
},
|
||||
plugins: [
|
||||
new webpack.BannerPlugin({
|
||||
banner: prefix,
|
||||
raw: true
|
||||
})
|
||||
]
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
const path = require('path');
|
||||
const { runtimeVersion } = require('./constants.js');
|
||||
const webpack = require('webpack');
|
||||
|
||||
const prefix = `const _noodl_cloud_runtime_version = "${runtimeVersion}";`;
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/sandbox.isolate.js',
|
||||
target: 'node',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: 'ts-loader',
|
||||
exclude: /node_modules/
|
||||
}
|
||||
]
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.ts', '.js']
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../dist')
|
||||
},
|
||||
plugins: [
|
||||
new webpack.BannerPlugin({
|
||||
banner: prefix,
|
||||
raw: true
|
||||
})
|
||||
]
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
const viewer = require('./webpack.viewer.prod');
|
||||
const isolate = require('./webpack.isolate.prod');
|
||||
|
||||
module.exports = [viewer, isolate];
|
||||
@@ -0,0 +1,49 @@
|
||||
//shared config for regular (non-deploy) viewer
|
||||
|
||||
const path = require('path');
|
||||
const { merge } = require('webpack-merge');
|
||||
const { outPath, runtimeVersion } = require('./constants.js');
|
||||
const common = require('./webpack.common.js');
|
||||
const webpack = require('webpack');
|
||||
|
||||
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
const GenerateJsonPlugin = require('generate-json-webpack-plugin');
|
||||
|
||||
const noodlEditorExternalViewerPath = path.join(outPath, 'cloudruntime');
|
||||
|
||||
function stripStartDirectories(targetPath, numDirs) {
|
||||
const p = targetPath.split('/');
|
||||
p.splice(0, numDirs);
|
||||
return p.join(path.sep);
|
||||
}
|
||||
|
||||
const prefix = `const { ipcRenderer } = require('electron'); const _noodl_cloud_runtime_version = "${runtimeVersion}";`;
|
||||
|
||||
module.exports = merge(common, {
|
||||
entry: {
|
||||
sandbox: './src/sandbox.viewer.js'
|
||||
},
|
||||
output: {
|
||||
filename: 'sandbox.viewer.bundle.js',
|
||||
path: noodlEditorExternalViewerPath
|
||||
},
|
||||
plugins: [
|
||||
new webpack.BannerPlugin({
|
||||
banner: prefix,
|
||||
raw: true
|
||||
}),
|
||||
new CleanWebpackPlugin(noodlEditorExternalViewerPath, {
|
||||
allowExternal: true
|
||||
}),
|
||||
new CopyWebpackPlugin([
|
||||
{
|
||||
from: 'static/viewer/**/*',
|
||||
transformPath: (targetPath) => stripStartDirectories(targetPath, 2)
|
||||
}
|
||||
]),
|
||||
new GenerateJsonPlugin('manifest.json', {
|
||||
version: runtimeVersion
|
||||
})
|
||||
]
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
const { merge } = require("webpack-merge");
|
||||
const common = require("./webpack.viewer.common.js");
|
||||
|
||||
module.exports = merge(common, {
|
||||
mode: "development",
|
||||
devtool: "inline-source-map",
|
||||
watch: true,
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
const { merge } = require('webpack-merge');
|
||||
const common = require('./webpack.viewer.common.js');
|
||||
|
||||
module.exports = merge(common, {
|
||||
mode: 'production'
|
||||
});
|
||||
Reference in New Issue
Block a user