@bigbinary/babel-preset-neeto 1.0.10 → 1.0.11
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.
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
install_gh() {
|
|
4
|
+
type -p curl >/dev/null || sudo apt install curl -y
|
|
5
|
+
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
|
|
6
|
+
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
|
|
7
|
+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list >/dev/null
|
|
8
|
+
sudo apt update
|
|
9
|
+
sudo apt install gh -y
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
handle_error() {
|
|
13
|
+
if [ $? -ne 0 ]; then
|
|
14
|
+
echo "Error: $1 failed. Please check the logs and resolve the issue before retrying."
|
|
15
|
+
exit 1
|
|
16
|
+
fi
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
bump_package() {
|
|
20
|
+
echo "== Bump the NPM package version =="
|
|
21
|
+
yarn install
|
|
22
|
+
handle_error "yarn install"
|
|
23
|
+
yarn config set version-tag-prefix "v"
|
|
24
|
+
yarn version --"$VERSION_LABEL" --no-git-tag-version
|
|
25
|
+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >~/.npmrc
|
|
26
|
+
yarn publish --non-interactive
|
|
27
|
+
handle_error "yarn publish"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
raise_pr() {
|
|
31
|
+
git config user.name "Joseph Mathew"
|
|
32
|
+
git config user.email "joseph.mathew@bigbinary.com"
|
|
33
|
+
git config core.hooksPath /dev/null
|
|
34
|
+
git push origin --delete bump-version
|
|
35
|
+
git checkout -b bump-version
|
|
36
|
+
git add -A
|
|
37
|
+
git commit -m "Bump version"
|
|
38
|
+
git push --set-upstream origin bump-version
|
|
39
|
+
gh pr create -B main -H bump-version -t "Bump version" -b "This is an automated PR." -l instant-mergepr -a @me
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
install_gh
|
|
43
|
+
|
|
44
|
+
LATEST_COMMIT_SHA=$(git log -1 --pretty=format:"%H")
|
|
45
|
+
echo "Latest commit SHA: $LATEST_COMMIT_SHA"
|
|
46
|
+
|
|
47
|
+
PR_NUMBER=$(gh pr list --state merged --search "$LATEST_COMMIT_SHA" --json number --jq ".[0].number")
|
|
48
|
+
echo "Last merged PR number: $PR_NUMBER"
|
|
49
|
+
|
|
50
|
+
PR_LABELS=$(gh pr view $PR_NUMBER --json labels --jq ".labels[].name" | tr "\n" " " | cut -d " " -f 1-)
|
|
51
|
+
echo "PR labels: $PR_LABELS"
|
|
52
|
+
|
|
53
|
+
[[ -z "$PR_LABELS" ]] && exit 0
|
|
54
|
+
|
|
55
|
+
ALL_VERSION_LABELS=(major minor patch)
|
|
56
|
+
|
|
57
|
+
PR_VERSION_LABELS=()
|
|
58
|
+
for version_label in "${ALL_VERSION_LABELS[@]}"; do
|
|
59
|
+
if echo "$PR_LABELS" | grep -q -o "$version_label"; then
|
|
60
|
+
PR_VERSION_LABELS+=("$version_label")
|
|
61
|
+
fi
|
|
62
|
+
done
|
|
63
|
+
|
|
64
|
+
PR_VERSION_LABELS_STR="${PR_VERSION_LABELS[*]}"
|
|
65
|
+
echo "Semantic versions present in PR labels: $PR_VERSION_LABELS_STR"
|
|
66
|
+
|
|
67
|
+
VERSION_LABEL=$(echo "${PR_VERSION_LABELS[0]}" | xargs)
|
|
68
|
+
echo "Version label selected: $VERSION_LABEL"
|
|
69
|
+
|
|
70
|
+
[[ -z "$VERSION_LABEL" ]] && exit 0
|
|
71
|
+
|
|
72
|
+
if [[ -n "$VERSION_LABEL" ]]; then
|
|
73
|
+
bump_package
|
|
74
|
+
else
|
|
75
|
+
echo "PR label doesn't exist"
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
raise_pr
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/babel-preset-neeto",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "A babel preset to transform short code to boilerplate at compile time",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"eslint-plugin-unused-imports": "2.0.0",
|
|
62
62
|
"husky": "^8.0.0",
|
|
63
63
|
"jest": "^29.5.0",
|
|
64
|
-
"lint-staged": "
|
|
64
|
+
"lint-staged": "13.3.0",
|
|
65
65
|
"prettier": "^2.8.7"
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
name: "Create and publish releases"
|
|
2
|
-
on:
|
|
3
|
-
pull_request:
|
|
4
|
-
branches:
|
|
5
|
-
- main
|
|
6
|
-
types: [closed]
|
|
7
|
-
jobs:
|
|
8
|
-
release:
|
|
9
|
-
name: "Create Release"
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
if: >-
|
|
12
|
-
${{ github.event.pull_request.merged == true && (
|
|
13
|
-
contains(github.event.pull_request.labels.*.name, 'patch') ||
|
|
14
|
-
contains(github.event.pull_request.labels.*.name, 'minor') ||
|
|
15
|
-
contains(github.event.pull_request.labels.*.name, 'major') ) }}
|
|
16
|
-
steps:
|
|
17
|
-
- name: Checkout the repository
|
|
18
|
-
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
|
|
19
|
-
|
|
20
|
-
- name: Setup git user
|
|
21
|
-
run: |
|
|
22
|
-
git config user.name "Joseph Mathew"
|
|
23
|
-
git config user.email "joseph.mathew@bigbinary.com"
|
|
24
|
-
- name: Setup NodeJS LTS version
|
|
25
|
-
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
|
|
26
|
-
with:
|
|
27
|
-
node-version-file: ".nvmrc"
|
|
28
|
-
|
|
29
|
-
- name: Setup the project
|
|
30
|
-
run: yarn install
|
|
31
|
-
|
|
32
|
-
- name: Prefix version tag with "v"
|
|
33
|
-
run: yarn config set version-tag-prefix "v"
|
|
34
|
-
|
|
35
|
-
- name: Disable Git commit hooks
|
|
36
|
-
run: git config core.hooksPath /dev/null
|
|
37
|
-
|
|
38
|
-
- name: Bump the patch version and create git tag on release
|
|
39
|
-
if: ${{ contains(github.event.pull_request.labels.*.name, 'patch') }}
|
|
40
|
-
run: yarn version --patch
|
|
41
|
-
|
|
42
|
-
- name: Bump the minor version and create git tag on release
|
|
43
|
-
if: ${{ contains(github.event.pull_request.labels.*.name, 'minor') }}
|
|
44
|
-
run: yarn version --minor
|
|
45
|
-
|
|
46
|
-
- name: Bump the major version and create git tag on release
|
|
47
|
-
if: ${{ contains(github.event.pull_request.labels.*.name, 'major') }}
|
|
48
|
-
run: yarn version --major
|
|
49
|
-
|
|
50
|
-
- name: Get the package version from package.json
|
|
51
|
-
uses: tyankatsu0105/read-package-version-actions@5aad2bb630a577ee4255546eb3ee0593df68f6ca
|
|
52
|
-
id: package-version
|
|
53
|
-
|
|
54
|
-
- name: Create a new version release commit
|
|
55
|
-
uses: EndBug/add-and-commit@050a66787244b10a4874a2a5f682130263edc192
|
|
56
|
-
with:
|
|
57
|
-
message: "New version release"
|
|
58
|
-
|
|
59
|
-
- name: Push the commit to main
|
|
60
|
-
uses: ad-m/github-push-action@492de9080c3179a3187bd456763f988f9a06e196
|
|
61
|
-
with:
|
|
62
|
-
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
63
|
-
branch: main
|
|
64
|
-
|
|
65
|
-
- name: Create a release draft on release
|
|
66
|
-
uses: release-drafter/release-drafter@ac463ffd9cc4c6ad5682af93dc3e3591c4657ee3
|
|
67
|
-
env:
|
|
68
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
69
|
-
with:
|
|
70
|
-
tag: v${{ steps.package-version.outputs.version }}
|
|
71
|
-
publish: true
|
|
72
|
-
|
|
73
|
-
- name: Publish the package on NPM
|
|
74
|
-
uses: JS-DevTools/npm-publish@22595ff8c4d0d9f53cef0656fbb90fbe06ee885c
|
|
75
|
-
with:
|
|
76
|
-
access: "public"
|
|
77
|
-
token: ${{ secrets.NPM_TOKEN }}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
name: Publish to npm
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
release:
|
|
5
|
-
types: [created]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
publish:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- name: Checkout the repository
|
|
12
|
-
uses: actions/checkout@v3
|
|
13
|
-
|
|
14
|
-
- name: Setup NodeJS LTS version
|
|
15
|
-
uses: actions/setup-node@v3
|
|
16
|
-
with:
|
|
17
|
-
node-version: "22.13"
|
|
18
|
-
|
|
19
|
-
- name: Setup the project
|
|
20
|
-
run: yarn install
|
|
21
|
-
|
|
22
|
-
- name: Publish the package on NPM
|
|
23
|
-
uses: JS-DevTools/npm-publish@v1
|
|
24
|
-
with:
|
|
25
|
-
access: "public"
|
|
26
|
-
token: ${{ secrets.NPM_TOKEN }}
|