-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f18a433
Showing
33 changed files
with
11,630 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"exclude": [ | ||
"**/index.ts", | ||
"package/**/*.ts", | ||
"examples/**/*.ts", | ||
"**/*.spec.ts", | ||
"ava.config.js" | ||
], | ||
"reporter": ["html", "lcov", "text"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ARG VARIANT="18" | ||
|
||
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:${VARIANT} | ||
|
||
USER node | ||
WORKDIR /home/node | ||
|
||
RUN mkdir -p .config/git \ | ||
&& echo ".vscode/*" >> .config/git/ignore \ | ||
&& echo "*.code-workspace" >> .config/git/ignore \ | ||
&& echo ".history/" >> .config/git/ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "Node.js", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"args": { | ||
"VARIANT": "18" | ||
} | ||
}, | ||
"extensions": [ | ||
"ms-vsliveshare.vsliveshare", | ||
"dbaeumer.vscode-eslint", | ||
"EditorConfig.EditorConfig", | ||
"esbenp.prettier-vscode" | ||
], | ||
"postCreateCommand": "npm install", | ||
"remoteUser": "node" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"root": true, | ||
"extends": ["standard-with-typescript", "prettier"], | ||
"parserOptions": { | ||
"project": "./tsconfig.json" | ||
}, | ||
"rules": { | ||
"no-console": "warn", | ||
"import/extensions": ["error", "ignorePackages"], | ||
"@typescript-eslint/consistent-type-imports": [ | ||
"warn", | ||
{ | ||
"fixStyle": "inline-type-imports" | ||
} | ||
], | ||
"sort-imports": [ | ||
"error", | ||
{ | ||
"ignoreDeclarationSort": true, | ||
"allowSeparatedGroups": true | ||
} | ||
], | ||
"import/no-duplicates": ["error", { "prefer-inline": true }], | ||
"import/order": [ | ||
"error", | ||
{ | ||
"newlines-between": "always", | ||
"alphabetize": { | ||
"order": "asc" | ||
}, | ||
"groups": [ | ||
"builtin", | ||
"external", | ||
"internal", | ||
"parent", | ||
"sibling", | ||
"index" | ||
], | ||
"pathGroupsExcludedImportTypes": ["builtin"], | ||
"pathGroups": [ | ||
{ | ||
"pattern": "index.js", | ||
"group": "internal", | ||
"position": "before" | ||
}, | ||
{ | ||
"pattern": "lib/**", | ||
"group": "internal" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
name: Setup | ||
description: Setup Node.js and install dependencies. | ||
|
||
inputs: | ||
node_version: | ||
description: The Node.js version. | ||
required: false | ||
default: '18' | ||
registry_url: | ||
description: The Node.js package registry URL. | ||
required: false | ||
default: https://registry.npmjs.org | ||
install_dependencies: | ||
description: Install dependencies. | ||
required: false | ||
default: 'true' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
if: inputs.install_dependencies == 'true' | ||
with: | ||
cache: npm | ||
node-version: ${{ inputs.node_version }} | ||
registry-url: ${{ inputs.registry_url }} | ||
- name: Setup Node.js without cache | ||
uses: actions/setup-node@v3 | ||
if: inputs.install_dependencies == 'false' | ||
with: | ||
node-version: ${{ inputs.node_version }} | ||
registry-url: ${{ inputs.registry_url }} | ||
- name: Install dependencies | ||
if: inputs.install_dependencies == 'true' | ||
shell: bash | ||
run: npm ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
name: _build | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
node_version: | ||
description: The Node.js version. | ||
type: string | ||
required: false | ||
default: '18' | ||
outputs: | ||
artifact_name: | ||
description: The artifact name. | ||
value: build-${{ github.sha }} | ||
|
||
jobs: | ||
build: | ||
name: Package | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup | ||
uses: ./.github/actions/setup | ||
with: | ||
node_version: ${{ inputs.node_version }} | ||
- name: Build | ||
run: npm run build | ||
- name: Package | ||
run: npm pack | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build-${{ github.sha }} | ||
if-no-files-found: error | ||
path: '*.tgz' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
name: _publish | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
artifact_name: | ||
description: The artifact name. | ||
type: string | ||
required: true | ||
registry_host: | ||
description: The package registry host. | ||
type: string | ||
required: true | ||
secrets: | ||
registry_token: | ||
description: The package registry token. | ||
required: true | ||
|
||
jobs: | ||
publish: | ||
name: Publish package | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup | ||
uses: ./.github/actions/setup | ||
with: | ||
install_dependencies: 'false' | ||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ inputs.artifact_name }} | ||
path: . | ||
- name: Get meta | ||
id: meta | ||
run: echo "tgz=$(ls *.tgz | head -n1)" >> $GITHUB_OUTPUT | ||
- name: Publish | ||
uses: rxfork/npm-publish@v1 | ||
with: | ||
access: public | ||
target: ${{ steps.meta.outputs.tgz }} | ||
token: ${{ secrets.registry_token }} | ||
registry: ${{ inputs.registry_host }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
--- | ||
name: Check | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
test: | ||
name: Test (Node.js v${{ matrix.node }} on ${{ matrix.os_name }}) | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 30 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
- windows-latest | ||
node: | ||
- '16' | ||
- '18' | ||
include: | ||
- os: ubuntu-latest | ||
os_name: Linux | ||
- os: macos-latest | ||
os_name: macOS | ||
- os: windows-latest | ||
os_name: Windows | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup | ||
uses: ./.github/actions/setup | ||
with: | ||
node_version: ${{ matrix.node }} | ||
- name: Test | ||
run: npm test | ||
lint: | ||
name: Lint (Node.js v${{ matrix.node }}) | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node: | ||
- '16' | ||
- '18' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup | ||
uses: ./.github/actions/setup | ||
with: | ||
node_version: ${{ matrix.node }} | ||
- name: Lint | ||
run: npm run lint | ||
build: | ||
name: Build | ||
uses: ./.github/workflows/_build.yml | ||
install: | ||
name: Install (Node.js v${{ matrix.node }} on ${{ matrix.os_name }}) | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 30 | ||
needs: build | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
- windows-latest | ||
node: | ||
- '16' | ||
- '18' | ||
include: | ||
- os: ubuntu-latest | ||
os_name: Linux | ||
- os: macos-latest | ||
os_name: macOS | ||
- os: windows-latest | ||
os_name: Windows | ||
steps: | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ needs.build.outputs.artifact_name }} | ||
path: . | ||
- name: Find packages | ||
uses: tj-actions/glob@v16 | ||
id: packages | ||
with: | ||
files: '*.tgz' | ||
- name: Create package.json | ||
uses: DamianReeves/[email protected] | ||
with: | ||
write-mode: overwrite | ||
path: package.json | ||
contents: | | ||
{"type":"module"} | ||
- name: Create index.js | ||
uses: DamianReeves/[email protected] | ||
with: | ||
write-mode: overwrite | ||
path: index.js | ||
contents: | | ||
import '@makenew/tsmodule' | ||
- name: Install | ||
run: npm install --save ${{ steps.packages.outputs.paths }} | ||
- name: Run | ||
run: node index.js | ||
typecheck: | ||
name: Typecheck (Node.js v${{ matrix.node }}) | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node: | ||
- '16' | ||
- '18' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup | ||
uses: ./.github/actions/setup | ||
with: | ||
node_version: ${{ matrix.node }} | ||
- name: Typecheck | ||
run: npm run typecheck |
Oops, something went wrong.