-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathwebpack.config.js
More file actions
128 lines (122 loc) · 3.16 KB
/
webpack.config.js
File metadata and controls
128 lines (122 loc) · 3.16 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
const path = require('path')
const CopyPlugin = require('copy-webpack-plugin')
const webpack = require('webpack')
const fs = require('fs')
const helpers = require('./webpack.helpers.js')
const WBMetaJsonGenerator = require('wb-packager-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const fileSystem = helpers.generateFS(__dirname + '/src/actions', 'workerB')
const entryFiles = helpers.generateEntryPaths(fileSystem.children)
const mode = process.argv.filter((val) => val.includes('--mode'))
let environment = 'production'
if (mode.length > 0 && mode[0].includes('dev')) {
environment = 'development'
}
const entryPaths = helpers.getFiles(entryFiles, '.ts').map((file) => file.replace('.ts', ''))
const folderDescriptionList = [
{
path: '/orgs/option/repos/option/workflows',
iconPath: 'src/actions/orgs/option/repos/option/workflows/workflows_logo.png',
description: 'List all the actions of a repo',
},
{
path: '/orgs/option/repos/option/workflows/option',
defaultAction: 'open',
},
{
path: '/orgs/option/repos/option/branches',
iconPath: 'src/actions/orgs/option/repos/option/branches/branch_logo.png',
description: 'List all the branches of a repo',
},
{
path: '/orgs/option/repos/option/branches/option',
defaultAction: 'open',
},
{
path: '/orgs/option/repos/option/issues',
iconPath: 'src/actions/orgs/option/repos/option/issues/issue_logo.png',
description: 'List all the issues of the repo',
defaultAction: 'open',
},
{
path: '/orgs/option/repos/option/issues/option',
defaultAction: 'open',
},
{
path: '/orgs/option/repos/option/pulls',
iconPath: 'src/actions/orgs/option/repos/option/pulls/pull_logo.png',
description: 'List all the pull requests of the repo',
defaultAction: 'open',
},
{
path: '/orgs/option/repos/option/pulls/option',
defaultAction: 'open',
},
{
path: '/orgs/option/repos',
iconPath: 'src/actions/orgs/option/repos/repo_logo.png',
description: 'List all the repos',
},
{
path: '/orgs/option/repos/option',
defaultAction: 'open',
},
{
path: '/orgs',
iconPath: 'src/actions/orgs/org_logo.png',
description: 'List all the organizations',
},
]
module.exports = {
entry: entryPaths.reduce((result, entryPath) => {
result[entryPath] = './src/actions/' + entryPath + '.ts'
return result
}, {}),
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
globalObject: 'this',
libraryTarget: 'umd',
library: 'main',
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.js?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: { presets: ['@babel/preset-env'] },
},
],
},
plugins: [
new WBMetaJsonGenerator({
environment,
package: 'Github',
packageDescription: 'github.com',
packageIcon: 'src/actions/package_logo.png',
readmeFile: 'README.md',
sites: ['https://www.github.com'],
folderDescriptionList,
}),
],
optimization: {
minimizer: [
new UglifyJsPlugin({
uglifyOptions: {
output: {
comments: /(@description|@name|@ignore)/i,
},
},
}),
],
},
}