filecat 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -201
- package/README.md +71 -71
- package/build/dist/421.bundle.js +1 -1
- package/build/dist/470.bundle.js +1 -1
- package/build/dist/859.bundle.js +1 -1
- package/build/dist/859.bundle.js.LICENSE.txt +1 -1
- package/build/dist/868.bundle.js +1 -1
- package/build/dist/868.bundle.js.LICENSE.txt +3 -3
- package/build/dist/916.bundle.js +1 -1
- package/build/dist/943.bundle.js +1 -1
- package/build/dist/977.bundle.js +1 -1
- package/build/dist/bundle.js +1 -1
- package/build/dist/bundle.js.LICENSE.txt +3 -3
- package/build/dist/excalidraw-assets/vendor-677e88ca78c86bddf13d.js +1 -1
- package/build/dist/filerobot-image-editor.min.js +42445 -42445
- package/build/dist/rle.js +17867 -17867
- package/build/main.js +33 -33
- package/build/wintun-amd64.dll +0 -0
- package/env +16 -16
- package/package.json +152 -152
- package/shell/build.js +102 -101
- package/shell/config/.babelrc +10 -10
- package/shell/config/webpack.config.js +71 -71
- package/shell/config/webpack.docker.config.js +62 -62
- package/shell/config/webpack.npm.config.js +64 -62
- package/shell/config/webpack.pkg.config.js +62 -62
- package/shell/dev.js +51 -51
- package/shell/install.js +48 -48
- package/shell/restart.sh +29 -29
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
3
|
-
const webpack = require('webpack');
|
|
4
|
-
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
|
5
|
-
const package_data = require("../../package.json")
|
|
6
|
-
module.exports = {
|
|
7
|
-
mode: 'production',
|
|
8
|
-
entry: path.join(__dirname, "..", "..", "src", "web", "project", 'index.js'),
|
|
9
|
-
output: {
|
|
10
|
-
// path: path.resolve(__dirname, '..','..','dist'),
|
|
11
|
-
filename: 'bundle.js',
|
|
12
|
-
path: path.resolve(__dirname, '..', "..", 'build', 'dist'),
|
|
13
|
-
},
|
|
14
|
-
module: {
|
|
15
|
-
rules: [
|
|
16
|
-
{
|
|
17
|
-
test: /\.(js|jsx|tsx|ts)$/,
|
|
18
|
-
exclude: /node_modules/,
|
|
19
|
-
use: {
|
|
20
|
-
loader: 'babel-loader',
|
|
21
|
-
options: {
|
|
22
|
-
configFile: path.resolve(__dirname, '.babelrc'), // 指定 .babelrc 文件路径
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
test: /\.css$/, // 匹配所有以.css结尾的文件
|
|
28
|
-
use: ['style-loader', 'css-loader'] // 使用style-loader和css-loader处理匹配到的文件
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
test: /\.svg/,
|
|
32
|
-
type: 'asset/inline'
|
|
33
|
-
}
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
resolve: {
|
|
37
|
-
extensions: ['.tsx', '.ts', '.js', '.jsx'],
|
|
38
|
-
},
|
|
39
|
-
plugins: [
|
|
40
|
-
new HtmlWebpackPlugin({
|
|
41
|
-
template: path.join(__dirname, "..", "..", "src", "web", "project", 'index.html'),
|
|
42
|
-
}),
|
|
43
|
-
new webpack.DefinePlugin({
|
|
44
|
-
'process.env': JSON.stringify(process.env),
|
|
45
|
-
}),
|
|
46
|
-
new webpack.DefinePlugin({
|
|
47
|
-
'process.env.version': JSON.stringify(package_data.version),
|
|
48
|
-
})
|
|
49
|
-
// new BundleAnalyzerPlugin()
|
|
50
|
-
],
|
|
51
|
-
devServer: {
|
|
52
|
-
static: [
|
|
53
|
-
{directory: path.join(__dirname, "..", "..", "node_modules", "@excalidraw", "excalidraw", "dist","excalidraw-assets-dev"),},
|
|
54
|
-
{directory: path.join(__dirname, "..", "..", "node_modules", "@excalidraw", "excalidraw", "dist","excalidraw-assets-dev","locales"),},
|
|
55
|
-
{directory: path.join(__dirname, "..", "..", "src", "web", "project", './'),},
|
|
56
|
-
{directory: path.join(__dirname, "..", "..", "src", "web", "project", 'component', "file", "component", "image", "js")},
|
|
57
|
-
{directory: path.join(__dirname, "..", "..", "src", "web", "project", 'component', "toolbox", "rdp", "client", "js")},
|
|
58
|
-
{directory: path.join(__dirname, "..", "..", "src", "web", "meta", 'resources', "img", "./",)}
|
|
59
|
-
],
|
|
60
|
-
port: 3301,
|
|
61
|
-
open: false,
|
|
62
|
-
// onListening: function (devServer) {
|
|
63
|
-
// if (!devServer) {
|
|
64
|
-
// throw new Error('webpack-dev-server is not defined');
|
|
65
|
-
// }
|
|
66
|
-
// // const port = devServer.server.address().port;
|
|
67
|
-
// console.log('Listening on port:', port);
|
|
68
|
-
// },
|
|
69
|
-
allowedHosts: "all", // 新增该配置项
|
|
70
|
-
},
|
|
71
|
-
};
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
3
|
+
const webpack = require('webpack');
|
|
4
|
+
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
|
5
|
+
const package_data = require("../../package.json")
|
|
6
|
+
module.exports = {
|
|
7
|
+
mode: 'production',
|
|
8
|
+
entry: path.join(__dirname, "..", "..", "src", "web", "project", 'index.js'),
|
|
9
|
+
output: {
|
|
10
|
+
// path: path.resolve(__dirname, '..','..','dist'),
|
|
11
|
+
filename: 'bundle.js',
|
|
12
|
+
path: path.resolve(__dirname, '..', "..", 'build', 'dist'),
|
|
13
|
+
},
|
|
14
|
+
module: {
|
|
15
|
+
rules: [
|
|
16
|
+
{
|
|
17
|
+
test: /\.(js|jsx|tsx|ts)$/,
|
|
18
|
+
exclude: /node_modules/,
|
|
19
|
+
use: {
|
|
20
|
+
loader: 'babel-loader',
|
|
21
|
+
options: {
|
|
22
|
+
configFile: path.resolve(__dirname, '.babelrc'), // 指定 .babelrc 文件路径
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
test: /\.css$/, // 匹配所有以.css结尾的文件
|
|
28
|
+
use: ['style-loader', 'css-loader'] // 使用style-loader和css-loader处理匹配到的文件
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
test: /\.svg/,
|
|
32
|
+
type: 'asset/inline'
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
resolve: {
|
|
37
|
+
extensions: ['.tsx', '.ts', '.js', '.jsx'],
|
|
38
|
+
},
|
|
39
|
+
plugins: [
|
|
40
|
+
new HtmlWebpackPlugin({
|
|
41
|
+
template: path.join(__dirname, "..", "..", "src", "web", "project", 'index.html'),
|
|
42
|
+
}),
|
|
43
|
+
new webpack.DefinePlugin({
|
|
44
|
+
'process.env': JSON.stringify(process.env),
|
|
45
|
+
}),
|
|
46
|
+
new webpack.DefinePlugin({
|
|
47
|
+
'process.env.version': JSON.stringify(package_data.version),
|
|
48
|
+
})
|
|
49
|
+
// new BundleAnalyzerPlugin()
|
|
50
|
+
],
|
|
51
|
+
devServer: {
|
|
52
|
+
static: [
|
|
53
|
+
{directory: path.join(__dirname, "..", "..", "node_modules", "@excalidraw", "excalidraw", "dist","excalidraw-assets-dev"),},
|
|
54
|
+
{directory: path.join(__dirname, "..", "..", "node_modules", "@excalidraw", "excalidraw", "dist","excalidraw-assets-dev","locales"),},
|
|
55
|
+
{directory: path.join(__dirname, "..", "..", "src", "web", "project", './'),},
|
|
56
|
+
{directory: path.join(__dirname, "..", "..", "src", "web", "project", 'component', "file", "component", "image", "js")},
|
|
57
|
+
{directory: path.join(__dirname, "..", "..", "src", "web", "project", 'component', "toolbox", "rdp", "client", "js")},
|
|
58
|
+
{directory: path.join(__dirname, "..", "..", "src", "web", "meta", 'resources', "img", "./",)}
|
|
59
|
+
],
|
|
60
|
+
port: 3301,
|
|
61
|
+
open: false,
|
|
62
|
+
// onListening: function (devServer) {
|
|
63
|
+
// if (!devServer) {
|
|
64
|
+
// throw new Error('webpack-dev-server is not defined');
|
|
65
|
+
// }
|
|
66
|
+
// // const port = devServer.server.address().port;
|
|
67
|
+
// console.log('Listening on port:', port);
|
|
68
|
+
// },
|
|
69
|
+
allowedHosts: "all", // 新增该配置项
|
|
70
|
+
},
|
|
71
|
+
};
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const nodeExternals = require('webpack-node-externals');
|
|
3
|
-
const webpack = require('webpack');
|
|
4
|
-
const TerserPlugin = require("terser-webpack-plugin");
|
|
5
|
-
const package_data = require("../../package.json")
|
|
6
|
-
var prebuild_file_path_1 = require("./prebuild-file-path");
|
|
7
|
-
const plugins = [
|
|
8
|
-
new webpack.DefinePlugin({
|
|
9
|
-
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
10
|
-
}),
|
|
11
|
-
new webpack.DefinePlugin({
|
|
12
|
-
'process.env.version': JSON.stringify(package_data.version),
|
|
13
|
-
}),
|
|
14
|
-
new webpack.DefinePlugin({
|
|
15
|
-
'process.platform': JSON.stringify(process.platform) // 这里将 process.platform 替换为实际的值 在遇到动态打包的时候require 可以判断类型 函数内部的无法判断
|
|
16
|
-
}),
|
|
17
|
-
new webpack.DefinePlugin({
|
|
18
|
-
'process.env.run_env': JSON.stringify("docker") // 必须用 JSON.stringify
|
|
19
|
-
}),
|
|
20
|
-
new webpack.IgnorePlugin({
|
|
21
|
-
resourceRegExp: /Debug/,
|
|
22
|
-
})
|
|
23
|
-
];
|
|
24
|
-
module.exports = {
|
|
25
|
-
target: 'node', // 指定打包结果运行在node环境下
|
|
26
|
-
mode: 'production', // 或者 'production'
|
|
27
|
-
entry: path.join(__dirname, "..", "..", "build", "server", "main", "server.js"), // 你的TypeScript入口文件路径
|
|
28
|
-
output: {
|
|
29
|
-
path: path.resolve(__dirname, "..", "..", "build"), // 输出目录
|
|
30
|
-
filename: 'main.js', // 输出文件名
|
|
31
|
-
},
|
|
32
|
-
resolve: {
|
|
33
|
-
extensions: ['.ts', '.js', '.node'], // 解析文件时自动补全的文件扩展名
|
|
34
|
-
},
|
|
35
|
-
module: {
|
|
36
|
-
rules: [
|
|
37
|
-
{
|
|
38
|
-
test: /\.node$|Addon$/,
|
|
39
|
-
loader: 'node-loader', // 会拷贝.node 并改变require路径 到build目录下 但是如果 .node 有更新 他是不会不更新的需要先删除?
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
},
|
|
43
|
-
externalsPresets: { node: true },
|
|
44
|
-
externals: [
|
|
45
|
-
{
|
|
46
|
-
'@aws-sdk/client-s3': 'S3', // 假设全局变量名为 S3 是 @aws-sdk/client-s3带 @符号的话会无法压缩
|
|
47
|
-
'cors':'commonjs cors' // 动态加载无法打包 如果需要可以使用 import "cors"
|
|
48
|
-
// 'routing-controllers':'commonjs routing-controllers', // 有一些动态引入(他需要的动态引入也需要导入),或者含有.node(使用用户自己安装编译的版本) 无法被打包 直接忽略这个包
|
|
49
|
-
}
|
|
50
|
-
],
|
|
51
|
-
// externals: [nodeExternals()], // 将所有的外部模块排除打包
|
|
52
|
-
plugins,
|
|
53
|
-
optimization: {
|
|
54
|
-
minimize: true, // 压缩Js代码
|
|
55
|
-
minimizer: [
|
|
56
|
-
new TerserPlugin({
|
|
57
|
-
extractComments: true,//不将注释提取到单独的文件中
|
|
58
|
-
}),
|
|
59
|
-
],
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
};
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const nodeExternals = require('webpack-node-externals');
|
|
3
|
+
const webpack = require('webpack');
|
|
4
|
+
const TerserPlugin = require("terser-webpack-plugin");
|
|
5
|
+
const package_data = require("../../package.json")
|
|
6
|
+
var prebuild_file_path_1 = require("./prebuild-file-path");
|
|
7
|
+
const plugins = [
|
|
8
|
+
new webpack.DefinePlugin({
|
|
9
|
+
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
10
|
+
}),
|
|
11
|
+
new webpack.DefinePlugin({
|
|
12
|
+
'process.env.version': JSON.stringify(package_data.version),
|
|
13
|
+
}),
|
|
14
|
+
new webpack.DefinePlugin({
|
|
15
|
+
'process.platform': JSON.stringify(process.platform) // 这里将 process.platform 替换为实际的值 在遇到动态打包的时候require 可以判断类型 函数内部的无法判断
|
|
16
|
+
}),
|
|
17
|
+
new webpack.DefinePlugin({
|
|
18
|
+
'process.env.run_env': JSON.stringify("docker") // 必须用 JSON.stringify
|
|
19
|
+
}),
|
|
20
|
+
new webpack.IgnorePlugin({
|
|
21
|
+
resourceRegExp: /Debug/,
|
|
22
|
+
})
|
|
23
|
+
];
|
|
24
|
+
module.exports = {
|
|
25
|
+
target: 'node', // 指定打包结果运行在node环境下
|
|
26
|
+
mode: 'production', // 或者 'production'
|
|
27
|
+
entry: path.join(__dirname, "..", "..", "build", "server", "main", "server.js"), // 你的TypeScript入口文件路径
|
|
28
|
+
output: {
|
|
29
|
+
path: path.resolve(__dirname, "..", "..", "build"), // 输出目录
|
|
30
|
+
filename: 'main.js', // 输出文件名
|
|
31
|
+
},
|
|
32
|
+
resolve: {
|
|
33
|
+
extensions: ['.ts', '.js', '.node'], // 解析文件时自动补全的文件扩展名
|
|
34
|
+
},
|
|
35
|
+
module: {
|
|
36
|
+
rules: [
|
|
37
|
+
{
|
|
38
|
+
test: /\.node$|Addon$/,
|
|
39
|
+
loader: 'node-loader', // 会拷贝.node 并改变require路径 到build目录下 但是如果 .node 有更新 他是不会不更新的需要先删除?
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
externalsPresets: { node: true },
|
|
44
|
+
externals: [
|
|
45
|
+
{
|
|
46
|
+
'@aws-sdk/client-s3': 'S3', // 假设全局变量名为 S3 是 @aws-sdk/client-s3带 @符号的话会无法压缩
|
|
47
|
+
'cors':'commonjs cors' // 动态加载无法打包 如果需要可以使用 import "cors"
|
|
48
|
+
// 'routing-controllers':'commonjs routing-controllers', // 有一些动态引入(他需要的动态引入也需要导入),或者含有.node(使用用户自己安装编译的版本) 无法被打包 直接忽略这个包
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
// externals: [nodeExternals()], // 将所有的外部模块排除打包
|
|
52
|
+
plugins,
|
|
53
|
+
optimization: {
|
|
54
|
+
minimize: true, // 压缩Js代码
|
|
55
|
+
minimizer: [
|
|
56
|
+
new TerserPlugin({
|
|
57
|
+
extractComments: true,//不将注释提取到单独的文件中
|
|
58
|
+
}),
|
|
59
|
+
],
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
};
|
|
@@ -1,62 +1,64 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const webpack = require('webpack');
|
|
3
|
-
const TerserPlugin = require("terser-webpack-plugin");
|
|
4
|
-
const package_data = require("../../package.json")
|
|
5
|
-
module.exports = {
|
|
6
|
-
target: 'node', // 指定打包结果运行在node环境下
|
|
7
|
-
mode: 'production', // 或者 'production'
|
|
8
|
-
entry: path.join(__dirname, "..", "..", "build", "server", "main", "server.js"), // 你的TypeScript入口文件路径
|
|
9
|
-
output: {
|
|
10
|
-
path: path.resolve(__dirname, "..", "..", "build"), // 输出目录
|
|
11
|
-
filename: 'main.js', // 输出文件名
|
|
12
|
-
},
|
|
13
|
-
resolve: {
|
|
14
|
-
extensions: ['.ts', '.js', '.node'] // 解析文件时自动补全的文件扩展名
|
|
15
|
-
},
|
|
16
|
-
module: {
|
|
17
|
-
rules: [
|
|
18
|
-
// {
|
|
19
|
-
// test: /\.js$/, // 处理 JS 文件
|
|
20
|
-
// exclude: /node_modules/, // 排除 node_modules 中的文件
|
|
21
|
-
// use: 'babel-loader', // 如果需要,可以用 Babel 转译 JS 文件
|
|
22
|
-
// }
|
|
23
|
-
]
|
|
24
|
-
},
|
|
25
|
-
externalsPresets: { node: true },
|
|
26
|
-
externals: [
|
|
27
|
-
{
|
|
28
|
-
'@aws-sdk/client-s3': 'S3', // 假设全局变量名为 S3 是 @aws-sdk/client-s3带 @符号的话会无法压缩
|
|
29
|
-
// 'routing-controllers':'commonjs routing-controllers', // 有一些动态引入(他需要的动态引入也需要导入),或者含有.node(使用用户自己安装编译的版本) 无法被打包 直接忽略这个包
|
|
30
|
-
'cors':'commonjs cors', // 动态加载无法打包 如果需要可以使用 import "cors"
|
|
31
|
-
'@xiaobaidadada/node-pty-prebuilt':'commonjs @xiaobaidadada/node-pty-prebuilt',
|
|
32
|
-
'@xiaobaidadada/node-tuntap2-wintun':'commonjs @xiaobaidadada/node-tuntap2-wintun',
|
|
33
|
-
'node-process-watcher':'commonjs node-process-watcher',
|
|
34
|
-
'
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const webpack = require('webpack');
|
|
3
|
+
const TerserPlugin = require("terser-webpack-plugin");
|
|
4
|
+
const package_data = require("../../package.json")
|
|
5
|
+
module.exports = {
|
|
6
|
+
target: 'node', // 指定打包结果运行在node环境下
|
|
7
|
+
mode: 'production', // 或者 'production'
|
|
8
|
+
entry: path.join(__dirname, "..", "..", "build", "server", "main", "server.js"), // 你的TypeScript入口文件路径
|
|
9
|
+
output: {
|
|
10
|
+
path: path.resolve(__dirname, "..", "..", "build"), // 输出目录
|
|
11
|
+
filename: 'main.js', // 输出文件名
|
|
12
|
+
},
|
|
13
|
+
resolve: {
|
|
14
|
+
extensions: ['.ts', '.js', '.node'] // 解析文件时自动补全的文件扩展名
|
|
15
|
+
},
|
|
16
|
+
module: {
|
|
17
|
+
rules: [
|
|
18
|
+
// {
|
|
19
|
+
// test: /\.js$/, // 处理 JS 文件
|
|
20
|
+
// exclude: /node_modules/, // 排除 node_modules 中的文件
|
|
21
|
+
// use: 'babel-loader', // 如果需要,可以用 Babel 转译 JS 文件
|
|
22
|
+
// }
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
externalsPresets: { node: true },
|
|
26
|
+
externals: [
|
|
27
|
+
{
|
|
28
|
+
'@aws-sdk/client-s3': 'S3', // 假设全局变量名为 S3 是 @aws-sdk/client-s3带 @符号的话会无法压缩
|
|
29
|
+
// 'routing-controllers':'commonjs routing-controllers', // 有一些动态引入(他需要的动态引入也需要导入),或者含有.node(使用用户自己安装编译的版本) 无法被打包 直接忽略这个包
|
|
30
|
+
'cors':'commonjs cors', // 动态加载无法打包 如果需要可以使用 import "cors"
|
|
31
|
+
'@xiaobaidadada/node-pty-prebuilt':'commonjs @xiaobaidadada/node-pty-prebuilt',
|
|
32
|
+
'@xiaobaidadada/node-tuntap2-wintun':'commonjs @xiaobaidadada/node-tuntap2-wintun',
|
|
33
|
+
'node-process-watcher':'commonjs node-process-watcher',
|
|
34
|
+
'@xiaobaidadada/ssh2-prebuilt':'commonjs @xiaobaidadada/ssh2-prebuilt',
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
plugins: [
|
|
38
|
+
new webpack.DefinePlugin({
|
|
39
|
+
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
40
|
+
}),
|
|
41
|
+
new webpack.DefinePlugin({
|
|
42
|
+
'process.env.version': JSON.stringify(package_data.version),
|
|
43
|
+
}),
|
|
44
|
+
new webpack.DefinePlugin({
|
|
45
|
+
'process.env.run_env': JSON.stringify("npm") // 必须用 JSON.stringify
|
|
46
|
+
}),
|
|
47
|
+
// new webpack.IgnorePlugin({ // 前面已经排除了可能含义.node的项目 这里就不需要了
|
|
48
|
+
// resourceRegExp: /\.node$/
|
|
49
|
+
// // contextRegExp: /moment$/,
|
|
50
|
+
// }),
|
|
51
|
+
// new webpack.IgnorePlugin({
|
|
52
|
+
// resourceRegExp: /Addon$/
|
|
53
|
+
// // contextRegExp: /moment$/,
|
|
54
|
+
// }),
|
|
55
|
+
],
|
|
56
|
+
optimization: {
|
|
57
|
+
minimize: true, // 压缩Js代码
|
|
58
|
+
minimizer: [
|
|
59
|
+
new TerserPlugin({
|
|
60
|
+
extractComments: true,//不将注释提取到单独的文件中
|
|
61
|
+
}),
|
|
62
|
+
],
|
|
63
|
+
}
|
|
64
|
+
};
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const nodeExternals = require('webpack-node-externals');
|
|
3
|
-
const webpack = require('webpack');
|
|
4
|
-
const TerserPlugin = require("terser-webpack-plugin");
|
|
5
|
-
const package_data = require("../../package.json")
|
|
6
|
-
var prebuild_file_path_1 = require("./prebuild-file-path");
|
|
7
|
-
const plugins = [
|
|
8
|
-
new webpack.DefinePlugin({
|
|
9
|
-
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
10
|
-
}),
|
|
11
|
-
new webpack.DefinePlugin({
|
|
12
|
-
'process.env.version': JSON.stringify(package_data.version),
|
|
13
|
-
}),
|
|
14
|
-
new webpack.DefinePlugin({
|
|
15
|
-
'process.platform': JSON.stringify(process.platform) // 这里将 process.platform 替换为实际的值 在遇到动态打包的时候require 可以判断类型 函数内部的无法判断
|
|
16
|
-
}),
|
|
17
|
-
new webpack.DefinePlugin({
|
|
18
|
-
'process.env.run_env': JSON.stringify("pkg")
|
|
19
|
-
}),
|
|
20
|
-
new webpack.IgnorePlugin({
|
|
21
|
-
resourceRegExp: /Debug/,
|
|
22
|
-
})
|
|
23
|
-
];
|
|
24
|
-
module.exports = {
|
|
25
|
-
target: 'node', // 指定打包结果运行在node环境下
|
|
26
|
-
mode: 'production', // 或者 'production'
|
|
27
|
-
entry: path.join(__dirname, "..", "..", "build", "server", "main", "server.js"), // 你的TypeScript入口文件路径
|
|
28
|
-
output: {
|
|
29
|
-
path: path.resolve(__dirname, "..", "..", "build"), // 输出目录
|
|
30
|
-
filename: 'main.js', // 输出文件名
|
|
31
|
-
},
|
|
32
|
-
resolve: {
|
|
33
|
-
extensions: ['.ts', '.js', '.node'], // 解析文件时自动补全的文件扩展名
|
|
34
|
-
},
|
|
35
|
-
module: {
|
|
36
|
-
rules: [
|
|
37
|
-
{
|
|
38
|
-
test: /\.node$|Addon$/,
|
|
39
|
-
loader: 'node-loader', // 会拷贝.node 并改变require路径 到build目录下 但是如果 .node 有更新 他是不会不更新的需要先删除?
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
},
|
|
43
|
-
externalsPresets: { node: true },
|
|
44
|
-
externals: [
|
|
45
|
-
{
|
|
46
|
-
'@aws-sdk/client-s3': 'S3', // 假设全局变量名为 S3 是 @aws-sdk/client-s3带 @符号的话会无法压缩
|
|
47
|
-
'cors':'commonjs cors' // 动态加载无法打包 如果需要可以使用 import "cors"
|
|
48
|
-
// 'routing-controllers':'commonjs routing-controllers', // 有一些动态引入(他需要的动态引入也需要导入),或者含有.node(使用用户自己安装编译的版本) 无法被打包 直接忽略这个包
|
|
49
|
-
}
|
|
50
|
-
],
|
|
51
|
-
// externals: [nodeExternals()], // 将所有的外部模块排除打包
|
|
52
|
-
plugins,
|
|
53
|
-
optimization: {
|
|
54
|
-
minimize: true, // 压缩Js代码
|
|
55
|
-
minimizer: [
|
|
56
|
-
new TerserPlugin({
|
|
57
|
-
extractComments: true,//不将注释提取到单独的文件中
|
|
58
|
-
}),
|
|
59
|
-
],
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
};
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const nodeExternals = require('webpack-node-externals');
|
|
3
|
+
const webpack = require('webpack');
|
|
4
|
+
const TerserPlugin = require("terser-webpack-plugin");
|
|
5
|
+
const package_data = require("../../package.json")
|
|
6
|
+
var prebuild_file_path_1 = require("./prebuild-file-path");
|
|
7
|
+
const plugins = [
|
|
8
|
+
new webpack.DefinePlugin({
|
|
9
|
+
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
10
|
+
}),
|
|
11
|
+
new webpack.DefinePlugin({
|
|
12
|
+
'process.env.version': JSON.stringify(package_data.version),
|
|
13
|
+
}),
|
|
14
|
+
new webpack.DefinePlugin({
|
|
15
|
+
'process.platform': JSON.stringify(process.platform) // 这里将 process.platform 替换为实际的值 在遇到动态打包的时候require 可以判断类型 函数内部的无法判断
|
|
16
|
+
}),
|
|
17
|
+
new webpack.DefinePlugin({
|
|
18
|
+
'process.env.run_env': JSON.stringify("pkg")
|
|
19
|
+
}),
|
|
20
|
+
new webpack.IgnorePlugin({
|
|
21
|
+
resourceRegExp: /Debug/,
|
|
22
|
+
})
|
|
23
|
+
];
|
|
24
|
+
module.exports = {
|
|
25
|
+
target: 'node', // 指定打包结果运行在node环境下
|
|
26
|
+
mode: 'production', // 或者 'production'
|
|
27
|
+
entry: path.join(__dirname, "..", "..", "build", "server", "main", "server.js"), // 你的TypeScript入口文件路径
|
|
28
|
+
output: {
|
|
29
|
+
path: path.resolve(__dirname, "..", "..", "build"), // 输出目录
|
|
30
|
+
filename: 'main.js', // 输出文件名
|
|
31
|
+
},
|
|
32
|
+
resolve: {
|
|
33
|
+
extensions: ['.ts', '.js', '.node'], // 解析文件时自动补全的文件扩展名
|
|
34
|
+
},
|
|
35
|
+
module: {
|
|
36
|
+
rules: [
|
|
37
|
+
{
|
|
38
|
+
test: /\.node$|Addon$/,
|
|
39
|
+
loader: 'node-loader', // 会拷贝.node 并改变require路径 到build目录下 但是如果 .node 有更新 他是不会不更新的需要先删除?
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
externalsPresets: { node: true },
|
|
44
|
+
externals: [
|
|
45
|
+
{
|
|
46
|
+
'@aws-sdk/client-s3': 'S3', // 假设全局变量名为 S3 是 @aws-sdk/client-s3带 @符号的话会无法压缩
|
|
47
|
+
'cors':'commonjs cors' // 动态加载无法打包 如果需要可以使用 import "cors"
|
|
48
|
+
// 'routing-controllers':'commonjs routing-controllers', // 有一些动态引入(他需要的动态引入也需要导入),或者含有.node(使用用户自己安装编译的版本) 无法被打包 直接忽略这个包
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
// externals: [nodeExternals()], // 将所有的外部模块排除打包
|
|
52
|
+
plugins,
|
|
53
|
+
optimization: {
|
|
54
|
+
minimize: true, // 压缩Js代码
|
|
55
|
+
minimizer: [
|
|
56
|
+
new TerserPlugin({
|
|
57
|
+
extractComments: true,//不将注释提取到单独的文件中
|
|
58
|
+
}),
|
|
59
|
+
],
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
};
|
package/shell/dev.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
const { spawn } = require('child_process');
|
|
3
|
-
const path = require("path");
|
|
4
|
-
const Webpack = require('webpack');
|
|
5
|
-
const WebpackDevServer = require('webpack-dev-server');
|
|
6
|
-
const webpackConfig = require('./config/webpack.config.js');
|
|
7
|
-
const {findAvailablePort} = require("../src/common/findPort");
|
|
8
|
-
|
|
9
|
-
// const temLog = console.log;
|
|
10
|
-
|
|
11
|
-
// const child = spawn('npm', ['run', 'server-dev'], {
|
|
12
|
-
// shell: true, // 在某些系统上可能需要设置 shell 为 true 以正确执行命令
|
|
13
|
-
// stdio: 'inherit', // 使子进程的输入、输出和错误流与父进程共享
|
|
14
|
-
// });
|
|
15
|
-
|
|
16
|
-
// child.stdout.on('data', (data) => {
|
|
17
|
-
//
|
|
18
|
-
// console.log(data.toString());
|
|
19
|
-
// })
|
|
20
|
-
// child.stderr.on('data', (data) => {
|
|
21
|
-
// console.log = temLog;
|
|
22
|
-
// console.error(data.toString());
|
|
23
|
-
// });
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const runServer = async () => {
|
|
27
|
-
const port = await findAvailablePort(49152, 65535);
|
|
28
|
-
process.env.webpack_port = port;
|
|
29
|
-
webpackConfig['mode'] = 'development';
|
|
30
|
-
webpackConfig['devServer']['port'] = port;
|
|
31
|
-
webpackConfig['devServer']['onListening'] = function (devServer) {
|
|
32
|
-
if (!devServer) {
|
|
33
|
-
throw new Error('webpack-dev-server is not defined');
|
|
34
|
-
}
|
|
35
|
-
console.log('\x1b[31m请用后端端口访问网页\x1b[0m');
|
|
36
|
-
};
|
|
37
|
-
const compiler = Webpack(webpackConfig);
|
|
38
|
-
|
|
39
|
-
// webpackConfig['mode'] = 'production';
|
|
40
|
-
const devServerOptions = { ...webpackConfig.devServer, open: false };
|
|
41
|
-
const server = new WebpackDevServer(devServerOptions, compiler);
|
|
42
|
-
server.start();
|
|
43
|
-
require("../src/main/server")
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
runServer();
|
|
47
|
-
// console.log = function (...args) {
|
|
48
|
-
// }
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
|
|
2
|
+
const { spawn } = require('child_process');
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const Webpack = require('webpack');
|
|
5
|
+
const WebpackDevServer = require('webpack-dev-server');
|
|
6
|
+
const webpackConfig = require('./config/webpack.config.js');
|
|
7
|
+
const {findAvailablePort} = require("../src/common/findPort");
|
|
8
|
+
|
|
9
|
+
// const temLog = console.log;
|
|
10
|
+
|
|
11
|
+
// const child = spawn('npm', ['run', 'server-dev'], {
|
|
12
|
+
// shell: true, // 在某些系统上可能需要设置 shell 为 true 以正确执行命令
|
|
13
|
+
// stdio: 'inherit', // 使子进程的输入、输出和错误流与父进程共享
|
|
14
|
+
// });
|
|
15
|
+
|
|
16
|
+
// child.stdout.on('data', (data) => {
|
|
17
|
+
//
|
|
18
|
+
// console.log(data.toString());
|
|
19
|
+
// })
|
|
20
|
+
// child.stderr.on('data', (data) => {
|
|
21
|
+
// console.log = temLog;
|
|
22
|
+
// console.error(data.toString());
|
|
23
|
+
// });
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
const runServer = async () => {
|
|
27
|
+
const port = await findAvailablePort(49152, 65535);
|
|
28
|
+
process.env.webpack_port = port;
|
|
29
|
+
webpackConfig['mode'] = 'development';
|
|
30
|
+
webpackConfig['devServer']['port'] = port;
|
|
31
|
+
webpackConfig['devServer']['onListening'] = function (devServer) {
|
|
32
|
+
if (!devServer) {
|
|
33
|
+
throw new Error('webpack-dev-server is not defined');
|
|
34
|
+
}
|
|
35
|
+
console.log('\x1b[31m请用后端端口访问网页\x1b[0m');
|
|
36
|
+
};
|
|
37
|
+
const compiler = Webpack(webpackConfig);
|
|
38
|
+
|
|
39
|
+
// webpackConfig['mode'] = 'production';
|
|
40
|
+
const devServerOptions = { ...webpackConfig.devServer, open: false };
|
|
41
|
+
const server = new WebpackDevServer(devServerOptions, compiler);
|
|
42
|
+
server.start();
|
|
43
|
+
require("../src/main/server")
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
runServer();
|
|
47
|
+
// console.log = function (...args) {
|
|
48
|
+
// }
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|