@aurodesignsystem/auro-library 2.2.1 → 2.2.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/bin/generateDocs.mjs +145 -0
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Semantic Release Automated Changelog
|
|
2
2
|
|
|
3
|
+
## [2.2.3](https://github.com/AlaskaAirlines/auro-library/compare/v2.2.2...v2.2.3) (2024-01-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Performance Improvements
|
|
7
|
+
|
|
8
|
+
* make generateDocs available from bin dir ([157aef6](https://github.com/AlaskaAirlines/auro-library/commit/157aef6ba3641bbf55d6e542d525159e5f780fc5))
|
|
9
|
+
|
|
10
|
+
## [2.2.2](https://github.com/AlaskaAirlines/auro-library/compare/v2.2.1...v2.2.2) (2024-01-09)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* update dependency script to be ES6 ([426b58f](https://github.com/AlaskaAirlines/auro-library/commit/426b58f13c0c9a72cbe0619c33a3d1773013c56c))
|
|
16
|
+
|
|
3
17
|
## [2.2.1](https://github.com/AlaskaAirlines/auro-library/compare/v2.2.0...v2.2.1) (2024-01-09)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import markdownMagic from 'markdown-magic';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import * as https from 'https';
|
|
4
|
+
|
|
5
|
+
import AuroLibraryUtils from "../scripts/utils/auroLibraryUtils.mjs";
|
|
6
|
+
|
|
7
|
+
const auroLibraryUtils = new AuroLibraryUtils();
|
|
8
|
+
|
|
9
|
+
const readmeTemplateUrl = 'https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/README.md';
|
|
10
|
+
const dirDocTemplates = './docTemplates';
|
|
11
|
+
const readmeFilePath = dirDocTemplates + '/README.md';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Replace all instances of [npm], [name], [Name], [namespace] and [Namespace] accordingly
|
|
15
|
+
*/
|
|
16
|
+
function formatApiTableContents(content, destination) {
|
|
17
|
+
const nameExtractionData = auroLibraryUtils.nameExtraction();
|
|
18
|
+
const wcName = nameExtractionData.namespace + '-' + nameExtractionData.name;
|
|
19
|
+
|
|
20
|
+
let result = content;
|
|
21
|
+
|
|
22
|
+
result = result
|
|
23
|
+
.replace(/\r\n|\r|\n####\s`([a-zA-Z]*)`/g, `\r\n#### <a name="$1"></a>\`$1\`<a href="#${wcName}" style="float: right; font-size: 1rem; font-weight: 100;">back to top</a>`)
|
|
24
|
+
.replace(/\r\n|\r|\n\|\s`([a-zA-Z]*)`/g, '\r\n| [$1](#$1)')
|
|
25
|
+
.replace(/\| \[\]\(#\)/g, "");
|
|
26
|
+
|
|
27
|
+
fs.writeFileSync(destination, result, { encoding: 'utf8'});
|
|
28
|
+
|
|
29
|
+
fs.readFile('./demo/api.md', 'utf8', function(err, data) {
|
|
30
|
+
auroLibraryUtils.formatFileContents(data, './demo/api.md');
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Compiles `./docTemplates/README.md` -> `./README.md`
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
function processReadme() {
|
|
39
|
+
const callback = function() {
|
|
40
|
+
|
|
41
|
+
if (fs.existsSync('./README.md')) {
|
|
42
|
+
fs.readFile('./README.md', 'utf8', function(err, data) {
|
|
43
|
+
auroLibraryUtils.formatFileContents(data, './README.md');
|
|
44
|
+
});
|
|
45
|
+
} else {
|
|
46
|
+
console.log('ERROR: ./README.md file is missing');
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const config = {
|
|
51
|
+
matchWord: 'AURO-GENERATED-CONTENT',
|
|
52
|
+
outputDir: './'
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const markdownPath = './docTemplates/README.md';
|
|
56
|
+
|
|
57
|
+
markdownMagic(markdownPath, config, callback);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Compiles `./docTemplates/demo.md` -> `./demo/demo.md`
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
function processDemo() {
|
|
65
|
+
const callback = function() {
|
|
66
|
+
if (fs.existsSync('./demo/demo.md')) {
|
|
67
|
+
fs.readFile('./demo/demo.md', 'utf8', function(err, data) {
|
|
68
|
+
auroLibraryUtils.formatFileContents(data, './demo/demo.md');
|
|
69
|
+
});
|
|
70
|
+
} else {
|
|
71
|
+
console.log('ERROR: ./demo/demo.md file is missing');
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const configDemo = {
|
|
76
|
+
matchWord: 'AURO-GENERATED-CONTENT',
|
|
77
|
+
outputDir: './demo'
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const markdownPath = './docs/partials/demo.md';
|
|
81
|
+
|
|
82
|
+
markdownMagic(markdownPath, configDemo, callback);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Compiles `./docTemplates/api.md` -> `./demo/api.md`
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
function processApiExamples() {
|
|
90
|
+
const callback = function() {
|
|
91
|
+
if (fs.existsSync('./demo/api.md')) {
|
|
92
|
+
fs.readFile('./demo/api.md', 'utf8', function(err, data) {
|
|
93
|
+
formatApiTableContents(data, './demo/api.md');
|
|
94
|
+
});
|
|
95
|
+
} else {
|
|
96
|
+
console.log('ERROR: ./demo/api.md file is missing');
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const config = {
|
|
101
|
+
matchWord: 'AURO-GENERATED-CONTENT',
|
|
102
|
+
outputDir: './demo'
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const markdownPath = './docs/partials/api.md';
|
|
106
|
+
|
|
107
|
+
markdownMagic(markdownPath, config, callback);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Copy README.md template from static source
|
|
112
|
+
* */
|
|
113
|
+
|
|
114
|
+
function copyReadmeLocally() {
|
|
115
|
+
|
|
116
|
+
if (!fs.existsSync(dirDocTemplates)){
|
|
117
|
+
fs.mkdirSync(dirDocTemplates);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (!fs.existsSync(readmeFilePath)) {
|
|
121
|
+
fs.writeFile(readmeFilePath, '', function(err) {
|
|
122
|
+
if(err) {
|
|
123
|
+
console.log('ERROR: Unable to create README.md file.', err);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
https.get(readmeTemplateUrl, function(response) {
|
|
129
|
+
let writeTemplate = response.pipe(fs.createWriteStream(readmeFilePath));
|
|
130
|
+
|
|
131
|
+
writeTemplate.on('finish', () => {
|
|
132
|
+
processReadme();
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
}).on('error', (err) => {
|
|
136
|
+
console.log('ERROR: Unable to fetch README.md file from server.', err);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Run all the actual document generation
|
|
142
|
+
*/
|
|
143
|
+
copyReadmeLocally();
|
|
144
|
+
processApiExamples();
|
|
145
|
+
processDemo();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aurodesignsystem/auro-library",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
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",
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
"engines": {
|
|
12
12
|
"node": ">=18.15.0"
|
|
13
13
|
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"generateDocs": "./bin/generateDocs.mjs"
|
|
16
|
+
},
|
|
14
17
|
"devDependencies": {
|
|
15
18
|
"@aurodesignsystem/eslint-config": "^1.3.0",
|
|
16
19
|
"@commitlint/cli": "^17.7.1",
|