mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 06:25:45 +01:00
start implementation of ui-scripts
This commit is contained in:
76
scm-ui/ui-scripts/src/createPluginConfig.js
Normal file
76
scm-ui/ui-scripts/src/createPluginConfig.js
Normal file
@@ -0,0 +1,76 @@
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
|
||||
const root = process.cwd();
|
||||
|
||||
const packageJsonPath = path.join(root, "package.json");
|
||||
const packageJSON = JSON.parse(
|
||||
fs.readFileSync(packageJsonPath, { encoding: "UTF-8" })
|
||||
);
|
||||
|
||||
let name = packageJSON.name;
|
||||
const orgaIndex = name.indexOf("/");
|
||||
if (orgaIndex > 0) {
|
||||
name = name.substring(orgaIndex + 1);
|
||||
}
|
||||
|
||||
module.exports = function(mode) {
|
||||
return {
|
||||
context: root,
|
||||
entry: {
|
||||
[name]: "./src/main/js/index.js"
|
||||
},
|
||||
mode,
|
||||
devtool: "source-map",
|
||||
target: "web",
|
||||
node: {
|
||||
fs: "empty",
|
||||
net: "empty",
|
||||
tls: "empty"
|
||||
},
|
||||
externals: [
|
||||
"react",
|
||||
"react-dom",
|
||||
"react-i18next",
|
||||
"react-router-dom",
|
||||
"styled-components",
|
||||
"@scm-manager/ui-types",
|
||||
"@scm-manager/ui-extensions",
|
||||
"@scm-manager/ui-components"
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(js|jsx)$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: "babel-loader",
|
||||
options: {
|
||||
presets: ["@scm-manager/babel-preset"]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.(css|scss|sass)$/i,
|
||||
use: ["style-loader", "css-loader", "sass-loader"]
|
||||
},
|
||||
{
|
||||
test: /\.(png|svg|jpg|gif|woff2?|eot|ttf)$/,
|
||||
use: ["file-loader"]
|
||||
}
|
||||
]
|
||||
},
|
||||
output: {
|
||||
path: path.join(
|
||||
root,
|
||||
"target",
|
||||
name + "-" + packageJSON.version,
|
||||
"webapp",
|
||||
"assets"
|
||||
),
|
||||
filename: "[name].bundle.js",
|
||||
library: name,
|
||||
libraryTarget: "amd"
|
||||
}
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user