@aurodesignsystem/auro-library 5.14.1 → 5.14.2
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/CHANGELOG.md +7 -0
- package/bin/generateDocs.mjs +4 -210
- package/bin/generateDocs_index.mjs +4 -210
- package/dist/_chunks/chunk-2MOEVVSZ.mjs +308 -0
- package/dist/_chunks/chunk-H7YO7ERJ.mjs +69 -0
- package/dist/_chunks/chunk-JLCAYVRX.mjs +84 -0
- package/dist/_chunks/chunk-RKBXVLA5.mjs +5983 -0
- package/dist/_chunks/chunk-TDFKN2EP.mjs +38 -0
- package/dist/_chunks/chunk-UY4SIQT6.mjs +201 -0
- package/dist/_chunks/chunk-V7YBXHAI.mjs +32379 -0
- package/dist/bin/generateDocs.mjs +152 -0
- package/dist/bin/generateDocs_index.mjs +152 -0
- package/dist/build/generateDocs.mjs +18 -0
- package/dist/build/generateReadme.mjs +49 -0
- package/dist/build/generateWcaComponent.mjs +6657 -0
- package/dist/build/processors/defaultDocsProcessor.mjs +16 -0
- package/dist/build/processors/defaultDotGithubSync.mjs +12 -0
- package/dist/build/syncGithubFiles.mjs +18 -0
- package/dist/utils/auroTemplateFiller.mjs +8 -0
- package/dist/utils/sharedFileProcessorUtils.mjs +31 -0
- package/package.json +10 -5
- package/scripts/build/generateDocs.mjs +4 -24
- package/scripts/build/generateReadme.mjs +4 -60
- package/scripts/build/generateWcaComponent.mjs +4 -43
- package/scripts/build/postinstall.mjs +10 -10
- package/scripts/build/pre-commit.mjs +13 -7
- package/scripts/build/processors/defaultDocsProcessor.mjs +4 -83
- package/scripts/build/processors/defaultDotGithubSync.mjs +4 -83
- package/scripts/build/syncGithubFiles.mjs +4 -25
- package/scripts/utils/ansiColors.mjs +119 -0
- package/scripts/utils/auroLibraryUtils.mjs +87 -51
- package/scripts/utils/auroTemplateFiller.mjs +4 -178
- package/scripts/utils/logger.mjs +27 -16
- package/scripts/utils/sharedFileProcessorUtils.mjs +4 -270
- package/scripts/build/deprecatedProseToFieldPlugin.spec.js +0 -188
- package/scripts/runtime/ClickTracker/test/ClickTracker.test.js +0 -424
- package/scripts/runtime/FocusTrap/test/FocusTrap.test.js +0 -168
- package/scripts/runtime/Focusables/test/Focusables.test.js +0 -185
- package/scripts/runtime/dateUtilities/dateFormatter.test.js +0 -284
- package/scripts/runtime/dateUtilities/dateUtilities.test.js +0 -80
- package/scripts/runtime/floatingUI/test/floatingUI.test.js +0 -189
- package/scripts/runtime/floatingUI.test.js +0 -478
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import{createRequire as __auroCreateRequire}from'node:module';const require=__auroCreateRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// scripts/utils/ansiColors.mjs
|
|
4
|
+
var ESC = "\x1B";
|
|
5
|
+
var RESET_COLOR = `${ESC}[39m`;
|
|
6
|
+
var BOLD_ON = `${ESC}[1m`;
|
|
7
|
+
var BOLD_OFF = `${ESC}[22m`;
|
|
8
|
+
function colorEnabled() {
|
|
9
|
+
const { FORCE_COLOR, NO_COLOR, TERM } = process.env;
|
|
10
|
+
if (FORCE_COLOR !== void 0) {
|
|
11
|
+
return FORCE_COLOR !== "0" && FORCE_COLOR !== "false";
|
|
12
|
+
}
|
|
13
|
+
if (NO_COLOR) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
if (TERM === "dumb") {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return Boolean(process.stdout?.isTTY);
|
|
20
|
+
}
|
|
21
|
+
function toRgb(hexColor) {
|
|
22
|
+
if (typeof hexColor !== "string") {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const raw = hexColor.replace(/^#/u, "");
|
|
26
|
+
const expanded = raw.length === 3 ? raw.split("").map((channel) => channel + channel).join("") : raw;
|
|
27
|
+
if (!/^[0-9a-f]{6}$/iu.test(expanded)) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return [
|
|
31
|
+
Number.parseInt(expanded.slice(0, 2), 16),
|
|
32
|
+
Number.parseInt(expanded.slice(2, 4), 16),
|
|
33
|
+
Number.parseInt(expanded.slice(4, 6), 16)
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
function hex(hexColor) {
|
|
37
|
+
const rgb = toRgb(hexColor);
|
|
38
|
+
const paint = (text, bold) => {
|
|
39
|
+
const body = `${text}`;
|
|
40
|
+
if (!rgb || body === "" || !colorEnabled()) {
|
|
41
|
+
return body;
|
|
42
|
+
}
|
|
43
|
+
const color = `${ESC}[38;2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
|
44
|
+
const open = bold ? `${color}${BOLD_ON}` : color;
|
|
45
|
+
const close = bold ? `${BOLD_OFF}${RESET_COLOR}` : RESET_COLOR;
|
|
46
|
+
return `${open}${body.replace(/(\r?\n)/gu, `${close}$1${open}`)}${close}`;
|
|
47
|
+
};
|
|
48
|
+
const colorize = (text) => paint(text, false);
|
|
49
|
+
colorize.bold = (text) => paint(text, true);
|
|
50
|
+
return colorize;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// scripts/utils/logger.mjs
|
|
54
|
+
var Logger = class _Logger {
|
|
55
|
+
/**
|
|
56
|
+
* Logs out messages in a readable format.
|
|
57
|
+
* @param {String} message - Message to be logged.
|
|
58
|
+
* @param {false | "info" | "success" | "error" | "warn"} status - Status that determines the color of the logged message.
|
|
59
|
+
* @param {Boolean} section - If true, adds a box around the message for readability.
|
|
60
|
+
*/
|
|
61
|
+
static auroLogger(message, status, section) {
|
|
62
|
+
if (status !== false) {
|
|
63
|
+
const infoColor = "#0096FF";
|
|
64
|
+
const successColor = "#4CBB17";
|
|
65
|
+
const errorColor = "#ff0000";
|
|
66
|
+
const warningColor = "#FFA500";
|
|
67
|
+
let color;
|
|
68
|
+
if (status === "info") {
|
|
69
|
+
color = infoColor;
|
|
70
|
+
} else if (status === "success") {
|
|
71
|
+
color = successColor;
|
|
72
|
+
} else if (status === "error") {
|
|
73
|
+
color = errorColor;
|
|
74
|
+
} else if (status === "warn") {
|
|
75
|
+
color = warningColor;
|
|
76
|
+
}
|
|
77
|
+
if (section) {
|
|
78
|
+
console.log(
|
|
79
|
+
hex(color)(
|
|
80
|
+
"\u256D \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E\n"
|
|
81
|
+
)
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
console.log(hex(color)(message));
|
|
85
|
+
if (section) {
|
|
86
|
+
console.log(
|
|
87
|
+
hex(color)(
|
|
88
|
+
"\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500\u256F"
|
|
89
|
+
)
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
if (section) {
|
|
94
|
+
console.log(
|
|
95
|
+
"\u256D \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E\n"
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
console.log(message);
|
|
99
|
+
if (section) {
|
|
100
|
+
console.log(
|
|
101
|
+
"\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500\u256F"
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
static log(message, section = false) {
|
|
107
|
+
_Logger.auroLogger(message, false, section);
|
|
108
|
+
}
|
|
109
|
+
static info(message, section = false) {
|
|
110
|
+
_Logger.auroLogger(message, "info", section);
|
|
111
|
+
}
|
|
112
|
+
static warn(message, section = false) {
|
|
113
|
+
_Logger.auroLogger(message, "warn", section);
|
|
114
|
+
}
|
|
115
|
+
static success(message, section = false) {
|
|
116
|
+
_Logger.auroLogger(message, "success", section);
|
|
117
|
+
}
|
|
118
|
+
static error(message, section = false) {
|
|
119
|
+
_Logger.auroLogger(message, "error", section);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// scripts/utils/auroLibraryUtils.mjs
|
|
124
|
+
import * as fs from "fs";
|
|
125
|
+
import * as path from "path";
|
|
126
|
+
import { fileURLToPath } from "url";
|
|
127
|
+
var AuroLibraryUtils = class {
|
|
128
|
+
getDirname() {
|
|
129
|
+
return fileURLToPath(import.meta.url);
|
|
130
|
+
}
|
|
131
|
+
get getProjectRootPath() {
|
|
132
|
+
const currentDir = this.getDirname();
|
|
133
|
+
if (!currentDir.includes("node_modules")) {
|
|
134
|
+
Logger.warn(
|
|
135
|
+
`Unable to determine best project root as node_modules
|
|
136
|
+
is not in the directory path.
|
|
137
|
+
|
|
138
|
+
Assuming - "${currentDir}"`,
|
|
139
|
+
true
|
|
140
|
+
);
|
|
141
|
+
return currentDir;
|
|
142
|
+
}
|
|
143
|
+
return currentDir.split("node_modules")[0];
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Copies and pastes all files in a source directory into a destination directory.
|
|
147
|
+
* @param {String} srcDir - File path of directory to copy from.
|
|
148
|
+
* @param {String} destDir - File path of directory to paste files into.
|
|
149
|
+
* @param {Boolean} removeFiles - If true, removes all files in destination directory before pasting files.
|
|
150
|
+
*/
|
|
151
|
+
copyDirectory(srcDir, destDir, removeFiles) {
|
|
152
|
+
if (!fs.existsSync(srcDir)) {
|
|
153
|
+
this.auroLogger(
|
|
154
|
+
`Source directory ${srcDir} does not exist`,
|
|
155
|
+
"error",
|
|
156
|
+
false
|
|
157
|
+
);
|
|
158
|
+
} else {
|
|
159
|
+
if (removeFiles && fs.existsSync(destDir)) {
|
|
160
|
+
const destFiles = fs.readdirSync(destDir);
|
|
161
|
+
let filesRemoved = 0;
|
|
162
|
+
destFiles.forEach((file) => {
|
|
163
|
+
const filePath = path.join(destDir, file);
|
|
164
|
+
fs.unlinkSync(filePath);
|
|
165
|
+
this.auroLogger(`Removed file: ${file}`, "success", false);
|
|
166
|
+
filesRemoved += 1;
|
|
167
|
+
});
|
|
168
|
+
if (filesRemoved > 0) {
|
|
169
|
+
this.auroLogger(`Removed ${filesRemoved} files`, "success", false);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (!fs.existsSync(destDir)) {
|
|
173
|
+
fs.mkdirSync(destDir);
|
|
174
|
+
}
|
|
175
|
+
const files = fs.readdirSync(srcDir);
|
|
176
|
+
files.forEach((file) => {
|
|
177
|
+
const sourceFilePath = path.join(srcDir, file);
|
|
178
|
+
const destFilePath = path.join(destDir, file);
|
|
179
|
+
const stat = fs.statSync(sourceFilePath);
|
|
180
|
+
if (stat.isDirectory()) {
|
|
181
|
+
this.copyDirectory(srcDir, destDir, removeFiles);
|
|
182
|
+
} else {
|
|
183
|
+
fs.copyFileSync(sourceFilePath, destFilePath);
|
|
184
|
+
fs.readFile(destFilePath, "utf8", (err, data) => {
|
|
185
|
+
this.formatFileContents(data, destFilePath);
|
|
186
|
+
});
|
|
187
|
+
this.auroLogger(`Copied file: ${file}`, "success");
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Logs out messages in a readable format.
|
|
194
|
+
* @param {String} message - Message to be logged.
|
|
195
|
+
* @param {"info" | "success" | "error"} status - Status that determines the color of the logged message.
|
|
196
|
+
* @param {Boolean} section - If true, adds a box around the message for readability.
|
|
197
|
+
*/
|
|
198
|
+
auroLogger(message, status, section) {
|
|
199
|
+
if (status) {
|
|
200
|
+
const infoColor = "#0096FF";
|
|
201
|
+
const successColor = "#4CBB17";
|
|
202
|
+
const errorColor = "#ff0000";
|
|
203
|
+
let color;
|
|
204
|
+
if (status === "info") {
|
|
205
|
+
color = infoColor;
|
|
206
|
+
} else if (status === "success") {
|
|
207
|
+
color = successColor;
|
|
208
|
+
} else if (status === "error") {
|
|
209
|
+
color = errorColor;
|
|
210
|
+
}
|
|
211
|
+
if (section) {
|
|
212
|
+
console.log(
|
|
213
|
+
hex(color)(
|
|
214
|
+
"\u256D \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E\n"
|
|
215
|
+
)
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
console.log(hex(color)(message));
|
|
219
|
+
if (section) {
|
|
220
|
+
console.log(
|
|
221
|
+
hex(color)(
|
|
222
|
+
"\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500\u256F"
|
|
223
|
+
)
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
} else {
|
|
227
|
+
if (section) {
|
|
228
|
+
console.log(
|
|
229
|
+
"\u256D \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E\n"
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
console.log(message);
|
|
233
|
+
if (section) {
|
|
234
|
+
console.log(
|
|
235
|
+
"\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500\u256F"
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Extracts NPM VERSION, BRANCH NAME, NPM, NAMESPACE, and NAME from package.json.
|
|
242
|
+
* @returns {Object} result - Object containing data from package.json.
|
|
243
|
+
*/
|
|
244
|
+
nameExtraction() {
|
|
245
|
+
let packageJson = fs.readFileSync("package.json", "utf8", (err) => {
|
|
246
|
+
if (err) {
|
|
247
|
+
console.log("ERROR: Unable to read package.json file", err);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
packageJson = JSON.parse(packageJson);
|
|
251
|
+
const pName = packageJson.name;
|
|
252
|
+
const npmStart = pName.indexOf("@");
|
|
253
|
+
const namespaceStart = pName.indexOf("/");
|
|
254
|
+
const nameStart = pName.indexOf("-");
|
|
255
|
+
return {
|
|
256
|
+
abstractNodeVersion: packageJson.engines.node.substring(2),
|
|
257
|
+
branchName: packageJson.release.branch,
|
|
258
|
+
npm: pName.substring(npmStart, namespaceStart),
|
|
259
|
+
namespace: pName.substring(namespaceStart + 1, nameStart),
|
|
260
|
+
namespaceCap: pName.substring(namespaceStart + 1)[0].toUpperCase() + pName.substring(namespaceStart + 2, nameStart),
|
|
261
|
+
name: pName.substring(nameStart + 1),
|
|
262
|
+
nameCap: pName.substring(nameStart + 1)[0].toUpperCase() + pName.substring(nameStart + 2),
|
|
263
|
+
version: packageJson.version,
|
|
264
|
+
tokensVersion: packageJson.peerDependencies?.["@aurodesignsystem/design-tokens"]?.substring(1) ?? "",
|
|
265
|
+
wcssVersion: packageJson.peerDependencies?.["@aurodesignsystem/webcorestylesheets"]?.substring(1) ?? ""
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Replace all instances of [abstractNodeVersion], [branchName], [npm], [name], [Name], [namespace] and [Namespace] accordingly.
|
|
270
|
+
* @param {String} content - The content to be formatted.
|
|
271
|
+
* @param {String} destination - The location to write the formatted content.
|
|
272
|
+
* @returns {void}
|
|
273
|
+
*/
|
|
274
|
+
formatFileContents(content, destination) {
|
|
275
|
+
const nameExtractionData = this.nameExtraction();
|
|
276
|
+
let result = content;
|
|
277
|
+
result = result.replace(
|
|
278
|
+
/\[abstractNodeVersion]/g,
|
|
279
|
+
nameExtractionData.abstractNodeVersion
|
|
280
|
+
);
|
|
281
|
+
result = result.replace(/\[branchName]/g, nameExtractionData.branchName);
|
|
282
|
+
result = result.replace(/\[npm]/g, nameExtractionData.npm);
|
|
283
|
+
result = result.replace(/\[name](?!\()/g, nameExtractionData.name);
|
|
284
|
+
result = result.replace(/\[Name](?!\()/g, nameExtractionData.nameCap);
|
|
285
|
+
result = result.replace(/\[namespace]/g, nameExtractionData.namespace);
|
|
286
|
+
result = result.replace(/\[Namespace]/g, nameExtractionData.namespaceCap);
|
|
287
|
+
result = result.replace(/\[Version]/g, nameExtractionData.version);
|
|
288
|
+
result = result.replace(/\[dtVersion]/g, nameExtractionData.tokensVersion);
|
|
289
|
+
result = result.replace(/\[wcssVersion]/g, nameExtractionData.wcssVersion);
|
|
290
|
+
result = result.replace(/(\r\n|\r|\n)[\s]+(\r\n|\r|\n)/g, "\r\n\r\n");
|
|
291
|
+
result = result.replace(/>(\r\n|\r|\n){2,}/g, ">\r\n");
|
|
292
|
+
result = result.replace(/>(\r\n|\r|\n)```/g, ">\r\n\r\n```");
|
|
293
|
+
result = result.replace(
|
|
294
|
+
/>(\r\n|\r|\n){2,}```(\r\n|\r|\n)/g,
|
|
295
|
+
">\r\n```\r\n"
|
|
296
|
+
);
|
|
297
|
+
result = result.replace(
|
|
298
|
+
/([^(\r\n|\r|\n)])(\r?\n|\r(?!\n))+#/g,
|
|
299
|
+
"$1\r\n\r\n#"
|
|
300
|
+
);
|
|
301
|
+
fs.writeFileSync(destination, result, { encoding: "utf8" });
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
export {
|
|
306
|
+
Logger,
|
|
307
|
+
AuroLibraryUtils
|
|
308
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import{createRequire as __auroCreateRequire}from'node:module';const require=__auroCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
fromAuroComponentRoot,
|
|
4
|
+
generateReadmeUrl,
|
|
5
|
+
processContentForFile,
|
|
6
|
+
templateFiller
|
|
7
|
+
} from "./chunk-UY4SIQT6.mjs";
|
|
8
|
+
import {
|
|
9
|
+
Logger
|
|
10
|
+
} from "./chunk-2MOEVVSZ.mjs";
|
|
11
|
+
|
|
12
|
+
// src/build/processors/defaultDocsProcessor.mjs
|
|
13
|
+
var defaultDocsProcessorConfig = {
|
|
14
|
+
overwriteLocalCopies: true,
|
|
15
|
+
remoteReadmeVersion: "master",
|
|
16
|
+
// eslint-disable-next-line no-warning-comments
|
|
17
|
+
// TODO: remove this variant when all components are updated to use latest auro-library
|
|
18
|
+
// AND the default README.md is updated to use the new paths
|
|
19
|
+
remoteReadmeVariant: "_updated_paths"
|
|
20
|
+
};
|
|
21
|
+
var fileConfigs = (config) => [
|
|
22
|
+
// README.md
|
|
23
|
+
{
|
|
24
|
+
identifier: "README.md",
|
|
25
|
+
input: {
|
|
26
|
+
remoteUrl: generateReadmeUrl(
|
|
27
|
+
config.remoteReadmeVersion,
|
|
28
|
+
config.remoteReadmeVariant
|
|
29
|
+
),
|
|
30
|
+
fileName: fromAuroComponentRoot("/docTemplates/README.md"),
|
|
31
|
+
overwrite: config.overwriteLocalCopies
|
|
32
|
+
},
|
|
33
|
+
output: fromAuroComponentRoot("/README.md")
|
|
34
|
+
},
|
|
35
|
+
// index.md
|
|
36
|
+
{
|
|
37
|
+
identifier: "index.md",
|
|
38
|
+
input: fromAuroComponentRoot("/docs/partials/index.md"),
|
|
39
|
+
output: fromAuroComponentRoot("/demo/index.md"),
|
|
40
|
+
mdMagicConfig: {
|
|
41
|
+
output: {
|
|
42
|
+
directory: fromAuroComponentRoot("/demo")
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
// api.md
|
|
47
|
+
{
|
|
48
|
+
identifier: "api.md",
|
|
49
|
+
input: fromAuroComponentRoot("/docs/partials/api.md"),
|
|
50
|
+
output: fromAuroComponentRoot("/demo/api.md"),
|
|
51
|
+
preProcessors: [templateFiller.formatApiTable]
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
async function processDocFiles(config = defaultDocsProcessorConfig) {
|
|
55
|
+
await templateFiller.extractNames();
|
|
56
|
+
for (const fileConfig of fileConfigs(config)) {
|
|
57
|
+
try {
|
|
58
|
+
await processContentForFile(fileConfig);
|
|
59
|
+
} catch (err) {
|
|
60
|
+
Logger.error(`Error processing ${fileConfig.identifier}: ${err.message}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
defaultDocsProcessorConfig,
|
|
67
|
+
fileConfigs,
|
|
68
|
+
processDocFiles
|
|
69
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import{createRequire as __auroCreateRequire}from'node:module';const require=__auroCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
fromAuroComponentRoot,
|
|
4
|
+
generateWCGeneratorUrl,
|
|
5
|
+
processContentForFile,
|
|
6
|
+
templateFiller
|
|
7
|
+
} from "./chunk-UY4SIQT6.mjs";
|
|
8
|
+
import {
|
|
9
|
+
Logger
|
|
10
|
+
} from "./chunk-2MOEVVSZ.mjs";
|
|
11
|
+
|
|
12
|
+
// src/build/processors/defaultDotGithubSync.mjs
|
|
13
|
+
var DOT_GITHUB_PATH = ".github";
|
|
14
|
+
var ISSUE_TEMPLATE_PATH = `${DOT_GITHUB_PATH}/ISSUE_TEMPLATE`;
|
|
15
|
+
var defaultGitHubSyncConfig = {
|
|
16
|
+
overwriteLocalCopies: true,
|
|
17
|
+
generatorTemplateVersion: "master"
|
|
18
|
+
};
|
|
19
|
+
var defaultGitHubTemplateFiles = (config = defaultGitHubSyncConfig) => [
|
|
20
|
+
// bug_report.yml
|
|
21
|
+
{
|
|
22
|
+
identifier: "bug_report.yml",
|
|
23
|
+
input: {
|
|
24
|
+
remoteUrl: generateWCGeneratorUrl(
|
|
25
|
+
config.generatorTemplateVersion,
|
|
26
|
+
`templates/${ISSUE_TEMPLATE_PATH}/bug_report.yml`
|
|
27
|
+
),
|
|
28
|
+
fileName: fromAuroComponentRoot(
|
|
29
|
+
`docTemplates/${ISSUE_TEMPLATE_PATH}/bug_report.yml`
|
|
30
|
+
),
|
|
31
|
+
overwrite: config.overwriteLocalCopies
|
|
32
|
+
},
|
|
33
|
+
output: fromAuroComponentRoot(`${ISSUE_TEMPLATE_PATH}/bug_report.yml`)
|
|
34
|
+
},
|
|
35
|
+
// config.yml
|
|
36
|
+
{
|
|
37
|
+
identifier: "config.yml",
|
|
38
|
+
input: {
|
|
39
|
+
remoteUrl: generateWCGeneratorUrl(
|
|
40
|
+
config.generatorTemplateVersion,
|
|
41
|
+
`templates/${ISSUE_TEMPLATE_PATH}/config.yml`
|
|
42
|
+
),
|
|
43
|
+
fileName: fromAuroComponentRoot(
|
|
44
|
+
`docTemplates/${ISSUE_TEMPLATE_PATH}/config.yml`
|
|
45
|
+
),
|
|
46
|
+
overwrite: config.overwriteLocalCopies
|
|
47
|
+
},
|
|
48
|
+
output: fromAuroComponentRoot(`${ISSUE_TEMPLATE_PATH}/config.yml`)
|
|
49
|
+
},
|
|
50
|
+
// PULL_REQUEST_TEMPLATE.md
|
|
51
|
+
{
|
|
52
|
+
identifier: "PULL_REQUEST_TEMPLATE.md",
|
|
53
|
+
input: {
|
|
54
|
+
remoteUrl: generateWCGeneratorUrl(
|
|
55
|
+
config.generatorTemplateVersion,
|
|
56
|
+
`templates/${DOT_GITHUB_PATH}/PULL_REQUEST_TEMPLATE.md`
|
|
57
|
+
),
|
|
58
|
+
fileName: fromAuroComponentRoot(
|
|
59
|
+
`docTemplates/${DOT_GITHUB_PATH}/PULL_REQUEST_TEMPLATE.md`
|
|
60
|
+
),
|
|
61
|
+
overwrite: config.overwriteLocalCopies
|
|
62
|
+
},
|
|
63
|
+
output: fromAuroComponentRoot(
|
|
64
|
+
`${DOT_GITHUB_PATH}/PULL_REQUEST_TEMPLATE.md`
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
];
|
|
68
|
+
async function syncGithubFiles(config = defaultGitHubSyncConfig) {
|
|
69
|
+
await templateFiller.extractNames();
|
|
70
|
+
for (const file of defaultGitHubTemplateFiles(config)) {
|
|
71
|
+
try {
|
|
72
|
+
Logger.log(`Processing file: ${file.identifier}`);
|
|
73
|
+
await processContentForFile(file);
|
|
74
|
+
} catch (error) {
|
|
75
|
+
Logger.error(
|
|
76
|
+
`Error processing file: ${file.identifier}, ${error.message}`
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
syncGithubFiles
|
|
84
|
+
};
|