filecat 1.0.6 → 1.0.8

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.
@@ -0,0 +1,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
+ 'node-unrar-js':'commonjs node-unrar-js',
35
+ 'ssh2':'commonjs ssh2',
36
+ }
37
+ ],
38
+ plugins: [
39
+ new webpack.DefinePlugin({
40
+ 'process.env.NODE_ENV': JSON.stringify('production'),
41
+ }),
42
+ new webpack.DefinePlugin({
43
+ 'process.env.version': JSON.stringify(package_data.version),
44
+ }),
45
+ // new webpack.IgnorePlugin({ // 前面已经排除了可能含义.node的项目 这里就不需要了
46
+ // resourceRegExp: /\.node$/
47
+ // // contextRegExp: /moment$/,
48
+ // }),
49
+ // new webpack.IgnorePlugin({
50
+ // resourceRegExp: /Addon$/
51
+ // // contextRegExp: /moment$/,
52
+ // }),
53
+ ],
54
+ optimization: {
55
+ minimize: true, // 压缩Js代码
56
+ minimizer: [
57
+ new TerserPlugin({
58
+ extractComments: true,//不将注释提取到单独的文件中
59
+ }),
60
+ ],
61
+ }
62
+ };
@@ -0,0 +1,59 @@
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
+ ];
21
+ module.exports = {
22
+ target: 'node', // 指定打包结果运行在node环境下
23
+ mode: 'production', // 或者 'production'
24
+ entry: path.join(__dirname, "..", "..", "build", "server", "main", "server.js"), // 你的TypeScript入口文件路径
25
+ output: {
26
+ path: path.resolve(__dirname, "..", "..", "build"), // 输出目录
27
+ filename: 'main.js', // 输出文件名
28
+ },
29
+ resolve: {
30
+ extensions: ['.ts', '.js', '.node'], // 解析文件时自动补全的文件扩展名
31
+ },
32
+ module: {
33
+ rules: [
34
+ {
35
+ test: /\.node$|Addon$/,
36
+ loader: 'node-loader', // 会拷贝.node 并改变require路径 到build目录下 但是如果 .node 有更新 他是不会不更新的需要先删除?
37
+ }
38
+ ]
39
+ },
40
+ externalsPresets: { node: true },
41
+ externals: [
42
+ {
43
+ '@aws-sdk/client-s3': 'S3', // 假设全局变量名为 S3 是 @aws-sdk/client-s3带 @符号的话会无法压缩
44
+ 'cors':'commonjs cors' // 动态加载无法打包 如果需要可以使用 import "cors"
45
+ // 'routing-controllers':'commonjs routing-controllers', // 有一些动态引入(他需要的动态引入也需要导入),或者含有.node(使用用户自己安装编译的版本) 无法被打包 直接忽略这个包
46
+ }
47
+ ],
48
+ // externals: [nodeExternals()], // 将所有的外部模块排除打包
49
+ plugins,
50
+ optimization: {
51
+ minimize: true, // 压缩Js代码
52
+ minimizer: [
53
+ new TerserPlugin({
54
+ extractComments: true,//不将注释提取到单独的文件中
55
+ }),
56
+ ],
57
+ }
58
+
59
+ };
@@ -0,0 +1,3 @@
1
+
2
+ npm run docker-build
3
+ docker build -t test .
@@ -1,55 +0,0 @@
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
- module.exports = {
7
- target: 'node', // 指定打包结果运行在node环境下
8
- mode: 'production', // 或者 'production'
9
- entry: path.join(__dirname,"..","..","build","server","main","server.js"), // 你的TypeScript入口文件路径
10
- output: {
11
- path: path.resolve(__dirname, "..","..","build"), // 输出目录
12
- filename: 'main.js', // 输出文件名
13
- },
14
- resolve: {
15
- extensions: ['.ts','.js'] // 解析文件时自动补全的文件扩展名
16
- },
17
- module: {
18
- rules: [
19
- {
20
- test: /\.(ts|js)$/,
21
- exclude: /node_modules/,
22
- use: {
23
- loader: 'babel-loader',
24
- options: {
25
- presets: [
26
- "@babel/preset-env",
27
- ]
28
- }
29
- },
30
- },
31
- ]
32
- },
33
- externals: [nodeExternals()], // 将所有的外部模块视为外部依赖
34
- plugins: [
35
- new webpack.DefinePlugin({
36
- 'process.env.NODE_ENV': JSON.stringify('production'),
37
- }),
38
- new webpack.IgnorePlugin({
39
- resourceRegExp: /^\.\/.*?\.node$/
40
- // contextRegExp: /moment$/,
41
- }),
42
- new webpack.DefinePlugin({
43
- 'process.env.version': JSON.stringify(package_data.version),
44
- })
45
- ],
46
- optimization: {
47
- minimize: true,
48
- minimizer: [
49
- new TerserPlugin({
50
- extractComments: false,//不将注释提取到单独的文件中
51
- }),
52
- ],
53
- }
54
-
55
- };