Skip to content
Merged
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
34 changes: 0 additions & 34 deletions .eslintrc.js

This file was deleted.

55 changes: 46 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Node.js CI

on:
push:
branches: ["main"]
branches: ['main']
pull_request:
branches: ["main"]
branches: ['main']

jobs:
static-check:
Expand All @@ -19,20 +19,23 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: ".node-version"
cache: "npm"
node-version-file: '.node-version'
cache: 'npm'
- run: npm ci
- name: Format Check
run: npm run format
- name: Lint
run: npm run lint
- name: Type Check
run: npm run typecheck
- name: Schema Type Check
run: npm run typecheck:schema

build-and-test:
runs-on: ubuntu-slim

strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x, 22.x, 24.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
Expand All @@ -41,13 +44,47 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
# Development tools require a newer Node.js than the SDK runtime.
- name: Use development Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
node-version-file: '.node-version'
cache: 'npm'
- run: npm ci
- name: Build
run: npm run build
- name: Unit Tests
run: npm run test
- name: Published Declaration Type Check
run: npm run typecheck:dist
- name: TypeScript Consumer Regression Matrix
run: npm run test:types
- name: Use runtime Node.js ${{ matrix.node-version }}
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ matrix.node-version }}
- name: Unit Tests and Coverage
run: npm run test:coverage
- name: Save coverage report
if: ${{ !cancelled() && hashFiles('coverage/coverage-summary.json') != '' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-node-${{ matrix.node-version }}
path: coverage/
if-no-files-found: error
retention-days: 14

typescript-compatibility:
runs-on: ubuntu-slim
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: '.node-version'
cache: 'npm'
- run: npm ci
- run: npm run build
- name: Install minimum supported TypeScript separately
run: npm install --prefix "$RUNNER_TEMP/microcms-ts6" --no-save --package-lock=false typescript@6.0.2
- name: TypeScript 6 consumer compatibility
run: MICROCMS_TYPESCRIPT_BINARY="$RUNNER_TEMP/microcms-ts6/node_modules/typescript/bin/tsc" npm run test:types
52 changes: 40 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,57 @@ name: release
on:
push:
tags:
- "v*"
- 'v*'

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

jobs:
build:
precheck:
runs-on: ubuntu-slim
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: ".node-version"
registry-url: "https://registry.npmjs.org"
node-version-file: '.node-version'
cache: 'npm'
- run: npm ci
- name: Lint
run: npm run lint
- name: Type Check
run: npm run typecheck
- name: Schema Type Check
run: npm run typecheck:schema
- name: Unit Tests and Coverage
run: npm run test:coverage
- name: Build
run: npm run build
- name: Published Declaration Type Check
run: npm run typecheck:dist
- name: TypeScript Consumer Regression Matrix
run: npm run test:types
- name: Install minimum supported TypeScript separately
run: npm install --prefix "$RUNNER_TEMP/microcms-ts6" --no-save --package-lock=false typescript@6.0.2
- name: TypeScript 6 consumer compatibility
run: MICROCMS_TYPESCRIPT_BINARY="$RUNNER_TEMP/microcms-ts6/node_modules/typescript/bin/tsc" npm run test:types

publish:
needs: precheck
runs-on: ubuntu-slim
permissions:
contents: read
id-token: write # Required for OIDC
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: '.node-version'
registry-url: 'https://registry.npmjs.org'
package-manager-cache: false
- name: release on npm
run: |
npm ci
npm run lint
npm run typecheck
npm run test
npm run build
- run: npm ci
- run: npm run build
- run: npm publish
98 changes: 98 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["typescript"],
"categories": {
"correctness": "off"
},
"env": {
"browser": true,
"node": true,
"es6": true,
"jest": true
},
"ignorePatterns": [
"examples/generated/",
"tests/fixtures/typegen/generated/",
"tests/fixtures/typegen/performance/"
],
"rules": {
"eslint/for-direction": "error",
"eslint/no-array-constructor": "error",
"eslint/no-async-promise-executor": "error",
"eslint/no-case-declarations": "error",
"eslint/no-class-assign": "error",
"eslint/no-compare-neg-zero": "error",
"eslint/no-cond-assign": "error",
"eslint/no-constant-condition": "error",
"eslint/no-control-regex": "error",
"eslint/no-debugger": "error",
"eslint/no-delete-var": "error",
"eslint/no-dupe-else-if": "error",
"eslint/no-duplicate-case": "error",
"eslint/no-empty": "error",
"eslint/no-empty-character-class": "error",
"eslint/no-empty-pattern": "error",
"eslint/no-ex-assign": "error",
"eslint/no-extra-boolean-cast": "error",
"eslint/no-fallthrough": "error",
"eslint/no-global-assign": "error",
"eslint/no-inner-declarations": "error",
"eslint/no-invalid-regexp": "error",
"eslint/no-irregular-whitespace": "error",
"eslint/no-loss-of-precision": "error",
"eslint/no-misleading-character-class": "error",
"eslint/no-nonoctal-decimal-escape": "error",
"eslint/no-prototype-builtins": "error",
"eslint/no-regex-spaces": "error",
"eslint/no-self-assign": "error",
"eslint/no-shadow-restricted-names": "error",
"eslint/no-sparse-arrays": "error",
"eslint/no-unsafe-finally": "error",
"eslint/no-unsafe-optional-chaining": "error",
"eslint/no-unused-labels": "error",
"eslint/no-useless-backreference": "error",
"eslint/no-useless-catch": "error",
"eslint/no-useless-escape": "error",
"eslint/no-var": "error",
"eslint/no-with": "error",
"eslint/prefer-const": "error",
"eslint/prefer-rest-params": "error",
"eslint/prefer-spread": "error",
"eslint/require-yield": "error",
"eslint/use-isnan": "error",
"eslint/valid-typeof": "error",
"typescript/ban-ts-comment": "error",
"typescript/ban-types": "error",
"typescript/no-duplicate-enum-values": "error",
"typescript/no-extra-non-null-assertion": "error",
"typescript/no-misused-new": "error",
"typescript/no-namespace": "error",
"typescript/no-non-null-asserted-optional-chain": "error",
"typescript/no-this-alias": "error",
"typescript/no-unnecessary-type-constraint": "error",
"typescript/no-unsafe-declaration-merging": "error",
"typescript/prefer-as-const": "error",
"typescript/triple-slash-reference": "error"
},
"overrides": [
{
"files": ["**/*.js", "**/*.mjs", "**/*.cjs"],
"rules": {
"eslint/constructor-super": "error",
"eslint/getter-return": "error",
"eslint/no-const-assign": "error",
"eslint/no-dupe-class-members": "error",
"eslint/no-dupe-keys": "error",
"eslint/no-func-assign": "error",
"eslint/no-import-assign": "error",
"eslint/no-obj-calls": "error",
"eslint/no-redeclare": "error",
"eslint/no-setter-return": "error",
"eslint/no-this-before-super": "error",
"eslint/no-undef": "error",
"eslint/no-unreachable": "error",
"eslint/no-unsafe-negation": "error"
}
}
]
}
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
examples/generated/
tests/fixtures/typegen/generated/
tests/fixtures/typegen/performance/
Loading