-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathfiles.js
235 lines (199 loc) · 7.06 KB
/
files.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
import path from 'node:path';
import process from 'node:process';
const info = {
entries: [
"base1/cockpit.js",
"apps/apps.jsx",
"kdump/kdump.js",
// do *not* call this metrics/metrics -- uBlock origin etc. like to block metrics.{css,js}
"metrics/index.js",
"networkmanager/networkmanager.jsx",
"networkmanager/firewall.jsx",
"playground/index.js",
"playground/exception.js",
"playground/metrics.js",
"playground/pkgs.js",
"playground/plot.js",
"playground/react-patterns.js",
"playground/service.js",
"playground/speed.js",
"playground/test.js",
"playground/translate.js",
"playground/preloaded.js",
"playground/notifications-receiver.js",
"playground/journal.jsx",
"playground/remote.tsx",
"selinux/selinux.js",
"shell/shell.jsx",
"sosreport/sosreport.jsx",
"static/login.js",
"storaged/storaged.jsx",
"systemd/services.jsx",
"systemd/logs.jsx",
"systemd/overview.jsx",
"systemd/terminal.jsx",
"systemd/hwinfo.jsx",
"packagekit/updates.jsx",
"users/users.js",
],
tests: [
"base1/test-base64.js",
"base1/test-browser-storage.js",
"base1/test-cache.js",
"base1/test-chan.js",
"base1/test-channel.ts",
"base1/test-dbus-address.js",
"base1/test-dbus-framed.js",
"base1/test-dbus.js",
"base1/test-echo.js",
"base1/test-events.js",
"base1/test-external.js",
"base1/test-file.ts",
"base1/test-format.ts",
"base1/test-framed-cache.js",
"base1/test-framed.js",
"base1/test-fsinfo.ts",
"base1/test-http.js",
"base1/test-info.ts",
"base1/test-journal-renderer.js",
"base1/test-locale.js",
"base1/test-location.js",
"base1/test-metrics.js",
"base1/test-path.ts",
"base1/test-permissions.js",
"base1/test-promise.ts",
"base1/test-protocol.js",
"base1/test-series.js",
"base1/test-spawn-proc.js",
"base1/test-spawn.js",
"base1/test-stream.js",
"base1/test-timeformat.ts",
"base1/test-types.ts",
"base1/test-user.js",
"base1/test-websocket.js",
"kdump/test-config-client.js",
"networkmanager/test-utils.js",
"shell/machines/test-machines.js",
"storaged/test-util.js",
],
files: [
"apps/index.html",
"apps/default.png",
"kdump/index.html",
"metrics/index.html",
"networkmanager/index.html",
"networkmanager/firewall.html",
"packagekit/index.html",
"playground/index.html",
"playground/exception.html",
"playground/hammer.gif",
"playground/metrics.html",
"playground/pkgs.html",
"playground/plot.html",
"playground/react-patterns.html",
"playground/service.html",
"playground/speed.html",
"playground/test.html",
"playground/translate.html",
"playground/preloaded.html",
"playground/notifications-receiver.html",
"playground/journal.html",
"playground/remote.html",
"selinux/index.html",
"shell/images/server-error.png",
"shell/images/server-large.png",
"shell/images/server-small.png",
"shell/images/cockpit-icon.svg",
"shell/images/bg-plain.jpg",
"shell/index.html",
"shell/shell.html",
"sosreport/index.html",
"sosreport/sosreport.png",
"static/login.html",
"storaged/index.html",
"storaged/images/storage-array.png",
"storaged/images/storage-disk.png",
"systemd/index.html",
"systemd/logs.html",
"systemd/services.html",
"systemd/terminal.html",
"systemd/hwinfo.html",
"users/index.html",
]
};
const srcdir = process.env.SRCDIR || '.';
const nodedir = path.relative(process.cwd(), path.resolve(srcdir, "node_modules"));
export const all_subdirs = Array.from(new Set(info.entries.map(key => key.split('/')[0])));
// This are the fonts we used up until migrating to Patternfly v6
// It is kept here to make sure all dependencies of the fonts works like in
// third-party plugins etc.
// With the PF6 migration we now want to use Variable Fonts (VF) to ensure better
// Patternfly visuals, and we will use a new directory structure to avoid hardcoding
// @font-face.
//
// This copies all non-VF Red Hat fonts to our `static/fonts/` directory.
const redhat_fonts = [
"Text-Bold", "Text-BoldItalic", "Text-Italic", "Text-Medium", "Text-MediumItalic", "Text-Regular",
"Display-Black", "Display-BlackItalic", "Display-Bold", "Display-BoldItalic",
"Display-Italic", "Display-Medium", "Display-MediumItalic", "Display-Regular",
"Mono-Bold", "Mono-BoldItalic", "Mono-Italic", "Mono-Medium", "Mono-MediumItalic", "Mono-Regular",
].map(name => {
const subdir = 'RedHat' + name.split('-')[0];
const fontsdir = '@patternfly/patternfly/assets/fonts';
return {
from: path.resolve(nodedir, fontsdir, subdir, 'RedHat' + name + '.woff2'),
to: 'static/fonts/'
};
});
// Different directory structure than our redhat_fonts, which makes it easier
// to use the Patternfly default src and avoid hardcoding our own @font-face.
//
// This copies all variable fonts (VF in the name) to subdirectories:
// static/fonts/
// ├── RedHatDisplay
// │ └── RedHatDisplayVF.woff2
// ├── RedHatMono
// │ ├── RedHatMonoVF-Italic.woff2
// │ └── RedHatMonoVF.woff2
// ├── RedHatText
// │ ├── RedHatTextVF-Italic.woff2
// │ └── RedHatTextVF.woff2
const redhat_fonts_variable_font = [
"Text",
"Display",
"Mono",
].map(name => {
const subdir = 'RedHat' + name;
const fontsdir = '@patternfly/patternfly/assets/fonts';
return {
from: path.resolve(nodedir, fontsdir, subdir) + '/**/*VF*.woff2',
to: `static/fonts/${subdir}`
};
});
const pkgfile = suffix => `${srcdir}/pkg/${suffix}`;
export const getFiles = subdir => {
/* Qualify all the paths in entries */
const entryPoints = [];
info.entries.forEach(key => {
if (subdir && key.indexOf(subdir) !== 0)
return;
entryPoints.push(pkgfile(key));
});
/* Qualify all the paths in files listed */
const files = [];
info.files.forEach(value => {
if (!subdir || value.indexOf(subdir) === 0)
files.push({ from: pkgfile(value), to: path.dirname(value) });
});
if (subdir) {
const manifest = subdir + "/manifest.json";
files.push({ from: pkgfile(manifest), to: subdir });
} else {
all_subdirs.forEach(subdir => {
const manifest = subdir + "/manifest.json";
files.push({ from: pkgfile(manifest), to: subdir });
});
}
return ({ entryPoints, assetFiles: files, redhat_fonts: redhat_fonts.concat(redhat_fonts_variable_font) });
};
export const getTestFiles = () => info.tests;