-
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 6733cd0
Showing
30 changed files
with
591 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,4 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/commitlintrc.json", | ||
"extends": ["@commitlint/config-conventional"] | ||
} |
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,7 @@ | ||
root = true | ||
|
||
[*] | ||
tab_width = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
end_of_line = lf |
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,2 @@ | ||
node_modules/ | ||
dist/ |
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,19 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/eslintrc", | ||
"root": true, | ||
"env": { | ||
"es6": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended-type-checked", | ||
"plugin:@typescript-eslint/stylistic-type-checked", | ||
"prettier" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"sourceType": "module", | ||
"project": "tsconfig.json" | ||
}, | ||
"plugins": ["@typescript-eslint"] | ||
} |
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 @@ | ||
*.lockb binary diff=lockb |
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,47 @@ | ||
name: Bug report | ||
description: Report errors or unexpected behavior | ||
labels: bug | ||
body: | ||
- type: checkboxes | ||
attributes: | ||
label: Is there already an issue for your problem? | ||
description: Please make sure you are not creating an already submitted issue. Check closed issues as well. | ||
options: | ||
- label: I have checked older issues, open and closed | ||
required: true | ||
|
||
- type: checkboxes | ||
attributes: | ||
label: Are you using the latest version of the package? | ||
description: Please make sure you are using the latest version of the package. If you are not, please update and check if the issue still persists. | ||
options: | ||
- label: I am using the latest version | ||
required: true | ||
|
||
- type: input | ||
attributes: | ||
label: Where are you running the package? | ||
description: Please provide the information about the rutime you are using. | ||
placeholder: Node.js v20.0.0 | ||
validations: | ||
required: true | ||
|
||
- type: textarea | ||
attributes: | ||
label: What steps can reproduce the bug? | ||
description: Explain the bug and provide a code snippet that can reproduce it. | ||
validations: | ||
required: true | ||
|
||
- type: textarea | ||
attributes: | ||
label: What is the expected behavior? | ||
|
||
- type: textarea | ||
attributes: | ||
label: What do you see instead? | ||
|
||
- type: textarea | ||
attributes: | ||
label: Additional information | ||
description: Any other additional information that may help. |
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 @@ | ||
blank_issues_enabled: false |
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: Feature Request | ||
description: Request a new feature or enhancement | ||
labels: enhancement | ||
body: | ||
- type: textarea | ||
id: description | ||
attributes: | ||
label: Provide a description of the new feature | ||
description: What is the expected behavior of the proposed feature? What is the scenario this would be used? | ||
validations: | ||
required: true | ||
|
||
- type: textarea | ||
id: additional-information | ||
attributes: | ||
label: Additional Information | ||
description: Give me some additional information on the feature request like proposed solutions, links, screenshots, etc. |
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,70 @@ | ||
name: Check Package | ||
|
||
on: | ||
workflow_call: | ||
pull_request: | ||
|
||
jobs: | ||
check_format: | ||
name: Check formatting | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Bun | ||
uses: oven-sh/setup-bun@v1 | ||
|
||
- name: Install dependencies | ||
run: bun install --frozen-lockfile | ||
|
||
- name: Run formatting check | ||
run: bun run format:check | ||
|
||
check_types: | ||
name: Check types | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Bun | ||
uses: oven-sh/setup-bun@v1 | ||
|
||
- name: Install dependencies | ||
run: bun install --frozen-lockfile | ||
|
||
- name: Run types check | ||
run: bun run type-check | ||
|
||
lint: | ||
name: Lint code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Bun | ||
uses: oven-sh/setup-bun@v1 | ||
|
||
- name: Install dependencies | ||
run: bun install --frozen-lockfile | ||
|
||
- name: Run linter | ||
run: bun run lint | ||
|
||
test: | ||
name: Test code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Bun | ||
uses: oven-sh/setup-bun@v1 | ||
|
||
- name: Install dependencies | ||
run: bun install --frozen-lockfile | ||
|
||
- name: Run tests | ||
run: bun run test |
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,16 @@ | ||
name: Lint Pull Request Title | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
lint_title: | ||
name: Lint title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Run linting action | ||
uses: amannn/action-semantic-pull-request@v5 |
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 Package | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
check: | ||
name: Check package | ||
uses: ./.github/workflows/check.yml | ||
|
||
publish: | ||
name: Publish | ||
needs: check | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: write | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "lts/*" | ||
|
||
- name: Setup Bun | ||
uses: oven-sh/setup-bun@v1 | ||
|
||
- name: Install dependencies | ||
run: bun install --frozen-lockfile | ||
|
||
- name: Build package | ||
run: bun run build | ||
|
||
- name: Clean up package.json | ||
run: bun run clean-pakage-json | ||
|
||
- name: Publish package | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: bunx semantic-release |
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,4 @@ | ||
node_modules/ | ||
.eslintcache | ||
dist/ | ||
*.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,6 @@ | ||
remote_branch="$(git rev-parse --abbrev-ref --symbolic-full-name '@{u}')" | ||
|
||
if [[ "$remote_branch" == "origin/master" ]]; then | ||
bunx --bun commitlint --from="$remote_branch" --to=HEAD | ||
bun run check-all | ||
fi |
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,2 @@ | ||
node_modules/ | ||
dist/ |
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,5 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/prettierrc", | ||
"printWidth": 100, | ||
"quoteProps": "consistent" | ||
} |
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 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/semantic-release", | ||
"branches": ["master"], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/github", | ||
"@semantic-release/npm" | ||
] | ||
} |
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 @@ | ||
{ | ||
"recommendations": [ | ||
"oven.bun-vscode", | ||
"editorconfig.editorconfig", | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode", | ||
"davidanson.vscode-markdownlint" | ||
] | ||
} |
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,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2024 SunsetTechuila | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,28 @@ | ||
# is-bun-module | ||
|
||
## How to use | ||
|
||
To check if a specifier is a [Bun module](https://bun.sh/docs/runtime/bun-apis): | ||
|
||
```typescript | ||
import { isBunModule } from "is-bun-module"; | ||
isBunModule("bun"); // true | ||
isBunModule("bun:test", "1.0.0"); // true | ||
isBunModule("notBunModule"); // false | ||
``` | ||
|
||
To check if a specifier is a Node module [supported by Bun](https://bun.sh/docs/runtime/nodejs-apis): | ||
|
||
```typescript | ||
import { isSupportedNodeModule } from "is-bun-module"; | ||
isSupportedNodeModule("fs"); // true | ||
isSupportedNodeModule("node:fs"); // true | ||
isSupportedNodeModule("node:notNodeModule"); // false | ||
isSupportedNodeModule("node:http2", "1.0.0"); // false, added in 1.0.13 | ||
``` | ||
|
||
## Notes | ||
|
||
- **Only Bun v1.0.0+ is supported** | ||
- You can also pass `latest` as Bun version | ||
- Inspired by [is-core-module](https://github.com/inspect-js/is-core-module) and made for [eslint-import-resolver-typescript](https://github.com/import-js/eslint-import-resolver-typescript) |
Binary file not shown.
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,66 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/package", | ||
"name": "is-bun-module", | ||
"author": "SunsetTechuila <[email protected]>", | ||
"description": "Is this specifier a Bun core module or supported Node one?", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"files": [ | ||
"dist/**/*" | ||
], | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js", | ||
"types": "./dist/index.d.ts" | ||
} | ||
}, | ||
"homepage": "https://github.com/SunsetTechuila/is-bun-module", | ||
"repository": "github:SunsetTechuila/is-bun-module", | ||
"bugs": { | ||
"url": "https://github.com/SunsetTechuila/is-bun-module/issues" | ||
}, | ||
"keywords": [ | ||
"core", | ||
"modules", | ||
"module", | ||
"node", | ||
"dependencies", | ||
"bun" | ||
], | ||
"scripts": { | ||
"build": "bun exec 'rm -rf dist' && bun build:code && bun build:types", | ||
"build:code": "bun build:code:base --format=esm --out-extension:.js=.mjs && bun build:code:base --format=cjs", | ||
"build:code:base": "bun --bun esbuild src/index.ts --target=es6 --bundle --minify --outdir=dist", | ||
"build:types": "bun --bun tsc --emitDeclarationOnly --project tsconfig.build.json", | ||
"check-all": "bun test && bun lint && bun type-check && bun format:check", | ||
"check-all:fix": "bun lint:fix && bun format", | ||
"test": "bun test", | ||
"format": "bun format:base --write", | ||
"format:check": "bun format:base --check", | ||
"format:base": "bun --bun prettier . --cache", | ||
"lint": "bun --bun eslint . --cache", | ||
"lint:fix": "bun lint --fix", | ||
"type-check": "bun --bun tsc --noEmit", | ||
"clean-pakage-json": "npm pkg delete $schema scripts devDependencies" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^19.3.0", | ||
"@commitlint/config-conventional": "^19.2.2", | ||
"@types/bun": "^1.1.3", | ||
"@types/semver": "^7.5.8", | ||
"@typescript-eslint/eslint-plugin": "^7.11.0", | ||
"@typescript-eslint/parser": "^7.11.0", | ||
"esbuild": "^0.21.4", | ||
"eslint": "^8.57.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"husky": "^9.0.11", | ||
"prettier": "^3.3.0", | ||
"semantic-release": "^24.0.0", | ||
"semver": "^7.6.2", | ||
"typescript": "^5.4.5" | ||
} | ||
} |
Oops, something went wrong.