@aurodesignsystem/auro-library 2.6.1 → 2.6.3
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 +14 -0
- package/package.json +1 -1
- package/scripts/build/generateDocs.mjs +39 -25
- package/scripts/utils/auroLibraryUtils.mjs +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Semantic Release Automated Changelog
|
|
2
2
|
|
|
3
|
+
## [2.6.3](https://github.com/AlaskaAirlines/auro-library/compare/v2.6.2...v2.6.3) (2024-08-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **readme:** update generateDocs script for dynamic readme support [#57](https://github.com/AlaskaAirlines/auro-library/issues/57) ([f3c3092](https://github.com/AlaskaAirlines/auro-library/commit/f3c3092f4c9cc61dcc9f4b55cb5f63be4127c6de))
|
|
9
|
+
|
|
10
|
+
## [2.6.2](https://github.com/AlaskaAirlines/auro-library/compare/v2.6.1...v2.6.2) (2024-08-07)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* update various build scripts ([9b726b3](https://github.com/AlaskaAirlines/auro-library/commit/9b726b3ad2fd616987a4488cc440f0f7498c0028))
|
|
16
|
+
|
|
3
17
|
## [2.6.1](https://github.com/AlaskaAirlines/auro-library/compare/v2.6.0...v2.6.1) (2024-08-06)
|
|
4
18
|
|
|
5
19
|
|
package/package.json
CHANGED
|
@@ -4,12 +4,29 @@ import fs from 'fs';
|
|
|
4
4
|
import https from 'https';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
|
|
7
|
+
import AuroLibraryUtils from "../utils/auroLibraryUtils.mjs";
|
|
8
|
+
|
|
9
|
+
const auroLibraryUtils = new AuroLibraryUtils();
|
|
10
|
+
|
|
7
11
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
8
12
|
|
|
9
|
-
const readmeTemplateUrl = 'https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/README_esm.md';
|
|
10
13
|
const dirDocTemplates = './docTemplates';
|
|
11
14
|
const readmeFilePath = dirDocTemplates + '/README.md';
|
|
12
15
|
|
|
16
|
+
// List of components that do not support ESM to determine which README to use
|
|
17
|
+
const nonEsmComponents = ['combobox', 'datepicker', 'menu', 'pane', 'select'];
|
|
18
|
+
|
|
19
|
+
function generateReadmeUrl() {
|
|
20
|
+
let nameExtractionData = nameExtraction();
|
|
21
|
+
let esmString = '';
|
|
22
|
+
|
|
23
|
+
if (!nonEsmComponents.includes(nameExtractionData.name)) {
|
|
24
|
+
esmString = '_esm';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return 'https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/README' + esmString + '.md';
|
|
28
|
+
}
|
|
29
|
+
|
|
13
30
|
/**
|
|
14
31
|
* Extract NPM, NAMESPACE and NAME from package.json
|
|
15
32
|
*/
|
|
@@ -21,12 +38,12 @@ function nameExtraction() {
|
|
|
21
38
|
}
|
|
22
39
|
})
|
|
23
40
|
|
|
24
|
-
packageJson = JSON.parse(packageJson);
|
|
25
|
-
|
|
41
|
+
packageJson = JSON.parse(packageJson);
|
|
42
|
+
|
|
26
43
|
let pName = packageJson.name;
|
|
27
44
|
let pVersion = packageJson.version;
|
|
28
|
-
let pdtVersion = packageJson.peerDependencies['\@aurodesignsystem/design-tokens'].substring(1)
|
|
29
|
-
let wcssVersion = packageJson.peerDependencies['\@aurodesignsystem/webcorestylesheets'].substring(1)
|
|
45
|
+
let pdtVersion = packageJson.peerDependencies['\@aurodesignsystem/design-tokens'].substring(1);
|
|
46
|
+
let wcssVersion = packageJson.peerDependencies['\@aurodesignsystem/webcorestylesheets'].substring(1);
|
|
30
47
|
|
|
31
48
|
let npmStart = pName.indexOf('@');
|
|
32
49
|
let namespaceStart = pName.indexOf('/');
|
|
@@ -42,7 +59,7 @@ function nameExtraction() {
|
|
|
42
59
|
'tokensVersion': pdtVersion,
|
|
43
60
|
'wcssVersion': wcssVersion
|
|
44
61
|
};
|
|
45
|
-
|
|
62
|
+
}
|
|
46
63
|
|
|
47
64
|
/**
|
|
48
65
|
* Replace all instances of [npm], [name], [Name], [namespace] and [Namespace] accordingly
|
|
@@ -50,23 +67,19 @@ function nameExtraction() {
|
|
|
50
67
|
|
|
51
68
|
function formatTemplateFileContents(content, destination) {
|
|
52
69
|
let nameExtractionData = nameExtraction();
|
|
70
|
+
let result = content;
|
|
53
71
|
|
|
54
72
|
/**
|
|
55
73
|
* Replace placeholder strings
|
|
56
74
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
'[wcssVersion]': 'wcssVersion'
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
let result = Object.entries(placeholders).reduce((acc, [key, value]) =>
|
|
69
|
-
acc.replace(new RegExp(key, 'g'), nameExtractionData[value]), content);
|
|
75
|
+
result = result.replace(/\[npm]/g, nameExtractionData.npm);
|
|
76
|
+
result = result.replace(/\[name](?!\()/g, nameExtractionData.name);
|
|
77
|
+
result = result.replace(/\[Name](?!\()/g, nameExtractionData.nameCap);
|
|
78
|
+
result = result.replace(/\[namespace]/g, nameExtractionData.namespace);
|
|
79
|
+
result = result.replace(/\[Namespace]/g, nameExtractionData.namespaceCap);
|
|
80
|
+
result = result.replace(/\[Version]/g, nameExtractionData.version);
|
|
81
|
+
result = result.replace(/\[dtVersion]/g, nameExtractionData.tokensVersion);
|
|
82
|
+
result = result.replace(/\[wcssVersion]/g, nameExtractionData.wcssVersion);
|
|
70
83
|
|
|
71
84
|
/**
|
|
72
85
|
* Cleanup line breaks
|
|
@@ -122,7 +135,7 @@ function processReadme() {
|
|
|
122
135
|
outputDir: './'
|
|
123
136
|
};
|
|
124
137
|
|
|
125
|
-
const markdownPath = path.join(__dirname, '
|
|
138
|
+
const markdownPath = path.join(__dirname, './../../../../../docTemplates/README.md');
|
|
126
139
|
|
|
127
140
|
markdownMagic(markdownPath, config, callback);
|
|
128
141
|
}
|
|
@@ -135,7 +148,8 @@ function processDemo() {
|
|
|
135
148
|
const callback = function(updatedContent, outputConfig) {
|
|
136
149
|
if (fs.existsSync('./demo/index.md')) {
|
|
137
150
|
fs.readFile('./demo/index.md', 'utf8', function(err, data) {
|
|
138
|
-
formatTemplateFileContents(data, './demo/index.md');
|
|
151
|
+
// formatTemplateFileContents(data, './demo/index.md');
|
|
152
|
+
auroLibraryUtils.formatFileContents(data, './demo/index.md');
|
|
139
153
|
});
|
|
140
154
|
} else {
|
|
141
155
|
console.log('ERROR: ./demo/index.md file is missing');
|
|
@@ -147,7 +161,7 @@ function processDemo() {
|
|
|
147
161
|
outputDir: './demo'
|
|
148
162
|
};
|
|
149
163
|
|
|
150
|
-
const markdownPath = path.join(__dirname, '
|
|
164
|
+
const markdownPath = path.join(__dirname, './../../../../../docs/partials/index.md');
|
|
151
165
|
|
|
152
166
|
markdownMagic(markdownPath, configDemo, callback);
|
|
153
167
|
}
|
|
@@ -172,7 +186,7 @@ function processApiExamples() {
|
|
|
172
186
|
outputDir: './demo'
|
|
173
187
|
};
|
|
174
188
|
|
|
175
|
-
const markdownPath = path.join(__dirname, '
|
|
189
|
+
const markdownPath = path.join(__dirname, './../../../../../docs/partials/api.md');
|
|
176
190
|
|
|
177
191
|
markdownMagic(markdownPath, config, callback);
|
|
178
192
|
}
|
|
@@ -182,7 +196,6 @@ function processApiExamples() {
|
|
|
182
196
|
* */
|
|
183
197
|
|
|
184
198
|
function copyReadmeLocally() {
|
|
185
|
-
|
|
186
199
|
if (!fs.existsSync(dirDocTemplates)){
|
|
187
200
|
fs.mkdirSync(dirDocTemplates);
|
|
188
201
|
}
|
|
@@ -195,7 +208,7 @@ function copyReadmeLocally() {
|
|
|
195
208
|
});
|
|
196
209
|
}
|
|
197
210
|
|
|
198
|
-
https.get(
|
|
211
|
+
https.get(generateReadmeUrl(), function(response) {
|
|
199
212
|
let writeTemplate = response.pipe(fs.createWriteStream(readmeFilePath));
|
|
200
213
|
|
|
201
214
|
writeTemplate.on('finish', () => {
|
|
@@ -213,3 +226,4 @@ function copyReadmeLocally() {
|
|
|
213
226
|
copyReadmeLocally();
|
|
214
227
|
processApiExamples();
|
|
215
228
|
processDemo();
|
|
229
|
+
|
|
@@ -128,7 +128,6 @@ export default class AuroLibraryUtils {
|
|
|
128
128
|
packageJson = JSON.parse(packageJson);
|
|
129
129
|
|
|
130
130
|
const pName = packageJson.name;
|
|
131
|
-
|
|
132
131
|
const npmStart = pName.indexOf('@');
|
|
133
132
|
const namespaceStart = pName.indexOf('/');
|
|
134
133
|
const nameStart = pName.indexOf('-');
|
|
@@ -141,7 +140,10 @@ export default class AuroLibraryUtils {
|
|
|
141
140
|
'namespaceCap': pName.substring(namespaceStart + 1)[0].toUpperCase() + pName.substring(namespaceStart + 2, nameStart),
|
|
142
141
|
'name': pName.substring(nameStart + 1),
|
|
143
142
|
'nameCap': pName.substring(nameStart + 1)[0].toUpperCase() + pName.substring(nameStart + 2),
|
|
144
|
-
'version': packageJson.version
|
|
143
|
+
'version': packageJson.version,
|
|
144
|
+
'tokensVersion': packageJson.peerDependencies['\@aurodesignsystem/design-tokens'].substring(1),
|
|
145
|
+
'wcssVersion': packageJson.peerDependencies['\@aurodesignsystem/webcorestylesheets'].substring(1)
|
|
146
|
+
|
|
145
147
|
};
|
|
146
148
|
}
|
|
147
149
|
|