Skip to content

Commit 067c395

Browse files
authored
Library publishing automation and typescript migration (#119)
* Move to vite+ for everything * Update tests and format * Migrate source to typescript * Update workflow * Format files * Reset version
1 parent 6c6fed1 commit 067c395

55 files changed

Lines changed: 4526 additions & 5195 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.babelrc

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Static Google Map Tests'
1+
name: CI
22

33
on:
44
push:
@@ -7,21 +7,17 @@ on:
77
- main
88

99
jobs:
10-
Run-Tests:
10+
check:
1111
runs-on: ubuntu-latest
12-
13-
strategy:
14-
matrix:
15-
node-version: [14.x]
16-
1712
steps:
18-
- uses: actions/checkout@v2
19-
- name: Use Node.js ${{ matrix.node-version }}
20-
uses: actions/setup-node@v2
13+
- uses: actions/checkout@v6
14+
15+
- uses: voidzero-dev/setup-vp@v1
2116
with:
22-
node-version: ${{ matrix.node-version }}
23-
cache: 'yarn'
24-
- name: Install dependencies
25-
run: yarn --frozen-lockfile
26-
- name: Run tests!
27-
run: yarn test
17+
node-version: "22"
18+
cache: true
19+
20+
- run: vp install
21+
- run: vp check
22+
- run: vp test
23+
- run: vp pack

.github/workflows/codeql-analysis.yml

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,53 @@ name: "CodeQL"
22

33
on:
44
push:
5-
branches: [main, ]
5+
branches: [main]
66
pull_request:
77
# The branches below must be a subset of the branches above
88
branches: [main]
99
schedule:
10-
- cron: '0 13 * * 1'
10+
- cron: "0 13 * * 1"
1111

1212
jobs:
1313
analyse:
1414
name: Analyse
1515
runs-on: ubuntu-latest
1616

1717
steps:
18-
- name: Checkout repository
19-
uses: actions/checkout@v2
20-
with:
21-
# We must fetch at least the immediate parents so that if this is
22-
# a pull request then we can checkout the head.
23-
fetch-depth: 2
24-
25-
# If this run was triggered by a pull request event, then checkout
26-
# the head of the pull request instead of the merge commit.
27-
- run: git checkout HEAD^2
28-
if: ${{ github.event_name == 'pull_request' }}
29-
30-
# Initializes the CodeQL tools for scanning.
31-
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@v1
33-
# Override language selection by uncommenting this and choosing your languages
34-
# with:
35-
# languages: go, javascript, csharp, python, cpp, java
36-
37-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
38-
# If this step fails, then you should remove it and run the build manually (see below)
39-
- name: Autobuild
40-
uses: github/codeql-action/autobuild@v1
41-
42-
# ℹ️ Command-line programs to run using the OS shell.
43-
# 📚 https://git.io/JvXDl
44-
45-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
46-
# and modify them (or add more) to build your code if your project
47-
# uses a compiled language
48-
49-
#- run: |
50-
# make bootstrap
51-
# make release
52-
53-
- name: Perform CodeQL Analysis
54-
uses: github/codeql-action/analyze@v1
18+
- name: Checkout repository
19+
uses: actions/checkout@v6
20+
with:
21+
# We must fetch at least the immediate parents so that if this is
22+
# a pull request then we can checkout the head.
23+
fetch-depth: 2
24+
25+
# If this run was triggered by a pull request event, then checkout
26+
# the head of the pull request instead of the merge commit.
27+
- run: git checkout HEAD^2
28+
if: ${{ github.event_name == 'pull_request' }}
29+
30+
# Initializes the CodeQL tools for scanning.
31+
- name: Initialize CodeQL
32+
uses: github/codeql-action/init@v4
33+
# Override language selection by uncommenting this and choosing your languages
34+
# with:
35+
# languages: go, javascript, csharp, python, cpp, java
36+
37+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
38+
# If this step fails, then you should remove it and run the build manually (see below)
39+
- name: Autobuild
40+
uses: github/codeql-action/autobuild@v3
41+
42+
# ℹ️ Command-line programs to run using the OS shell.
43+
# 📚 https://git.io/JvXDl
44+
45+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
46+
# and modify them (or add more) to build your code if your project
47+
# uses a compiled language
48+
49+
#- run: |
50+
# make bootstrap
51+
# make release
52+
53+
- name: Perform CodeQL Analysis
54+
uses: github/codeql-action/analyze@v3

.github/workflows/dispatch.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Slash Command Dispatch
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
permissions:
8+
issues: write
9+
pull-requests: write
10+
actions: write
11+
contents: read
12+
13+
jobs:
14+
dispatch:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: peter-evans/slash-command-dispatch@v5
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
commands: |
21+
release
22+
permission: write

.github/workflows/publish.yaml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Publish react-static-google-map
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- main
8+
9+
jobs:
10+
build:
11+
if: |
12+
github.event.pull_request.merged == true &&
13+
contains(github.event.pull_request.labels.*.name, 'release')
14+
runs-on: ubuntu-latest
15+
outputs:
16+
version: ${{ steps.version.outputs.version }}
17+
permissions:
18+
contents: read
19+
steps:
20+
- uses: actions/checkout@v6
21+
22+
- uses: voidzero-dev/setup-vp@v1
23+
with:
24+
node-version: "22"
25+
cache: true
26+
27+
- run: vp install
28+
- run: vp pack
29+
30+
- name: Extract version
31+
id: version
32+
run: |
33+
VERSION=$(jq -r .version package.json)
34+
echo "version=$VERSION" >> $GITHUB_OUTPUT
35+
36+
publish-npm:
37+
needs: build
38+
runs-on: ubuntu-latest
39+
environment: Publish
40+
permissions:
41+
contents: read
42+
id-token: write
43+
steps:
44+
- uses: actions/checkout@v6
45+
46+
- uses: voidzero-dev/setup-vp@v1
47+
with:
48+
node-version: "22"
49+
cache: true
50+
51+
- run: vp install
52+
- run: vp pack
53+
54+
- uses: actions/setup-node@v6
55+
with:
56+
node-version: "22"
57+
registry-url: "https://registry.npmjs.org"
58+
59+
- name: Publish to npm
60+
run: npm publish --provenance --access public --ignore-scripts
61+
env:
62+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
63+
64+
create-release:
65+
needs: [build, publish-npm]
66+
runs-on: ubuntu-latest
67+
permissions:
68+
contents: write
69+
steps:
70+
- uses: actions/checkout@v6
71+
72+
- name: Create GitHub Release
73+
uses: softprops/action-gh-release@v2
74+
with:
75+
tag_name: v${{ needs.build.outputs.version }}
76+
name: Release v${{ needs.build.outputs.version }}
77+
generate_release_notes: true
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Create Release PR
2+
3+
on:
4+
repository_dispatch:
5+
types: [release-command]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout main
16+
uses: actions/checkout@v6
17+
with:
18+
ref: main
19+
20+
- name: Extract version
21+
run: |
22+
CURRENT_VERSION=$(jq -r .version package.json)
23+
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION"
24+
MAJOR=${VERSION_PARTS[0]}
25+
MINOR=${VERSION_PARTS[1]}
26+
PATCH=${VERSION_PARTS[2]}
27+
28+
NAMED_VERSION="${{ github.event.client_payload.slash_command.args.named.version }}"
29+
RAW_ARGS="${{ github.event.client_payload.slash_command.args.all }}"
30+
RAW_ARGS=$(echo "$RAW_ARGS" | tr '[:upper:]' '[:lower:]')
31+
32+
if [[ -n "$NAMED_VERSION" ]]; then
33+
VERSION="$NAMED_VERSION"
34+
elif [[ "$RAW_ARGS" == "patch" ]]; then
35+
PATCH=$((PATCH + 1))
36+
elif [[ "$RAW_ARGS" == "minor" ]]; then
37+
MINOR=$((MINOR + 1))
38+
PATCH=0
39+
elif [[ "$RAW_ARGS" == "major" ]]; then
40+
MAJOR=$((MAJOR + 1))
41+
MINOR=0
42+
PATCH=0
43+
else
44+
echo "Invalid release argument: '$RAW_ARGS'"
45+
exit 1
46+
fi
47+
48+
if [[ -z "$VERSION" ]]; then
49+
VERSION="$MAJOR.$MINOR.$PATCH"
50+
fi
51+
52+
echo "VERSION=$VERSION" >> $GITHUB_ENV
53+
54+
- name: Bump version
55+
run: |
56+
npm version $VERSION --allow-same-version --no-git-tag-version --no-commit-hooks
57+
58+
- name: Create PR
59+
uses: peter-evans/create-pull-request@v8
60+
with:
61+
token: ${{ secrets.GITHUB_TOKEN }}
62+
base: main
63+
branch: release-v${{ env.VERSION }}
64+
title: "Release v${{ env.VERSION }}"
65+
body: "Automated release triggered by slash command"
66+
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
67+
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
68+
labels: "release"

.vite-hooks/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vp staged

.yarn/install-state.gz

287 KB
Binary file not shown.

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

0 commit comments

Comments
 (0)