@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,16 @@
|
|
|
1
|
+
import{createRequire as __auroCreateRequire}from'node:module';const require=__auroCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
defaultDocsProcessorConfig,
|
|
4
|
+
fileConfigs,
|
|
5
|
+
processDocFiles
|
|
6
|
+
} from "../../_chunks/chunk-H7YO7ERJ.mjs";
|
|
7
|
+
import "../../_chunks/chunk-UY4SIQT6.mjs";
|
|
8
|
+
import "../../_chunks/chunk-RKBXVLA5.mjs";
|
|
9
|
+
import "../../_chunks/chunk-2MOEVVSZ.mjs";
|
|
10
|
+
import "../../_chunks/chunk-V7YBXHAI.mjs";
|
|
11
|
+
import "../../_chunks/chunk-TDFKN2EP.mjs";
|
|
12
|
+
export {
|
|
13
|
+
defaultDocsProcessorConfig,
|
|
14
|
+
fileConfigs,
|
|
15
|
+
processDocFiles
|
|
16
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{createRequire as __auroCreateRequire}from'node:module';const require=__auroCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
syncGithubFiles
|
|
4
|
+
} from "../../_chunks/chunk-JLCAYVRX.mjs";
|
|
5
|
+
import "../../_chunks/chunk-UY4SIQT6.mjs";
|
|
6
|
+
import "../../_chunks/chunk-RKBXVLA5.mjs";
|
|
7
|
+
import "../../_chunks/chunk-2MOEVVSZ.mjs";
|
|
8
|
+
import "../../_chunks/chunk-V7YBXHAI.mjs";
|
|
9
|
+
import "../../_chunks/chunk-TDFKN2EP.mjs";
|
|
10
|
+
export {
|
|
11
|
+
syncGithubFiles
|
|
12
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{createRequire as __auroCreateRequire}from'node:module';const require=__auroCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
syncGithubFiles
|
|
4
|
+
} from "../_chunks/chunk-JLCAYVRX.mjs";
|
|
5
|
+
import "../_chunks/chunk-UY4SIQT6.mjs";
|
|
6
|
+
import "../_chunks/chunk-RKBXVLA5.mjs";
|
|
7
|
+
import {
|
|
8
|
+
Logger
|
|
9
|
+
} from "../_chunks/chunk-2MOEVVSZ.mjs";
|
|
10
|
+
import "../_chunks/chunk-V7YBXHAI.mjs";
|
|
11
|
+
import "../_chunks/chunk-TDFKN2EP.mjs";
|
|
12
|
+
|
|
13
|
+
// src/build/syncGithubFiles.mjs
|
|
14
|
+
syncGithubFiles().then(() => {
|
|
15
|
+
Logger.log("Docs processed successfully");
|
|
16
|
+
}).catch((err) => {
|
|
17
|
+
Logger.error(`Error processing docs: ${err.message}`);
|
|
18
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{createRequire as __auroCreateRequire}from'node:module';const require=__auroCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
AuroTemplateFiller
|
|
4
|
+
} from "../_chunks/chunk-RKBXVLA5.mjs";
|
|
5
|
+
import "../_chunks/chunk-TDFKN2EP.mjs";
|
|
6
|
+
export {
|
|
7
|
+
AuroTemplateFiller
|
|
8
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import{createRequire as __auroCreateRequire}from'node:module';const require=__auroCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
MD_MAGIC_CONFIG,
|
|
4
|
+
auroLibraryUtils,
|
|
5
|
+
fromAuroComponentRoot,
|
|
6
|
+
generateReadmeUrl,
|
|
7
|
+
generateWCGeneratorUrl,
|
|
8
|
+
nonEsmComponents,
|
|
9
|
+
optionallyCopyFile,
|
|
10
|
+
processContentForFile,
|
|
11
|
+
retrieveRemoteFileCopy,
|
|
12
|
+
runMarkdownMagicOnFile,
|
|
13
|
+
templateFiller
|
|
14
|
+
} from "../_chunks/chunk-UY4SIQT6.mjs";
|
|
15
|
+
import "../_chunks/chunk-RKBXVLA5.mjs";
|
|
16
|
+
import "../_chunks/chunk-2MOEVVSZ.mjs";
|
|
17
|
+
import "../_chunks/chunk-V7YBXHAI.mjs";
|
|
18
|
+
import "../_chunks/chunk-TDFKN2EP.mjs";
|
|
19
|
+
export {
|
|
20
|
+
MD_MAGIC_CONFIG,
|
|
21
|
+
auroLibraryUtils,
|
|
22
|
+
fromAuroComponentRoot,
|
|
23
|
+
generateReadmeUrl,
|
|
24
|
+
generateWCGeneratorUrl,
|
|
25
|
+
nonEsmComponents,
|
|
26
|
+
optionallyCopyFile,
|
|
27
|
+
processContentForFile,
|
|
28
|
+
retrieveRemoteFileCopy,
|
|
29
|
+
runMarkdownMagicOnFile,
|
|
30
|
+
templateFiller
|
|
31
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aurodesignsystem/auro-library",
|
|
3
|
-
"version": "5.14.
|
|
3
|
+
"version": "5.14.2",
|
|
4
4
|
"description": "This repository holds shared scripts, utilities, and workflows utilized across repositories along the Auro Design System.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,12 +15,10 @@
|
|
|
15
15
|
"generateDocs": "./bin/generateDocs.mjs"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"handlebars": "^4.7.8",
|
|
19
|
-
"markdown-magic": "^2.6.1",
|
|
20
18
|
"@floating-ui/dom": "^1.7.4"
|
|
21
19
|
},
|
|
22
20
|
"devDependencies": {
|
|
23
|
-
"@aurodesignsystem/auro-cli": "^3.
|
|
21
|
+
"@aurodesignsystem/auro-cli": "^3.7.1",
|
|
24
22
|
"@aurodesignsystem/auro-config": "^1.3.1",
|
|
25
23
|
"@commitlint/cli": "^18.5.0",
|
|
26
24
|
"@commitlint/config-conventional": "^18.5.0",
|
|
@@ -28,7 +26,11 @@
|
|
|
28
26
|
"@semantic-release/changelog": "^6.0.3",
|
|
29
27
|
"@semantic-release/git": "^10.0.1",
|
|
30
28
|
"@semantic-release/npm": "^13.0.0",
|
|
29
|
+
"esbuild": "^0.24.2",
|
|
30
|
+
"glob": "^11.0.3",
|
|
31
|
+
"handlebars": "^4.7.8",
|
|
31
32
|
"husky": "^9.1.7",
|
|
33
|
+
"markdown-magic": "^2.6.1",
|
|
32
34
|
"npm-run-all": "^4.1.5",
|
|
33
35
|
"semantic-release": "^25.0.0",
|
|
34
36
|
"sinon": "^20.0.0",
|
|
@@ -74,10 +76,13 @@
|
|
|
74
76
|
"provenance": true
|
|
75
77
|
},
|
|
76
78
|
"scripts": {
|
|
77
|
-
"prepare": "husky install",
|
|
79
|
+
"prepare": "husky install && npm run build:bundles",
|
|
80
|
+
"prepack": "npm run build:bundles",
|
|
78
81
|
"lint": "biome check --no-errors-on-unmatched",
|
|
79
82
|
"lint:fix": "biome check --fix --no-errors-on-unmatched",
|
|
83
|
+
"build:bundles": "node build/bundleDocsScripts.mjs",
|
|
80
84
|
"build:docs": "node scripts/build/generateReadme.mjs",
|
|
85
|
+
"pretest:vitest": "npm run build:bundles",
|
|
81
86
|
"test:vitest": "vitest --run",
|
|
82
87
|
"test:vitest:watch": "vitest",
|
|
83
88
|
"test:auro": "auro test --files 'scripts/**/*.test.js'",
|
|
@@ -1,24 +1,4 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// This script will generate the docs for the component
|
|
6
|
-
// based on example HTML, markdown files, and more.
|
|
7
|
-
//
|
|
8
|
-
// The actions in this file live in:
|
|
9
|
-
// scripts/build/processors/defaultDocsProcessor.mjs
|
|
10
|
-
//
|
|
11
|
-
// This script is intended to be run AS-IS without modification.
|
|
12
|
-
// To run a different processor, please see the defaultDocsProcessor.mjs file
|
|
13
|
-
// and re-create in your repo OR add a new processor file.
|
|
14
|
-
// ------------------------------------------------------
|
|
15
|
-
|
|
16
|
-
import {Logger} from "../utils/logger.mjs";
|
|
17
|
-
import {processDocFiles} from "./processors/defaultDocsProcessor.mjs";
|
|
18
|
-
|
|
19
|
-
processDocFiles().then(() => {
|
|
20
|
-
Logger.log('Docs processed successfully');
|
|
21
|
-
}).
|
|
22
|
-
catch((err) => {
|
|
23
|
-
Logger.error(`Error processing docs: ${err.message}`);
|
|
24
|
-
});
|
|
1
|
+
// Shim for the pre-compiled build. Do not edit.
|
|
2
|
+
// Generated by build/bundleDocsScripts.mjs from src/build/generateDocs.mjs.
|
|
3
|
+
// Edit that file, then run `npm run build:bundles`.
|
|
4
|
+
import "../../dist/build/generateDocs.mjs";
|
|
@@ -1,60 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const readmeFilePath = dirDocs + '/README.md';
|
|
6
|
-
|
|
7
|
-
import AuroLibraryUtils from "../utils/auroLibraryUtils.mjs";
|
|
8
|
-
|
|
9
|
-
const auroLibraryUtils = new AuroLibraryUtils();
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Compiles `./docs/README.md` -> `./README.md`
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
function processReadme() {
|
|
16
|
-
const callback = function() {
|
|
17
|
-
|
|
18
|
-
if (fs.existsSync('./README.md')) {
|
|
19
|
-
fs.readFile('./README.md', 'utf8', function(err, data) {
|
|
20
|
-
auroLibraryUtils.formatFileContents(data, './README.md');
|
|
21
|
-
});
|
|
22
|
-
} else {
|
|
23
|
-
console.log('ERROR: ./README.md file is missing');
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const config = {
|
|
28
|
-
matchWord: 'AURO-GENERATED-CONTENT',
|
|
29
|
-
outputDir: './'
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const markdownPath = './docs/README.md';
|
|
33
|
-
|
|
34
|
-
markdownMagic(markdownPath, config, callback);
|
|
35
|
-
|
|
36
|
-
fs.copyFileSync(readmeFilePath, './README.md');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Copy README.md template from static source
|
|
41
|
-
* */
|
|
42
|
-
|
|
43
|
-
function copyReadmeLocally() {
|
|
44
|
-
|
|
45
|
-
if (!fs.existsSync(dirDocs)){
|
|
46
|
-
fs.mkdirSync(dirDocs);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (!fs.existsSync(readmeFilePath)) {
|
|
50
|
-
fs.writeFile(readmeFilePath, '', function(err) {
|
|
51
|
-
if(err) {
|
|
52
|
-
console.log('ERROR: Unable to create README.md file.', err);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
processReadme();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
copyReadmeLocally();
|
|
1
|
+
// Shim for the pre-compiled build. Do not edit.
|
|
2
|
+
// Generated by build/bundleDocsScripts.mjs from src/build/generateReadme.mjs.
|
|
3
|
+
// Edit that file, then run `npm run build:bundles`.
|
|
4
|
+
import "../../dist/build/generateReadme.mjs";
|
|
@@ -1,43 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import getTemplatedComponentCode from './prepWcaCompatibleCode.mjs';
|
|
6
|
-
|
|
7
|
-
const promisifiedGlob = util.promisify(glob);
|
|
8
|
-
|
|
9
|
-
const WAC_DIR = path.resolve(process.cwd(), './scripts/wca');
|
|
10
|
-
|
|
11
|
-
async function globPath(sources) {
|
|
12
|
-
try {
|
|
13
|
-
const fileArrays = await Promise.all(
|
|
14
|
-
sources.map(source => promisifiedGlob(source))
|
|
15
|
-
);
|
|
16
|
-
return fileArrays.flat();
|
|
17
|
-
} catch (err) {
|
|
18
|
-
console.error('Error processing glob patterns:', err);
|
|
19
|
-
throw err; // Re-throw to handle failure at caller
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function createExtendsFile(filePaths) {
|
|
24
|
-
if (!fs.existsSync(WAC_DIR)) {
|
|
25
|
-
await fs.promises.mkdir(WAC_DIR, { recursive: true });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
for (const filePath of filePaths) {
|
|
29
|
-
const resolvedPath = path.resolve(process.cwd(), filePath);
|
|
30
|
-
const fileContent = await fs.promises.readFile(resolvedPath, 'utf-8',);
|
|
31
|
-
const newPath = path.resolve(WAC_DIR, `${path.basename(filePath)}`);
|
|
32
|
-
const newCode = getTemplatedComponentCode(fileContent, path.relative(WAC_DIR, filePath));
|
|
33
|
-
await fs.promises.writeFile(newPath, newCode);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async function main() {
|
|
38
|
-
// files to analyze
|
|
39
|
-
const filePaths = await globPath(process.argv.slice(2));
|
|
40
|
-
await createExtendsFile(filePaths);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
main();
|
|
1
|
+
// Shim for the pre-compiled build. Do not edit.
|
|
2
|
+
// Generated by build/bundleDocsScripts.mjs from src/build/generateWcaComponent.mjs.
|
|
3
|
+
// Edit that file, then run `npm run build:bundles`.
|
|
4
|
+
import "../../dist/build/generateWcaComponent.mjs";
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import { createRequire } from 'node:module';
|
|
5
|
-
import { resolve } from 'path';
|
|
6
|
-
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { resolve } from "path";
|
|
3
|
+
import { hex } from "../utils/ansiColors.mjs";
|
|
7
4
|
|
|
8
5
|
const require = createRequire(import.meta.url);
|
|
9
|
-
const pjson = require(resolve(process.cwd(),
|
|
6
|
+
const pjson = require(resolve(process.cwd(), "package.json"));
|
|
10
7
|
|
|
11
|
-
console.log(
|
|
8
|
+
console.log(
|
|
9
|
+
hex("#f26135")(`
|
|
12
10
|
|
|
13
11
|
_______ __ __ __
|
|
14
12
|
| __|.---.-.--.--. | |--.-----.| | |.-----.
|
|
@@ -24,8 +22,10 @@ console.log(chalk.hex('#f26135')(`
|
|
|
24
22
|
╭ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ──────────────────────────────╮
|
|
25
23
|
|
|
26
24
|
Thanks for installing the latest version
|
|
27
|
-
of `) +
|
|
25
|
+
of `) +
|
|
26
|
+
hex("#ffd200").bold(`${pjson.name} v${pjson.version}.`) +
|
|
27
|
+
hex("#f26135")(`
|
|
28
28
|
|
|
29
29
|
╰─────────────────────────────── ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯
|
|
30
|
-
`)
|
|
30
|
+
`),
|
|
31
31
|
);
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { hex } from "../utils/ansiColors.mjs";
|
|
4
4
|
|
|
5
|
-
console.log(
|
|
5
|
+
console.log(
|
|
6
|
+
hex("#ffd200")(`
|
|
6
7
|
|
|
7
|
-
╭ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ──────────────────────────────╮`) +
|
|
8
|
+
╭ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ──────────────────────────────╮`) +
|
|
9
|
+
hex("#f26135")(`
|
|
8
10
|
|
|
9
11
|
Are you familiar with Auro's Definition of Done?
|
|
10
12
|
|
|
11
|
-
Please be sure to review`) +
|
|
12
|
-
|
|
13
|
+
Please be sure to review`) +
|
|
14
|
+
hex("#ffd200")(`
|
|
15
|
+
https://auro.alaskaair.com/definition-of-done`) +
|
|
16
|
+
hex("#f26135")(`
|
|
13
17
|
before submitting your pull request
|
|
14
|
-
to ensure that you are compliant.`) +
|
|
18
|
+
to ensure that you are compliant.`) +
|
|
19
|
+
hex("#ffd200")(`
|
|
15
20
|
|
|
16
21
|
╰─────────────────────────────── ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯
|
|
17
|
-
`)
|
|
22
|
+
`),
|
|
23
|
+
);
|
|
@@ -1,83 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
processContentForFile,
|
|
6
|
-
templateFiller
|
|
7
|
-
} from "../../utils/sharedFileProcessorUtils.mjs";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Processor config object.
|
|
11
|
-
* @typedef {Object} ProcessorConfig
|
|
12
|
-
* @property {boolean} [overwriteLocalCopies=true] - The release version tag to use instead of master.
|
|
13
|
-
* @property {string} [remoteReadmeVersion="master"] - The release version tag to use instead of master.
|
|
14
|
-
* @property {string} [remoteReadmeVariant=""] - The variant string to use for the README source.
|
|
15
|
-
* (like "_esm" to make README_esm.md).
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @param {ProcessorConfig} config - The configuration for this processor.
|
|
21
|
-
*/
|
|
22
|
-
export const defaultDocsProcessorConfig = {
|
|
23
|
-
overwriteLocalCopies: true,
|
|
24
|
-
remoteReadmeVersion: "master",
|
|
25
|
-
// eslint-disable-next-line no-warning-comments
|
|
26
|
-
// TODO: remove this variant when all components are updated to use latest auro-library
|
|
27
|
-
// AND the default README.md is updated to use the new paths
|
|
28
|
-
remoteReadmeVariant: "_updated_paths"
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @param {ProcessorConfig} config - The configuration for this processor.
|
|
33
|
-
* @returns {import('../utils/sharedFileProcessorUtils').FileProcessorConfig[]}
|
|
34
|
-
*/
|
|
35
|
-
export const fileConfigs = (config) => [
|
|
36
|
-
// README.md
|
|
37
|
-
{
|
|
38
|
-
identifier: 'README.md',
|
|
39
|
-
input: {
|
|
40
|
-
remoteUrl: generateReadmeUrl(config.remoteReadmeVersion, config.remoteReadmeVariant),
|
|
41
|
-
fileName: fromAuroComponentRoot(`/docTemplates/README.md`),
|
|
42
|
-
overwrite: config.overwriteLocalCopies
|
|
43
|
-
},
|
|
44
|
-
output: fromAuroComponentRoot("/README.md")
|
|
45
|
-
},
|
|
46
|
-
// index.md
|
|
47
|
-
{
|
|
48
|
-
identifier: 'index.md',
|
|
49
|
-
input: fromAuroComponentRoot("/docs/partials/index.md"),
|
|
50
|
-
output: fromAuroComponentRoot("/demo/index.md"),
|
|
51
|
-
mdMagicConfig: {
|
|
52
|
-
output: {
|
|
53
|
-
directory: fromAuroComponentRoot("/demo")
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
// api.md
|
|
58
|
-
{
|
|
59
|
-
identifier: 'api.md',
|
|
60
|
-
input: fromAuroComponentRoot("/docs/partials/api.md"),
|
|
61
|
-
output: fromAuroComponentRoot("/demo/api.md"),
|
|
62
|
-
preProcessors: [templateFiller.formatApiTable],
|
|
63
|
-
}
|
|
64
|
-
];
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
*
|
|
68
|
-
* @param {ProcessorConfig} config - The configuration for this processor.
|
|
69
|
-
* @return {Promise<void>}
|
|
70
|
-
*/
|
|
71
|
-
export async function processDocFiles(config = defaultDocsProcessorConfig) {
|
|
72
|
-
// setup
|
|
73
|
-
await templateFiller.extractNames();
|
|
74
|
-
|
|
75
|
-
for (const fileConfig of fileConfigs(config)) {
|
|
76
|
-
try {
|
|
77
|
-
// eslint-disable-next-line no-await-in-loop
|
|
78
|
-
await processContentForFile(fileConfig);
|
|
79
|
-
} catch (err) {
|
|
80
|
-
Logger.error(`Error processing ${fileConfig.identifier}: ${err.message}`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
1
|
+
// Shim for the pre-compiled build. Do not edit.
|
|
2
|
+
// Generated by build/bundleDocsScripts.mjs from src/build/processors/defaultDocsProcessor.mjs.
|
|
3
|
+
// Edit that file, then run `npm run build:bundles`.
|
|
4
|
+
export * from "../../../dist/build/processors/defaultDocsProcessor.mjs";
|
|
@@ -1,83 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
processContentForFile,
|
|
6
|
-
templateFiller
|
|
7
|
-
} from "../../utils/sharedFileProcessorUtils.mjs";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Processor config object.
|
|
11
|
-
* @typedef {Object} ProcessorConfig
|
|
12
|
-
* @property {boolean} [overwriteLocalCopies=true] - The release version tag to use instead of master.
|
|
13
|
-
* @property {string} [generatorTemplateVersion="master"] - The release version tag to use instead of master.
|
|
14
|
-
* (like "_esm" to make README_esm.md).
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const DOT_GITHUB_PATH = '.github';
|
|
18
|
-
const ISSUE_TEMPLATE_PATH = `${DOT_GITHUB_PATH}/ISSUE_TEMPLATE`;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @type {ProcessorConfig} config - The default configuration for this processor.
|
|
22
|
-
*/
|
|
23
|
-
const defaultGitHubSyncConfig = {
|
|
24
|
-
overwriteLocalCopies: true,
|
|
25
|
-
generatorTemplateVersion: "master",
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @param {ProcessorConfig} config - The configuration for this processor.
|
|
30
|
-
* @returns {import('../utils/sharedFileProcessorUtils').FileProcessorConfig[]}
|
|
31
|
-
*/
|
|
32
|
-
const defaultGitHubTemplateFiles = (config = defaultGitHubSyncConfig) => [
|
|
33
|
-
// bug_report.yml
|
|
34
|
-
{
|
|
35
|
-
identifier: 'bug_report.yml',
|
|
36
|
-
input: {
|
|
37
|
-
remoteUrl: generateWCGeneratorUrl(config.generatorTemplateVersion, `templates/${ISSUE_TEMPLATE_PATH}/bug_report.yml`),
|
|
38
|
-
fileName: fromAuroComponentRoot(`docTemplates/${ISSUE_TEMPLATE_PATH}/bug_report.yml`),
|
|
39
|
-
overwrite: config.overwriteLocalCopies
|
|
40
|
-
},
|
|
41
|
-
output: fromAuroComponentRoot(`${ISSUE_TEMPLATE_PATH}/bug_report.yml`)
|
|
42
|
-
},
|
|
43
|
-
// config.yml
|
|
44
|
-
{
|
|
45
|
-
identifier: 'config.yml',
|
|
46
|
-
input: {
|
|
47
|
-
remoteUrl: generateWCGeneratorUrl(config.generatorTemplateVersion, `templates/${ISSUE_TEMPLATE_PATH}/config.yml`),
|
|
48
|
-
fileName: fromAuroComponentRoot(`docTemplates/${ISSUE_TEMPLATE_PATH}/config.yml`),
|
|
49
|
-
overwrite: config.overwriteLocalCopies
|
|
50
|
-
},
|
|
51
|
-
output: fromAuroComponentRoot(`${ISSUE_TEMPLATE_PATH}/config.yml`)
|
|
52
|
-
},
|
|
53
|
-
// PULL_REQUEST_TEMPLATE.md
|
|
54
|
-
{
|
|
55
|
-
identifier: 'PULL_REQUEST_TEMPLATE.md',
|
|
56
|
-
input: {
|
|
57
|
-
remoteUrl: generateWCGeneratorUrl(config.generatorTemplateVersion, `templates/${DOT_GITHUB_PATH}/PULL_REQUEST_TEMPLATE.md`),
|
|
58
|
-
fileName: fromAuroComponentRoot(`docTemplates/${DOT_GITHUB_PATH}/PULL_REQUEST_TEMPLATE.md`),
|
|
59
|
-
overwrite: config.overwriteLocalCopies
|
|
60
|
-
},
|
|
61
|
-
output: fromAuroComponentRoot(`${DOT_GITHUB_PATH}/PULL_REQUEST_TEMPLATE.md`)
|
|
62
|
-
},
|
|
63
|
-
];
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
*
|
|
67
|
-
* @param {ProcessorConfig} config - The configuration for this processor.
|
|
68
|
-
* @return {Promise<void>}
|
|
69
|
-
*/
|
|
70
|
-
export async function syncGithubFiles(config = defaultGitHubSyncConfig) {
|
|
71
|
-
// setup
|
|
72
|
-
await templateFiller.extractNames();
|
|
73
|
-
|
|
74
|
-
for (const file of defaultGitHubTemplateFiles(config)) {
|
|
75
|
-
try {
|
|
76
|
-
Logger.log(`Processing file: ${file.identifier}`);
|
|
77
|
-
// eslint-disable-next-line no-await-in-loop
|
|
78
|
-
await processContentForFile(file);
|
|
79
|
-
} catch (error) {
|
|
80
|
-
Logger.error(`Error processing file: ${file.identifier}, ${error.message}`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
1
|
+
// Shim for the pre-compiled build. Do not edit.
|
|
2
|
+
// Generated by build/bundleDocsScripts.mjs from src/build/processors/defaultDotGithubSync.mjs.
|
|
3
|
+
// Edit that file, then run `npm run build:bundles`.
|
|
4
|
+
export * from "../../../dist/build/processors/defaultDotGithubSync.mjs";
|
|
@@ -1,25 +1,4 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// This script will synchronize shared GitHub config
|
|
6
|
-
// files to the local repo (eventually, anything that lives
|
|
7
|
-
// in the .github directory).
|
|
8
|
-
//
|
|
9
|
-
// The actions in this file live in:
|
|
10
|
-
// scripts/build/processors/defaultDotGithubSync.mjs
|
|
11
|
-
//
|
|
12
|
-
// This script is intended to be run AS-IS without modification.
|
|
13
|
-
// To run a different processor, please see the defaultDotGithubSync.mjs file
|
|
14
|
-
// and re-create in your repo OR add a new processor file.
|
|
15
|
-
// ------------------------------------------------------
|
|
16
|
-
|
|
17
|
-
import {syncGithubFiles} from "./processors/defaultDotGithubSync.mjs";
|
|
18
|
-
import {Logger} from "../utils/logger.mjs";
|
|
19
|
-
|
|
20
|
-
syncGithubFiles().then(() => {
|
|
21
|
-
Logger.log('Docs processed successfully');
|
|
22
|
-
}).
|
|
23
|
-
catch((err) => {
|
|
24
|
-
Logger.error(`Error processing docs: ${err.message}`);
|
|
25
|
-
});
|
|
1
|
+
// Shim for the pre-compiled build. Do not edit.
|
|
2
|
+
// Generated by build/bundleDocsScripts.mjs from src/build/syncGithubFiles.mjs.
|
|
3
|
+
// Edit that file, then run `npm run build:bundles`.
|
|
4
|
+
import "../../dist/build/syncGithubFiles.mjs";
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Minimal stand-in for the slice of `chalk` this package used: `hex(color)(text)`
|
|
2
|
+
// and `hex(color).bold(text)`.
|
|
3
|
+
//
|
|
4
|
+
// auro-library is a runtime dependency of nearly every Auro component, so
|
|
5
|
+
// anything imported by a published script is installed into every downstream
|
|
6
|
+
// project. `chalk` was never actually declared as a dependency -- it only ever
|
|
7
|
+
// resolved by accident when a consumer happened to hoist one -- so these two
|
|
8
|
+
// helpers replace it rather than shipping a package for four call sites.
|
|
9
|
+
//
|
|
10
|
+
// Output is byte-identical to chalk for both supported forms, including
|
|
11
|
+
// chalk's decision about *when* to emit escapes at all.
|
|
12
|
+
|
|
13
|
+
const ESC = "\u001B";
|
|
14
|
+
const RESET_COLOR = `${ESC}[39m`;
|
|
15
|
+
const BOLD_ON = `${ESC}[1m`;
|
|
16
|
+
const BOLD_OFF = `${ESC}[22m`;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Whether to emit ANSI escapes, following the same precedence chalk uses:
|
|
20
|
+
* FORCE_COLOR wins, then NO_COLOR, then a dumb terminal, then TTY detection.
|
|
21
|
+
* Notably this means piped and CI output is plain text, which is what chalk
|
|
22
|
+
* already did here.
|
|
23
|
+
* @returns {boolean} True when escapes should be emitted.
|
|
24
|
+
*/
|
|
25
|
+
function colorEnabled() {
|
|
26
|
+
const { FORCE_COLOR, NO_COLOR, TERM } = process.env;
|
|
27
|
+
|
|
28
|
+
if (FORCE_COLOR !== undefined) {
|
|
29
|
+
// An explicit `0`/`false` is a force-*off* in chalk's `supports-color`, not
|
|
30
|
+
// an absence of opinion -- it short-circuits ahead of TTY detection, so
|
|
31
|
+
// setting it yields plain text even on a terminal. A set-but-empty value is
|
|
32
|
+
// a force-*on*, which is why this tests the two off values rather than
|
|
33
|
+
// truthiness.
|
|
34
|
+
return FORCE_COLOR !== "0" && FORCE_COLOR !== "false";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (NO_COLOR) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (TERM === "dumb") {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return Boolean(process.stdout?.isTTY);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Parse `#rgb` or `#rrggbb` into 8-bit channels.
|
|
50
|
+
* @param {string} hexColor - Hex color string, with or without a leading `#`.
|
|
51
|
+
* @returns {[number, number, number] | null} Channels, or null if unparseable.
|
|
52
|
+
*/
|
|
53
|
+
function toRgb(hexColor) {
|
|
54
|
+
if (typeof hexColor !== "string") {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const raw = hexColor.replace(/^#/u, "");
|
|
59
|
+
const expanded =
|
|
60
|
+
raw.length === 3
|
|
61
|
+
? raw
|
|
62
|
+
.split("")
|
|
63
|
+
.map((channel) => channel + channel)
|
|
64
|
+
.join("")
|
|
65
|
+
: raw;
|
|
66
|
+
|
|
67
|
+
if (!/^[0-9a-f]{6}$/iu.test(expanded)) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return [
|
|
72
|
+
Number.parseInt(expanded.slice(0, 2), 16),
|
|
73
|
+
Number.parseInt(expanded.slice(2, 4), 16),
|
|
74
|
+
Number.parseInt(expanded.slice(4, 6), 16),
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Build a colorizer for a hex color.
|
|
80
|
+
*
|
|
81
|
+
* Unlike `chalk.hex`, an unparseable or missing color returns the text
|
|
82
|
+
* unchanged instead of throwing -- `Logger.auroLogger` reaches this path
|
|
83
|
+
* whenever it is handed a status it does not recognize.
|
|
84
|
+
* @param {string} hexColor - Hex color string, e.g. `#0096FF`.
|
|
85
|
+
* @returns {((text: string) => string) & {bold: (text: string) => string}} Colorizer with a `.bold` variant.
|
|
86
|
+
*/
|
|
87
|
+
export function hex(hexColor) {
|
|
88
|
+
const rgb = toRgb(hexColor);
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @param {string} text - Text to wrap.
|
|
92
|
+
* @param {boolean} bold - Whether to also apply bold.
|
|
93
|
+
* @returns {string} The wrapped text.
|
|
94
|
+
*/
|
|
95
|
+
const paint = (text, bold) => {
|
|
96
|
+
const body = `${text}`;
|
|
97
|
+
|
|
98
|
+
// chalk short-circuits empty input rather than emitting a bare open/close
|
|
99
|
+
// pair, and every banner here is built by concatenating segments.
|
|
100
|
+
if (!rgb || body === "" || !colorEnabled()) {
|
|
101
|
+
return body;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const color = `${ESC}[38;2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
|
105
|
+
const open = bold ? `${color}${BOLD_ON}` : color;
|
|
106
|
+
const close = bold ? `${BOLD_OFF}${RESET_COLOR}` : RESET_COLOR;
|
|
107
|
+
|
|
108
|
+
// Re-open the style after every line break, the way chalk does, so the
|
|
109
|
+
// color survives anything that processes output line by line. The ASCII
|
|
110
|
+
// banners and the boxed `section` logs all rely on this.
|
|
111
|
+
return `${open}${body.replace(/(\r?\n)/gu, `${close}$1${open}`)}${close}`;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const colorize = (text) => paint(text, false);
|
|
115
|
+
|
|
116
|
+
colorize.bold = (text) => paint(text, true);
|
|
117
|
+
|
|
118
|
+
return colorize;
|
|
119
|
+
}
|