-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: initial schema & manifests (#20)
Adds the first few manifests along with the first cut of the JSON schema they validate to.
- Loading branch information
Showing
14 changed files
with
795 additions
and
127 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,27 @@ | ||
name: Build & Test | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.x, 20.x, 21.x] | ||
fail-fast: false | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Use Node v${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install Dependencies | ||
run: npm ci | ||
- name: Build | ||
run: npm run build | ||
- name: Validate Manifests | ||
run: npm run validate-manifests |
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,42 @@ | ||
name: Publish (npm) | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
- run: npm ci | ||
- run: npm run build | ||
- run: npm run validate-schemas | ||
|
||
publish-npm: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22.x | ||
registry-url: 'https://registry.npmjs.org' | ||
cache: 'npm' | ||
- run: npm ci | ||
- run: npm version ${TAG_NAME} --git-tag-version=false | ||
env: | ||
TAG_NAME: ${{ github.ref_name }} | ||
- run: npm publish --provenance --access public --tag next | ||
if: "github.event.release.prerelease" | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.npm_secret }} | ||
- run: npm publish --provenance --access public | ||
if: "!github.event.release.prerelease" | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.npm_secret }} |
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
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 |
---|---|---|
@@ -1,53 +1,118 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"$id": "https://github.com/es-tooling/module-replacements/blob/main/manifest-schema.json", | ||
"title": "Module replacements manifest schema", | ||
"description": "A schema for the structure used when defining JS module replacements", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"modules": { | ||
"moduleReplacements": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"id": { | ||
"type": "string" | ||
"anyOf": [ | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"const": "documented" | ||
}, | ||
"moduleName": { | ||
"type": "string" | ||
}, | ||
"category": { | ||
"type": "string" | ||
}, | ||
"docPath": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"docPath", | ||
"moduleName", | ||
"type" | ||
], | ||
"additionalProperties": false | ||
}, | ||
"replacements": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"required": ["id", "replacements"] | ||
} | ||
}, | ||
"replacements": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"id": { | ||
"type": "string" | ||
}, | ||
"native": { | ||
"type": "boolean" | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"const": "native" | ||
}, | ||
"moduleName": { | ||
"type": "string" | ||
}, | ||
"category": { | ||
"type": "string" | ||
}, | ||
"mdnPath": { | ||
"type": "string" | ||
}, | ||
"nodeVersion": { | ||
"type": "string" | ||
}, | ||
"replacement": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"mdnPath", | ||
"moduleName", | ||
"nodeVersion", | ||
"replacement", | ||
"type" | ||
], | ||
"additionalProperties": false | ||
}, | ||
"example": { | ||
"type": "string" | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"const": "simple" | ||
}, | ||
"moduleName": { | ||
"type": "string" | ||
}, | ||
"category": { | ||
"type": "string" | ||
}, | ||
"replacement": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"moduleName", | ||
"replacement", | ||
"type" | ||
], | ||
"additionalProperties": false | ||
}, | ||
"url": { | ||
"type": "string" | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"const": "none" | ||
}, | ||
"moduleName": { | ||
"type": "string" | ||
}, | ||
"category": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"moduleName", | ||
"type" | ||
], | ||
"additionalProperties": false | ||
} | ||
}, | ||
"required": [ | ||
"id", "example", "url" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"moduleReplacements" | ||
], | ||
"additionalProperties": false, | ||
"definitions": {} | ||
} |
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,82 @@ | ||
{ | ||
"moduleReplacements": [ | ||
{ | ||
"type": "simple", | ||
"moduleName": "is-number", | ||
"replacement": "Use typeof v === \"number\"", | ||
"category": "micro-utilities" | ||
}, | ||
{ | ||
"type": "simple", | ||
"moduleName": "is-plain-object", | ||
"replacement": "Use typeof v === \"object\" && v !== null && v.constructor === Object", | ||
"category": "micro-utilities" | ||
}, | ||
{ | ||
"type": "simple", | ||
"moduleName": "is-primitve", | ||
"replacement": "Use v === null || (typeof v !== \"function\" && typeof v !== \"object\")", | ||
"category": "micro-utilities" | ||
}, | ||
{ | ||
"type": "simple", | ||
"moduleName": "is-regexp", | ||
"replacement": "Use v instanceof RegExp, or if cross-realm, use Object.prototype.toString.call(v) === \"[object RegExp]\"", | ||
"category": "micro-utilities" | ||
}, | ||
{ | ||
"type": "simple", | ||
"moduleName": "is-travis", | ||
"replacement": "Use (\"TRAVIS\" in process.env)", | ||
"category": "micro-utilities" | ||
}, | ||
{ | ||
"type": "simple", | ||
"moduleName": "is-npm", | ||
"replacement": "Use process.env.npm_config_user_agent?.startsWith(\"npm\")", | ||
"category": "micro-utilities" | ||
}, | ||
{ | ||
"type": "simple", | ||
"moduleName": "clone-regexp", | ||
"replacement": "Use new RegExp(regexpToCopy)", | ||
"category": "micro-utilities" | ||
}, | ||
{ | ||
"type": "simple", | ||
"moduleName": "split-lines", | ||
"replacement": "Use str.split(/\\r?\\n/)", | ||
"category": "micro-utilities" | ||
}, | ||
{ | ||
"type": "simple", | ||
"moduleName": "is-windows", | ||
"replacement": "Use process.platform === \"win32\"", | ||
"category": "micro-utilities" | ||
}, | ||
{ | ||
"type": "simple", | ||
"moduleName": "is-whitespace", | ||
"replacement": "Use str.trim() === \"\" or /^\\s*$/.test(str)", | ||
"category": "micro-utilities" | ||
}, | ||
{ | ||
"type": "simple", | ||
"moduleName": "is-string", | ||
"replacement": "Use typeof str === \"string\"", | ||
"category": "micro-utilities" | ||
}, | ||
{ | ||
"type": "simple", | ||
"moduleName": "is-odd", | ||
"replacement": "Use (n % 2) === 1", | ||
"category": "micro-utilities" | ||
}, | ||
{ | ||
"type": "simple", | ||
"moduleName": "is-even", | ||
"replacement": "Use (n % 2) === 0", | ||
"category": "micro-utilities" | ||
} | ||
] | ||
} |
Oops, something went wrong.