@aurodesignsystem/auro-library 3.0.0 → 3.0.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 +23 -0
- package/package.json +1 -1
- package/scripts/build/prepWcaCompatibleCode.mjs +1 -1
- package/scripts/build/processors/defaultDocsProcessor.mjs +3 -3
- package/scripts/utils/auroFileHandler.mjs +4 -1
- package/scripts/utils/auroLibraryUtils.mjs +3 -7
- package/scripts/utils/sharedFileProcessorUtils.mjs +18 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Semantic Release Automated Changelog
|
|
2
2
|
|
|
3
|
+
## [3.0.2](https://github.com/AlaskaAirlines/auro-library/compare/v3.0.1...v3.0.2) (2024-11-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* automatically create `docTemplate` when generating docs [#94](https://github.com/AlaskaAirlines/auro-library/issues/94) ([e6195d9](https://github.com/AlaskaAirlines/auro-library/commit/e6195d958233cd5b0902cb5afbf769dff246e852))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Performance Improvements
|
|
12
|
+
|
|
13
|
+
* omit dir exist checking (sourcery reccomendation) ([68de618](https://github.com/AlaskaAirlines/auro-library/commit/68de61844960bf6d32df2ed66ca714857da1d623))
|
|
14
|
+
|
|
15
|
+
## [3.0.1](https://github.com/AlaskaAirlines/auro-library/compare/v3.0.0...v3.0.1) (2024-11-07)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* make api table formatter a preProcessor ([98d3de1](https://github.com/AlaskaAirlines/auro-library/commit/98d3de1e290ea2e3f03da9ef0d167c3291bc195b))
|
|
21
|
+
* properly consume remoteReadmeVariant ([7b5f108](https://github.com/AlaskaAirlines/auro-library/commit/7b5f1082710288d86f8bf182c0ceb71ac3ad7420))
|
|
22
|
+
* sourcery feedback ([de11fe8](https://github.com/AlaskaAirlines/auro-library/commit/de11fe8d70946b6096970026406f63bd9fdc10ba))
|
|
23
|
+
* use fileURLToPath instead of manual formatting ([3d4e834](https://github.com/AlaskaAirlines/auro-library/commit/3d4e8348bf249620eb88a6e1094a8f920c34369a))
|
|
24
|
+
* use import.meta.url instead of __dirname ([9185197](https://github.com/AlaskaAirlines/auro-library/commit/9185197d8b0179dfe645497c640b025d8f39c6b3))
|
|
25
|
+
|
|
3
26
|
# [3.0.0](https://github.com/AlaskaAirlines/auro-library/compare/v2.11.0...v3.0.0) (2024-11-05)
|
|
4
27
|
|
|
5
28
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default (code, sourcePath) => {
|
|
2
2
|
const defaultTag = (code.match(/static register\(name \= (.+)\)/) || code.match(/customElements.get\((.+?)\)/))[1];
|
|
3
3
|
const className = code.match(/export class (.+) extends/)?.[1];
|
|
4
|
-
const classDesc = code.match(/\/\*\*((.|\n)*?)
|
|
4
|
+
const classDesc = code.match(/\/\*\*((.|\n)*?)(\*\n|\*\/)/)?.[1] || '';
|
|
5
5
|
|
|
6
6
|
if (!defaultTag || !className) {
|
|
7
7
|
return code;
|
|
@@ -25,14 +25,14 @@ export const defaultDocsProcessorConfig = {
|
|
|
25
25
|
// eslint-disable-next-line no-warning-comments
|
|
26
26
|
// TODO: remove this variant when all components are updated to use latest auro-library
|
|
27
27
|
// AND the default README.md is updated to use the new paths
|
|
28
|
-
|
|
28
|
+
remoteReadmeVariant: "_updated_paths"
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* @param {ProcessorConfig} config - The configuration for this processor.
|
|
33
33
|
* @returns {import('../utils/sharedFileProcessorUtils').FileProcessorConfig[]}
|
|
34
34
|
*/
|
|
35
|
-
export const fileConfigs = (config
|
|
35
|
+
export const fileConfigs = (config) => [
|
|
36
36
|
// README.md
|
|
37
37
|
{
|
|
38
38
|
identifier: 'README.md',
|
|
@@ -59,7 +59,7 @@ export const fileConfigs = (config = defaultDocsProcessorConfig) => [
|
|
|
59
59
|
identifier: 'api.md',
|
|
60
60
|
input: fromAuroComponentRoot("/docs/partials/api.md"),
|
|
61
61
|
output: fromAuroComponentRoot("/demo/api.md"),
|
|
62
|
-
|
|
62
|
+
preProcessors: [templateFiller.formatApiTable],
|
|
63
63
|
}
|
|
64
64
|
];
|
|
65
65
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
2
3
|
|
|
3
4
|
import {Logger} from "../utils/logger.mjs";
|
|
4
5
|
|
|
@@ -40,7 +41,9 @@ export class AuroFileHandler {
|
|
|
40
41
|
* @returns {Promise<boolean>}
|
|
41
42
|
*/
|
|
42
43
|
static async tryWriteFile(filePath, fileContents) {
|
|
43
|
-
try {
|
|
44
|
+
try {
|
|
45
|
+
const dirname = path.dirname(filePath);
|
|
46
|
+
await fs.mkdir(dirname, {recursive: true});
|
|
44
47
|
await fs.writeFile(filePath, fileContents, {encoding: 'utf-8'});
|
|
45
48
|
return true;
|
|
46
49
|
} catch (err) {
|
|
@@ -8,17 +8,13 @@
|
|
|
8
8
|
import * as fs from 'fs';
|
|
9
9
|
import * as path from 'path';
|
|
10
10
|
import chalk from 'chalk';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
|
|
11
13
|
import {Logger} from "./logger.mjs";
|
|
12
14
|
|
|
13
15
|
export default class AuroLibraryUtils {
|
|
14
16
|
getDirname() {
|
|
15
|
-
|
|
16
|
-
Logger.warn('Unable to determine project root as __dirname is not defined. Assuming current directory is okay!', true);
|
|
17
|
-
return '';
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// eslint-disable-next-line no-undef
|
|
21
|
-
return __dirname;
|
|
17
|
+
return fileURLToPath(import.meta.url);
|
|
22
18
|
}
|
|
23
19
|
|
|
24
20
|
get getProjectRootPath() {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
1
|
import * as mdMagic from 'markdown-magic';
|
|
3
2
|
import fs from 'node:fs/promises';
|
|
4
|
-
import
|
|
3
|
+
import path from "node:path";
|
|
5
4
|
|
|
6
5
|
import AuroLibraryUtils from "./auroLibraryUtils.mjs";
|
|
7
6
|
import { AuroTemplateFiller } from "./auroTemplateFiller.mjs";
|
|
@@ -75,8 +74,12 @@ export const nonEsmComponents = ['combobox', 'datepicker', 'menu', 'pane', 'sele
|
|
|
75
74
|
*/
|
|
76
75
|
// TODO: test this in auro-flight before merging to main
|
|
77
76
|
export function fromAuroComponentRoot(pathLike) {
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
if (pathLike.startsWith('/')) {
|
|
78
|
+
// remove the first slash
|
|
79
|
+
return path.join(auroLibraryUtils.getProjectRootPath, pathLike.slice(1))
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return path.join(auroLibraryUtils.getProjectRootPath, pathLike)
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
|
|
@@ -149,6 +152,7 @@ export function generateReadmeUrl(branchOrTag = 'master', variantOverride = '')
|
|
|
149
152
|
* @property {string | InputFileType} input - path to an input file, including filename
|
|
150
153
|
* @property {string} output - path to an output file, including filename
|
|
151
154
|
* @property {Partial<MarkdownMagicOptions>} [mdMagicConfig] - extra configuration options for md magic
|
|
155
|
+
* @property {Array<(contents: string) => string>} [preProcessors] - extra processor functions to run on content AFTER markdownmagic and BEFORE templateFiller
|
|
152
156
|
* @property {Array<(contents: string) => string>} [postProcessors] - extra processor functions to run on content
|
|
153
157
|
*/
|
|
154
158
|
|
|
@@ -241,17 +245,24 @@ export async function processContentForFile(config) {
|
|
|
241
245
|
// 3a. Read the output file contents
|
|
242
246
|
let fileContents = await fs.readFile(output, {encoding: 'utf-8'});
|
|
243
247
|
|
|
244
|
-
// 3b.
|
|
248
|
+
// 3b. Run any pre-processors
|
|
249
|
+
if (config.preProcessors) {
|
|
250
|
+
for (const processor of config.preProcessors) {
|
|
251
|
+
fileContents = processor(fileContents)
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// 3c. Replace template variables in output file
|
|
245
256
|
fileContents = templateFiller.replaceTemplateValues(fileContents);
|
|
246
257
|
|
|
247
|
-
//
|
|
258
|
+
// 3d. Run any post-processors
|
|
248
259
|
if (config.postProcessors) {
|
|
249
260
|
for (const processor of config.postProcessors) {
|
|
250
261
|
fileContents = processor(fileContents)
|
|
251
262
|
}
|
|
252
263
|
}
|
|
253
264
|
|
|
254
|
-
//
|
|
265
|
+
// 3e. Write the final file contents
|
|
255
266
|
if (!await AuroFileHandler.tryWriteFile(output, fileContents)) {
|
|
256
267
|
throw new Error(`Error writing "${bareFileName}" file to output ${output}`);
|
|
257
268
|
}
|