@aurodesignsystem/auro-library 2.5.0 → 2.6.0
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/README.md +64 -59
- package/bin/generateDocs_index.mjs +1 -1
- package/package.json +1 -1
- package/scripts/build/generateDocs.mjs +1 -1
- package/scripts/utils/runtimeUtils.mjs +28 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Semantic Release Automated Changelog
|
|
2
2
|
|
|
3
|
+
# [2.6.0](https://github.com/AlaskaAirlines/auro-library/compare/v2.5.1...v2.6.0) (2024-04-29)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **tagname:** add new functions for handling custom named components. [#51](https://github.com/AlaskaAirlines/auro-library/issues/51) ([1c7addc](https://github.com/AlaskaAirlines/auro-library/commit/1c7addcb9c637bdf043470e04626b9b4328ed6b6))
|
|
9
|
+
|
|
10
|
+
## [2.5.1](https://github.com/AlaskaAirlines/auro-library/compare/v2.5.0...v2.5.1) (2024-02-07)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* update reference to index.md ([e504708](https://github.com/AlaskaAirlines/auro-library/commit/e5047082cc0e198d0ee8e35fccdd1d715e3ff940))
|
|
16
|
+
|
|
3
17
|
# [2.5.0](https://github.com/AlaskaAirlines/auro-library/compare/v2.4.7...v2.5.0) (2024-02-07)
|
|
4
18
|
|
|
5
19
|
|
package/README.md
CHANGED
|
@@ -2,46 +2,77 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/description.md) -->
|
|
4
4
|
<!-- The below content is automatically added from ./../docs/partials/description.md -->
|
|
5
|
-
This repository holds shared scripts, utilities, and workflows utilized
|
|
5
|
+
This repository holds shared scripts, utilities, and workflows utilized across repositories along the Auro Design System.
|
|
6
6
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
7
7
|
|
|
8
8
|
## Scripts
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
### Publish Surge Demo
|
|
11
11
|
|
|
12
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/
|
|
13
|
-
<!-- The below content is automatically added from ./../docs/partials/
|
|
14
|
-
This
|
|
15
|
-
|
|
12
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/publishDemo.md) -->
|
|
13
|
+
<!-- The below content is automatically added from ./../docs/partials/publishDemo.md -->
|
|
14
|
+
This is an automated workflow that utilizes GitHub Actions to generate surge demos. Upon making any change to a PR a comment will be added or updated on the PR with a link to the demo similar to the following:
|
|
15
|
+
|
|
16
|
+
```md
|
|
17
|
+
Surge demo deployment succeeded! 🚀🚀🚀
|
|
18
|
+
|
|
19
|
+
[Auro Web Component Generator](https://surge.sh/)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This workflow utilizes the file `./scripts/config/useBundles.js` to update the demo HTML files to use the bundled versions of components so that they can be supported staticly in surge.
|
|
23
|
+
|
|
24
|
+
In order to add this functionality to an auro component you just need to add the following snippet into the `publishDemo.yml` file in the `./.github/workflows` directory.
|
|
25
|
+
|
|
26
|
+
```yml
|
|
27
|
+
name: Deploy Demo
|
|
28
|
+
|
|
29
|
+
on:
|
|
30
|
+
pull_request:
|
|
31
|
+
branches: [ main ]
|
|
16
32
|
|
|
17
|
-
|
|
33
|
+
jobs:
|
|
34
|
+
call-publish-demo-workflow:
|
|
35
|
+
uses: AlaskaAirlines/auro-library/.github/workflows/publishDemo.yml@main
|
|
36
|
+
secrets:
|
|
37
|
+
SURGE_TOKEN: ${{secrets.AURO_SURGE_TOKEN}}
|
|
38
|
+
```
|
|
18
39
|
|
|
19
|
-
|
|
20
|
-
|
|
40
|
+
> Note: This will only work properly in components located in the "AlaskaAirlines" organization due to a dependency on the org-wide Actions secret `AURO_SURGE_TOKEN`.
|
|
41
|
+
|
|
42
|
+
Afterwards you will want to make sure to update the script tags you want replaced with bundles in your `./demo/*.html` files with the `data-demo-scripts="true"` attribute.
|
|
43
|
+
|
|
44
|
+
```diff
|
|
45
|
+
-- <script type="module" src="../index.js"></script>
|
|
46
|
+
++ <script type="module" src="../index.js" data-demo-script="true"></script>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
> Note: If you fail to do this, the components will fail to register in your demo.
|
|
50
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
51
|
+
---
|
|
21
52
|
|
|
22
|
-
|
|
53
|
+
### Surge Demo Teardown
|
|
23
54
|
|
|
55
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/demoTeardown.md) -->
|
|
56
|
+
<!-- The below content is automatically added from ./../docs/partials/demoTeardown.md -->
|
|
24
57
|
This workflow works to automatically delete and clear any surge demos that have been active for more than 2+ months. Surge in theory allows us to have an infinite amount of active pages but by clearing unused and stale demos we can keep our Surge account more organized in the future.
|
|
25
58
|
|
|
26
|
-
> Note: This workflow
|
|
59
|
+
> Note: This workflow executes on a monthly cronjob on the first of each month.
|
|
27
60
|
|
|
28
61
|
In order to clear all our surge projects we rely on [this GitHub Action](https://github.com/marketplace/actions/surge-sh-teardown) to handle the deletion logic.
|
|
29
62
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
63
|
+
---
|
|
30
64
|
|
|
31
|
-
|
|
65
|
+
### Dependency Tag Versioning
|
|
32
66
|
|
|
33
67
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/dependencyTagVersioning.md) -->
|
|
34
|
-
<!-- The below content is automatically added from ./../docs/partials/dependencyTagVersioning.md -->
|
|
35
|
-
|
|
36
|
-
## Dependency Tag Versioming
|
|
37
|
-
|
|
68
|
+
<!-- The below content is automatically added from ./../docs/partials/dependencyTagVersioning.md -->
|
|
38
69
|
This is a two part utility for the purpose of generating a custom string for dependency component tag naming. This is important to prevent [version conflicts](https://www.thinktecture.com/en/web-components/web-components-flaws/#elementor-toc__heading-anchor-0) when multiple versions of a given Auro component may be loaded on a single page.
|
|
39
70
|
|
|
40
71
|
_Note: The example configuration used below in all code samples assumes `auro-dropdown` is the dependency component. Substitute any Auro component in the example code as needed._
|
|
41
72
|
|
|
42
|
-
|
|
73
|
+
#### Part 1: The Build
|
|
43
74
|
|
|
44
|
-
|
|
75
|
+
##### Configuration
|
|
45
76
|
|
|
46
77
|
1. Create a new file `./scripts/version.js` with the following content:
|
|
47
78
|
|
|
@@ -63,7 +94,7 @@ versionWriter.writeDepVersionFile('@aurodesignsystem/auro-dropdown'); // duplica
|
|
|
63
94
|
"build": "npm-run-all build:version ... etc.",
|
|
64
95
|
```
|
|
65
96
|
|
|
66
|
-
|
|
97
|
+
##### Execution
|
|
67
98
|
|
|
68
99
|
Once configuration is complete, execute `npm run build`. This must be done once before `npm run dev` when developing locally. When Auro dependencies are initially installed or updated to new versions then `npm run build:version` or a complete `npm run build` must be executed.
|
|
69
100
|
|
|
@@ -71,20 +102,20 @@ Upon execution of `build:version`, for each Auro dependency defined in the `./sc
|
|
|
71
102
|
|
|
72
103
|
For example, following these steps:
|
|
73
104
|
1. Run `npm i @aurodesignsystem/auro-dropdown@1.0.0`
|
|
74
|
-
|
|
105
|
+
2. add the following to the `./scripts/version.js` script file:
|
|
75
106
|
```js
|
|
76
107
|
versionWriter.writeDepVersionFile('@aurodesignsystem/auro-dropdown');
|
|
77
108
|
```
|
|
78
|
-
|
|
109
|
+
3. Run `npm run build`
|
|
79
110
|
|
|
80
111
|
Will result in:
|
|
81
112
|
- A new file created: `./src/dropdownVersion.js`
|
|
82
113
|
- File content will export the version of the component installed. In this case:
|
|
83
114
|
`export default '1.0.0'`
|
|
84
115
|
|
|
85
|
-
|
|
116
|
+
#### Part 2: The Runtime
|
|
86
117
|
|
|
87
|
-
|
|
118
|
+
##### Configuration
|
|
88
119
|
|
|
89
120
|
In the main component JS file located in the `./src` directory add the following:
|
|
90
121
|
|
|
@@ -110,7 +141,7 @@ In the component properties add the following:
|
|
|
110
141
|
dropdownTag: { type: Object }
|
|
111
142
|
```
|
|
112
143
|
|
|
113
|
-
|
|
144
|
+
##### Usage
|
|
114
145
|
|
|
115
146
|
The new dynamically named version of `auro-dropdown` may now be used in your component template as follows:
|
|
116
147
|
|
|
@@ -134,57 +165,31 @@ When the component is rendered during runtime the DOM will now show up as follow
|
|
|
134
165
|
|
|
135
166
|
_Note: the numbers attached in the tag name will match the version of the dependency that was installed._
|
|
136
167
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
The dynamic component is accessible using a the following string in a JS query selector: `this.dropdownTag._$litStatic# Auro-Library
|
|
140
|
-
|
|
141
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/description.md) -->
|
|
142
|
-
<!-- The below content is automatically added from ./../docs/partials/description.md -->
|
|
143
|
-
This repository holds shared scripts, utilities, and workflows utilized acorss repositories along the Auro Design System.
|
|
144
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
145
|
-
|
|
146
|
-
## Scripts
|
|
147
|
-
|
|
148
|
-
#### Publish Surge Demo
|
|
149
|
-
|
|
150
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/description.md) -->
|
|
151
|
-
<!-- The below content is automatically added from ./../docs/partials/description.md -->
|
|
152
|
-
This repository holds shared scripts, utilities, and workflows utilized acorss repositories along the Auro Design System.
|
|
153
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
154
|
-
|
|
155
|
-
#### Surge Demo Teardown
|
|
168
|
+
##### Accessing the dynamically named element with JS
|
|
156
169
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
This workflow works to automatically delete and clear any surge demos that have been active for more than 2+ months. Surge in theory allows us to have an infinite amount of active pages but by clearing unused and stale demos we can keep our Surge account more organized in the future.
|
|
163
|
-
|
|
164
|
-
> Note: This workflow exectutes on a monthly cronjob on the first of each month.
|
|
170
|
+
The dynamic component is accessible using a the following string in a JS query selector:
|
|
171
|
+
```js
|
|
172
|
+
this.dropdownTag._$litStatic$
|
|
173
|
+
```
|
|
165
174
|
|
|
166
|
-
In order to clear all our surge projects we rely on [this GitHub Action](https://github.com/marketplace/actions/surge-sh-teardown) to handle the deletion logic.
|
|
167
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
168
|
-
|
|
169
|
-
#### Dependency Tag Versioning
|
|
170
|
-
|
|
171
175
|
```js
|
|
172
176
|
firstUpdated() {
|
|
173
177
|
this.dropdown = this.shadowRoot.querySelector(this.dropdownTag._$litStatic$);
|
|
174
178
|
};
|
|
175
179
|
```
|
|
176
180
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
181
|
+
---
|
|
177
182
|
|
|
178
|
-
|
|
183
|
+
### Sync All Templates
|
|
179
184
|
|
|
180
185
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/syncAllTemplates.md) -->
|
|
181
186
|
<!-- The below content is automatically added from ./../docs/partials/syncAllTemplates.md -->
|
|
182
187
|
|
|
183
|
-
|
|
188
|
+
### How to Run the `syncAllTemplates.mjs` Script
|
|
184
189
|
|
|
185
190
|
To run the `syncAllTemplates.mjs` script, you will need to add a new node script into the linked component and point that to the `syncAllTemplates.mjs` file. You can individually run the workflow configurations by pointing to the `syncAllTemplates.mjs` file and adding a `--github` parameter after the path. The same can be done for the linter configurations by adding a `--linters` parameter.
|
|
186
191
|
|
|
187
|
-
|
|
192
|
+
#### Example Calls
|
|
188
193
|
|
|
189
194
|
```
|
|
190
195
|
// Default
|
|
@@ -142,7 +142,7 @@ function processDemo() {
|
|
|
142
142
|
outputDir: './demo'
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
-
const markdownPath = path.join(__dirname, '../docs/partials/
|
|
145
|
+
const markdownPath = path.join(__dirname, '../docs/partials/index.md');
|
|
146
146
|
|
|
147
147
|
markdownMagic(markdownPath, configDemo, callback);
|
|
148
148
|
}
|
package/package.json
CHANGED
|
@@ -25,5 +25,33 @@ export default class AuroLibraryRuntimeUtils {
|
|
|
25
25
|
return __Closest(base);
|
|
26
26
|
}
|
|
27
27
|
/* eslint-enable jsdoc/require-param */
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* If the element passed is registered with a different tag name than what is passed in, the tag name is added as an attribute to the element.
|
|
31
|
+
* @param {Object} elem - The element to check.
|
|
32
|
+
* @param {String} tagName - The name of the Auro component to check for or add as an attribute.
|
|
33
|
+
* @returns {void}
|
|
34
|
+
*/
|
|
35
|
+
handleComponentTagRename(elem, tagName) {
|
|
36
|
+
const tag = tagName.toLowerCase();
|
|
37
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
38
|
+
|
|
39
|
+
if (elemTag !== tag) {
|
|
40
|
+
elem.setAttribute(tag, true);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Validates if an element is a specific Auro component.
|
|
46
|
+
* @param {Object} elem - The element to validate.
|
|
47
|
+
* @param {String} tagName - The name of the Auro component to check against.
|
|
48
|
+
* @returns {Boolean} - Returns true if the element is the specified Auro component.
|
|
49
|
+
*/
|
|
50
|
+
elementMatch(elem, tagName) {
|
|
51
|
+
const tag = tagName.toLowerCase();
|
|
52
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
53
|
+
|
|
54
|
+
return elemTag === tag || elem.hasAttribute(tag);
|
|
55
|
+
}
|
|
28
56
|
}
|
|
29
57
|
|