@aurodesignsystem/auro-library 2.3.2 → 2.4.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 +7 -0
- package/package.json +1 -1
- package/shellScripts/README.md +58 -0
- package/shellScripts/automation.sh +104 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Semantic Release Automated Changelog
|
|
2
2
|
|
|
3
|
+
# [2.4.0](https://github.com/AlaskaAirlines/auro-library/compare/v2.3.2...v2.4.0) (2024-01-26)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add shell scripts ([caccc2a](https://github.com/AlaskaAirlines/auro-library/commit/caccc2a62855337727c4a805d2cc9e3879c42e18))
|
|
9
|
+
|
|
3
10
|
## [2.3.2](https://github.com/AlaskaAirlines/auro-library/compare/v2.3.1...v2.3.2) (2024-01-25)
|
|
4
11
|
|
|
5
12
|
|
package/package.json
CHANGED
|
@@ -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
|
+
}
|