@aurodesignsystem-dev/auro-library 0.0.0-pr187.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/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/.tool-versions +1 -0
- package/CHANGELOG.md +664 -0
- package/LICENSE +201 -0
- package/README.md +235 -0
- package/bin/generateDocs.mjs +210 -0
- package/bin/generateDocs_index.mjs +210 -0
- package/package.json +92 -0
- package/scripts/build/generateDocs.mjs +24 -0
- package/scripts/build/generateReadme.mjs +60 -0
- package/scripts/build/generateWcaComponent.mjs +43 -0
- package/scripts/build/postCss.mjs +66 -0
- package/scripts/build/postinstall.mjs +31 -0
- package/scripts/build/pre-commit.mjs +17 -0
- package/scripts/build/prepWcaCompatibleCode.mjs +19 -0
- package/scripts/build/processors/defaultDocsProcessor.mjs +83 -0
- package/scripts/build/processors/defaultDotGithubSync.mjs +83 -0
- package/scripts/build/staticStyles-template.js +2 -0
- package/scripts/build/syncGithubFiles.mjs +25 -0
- package/scripts/build/versionWriter.js +26 -0
- package/scripts/runtime/FocusTrap/FocusTrap.mjs +194 -0
- package/scripts/runtime/FocusTrap/index.mjs +1 -0
- package/scripts/runtime/FocusTrap/test/FocusTrap.test.js +168 -0
- package/scripts/runtime/Focusables/Focusables.mjs +157 -0
- package/scripts/runtime/Focusables/index.mjs +1 -0
- package/scripts/runtime/Focusables/test/Focusables.test.js +165 -0
- package/scripts/runtime/dateUtilities/baseDateUtilities.mjs +58 -0
- package/scripts/runtime/dateUtilities/dateConstraints.mjs +11 -0
- package/scripts/runtime/dateUtilities/dateFormatter.mjs +104 -0
- package/scripts/runtime/dateUtilities/dateUtilities.mjs +218 -0
- package/scripts/runtime/dateUtilities/index.mjs +26 -0
- package/scripts/runtime/dependencyTagVersioning.mjs +42 -0
- package/scripts/runtime/floatingUI.mjs +646 -0
- package/scripts/test-plugin/iterateWithA11Check.mjs +82 -0
- package/scripts/utils/auroFileHandler.mjs +70 -0
- package/scripts/utils/auroLibraryUtils.mjs +206 -0
- package/scripts/utils/auroTemplateFiller.mjs +178 -0
- package/scripts/utils/logger.mjs +73 -0
- package/scripts/utils/runtimeUtils.mjs +70 -0
- package/scripts/utils/sharedFileProcessorUtils.mjs +270 -0
- package/shellScripts/README.md +58 -0
- package/shellScripts/automation.sh +104 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import * as mdMagic from 'markdown-magic';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
import AuroLibraryUtils from "./auroLibraryUtils.mjs";
|
|
6
|
+
import { AuroTemplateFiller } from "./auroTemplateFiller.mjs";
|
|
7
|
+
import { AuroFileHandler } from "./auroFileHandler.mjs";
|
|
8
|
+
import {Logger} from "./logger.mjs";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
// This JSDoc type trickery is here so you get "decent enough" auto complete
|
|
12
|
+
/** @type {typeof import('markdown-magic').markdownMagic} */
|
|
13
|
+
const applyMarkdownMagic = mdMagic.default
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Optional output configuration
|
|
17
|
+
* @typedef {object} OutputConfig
|
|
18
|
+
* @property {string} [directory] - Change output path of new content. Default behavior is replacing the original file
|
|
19
|
+
* @property {boolean} [removeComments = false] - Remove comments from output. Default is false.
|
|
20
|
+
* @property {function} [pathFormatter] - Custom function for altering output paths
|
|
21
|
+
* @property {boolean} [applyTransformsToSource = false] - Apply transforms to source file. Default is true. This is for when outputDir is set.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Configuration for Markdown magic
|
|
26
|
+
*
|
|
27
|
+
* Below is the main config for `markdown-magic` - copy-pasted directly from the library
|
|
28
|
+
*
|
|
29
|
+
* @typedef {object} MarkdownMagicOptions
|
|
30
|
+
* @property {string} matchWord - [v2-only] string to match for variables
|
|
31
|
+
* @property {FilePathsOrGlobs} [files] - Files to process.
|
|
32
|
+
* @property {Array} [transforms = defaultTransforms] - Custom commands to transform block contents, see transforms & custom transforms sections below.
|
|
33
|
+
* @property {OutputConfig} [output] - Output configuration
|
|
34
|
+
* @property {SyntaxType} [syntax = 'md'] - Syntax to parse
|
|
35
|
+
* @property {string} [open = 'doc-gen'] - Opening match word
|
|
36
|
+
* @property {string} [close = 'end-doc-gen'] - Closing match word. If not defined will be same as opening word.
|
|
37
|
+
* @property {string} [cwd = process.cwd() ] - Current working directory. Default process.cwd()
|
|
38
|
+
* @property {boolean} [outputFlatten] - Flatten files that are output
|
|
39
|
+
* @property {boolean} [useGitGlob] - Use git glob for LARGE file directories
|
|
40
|
+
* @property {boolean} [dryRun = false] - See planned execution of matched blocks
|
|
41
|
+
* @property {boolean} [debug = false] - See debug details
|
|
42
|
+
* @property {boolean} [silent = false] - Silence all console output
|
|
43
|
+
* @property {boolean} [applyTransformsToSource = true] - Apply transforms to source file. Default is true.
|
|
44
|
+
* @property {boolean} [failOnMissingTransforms = false] - Fail if transform functions are missing. Default skip blocks.
|
|
45
|
+
* @property {boolean} [failOnMissingRemote = true] - Fail if remote file is missing.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
// Config
|
|
50
|
+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
51
|
+
|
|
52
|
+
/** @type {MarkdownMagicOptions} */
|
|
53
|
+
export const MD_MAGIC_CONFIG = {
|
|
54
|
+
matchWord: "AURO-GENERATED-CONTENT",
|
|
55
|
+
output: {
|
|
56
|
+
directory: "./",
|
|
57
|
+
applyTransformsToSource: true
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// Initialize utility services
|
|
62
|
+
export const auroLibraryUtils = new AuroLibraryUtils();
|
|
63
|
+
export const templateFiller = new AuroTemplateFiller();
|
|
64
|
+
|
|
65
|
+
// List of components that do not support ESM to determine which README to use
|
|
66
|
+
export const nonEsmComponents = ['combobox', 'datepicker', 'menu', 'pane', 'select'];
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
// Local utils
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @param {string} pathLike - Please include the preceding slash! Like so: `/docTemplates/README.md`
|
|
73
|
+
* @return {string}
|
|
74
|
+
*/
|
|
75
|
+
// TODO: test this in auro-flight before merging to main
|
|
76
|
+
export function fromAuroComponentRoot(pathLike) {
|
|
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)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
// External assets
|
|
87
|
+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Generate a URL for the WC Generator README file.
|
|
91
|
+
* @param {string} branchOrTag
|
|
92
|
+
* @param {string} fileNameWithPath
|
|
93
|
+
* @return {string}
|
|
94
|
+
*/
|
|
95
|
+
export function generateWCGeneratorUrl(branchOrTag, fileNameWithPath) {
|
|
96
|
+
const baseRepoUrl = 'https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator'
|
|
97
|
+
|
|
98
|
+
// check if tag starts with 'vX' since our tags are `v4.0.0`
|
|
99
|
+
const isTag = branchOrTag.startsWith('v') &&
|
|
100
|
+
/^\d+\.\d+\.\d+(-.*)?$/.test(branchOrTag.slice(1));
|
|
101
|
+
|
|
102
|
+
if (isTag) {
|
|
103
|
+
return `${baseRepoUrl}/refs/tags/${branchOrTag}/${fileNameWithPath}`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (branchOrTag !== 'master') {
|
|
107
|
+
return `${baseRepoUrl}/refs/heads/${branchOrTag}/${fileNameWithPath}`;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return `${baseRepoUrl}/master/${fileNameWithPath}`;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @param {string} branchOrTag - the git branch or tag to use for the README source
|
|
115
|
+
* @param {string} [variantOverride] - override the variant string
|
|
116
|
+
* @return {string}
|
|
117
|
+
*/
|
|
118
|
+
export function generateReadmeUrl(branchOrTag = 'master', variantOverride = '') {
|
|
119
|
+
// LEGACY CODE FOR NON-ESM COMPONENTS
|
|
120
|
+
|
|
121
|
+
const nameExtractionData = templateFiller.values;
|
|
122
|
+
let variantString = '';
|
|
123
|
+
|
|
124
|
+
if (!nonEsmComponents.includes(nameExtractionData.name)) {
|
|
125
|
+
variantString = '_esm';
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// END LEGACY CODE
|
|
129
|
+
|
|
130
|
+
if (variantOverride !== '') {
|
|
131
|
+
variantString = variantOverride;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return generateWCGeneratorUrl(branchOrTag, `componentDocs/README${variantString}.md`);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Main Markdown magic processors
|
|
138
|
+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* This is the expected object type when passing something other than a string.
|
|
142
|
+
* @typedef {Object} InputFileType
|
|
143
|
+
* @property {string} remoteUrl - The remote template to fetch
|
|
144
|
+
* @property {string} fileName - Path including file name to store
|
|
145
|
+
* @property {boolean} [overwrite] - Default is true. Choose to overwrite the file if it exists
|
|
146
|
+
*/
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @typedef {Object} FileProcessorConfig
|
|
151
|
+
* @property {string} identifier - A unique identifier for this file (used for logging).
|
|
152
|
+
* @property {string | InputFileType} input - path to an input file, including filename
|
|
153
|
+
* @property {string} output - path to an output file, including filename
|
|
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
|
|
156
|
+
* @property {Array<(contents: string) => string>} [postProcessors] - extra processor functions to run on content
|
|
157
|
+
* @property {object} [extraVars] - extra variables to use in the template
|
|
158
|
+
*/
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
// Individual file processing steps
|
|
162
|
+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Retrieve a remote file using a provided configuration and store at a local path.
|
|
166
|
+
* @param {InputFileType} input - the input file configuration
|
|
167
|
+
* @return {Promise<void>}
|
|
168
|
+
*/
|
|
169
|
+
export async function retrieveRemoteFileCopy(input) {
|
|
170
|
+
const bareFileName = input.fileName
|
|
171
|
+
|
|
172
|
+
Logger.log(`Retrieving latest "${bareFileName}" file...`);
|
|
173
|
+
|
|
174
|
+
// 0b. Attempt to populate from remote file
|
|
175
|
+
const contents = await fetch(input.remoteUrl, {
|
|
176
|
+
redirect: 'follow'
|
|
177
|
+
}).then(r => r.text());
|
|
178
|
+
|
|
179
|
+
// 0c. Write remote contents to local folder as cache
|
|
180
|
+
await AuroFileHandler.tryWriteFile(input.fileName, contents);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Run markdown magic on a file.
|
|
186
|
+
* @param {string} input
|
|
187
|
+
* @param {string} output
|
|
188
|
+
* @param {Partial<MarkdownMagicOptions>} [extraMdMagicConfig] - extra configuration options for md magic
|
|
189
|
+
* @return {Promise<void>}
|
|
190
|
+
*/
|
|
191
|
+
export async function runMarkdownMagicOnFile(input, output, extraMdMagicConfig = {}) {
|
|
192
|
+
await applyMarkdownMagic(output, {
|
|
193
|
+
...MD_MAGIC_CONFIG,
|
|
194
|
+
...extraMdMagicConfig
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Optionally copy a file to a new location.
|
|
201
|
+
* @param {string} input - the input file path
|
|
202
|
+
* @param {string} output - the output file path
|
|
203
|
+
* @param {boolean} overwrite - whether to overwrite the file if it exists (default is true)
|
|
204
|
+
* @return {Promise<void>}
|
|
205
|
+
*/
|
|
206
|
+
export async function optionallyCopyFile(input, output, overwrite = true) {
|
|
207
|
+
if (await AuroFileHandler.exists(output) && !overwrite) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (!await AuroFileHandler.tryCopyFile(input, output)) {
|
|
212
|
+
throw new Error(`Error copying "${input}" file to output ${output}`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Process the content of a file.
|
|
218
|
+
*
|
|
219
|
+
* This is a high level function that performs the following via lower functions:
|
|
220
|
+
* - Read contents of file
|
|
221
|
+
* - Run "markdown-magic" on file contents (optional, *.md specific)
|
|
222
|
+
* - Run template variable replacement on file contents
|
|
223
|
+
* @param {FileProcessorConfig} config - the config for this file
|
|
224
|
+
*/
|
|
225
|
+
export async function processContentForFile(config) {
|
|
226
|
+
const { input: rawInput, output, mdMagicConfig, extraVars = {} } = config
|
|
227
|
+
|
|
228
|
+
// Helper vars
|
|
229
|
+
const derivedInputPath = typeof rawInput === 'string' ? rawInput : rawInput.fileName;
|
|
230
|
+
const segments = derivedInputPath.split("/")
|
|
231
|
+
const bareFileName = segments[segments.length - 1]
|
|
232
|
+
|
|
233
|
+
// 0. Optionally retrieve a remote file
|
|
234
|
+
if (typeof rawInput === 'object') {
|
|
235
|
+
await retrieveRemoteFileCopy(rawInput);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// 1. Copy input or local input cache to output
|
|
239
|
+
await optionallyCopyFile(derivedInputPath, output, rawInput.overwrite ?? true);
|
|
240
|
+
|
|
241
|
+
// 2. If the file is a Markdown file, run markdown magic to inject contents and perform replacements
|
|
242
|
+
if (output.endsWith(".md")) {
|
|
243
|
+
await runMarkdownMagicOnFile(derivedInputPath, output, mdMagicConfig);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// 3a. Read the output file contents
|
|
247
|
+
let fileContents = await fs.readFile(output, {encoding: 'utf-8'});
|
|
248
|
+
|
|
249
|
+
// 3b. Run any pre-processors
|
|
250
|
+
if (config.preProcessors) {
|
|
251
|
+
for (const processor of config.preProcessors) {
|
|
252
|
+
fileContents = processor(fileContents)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// 3c. Replace template variables in output file
|
|
257
|
+
fileContents = templateFiller.replaceTemplateValues(fileContents, extraVars);
|
|
258
|
+
|
|
259
|
+
// 3d. Run any post-processors
|
|
260
|
+
if (config.postProcessors) {
|
|
261
|
+
for (const processor of config.postProcessors) {
|
|
262
|
+
fileContents = processor(fileContents)
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// 3e. Write the final file contents
|
|
267
|
+
if (!await AuroFileHandler.tryWriteFile(output, fileContents)) {
|
|
268
|
+
throw new Error(`Error writing "${bareFileName}" file to output ${output}`);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Automated shell scripts
|
|
2
|
+
|
|
3
|
+
In this repo is a single shell script that contains functions designed to do automated tasks locally, prepare those updates and push them to their individual remote repos.
|
|
4
|
+
|
|
5
|
+
### Install shell script
|
|
6
|
+
|
|
7
|
+
This shell script, and others, can be installed anywhere in your local environment. If you chose, installing the npm in a global space is acceptable as well.
|
|
8
|
+
|
|
9
|
+
To access the script(s) from your command line, it is required to source the file when a new shell is opened.
|
|
10
|
+
|
|
11
|
+
With BASH, it is common to add a `source` command in the `~./bash_profile` config file. In the following code example the `automation.sh` shell script was placed into the `~/.bash_resources` directory.
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
source ~/.bash_resources/automation.sh
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### What's in the script?
|
|
18
|
+
|
|
19
|
+
`gitVersion`
|
|
20
|
+
|
|
21
|
+
This is a simple function that when within a repo's directory, from the CLI you can run `gitVersion` and it will print out the version number from the repo's package.json file.
|
|
22
|
+
|
|
23
|
+
This is handy for things like having an alias to a repo's directory. For example, you could have an alias for the `auro-menu` component that takes you to the repo's directory and prints out the package version.
|
|
24
|
+
|
|
25
|
+
```shell
|
|
26
|
+
alias menu="cd ~/src/auro/menu && gitVersion"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`updateRepos`
|
|
30
|
+
|
|
31
|
+
This function takes an array of all the repo directories in your local setup that you want to loop through, determine what the HEAD branch is, check it out and perform a `git pull`.
|
|
32
|
+
|
|
33
|
+
With this one command you can ensure that all your local repos have the latest versions from the remote.
|
|
34
|
+
|
|
35
|
+
`addToRepo`
|
|
36
|
+
|
|
37
|
+
This function is like a sandwich. There is the first part that ensures that the repo is up to date. Much like the `updateRepos` function, and then it ends with a commit and a push.
|
|
38
|
+
|
|
39
|
+
In the middle is the part where custom actions can be written that allow for simple repetitive updates to be scripted.
|
|
40
|
+
|
|
41
|
+
Need to add a new file to all the repos?
|
|
42
|
+
|
|
43
|
+
```shell
|
|
44
|
+
command cp ../WC-Generator/.github/workflows/addToProject.yml .github/workflows/addToProject.yml
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Need to do a search and replace of content in a specific file and delete the temp resource created?
|
|
48
|
+
|
|
49
|
+
```shell
|
|
50
|
+
command sed -i -e 's/@v3/@v4/g' .github/workflows/testPublish.yml
|
|
51
|
+
command rm .github/workflows/testPublish.yml-e
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`openActions`
|
|
55
|
+
|
|
56
|
+
This really simple function takes an array and constructs a URL on the fly to be opened by your default browser.
|
|
57
|
+
|
|
58
|
+
This function specifically opens all the Auro element actions page. This is a great way to do a quick scan of all the repos to ensure that actions are working as expected and there are no unknown blocked releases because you missed a notification from Github.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Simple function that looks into a repo's package.json and print out
|
|
4
|
+
# the current verison released.
|
|
5
|
+
function gitVersion {
|
|
6
|
+
# Version key/value should be on his own line
|
|
7
|
+
PACKAGE_VERSION=$(cat package.json \
|
|
8
|
+
| grep version \
|
|
9
|
+
| head -1 \
|
|
10
|
+
| awk -F: '{ print $2 }' \
|
|
11
|
+
| sed 's/[",^|]//g')
|
|
12
|
+
|
|
13
|
+
echo -e "Package version -$PACKAGE_VERSION"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
# This function will loop through all the repos listed
|
|
17
|
+
# and do a `git pull` for each repo before moving on.
|
|
18
|
+
function updateRepos {
|
|
19
|
+
## declare an array variable
|
|
20
|
+
declare -a arr=("alert" "WC-Generator/" "drawer/" "wcss/" "hyperlink/" "auro-lockup/" "icons/" "flight/" "dialog/" "banner/" "card/" "nav/" "datepicker/" "popover/" "dropdown/" "radio/" "checkbox/" "button/" "loader/" "flightline/" "b2top/" "combobox/" "carousel/" "table/" "toast/" "icon/" "select/" "sidenav/" "pane/" "header/" "datetime/" "input/" "avatar/" "badge/" "background/" "interruption/" "skeleton/" "menu/" "eslint-config/" "tokens/"
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
## now loop through the above array
|
|
24
|
+
for i in "${arr[@]}"
|
|
25
|
+
do
|
|
26
|
+
echo -e "\n$i\n"
|
|
27
|
+
command cd ~/src/auro/"$i"
|
|
28
|
+
echo "look at me in '$i'"
|
|
29
|
+
gitVersion
|
|
30
|
+
branch=$(git symbolic-ref --short HEAD)
|
|
31
|
+
echo -e "making sure on $branch branch"
|
|
32
|
+
command git checkout $branch
|
|
33
|
+
echo -e "updating repo from remote"
|
|
34
|
+
command git pull
|
|
35
|
+
|
|
36
|
+
done
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
function addToRepo {
|
|
41
|
+
## declare an array variable
|
|
42
|
+
declare -a arr=("wcss/" "icons/" "banner/" "card/" "radio/" "checkbox/" "button/" "loader/" "flightline/" "b2top/" "combobox/" "carousel/" "table/" "toast/" "icon/" "select/" "sidenav/" "pane/" "header/" "datetime/" "input/" "avatar/" "badge/" "background/" "interruption/" "skeleton/" "menu/" "eslint-config/" "tokens/")
|
|
43
|
+
|
|
44
|
+
## now loop through the above array
|
|
45
|
+
for i in "${arr[@]}"
|
|
46
|
+
do
|
|
47
|
+
# CD into dir and ensure that the repo is
|
|
48
|
+
# up to date with a `git pull`
|
|
49
|
+
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
|
50
|
+
echo -e "\n$i\n"
|
|
51
|
+
command cd ~/src/auro/"$i"
|
|
52
|
+
echo "look at me in '$i'"
|
|
53
|
+
sleep 1
|
|
54
|
+
gitVersion
|
|
55
|
+
branch=$(git symbolic-ref --short HEAD) # determins if the head is `master` or `main`
|
|
56
|
+
echo -e "making sure on $branch branch" # uses variable
|
|
57
|
+
command git checkout $branch # uses variable
|
|
58
|
+
echo -e "updating repo from remote"
|
|
59
|
+
command git pull
|
|
60
|
+
sleep 1
|
|
61
|
+
|
|
62
|
+
# Customize the action to be performed
|
|
63
|
+
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
|
64
|
+
# This action will copy a resource from one dir to another
|
|
65
|
+
# to update the repo
|
|
66
|
+
command cp ../WC-Generator/.github/workflows/addToProject.yml .github/workflows/addToProject.yml
|
|
67
|
+
echo -e "Copied file to '$i' repo.\n"
|
|
68
|
+
|
|
69
|
+
# This action will look for `@v3` and replace with @v4
|
|
70
|
+
# in .github/workflows/testPublish.yml, then delete the
|
|
71
|
+
# temporary file that was created.
|
|
72
|
+
command sed -i -e 's/@v3/@v4/g' .github/workflows/testPublish.yml
|
|
73
|
+
command rm .github/workflows/testPublish.yml-e
|
|
74
|
+
echo -e "Updated workflow script\n"
|
|
75
|
+
|
|
76
|
+
# Perform git functions to add, commit and push
|
|
77
|
+
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
|
78
|
+
sleep 1
|
|
79
|
+
command git add --all
|
|
80
|
+
sleep 1
|
|
81
|
+
command git commit -m "build: add auto-assign to project script"
|
|
82
|
+
echo -e "Commit added to Git\n"
|
|
83
|
+
echo -e "Pushing to the remote\n"
|
|
84
|
+
sleep 2
|
|
85
|
+
command git push
|
|
86
|
+
echo -e "Update pushed to the remote\n"
|
|
87
|
+
sleep 2
|
|
88
|
+
|
|
89
|
+
done
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
# This function will loop through the array to construct a URL for each repo's
|
|
93
|
+
# actions landing page. This is great for validating that actions have
|
|
94
|
+
# run successfully.
|
|
95
|
+
function openActions {
|
|
96
|
+
## declare an array variable
|
|
97
|
+
declare -a arr=("auro-alert" "WC-Generator/" "auro-drawer/" "webcorestylesheets/" "auro-hyperlink/" "auro-lockup/" "icons/" "auro-flight/" "auro-dialog/" "auro-banner/" "auro-card/" "auro-nav/" "auro-datepicker/" "auro-popover/" "auro-dropdown/" "auro-radio/" "auro-checkbox/" "auro-button/" "auro-loader/" "auro-flightline/" "auro-backtotop/" "auro-combobox/" "auro-carousel/" "auro-table/" "auro-toast/" "auro-icon/" "auro-select/" "auro-sidenav/" "auro-pane/" "auro-header/" "auro-datetime/" "auro-input/" "auro-avatar/" "auro-badge/" "auro-background/" "auro-interruption/" "auro-skeleton/" "auro-menu/" "eslint-config-auro/" "aurodesigntokens/")
|
|
98
|
+
|
|
99
|
+
## now loop through the above array
|
|
100
|
+
for i in "${arr[@]}"
|
|
101
|
+
do
|
|
102
|
+
command open https://github.com/AlaskaAirlines/"$i"actions
|
|
103
|
+
done
|
|
104
|
+
}
|