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
7 changes: 7 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ignorePatterns": ["**/*.js", "dist"],
"extends": ["@map-colonies/eslint-config/ts-base"],
"parserOptions": {
"project": "./tsconfig.lint.json"
}
}
21 changes: 21 additions & 0 deletions .github/actions/init-npm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: init-npm
description: 'Initialize the repo with npm and install all the dependencies'
inputs:
node-version:
description: 'Node.js version'
required: true
default: '24.x'
runs:
using: composite
steps:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: npm
- name: Install TS Project dependencies
shell: bash
run: npm ci
- name: build
shell: bash
run: npm run build
39 changes: 39 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
on:
workflow_dispatch:
release:
types: [published]

permissions:
id-token: write # Required for OIDC
contents: read

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Init nodejs
uses: ./.github/actions/init-npm
- run: npm install -g npm
- name: Get package version and branch
id: package-info
run: |
VERSION=$(node -p "require('./package.json').version")
BRANCH=${GITHUB_REF#refs/heads/}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
- name: Publish to npm
run: |
echo "is pre-release: ${{ github.event.release.prerelease }}"
echo "publish triggered on: ${{ github.ref_type }}"
if ([[ "${{ github.ref_type }}" == "tag" ]] &&
[[ "${{ github.event.release.prerelease }}" == "true" ]] &&
[[ "${{ github.ref_name }}" == "v${{ steps.package-info.outputs.version }}" ]]) ||
([[ "${{ github.ref_type }}" == "branch" ]] &&
[[ "${{ github.ref_name }}" == "alpha" ]]); then
echo "publishing prerelease with alpha tag from ${{ github.ref_type }}"
npm publish --access public --tag alpha
else
echo "publishing standard release"
npm publish --access public
fi
52 changes: 52 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: pull_request

on: [pull_request, workflow_dispatch]

jobs:
eslint:
name: Run TS Project eslint
runs-on: ubuntu-latest

strategy:
matrix:
node: [24.x]

steps:
- name: Check out TS Project Git repository
uses: actions/checkout@v4

- name: Init nodejs
uses: ./.github/actions/init-npm
with:
node-version: ${{ matrix.node }}

- name: Run TS Project linters
uses: wearerequired/lint-action@v2
with:
github_token: ${{ secrets.github_token }}
eslint: true
prettier: true
eslint_extensions: ts

tests:
name: Run Tests
runs-on: ubuntu-latest

strategy:
matrix:
node: [24.x]

steps:
- name: Check out TS Project Git repository
uses: actions/checkout@v4

- name: Init nodejs
uses: ./.github/actions/init-npm

- name: Run tests
run: npm run test

- uses: actions/upload-artifact@v4
with:
name: Test Reporters ${{ matrix.node }}
path: ./reports/**
45 changes: 45 additions & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: release-please

on:
push:
branches:
- master
- alpha

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- id: prerelease
name: Determine prerelease flag
run: |
branch="${GITHUB_REF##*/}"
echo "Detected branch: $branch"

if [ "$branch" = "alpha" ]; then
echo "prerelease_type_config=release-please-config-alpha.json" >> $GITHUB_OUTPUT
echo "release_type=alpha" >> $GITHUB_OUTPUT
echo "Running in pre-release mode"
else
echo "prerelease_type_config=release-please-config.json" >> $GITHUB_OUTPUT
echo "release_type=default" >> $GITHUB_OUTPUT
echo "Running in stable mode"
fi

- id: mode
name: summary
run: |
echo "config file: ${{ steps.prerelease.outputs.prerelease_type_config }}"
echo "release type: ${{ steps.prerelease.outputs.release_type }}"

- id: release
name: Run release-please
uses: googleapis/release-please-action@v4
with:
token: ${{ secrets.GH_PAT }}
target-branch: ${{ github.ref_name }}
config-file: ${{ steps.prerelease.outputs.prerelease_type_config }}
43 changes: 43 additions & 0 deletions .github/workflows/typedoc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy typedoc to Pages

on:
push:
branches: ['master']
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: 'pages'
cancel-in-progress: false

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- name: Install TS Project dependencies
run: npm ci
- name: build docs
run: npx typedoc
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
dist/
*.tgz
.env
reports/
coverage/
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@map-colonies/prettier-config"
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "1.0.0"
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# 3d-shared
# 3d-shared
Loading
Loading