Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly

- package-ecosystem: npm
directories:
- /
- /docs
- /docs/typedoc
schedule:
interval: weekly
# Gives new releases a few days to be vetted before they're proposed.
cooldown:
default-days: 3
# Upgrade the Vite+ toolchain with `vp migrate`, which re-pins these together.
ignore:
- dependency-name: vite-plus
- dependency-name: "@voidzero-dev/vite-plus-core"
- dependency-name: vitest
- dependency-name: "@vitest/*"
groups:
dependencies:
update-types:
- minor
- patch
169 changes: 103 additions & 66 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: CI

on:
push:
branches:
- main
- "release/npm/**"
tags:
- "v*"
pull_request:
workflow_call:
workflow_dispatch:
inputs:
Expand All @@ -10,8 +16,11 @@ on:
required: true
type: string

permissions:
contents: read

jobs:
lint:
build:
runs-on: ubuntu-24.04
outputs:
version: ${{ steps.version.outputs.version }}
Expand All @@ -20,9 +29,13 @@ jobs:
uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false

- name: Build Reason
run: "echo ref: ${{github.ref}} event: ${{github.event_name}}"
env:
GIT_REF: ${{ github.ref }}
EVENT_NAME: ${{ github.event_name }}
run: 'echo "ref: $GIT_REF event: $EVENT_NAME"'

- name: Build Version
id: version
Expand All @@ -38,88 +51,110 @@ jobs:
dotnet tool install --global minver-cli --version 7.0.0
version=$(minver --tag-prefix v)
fi
echo "version=$version" >> $GITHUB_OUTPUT
echo "### Version: $version" >> $GITHUB_STEP_SUMMARY
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then
echo "::error::'$version' is not a valid semver version."
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "### Version: $version" >> "$GITHUB_STEP_SUMMARY"

- name: Setup Deno
uses: denoland/setup-deno@v2
- name: Setup Vite+
uses: voidzero-dev/setup-vp@v1.22.0
with:
deno-version: v2.x
node-version-file: .node-version
cache: true

- name: Check
run: vp check

- name: Code Style
run: deno fmt --check
- name: Test
run: vp test --project unit --coverage

- name: Set Package Version
env:
VERSION: ${{ steps.version.outputs.version }}
run: vp pm version "$VERSION" -- --no-git-tag-version --no-git-checks

- name: Pack
run: |
vp pack
vp pm pack --out "$RUNNER_TEMP/fetchclient.tgz"

- name: Linting
run: deno lint
- name: Show Package
run: tar -xOzf "$RUNNER_TEMP/fetchclient.tgz" package/package.json

- name: Type Check
run: deno task check
- name: Upload Package
uses: actions/upload-artifact@v7
with:
name: npm-package
path: ${{ runner.temp }}/fetchclient.tgz
if-no-files-found: error

deno:
# Calls real third-party APIs, so it reports problems without gating publishing.
integration:
runs-on: ubuntu-24.04
needs: lint
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Deno
uses: denoland/setup-deno@v2
- name: Setup Vite+
uses: voidzero-dev/setup-vp@v1.22.0
with:
deno-version: v2.x
node-version-file: .node-version
cache: true

- name: Tests
run: |
deno test --allow-net --coverage=cov/ src/tests
deno coverage cov/

- name: Publish Release Package
if: startsWith(github.ref, 'refs/tags/v')
run: deno publish --set-version ${{ needs.lint.outputs.version }}
- name: Integration Tests
run: vp test --project integration

npm:
docs:
runs-on: ubuntu-24.04
needs: lint
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false

- uses: denoland/setup-deno@v2
- name: Setup Vite+
uses: voidzero-dev/setup-vp@v1.22.0
with:
deno-version: v2.x
node-version-file: .node-version
cache: true

- name: Build Documentation
run: vp run docs:build

- name: Build NPM Package
run: deno task build --set-version ${{ needs.lint.outputs.version }}
publish:
runs-on: ubuntu-24.04
needs: build
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/release/npm/') || github.event_name == 'workflow_dispatch'
permissions:
contents: read
packages: write
id-token: write
steps:
# No checkout here: npm refuses to run inside the repo because devEngines pins pnpm.
- name: Download Package
uses: actions/download-artifact@v8
with:
name: npm-package

- name: Add NPM Package Metadata
- name: Resolve Dist Tag
id: dist-tag
env:
REPOSITORY_URL: https://github.com/${{ github.repository }}
VERSION: ${{ needs.build.outputs.version }}
IS_RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/release/npm/') || github.event_name == 'workflow_dispatch' }}
run: |
package_dir=$(mktemp -d)
tar -xzf fetchclient.tgz -C "$package_dir"
PACKAGE_JSON="$package_dir/package/package.json" deno eval '
const path = Deno.env.get("PACKAGE_JSON");
const repositoryUrl = Deno.env.get("REPOSITORY_URL");
const packageJson = JSON.parse(await Deno.readTextFile(path));
packageJson.repository = { type: "git", url: repositoryUrl };
await Deno.writeTextFile(path, `${JSON.stringify(packageJson, null, 2)}\n`);
'
tar -czf fetchclient.tgz -C "$package_dir" package

- name: Show NPM Package
run: tar -xOf fetchclient.tgz package/package.json

- name: Setup Node.js environment
if [ "$IS_RELEASE" = "true" ] && [[ "$VERSION" != *-* ]]; then
tag=latest
else
tag=next
fi
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "### Dist tag: $tag" >> "$GITHUB_STEP_SUMMARY"

- name: Setup npm Registry
uses: actions/setup-node@v7
with:
node-version: "24.x"
Expand All @@ -128,24 +163,26 @@ jobs:

- name: Publish Release Package
if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/release/npm/') || github.event_name == 'workflow_dispatch'
run: npm publish fetchclient.tgz --provenance --access public
env:
DIST_TAG: ${{ steps.dist-tag.outputs.tag }}
run: npm publish fetchclient.tgz --provenance --access public --tag "$DIST_TAG"

- name: Setup GitHub CI Node.js environment
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/release/npm/') || github.event_name == 'workflow_dispatch'
- name: Setup GitHub Packages Registry
uses: actions/setup-node@v7
with:
node-version: "24.x"
registry-url: "https://npm.pkg.github.com"
scope: "@foundatiofx"

- name: Push GitHub CI Packages
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/release/npm/') || github.event_name == 'workflow_dispatch'
env:
VERSION: ${{ needs.build.outputs.version }}
DIST_TAG: ${{ steps.dist-tag.outputs.tag }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
package="@foundatiofx/fetchclient@${{ needs.lint.outputs.version }}"
package="@foundatiofx/fetchclient@$VERSION"
if npm view "$package" version --registry https://npm.pkg.github.com > /dev/null 2>&1; then
echo "$package already exists in GitHub Packages; skipping publish."
else
npm publish fetchclient.tgz --tag ${{ (startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/release/npm/') || github.event_name == 'workflow_dispatch') && 'latest' || 'next' }} --access public
npm publish fetchclient.tgz --tag "$DIST_TAG" --access public
fi
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
7 changes: 4 additions & 3 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v7

- name: Setup Deno
uses: denoland/setup-deno@v2
- name: Setup Vite+
uses: voidzero-dev/setup-vp@v1.22.0
with:
deno-version: v2.x
node-version-file: .node-version
cache: true
26 changes: 15 additions & 11 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@ on:
branches:
- main

permissions:
contents: read

# Let an in-progress deployment finish instead of cancelling it.
concurrency:
group: pages
cancel-in-progress: false

jobs:
deploy-docs:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
contents: read
pages: write
Expand All @@ -21,20 +29,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v7
- name: Setup Vite+
uses: voidzero-dev/setup-vp@v1.22.0
with:
node-version: 24

- name: Install dependencies
run: npm ci --force
working-directory: docs
node-version-file: .node-version
cache: true

- name: Build documentation
run: npm run build
working-directory: docs
run: vp run docs:build
env:
NODE_ENV: production

Expand Down
19 changes: 14 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
.DS_Store
/npm
node_modules
dist
coverage
*.log
*.tgz
*.lcov
/cov
.DS_Store
!.vscode/
!.vscode/settings.json
!.vscode/extensions.json

# dotenv environment variable files
.env
.env.*
!.env.example

nul
.claude/settings.local.json
.vitest/
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24
1 change: 1 addition & 0 deletions .vite-hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vp staged
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["VoidZero.vite-plus-extension-pack"]
}
36 changes: 0 additions & 36 deletions .vscode/launch.json

This file was deleted.

Loading
Loading