This repository has been archived by the owner on Feb 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.installer.config.js
107 lines (103 loc) · 2.64 KB
/
webpack.installer.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// run via `npm run package` (see scripts in package.json)
// using stuff from /package, this packages a full Dnn installer Zip
// This needs to be the very first import so that it is the first to run,
// otherwise the env global variable might not contain the contents of the .env file.
import './gulpfileDir/config/envLoader.js';
import path, { resolve } from 'path';
import FileManagerPlugin from 'filemanager-webpack-plugin';
import * as paths from './gulpfileDir/config/paths.js';
// ES6 doesn't have __filename or __dirname global variables so this creates them for us.
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const webpackPlugins = [
new FileManagerPlugin({
runTasksInSeries: true,
events: {
onEnd: [
{
delete: [`${paths.pkg.temp}`],
},
{
delete: [`${paths.pkg.path}/main.js`],
},
{
mkdir: [`${paths.pkg.temp}`],
},
{
archive: [
{
source: `${paths.container}`,
destination: `${paths.pkg.temp}/cont.zip`,
},
],
},
{
archive: [
{
source: `${paths.skin}`,
destination: `${paths.pkg.temp}/main.zip`,
},
],
},
{
archive: [
{
source: `${paths.pkg.code}`,
destination: `${paths.pkg.temp}/appc.zip`,
},
],
},
{
copy: [
{
source: `${paths.pkg.path}/*.dnn`,
destination: `${paths.pkg.temp}`,
},
],
},
{
copy: [
{
source: `${paths.pkg.static}/*.{png,txt}`,
destination: `${paths.pkg.temp}`,
},
],
},
{
archive: [
{
source: `${paths.pkg.temp}`,
destination: `${paths.pkg.path}/${paths.pkg.name}-000001-Install.zip`,
},
],
},
],
},
}),
];
export default {
mode: 'production',
entry: resolve(__dirname, 'package/static/manifest.dnn'),
output: {
path: resolve(__dirname, `${paths.pkg.path}`),
},
module: {
rules: [
{
test: /\.dnn/,
use: [
{
loader: 'file-loader',
options: {
outputPath: './',
name: 'manifest.dnn',
},
},
resolve(__dirname, 'package/static/DNN-manifest-loader.cjs'),
],
},
],
},
plugins: webpackPlugins,
};