mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Visual Console Client: now the files are built into the console
Former-commit-id: 7bf533c9acb53a64d3a2babd43942248880dbb8e
This commit is contained in:
parent
fe61d38686
commit
0dcbec64b4
@ -3,12 +3,12 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Visual Console",
|
"description": "Visual Console",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean-build": "node ./scripts/clean-build.js",
|
"clean-build": "BUILD_PATH=\"pandora_console/include/visual-console\" node ./scripts/clean-build.js",
|
||||||
"prebuild": "npm run clean-build",
|
"prebuild": "npm run clean-build",
|
||||||
"build": "NODE_ENV=production webpack",
|
"build": "BUILD_PATH=\"pandora_console/include/visual-console\" NODE_ENV=production webpack",
|
||||||
"prebuild:dev": "npm run clean-build",
|
"prebuild:dev": "npm run clean-build",
|
||||||
"build:dev": "NODE_ENV=NODE_ENV=production webpack",
|
"build:dev": "BUILD_PATH=\"pandora_console/include/visual-console\" NODE_ENV=development webpack",
|
||||||
"build:watch": "NODE_ENV=NODE_ENV=production webpack --watch",
|
"build:watch": "BUILD_PATH=\"pandora_console/include/visual-console\" NODE_ENV=production webpack --watch",
|
||||||
"format": "prettier",
|
"format": "prettier",
|
||||||
"lint": "eslint \"src/**/*.ts\"",
|
"lint": "eslint \"src/**/*.ts\"",
|
||||||
"start": "webpack-dev-server --color --mode=development",
|
"start": "webpack-dev-server --color --mode=development",
|
||||||
|
@ -5,17 +5,12 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<title>Visual Console Sandbox</title>
|
<title>Visual Console Sandbox</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<link
|
<link rel="stylesheet" type="text/css" media="screen" href="vc.main.css" />
|
||||||
rel="stylesheet"
|
|
||||||
type="text/css"
|
|
||||||
media="screen"
|
|
||||||
href="visual-console-client.css"
|
|
||||||
/>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="visual-console-container"></div>
|
<div id="visual-console-container"></div>
|
||||||
</body>
|
</body>
|
||||||
<script src="visual-console-client.min.js"></script>
|
<script src="vc.main.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var container = document.getElementById("visual-console-container");
|
var container = document.getElementById("visual-console-container");
|
||||||
|
|
||||||
|
@ -1,7 +1,16 @@
|
|||||||
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
|
||||||
const buildPath = path.join(__dirname, "..", "build");
|
const buildPath = path.join(
|
||||||
|
__dirname,
|
||||||
|
"..",
|
||||||
|
"..",
|
||||||
|
process.env.BUILD_PATH && process.env.BUILD_PATH.length > 0
|
||||||
|
? process.env.BUILD_PATH
|
||||||
|
: "build"
|
||||||
|
);
|
||||||
|
|
||||||
if (fs.existsSync(buildPath)) {
|
if (fs.existsSync(buildPath)) {
|
||||||
fs.readdirSync(buildPath).forEach(file =>
|
fs.readdirSync(buildPath).forEach(file =>
|
||||||
|
@ -1,16 +1,24 @@
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
|
const path = require("path");
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||||
|
|
||||||
const dev = process.env.NODE_ENV !== "production";
|
const dev = process.env.NODE_ENV !== "production";
|
||||||
|
const entry = path.join(__dirname, "src", "index.ts");
|
||||||
|
const buildPath = path.join(
|
||||||
|
__dirname,
|
||||||
|
"..",
|
||||||
|
process.env.BUILD_PATH && process.env.BUILD_PATH.length > 0
|
||||||
|
? process.env.BUILD_PATH
|
||||||
|
: "build"
|
||||||
|
);
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
mode: dev ? "development" : "production",
|
mode: dev ? "development" : "production",
|
||||||
entry: __dirname + "/src/index.ts", // Start from this file.
|
entry, // Start from this file.
|
||||||
output: {
|
output: {
|
||||||
path: __dirname + "/build", // The files will be created here.
|
path: buildPath, // The files will be created here.
|
||||||
filename: dev
|
filename: dev ? "vc.[name].min.js" : "vc.[name].[chunkhash:8].min.js"
|
||||||
? "visual-console-client.min.js"
|
|
||||||
: "visual-console-client.[hash].min.js",
|
|
||||||
publicPath: dev ? "" : "pandora_console/include/visual_console/"
|
|
||||||
},
|
},
|
||||||
devtool: "source-map",
|
devtool: "source-map",
|
||||||
resolve: {
|
resolve: {
|
||||||
@ -64,7 +72,8 @@ module.exports = {
|
|||||||
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
|
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
|
||||||
loader: "url-loader",
|
loader: "url-loader",
|
||||||
options: {
|
options: {
|
||||||
limit: 10000
|
limit: 10000,
|
||||||
|
name: "[name].[hash:8].[ext]"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -74,9 +83,7 @@ module.exports = {
|
|||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
// Options similar to the same options in webpackOptions.output
|
// Options similar to the same options in webpackOptions.output
|
||||||
// both options are optional
|
// both options are optional
|
||||||
filename: dev
|
filename: dev ? "vc.[name].css" : "vc.[name].[contenthash:8].css",
|
||||||
? "visual-console-client.css"
|
|
||||||
: "visual-console-client.[hash].css",
|
|
||||||
// Disable to remove warnings about conflicting order between imports.
|
// Disable to remove warnings about conflicting order between imports.
|
||||||
orderWarning: true
|
orderWarning: true
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user