Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c12bd19573 |
No files matched your search
@@ -1,2 +1 @@
|
|||||||
github: [antfu]
|
github: [antfu]
|
||||||
opencollective: antfu
|
|
||||||
+80
-12
@@ -1,19 +1,87 @@
|
|||||||
name: Unit Test
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches:
|
||||||
pull_request:
|
- main
|
||||||
branches: [main]
|
|
||||||
|
|
||||||
permissions: {}
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
unit-test:
|
lint:
|
||||||
uses: sxzz/workflows/.github/workflows/unit-test.yml@main
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
# coverage:
|
- name: Install pnpm
|
||||||
# uses: sxzz/workflows/.github/workflows/coverage.yml@main
|
uses: pnpm/action-setup@v2
|
||||||
# needs: unit-test
|
|
||||||
# permissions:
|
- name: Set node
|
||||||
# id-token: write
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: lts/*
|
||||||
|
|
||||||
|
- name: Setup
|
||||||
|
run: npm i -g @antfu/ni
|
||||||
|
|
||||||
|
- name: Install
|
||||||
|
run: nci
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
run: nr lint
|
||||||
|
|
||||||
|
typecheck:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v2
|
||||||
|
|
||||||
|
- name: Set node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: lts/*
|
||||||
|
|
||||||
|
- name: Setup
|
||||||
|
run: npm i -g @antfu/ni
|
||||||
|
|
||||||
|
- name: Install
|
||||||
|
run: nci
|
||||||
|
|
||||||
|
- name: Typecheck
|
||||||
|
run: nr typecheck
|
||||||
|
|
||||||
|
test:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node: [lts/*]
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
fail-fast: false
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v2
|
||||||
|
|
||||||
|
- name: Set node ${{ matrix.node }}
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node }}
|
||||||
|
|
||||||
|
- name: Setup
|
||||||
|
run: npm i -g @antfu/ni
|
||||||
|
|
||||||
|
- name: Install
|
||||||
|
run: nci
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: nr build
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: nr test
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
@@ -7,9 +10,20 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
uses: sxzz/workflows/.github/workflows/release.yml@main
|
runs-on: ubuntu-latest
|
||||||
with:
|
steps:
|
||||||
publish: true
|
- uses: actions/checkout@v3
|
||||||
permissions:
|
with:
|
||||||
contents: write
|
fetch-depth: 0
|
||||||
id-token: write
|
|
||||||
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v2
|
||||||
|
|
||||||
|
- name: Set node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: lts/*
|
||||||
|
|
||||||
|
- run: npx changelogithub
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
.cache
|
.cache
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.githooks
|
|
||||||
.idea
|
.idea
|
||||||
*.log
|
*.log
|
||||||
*.tgz
|
*.tgz
|
||||||
@@ -9,5 +8,4 @@ dist
|
|||||||
lib-cov
|
lib-cov
|
||||||
logs
|
logs
|
||||||
node_modules
|
node_modules
|
||||||
skills/npm-*
|
|
||||||
temp
|
temp
|
||||||
Vendored
-6
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"recommendations": [
|
|
||||||
"dbaeumer.vscode-eslint",
|
|
||||||
"antfu.pnpm-catalog-lens"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Vendored
+4
-1
@@ -1,11 +1,14 @@
|
|||||||
{
|
{
|
||||||
|
// Enable the ESlint flat config support
|
||||||
|
"eslint.experimental.useFlatConfig": true,
|
||||||
|
|
||||||
// Disable the default formatter, use eslint instead
|
// Disable the default formatter, use eslint instead
|
||||||
"prettier.enable": false,
|
"prettier.enable": false,
|
||||||
"editor.formatOnSave": false,
|
"editor.formatOnSave": false,
|
||||||
|
|
||||||
// Auto fix
|
// Auto fix
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": "explicit",
|
"source.fixAll": "explicit",
|
||||||
"source.organizeImports": "never"
|
"source.organizeImports": "never"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2025-PRESENT Anthony Fu <https://github.com/antfu>
|
Copyright (c) 2022 Anthony Fu <https://github.com/antfu>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -8,32 +8,28 @@
|
|||||||
|
|
||||||
_description_
|
_description_
|
||||||
|
|
||||||
## Note for Developers
|
> **Note**:
|
||||||
|
> Replace `pkg-placeholder`, `_description_` and `antfu` globally to use this template.
|
||||||
This starter recommands using [npm Trusted Publisher](https://github.com/e18e/ecosystem-issues/issues/201), where the release is done on CI to ensure the security of the packages.
|
|
||||||
|
|
||||||
To do so, you need to run `pnpm publish` manually for the very first time to create the package on npm, and then go to `https://www.npmjs.com/package/<your-package-name>/access` to set the connection to your GitHub repo.
|
|
||||||
|
|
||||||
Then for the future releases, you can run `pnpm run release` to do the release and the GitHub Actions will take care of the release process.
|
|
||||||
|
|
||||||
## Sponsors
|
## Sponsors
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
|
<a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
|
||||||
<img src="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg" alt="Sponsors"/>
|
<img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/>
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
[MIT](./LICENSE) License © [Anthony Fu](https://github.com/antfu)
|
[MIT](./LICENSE) License © 2023-PRESENT [Anthony Fu](https://github.com/antfu)
|
||||||
|
|
||||||
|
|
||||||
<!-- Badges -->
|
<!-- Badges -->
|
||||||
|
|
||||||
[npm-version-src]: https://img.shields.io/npm/v/pkg-placeholder?style=flat&colorA=080f12&colorB=1fa669
|
[npm-version-src]: https://img.shields.io/npm/v/pkg-placeholder?style=flat&colorA=080f12&colorB=1fa669
|
||||||
[npm-version-href]: https://npmx.dev/package/pkg-placeholder
|
[npm-version-href]: https://npmjs.com/package/pkg-placeholder
|
||||||
[npm-downloads-src]: https://img.shields.io/npm/dm/pkg-placeholder?style=flat&colorA=080f12&colorB=1fa669
|
[npm-downloads-src]: https://img.shields.io/npm/dm/pkg-placeholder?style=flat&colorA=080f12&colorB=1fa669
|
||||||
[npm-downloads-href]: https://npmx.dev/package/pkg-placeholder
|
[npm-downloads-href]: https://npmjs.com/package/pkg-placeholder
|
||||||
[bundle-src]: https://img.shields.io/bundlephobia/minzip/pkg-placeholder?style=flat&colorA=080f12&colorB=1fa669&label=minzip
|
[bundle-src]: https://img.shields.io/bundlephobia/minzip/pkg-placeholder?style=flat&colorA=080f12&colorB=1fa669&label=minzip
|
||||||
[bundle-href]: https://bundlephobia.com/result?p=pkg-placeholder
|
[bundle-href]: https://bundlephobia.com/result?p=pkg-placeholder
|
||||||
[license-src]: https://img.shields.io/github/license/antfu/pkg-placeholder.svg?style=flat&colorA=080f12&colorB=1fa669
|
[license-src]: https://img.shields.io/github/license/antfu/pkg-placeholder.svg?style=flat&colorA=080f12&colorB=1fa669
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { defineBuildConfig } from 'unbuild'
|
||||||
|
|
||||||
|
export default defineBuildConfig({
|
||||||
|
entries: [
|
||||||
|
'src/index',
|
||||||
|
],
|
||||||
|
declaration: true,
|
||||||
|
clean: true,
|
||||||
|
rollup: {
|
||||||
|
emitCJS: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
+8
-2
@@ -3,7 +3,13 @@ import antfu from '@antfu/eslint-config'
|
|||||||
|
|
||||||
export default antfu(
|
export default antfu(
|
||||||
{
|
{
|
||||||
type: 'lib',
|
ignores: [
|
||||||
pnpm: true,
|
// eslint ignore globs here
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
// overrides
|
||||||
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
+43
-43
@@ -2,7 +2,7 @@
|
|||||||
"name": "pkg-placeholder",
|
"name": "pkg-placeholder",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"packageManager": "pnpm@11.15.1",
|
"packageManager": "pnpm@8.8.0",
|
||||||
"description": "_description_",
|
"description": "_description_",
|
||||||
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -16,58 +16,58 @@
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./dist/index.mjs",
|
".": {
|
||||||
"./package.json": "./package.json"
|
"types": "./dist/index.d.ts",
|
||||||
|
"import": "./dist/index.mjs",
|
||||||
|
"require": "./dist/index.cjs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"main": "./dist/index.mjs",
|
||||||
|
"module": "./dist/index.mjs",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"typesVersions": {
|
||||||
|
"*": {
|
||||||
|
"*": [
|
||||||
|
"./dist/*",
|
||||||
|
"./dist/index.d.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"types": "./dist/index.d.mts",
|
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsdown",
|
"build": "unbuild",
|
||||||
"dev": "tsdown --watch",
|
"dev": "unbuild --stub",
|
||||||
"lint": "eslint",
|
"lint": "eslint .",
|
||||||
"prepack": "nr build",
|
"prepublishOnly": "nr build",
|
||||||
"release": "bumpp",
|
"release": "bumpp && npm publish",
|
||||||
"start": "tsx src/index.ts",
|
"start": "esno src/index.ts",
|
||||||
"test": "pnpm run build && vitest",
|
"test": "vitest",
|
||||||
"typecheck": "tsc",
|
"typecheck": "tsc --noEmit",
|
||||||
"prepare": "git config core.hooksPath .githooks && simple-git-hooks && skills-npm"
|
"prepare": "simple-git-hooks"
|
||||||
},
|
|
||||||
"scripts-info": {
|
|
||||||
"build": "Build the library for publishing",
|
|
||||||
"dev": "Rebuild on change during development",
|
|
||||||
"lint": "Check for code style issues",
|
|
||||||
"prepack": "Build before publishing",
|
|
||||||
"release": "Bump version and publish a release",
|
|
||||||
"start": "Run the entry file",
|
|
||||||
"test": "Run the test suite",
|
|
||||||
"typecheck": "Check types",
|
|
||||||
"prepare": "Set up git hooks and skills"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "catalog:cli",
|
"@antfu/eslint-config": "^1.0.0-beta.22",
|
||||||
"@antfu/ni": "catalog:cli",
|
"@antfu/ni": "^0.21.8",
|
||||||
"@antfu/utils": "catalog:inlined",
|
"@antfu/utils": "^0.7.6",
|
||||||
"@types/node": "catalog:types",
|
"@types/node": "^20.8.3",
|
||||||
"bumpp": "catalog:cli",
|
"bumpp": "^9.2.0",
|
||||||
"eslint": "catalog:cli",
|
"eslint": "^8.51.0",
|
||||||
"nano-staged": "catalog:cli",
|
"esno": "^0.17.0",
|
||||||
"publint": "catalog:cli",
|
"lint-staged": "^14.0.1",
|
||||||
"simple-git-hooks": "catalog:cli",
|
"pnpm": "^8.8.0",
|
||||||
"skills-npm": "catalog:cli",
|
"rimraf": "^5.0.5",
|
||||||
"tsdown": "catalog:cli",
|
"simple-git-hooks": "^2.9.0",
|
||||||
"tsdown-stale-guard": "catalog:testing",
|
"typescript": "^5.2.2",
|
||||||
"tsnapi": "catalog:testing",
|
"unbuild": "^2.0.0",
|
||||||
"tsx": "catalog:cli",
|
"vite": "^4.4.11",
|
||||||
"typescript": "catalog:cli",
|
"vitest": "^0.34.6"
|
||||||
"vite": "catalog:cli",
|
|
||||||
"vitest": "catalog:testing"
|
|
||||||
},
|
},
|
||||||
"simple-git-hooks": {
|
"simple-git-hooks": {
|
||||||
"pre-commit": "pnpm i --frozen-lockfile --ignore-scripts --offline && pnpm run build && npx nano-staged"
|
"pre-commit": "pnpm lint-staged"
|
||||||
},
|
},
|
||||||
"nano-staged": {
|
"lint-staged": {
|
||||||
"*": "eslint --fix"
|
"*": "eslint --fix"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Generated
+3801
-4853
File diff suppressed because it is too large.
Load diff
@@ -1,40 +1,3 @@
|
|||||||
catalogMode: prefer
|
|
||||||
ignoreWorkspaceRootCheck: true
|
|
||||||
minimumReleaseAgeExclude:
|
|
||||||
- '@types/node@25.9.0'
|
|
||||||
- tsx@4.22.2
|
|
||||||
- bumpp@12.0.0
|
|
||||||
shellEmulator: true
|
|
||||||
trustPolicy: no-downgrade
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
- playground
|
- playground
|
||||||
- docs
|
|
||||||
- packages/*
|
|
||||||
- examples/*
|
- examples/*
|
||||||
|
|
||||||
catalogs:
|
|
||||||
cli:
|
|
||||||
'@antfu/eslint-config': ^9.1.0
|
|
||||||
'@antfu/ni': ^30.2.0
|
|
||||||
bumpp: ^12.0.0
|
|
||||||
eslint: ^10.7.0
|
|
||||||
nano-staged: ^1.0.2
|
|
||||||
publint: ^0.3.21
|
|
||||||
simple-git-hooks: ^2.13.1
|
|
||||||
skills-npm: ^1.2.0
|
|
||||||
tsdown: ^0.22.12
|
|
||||||
tsx: ^4.23.1
|
|
||||||
typescript: ^6.0.3
|
|
||||||
vite: ^8.1.5
|
|
||||||
inlined:
|
|
||||||
'@antfu/utils': ^9.3.0
|
|
||||||
testing:
|
|
||||||
tsdown-stale-guard: ^0.1.3
|
|
||||||
tsnapi: ^1.0.0
|
|
||||||
vitest: ^4.1.10
|
|
||||||
types:
|
|
||||||
'@types/node': ^26.1.1
|
|
||||||
allowBuilds:
|
|
||||||
esbuild: true
|
|
||||||
simple-git-hooks: true
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
/**
|
|
||||||
* Generated by tsnapi — public API snapshot of `pkg-placeholder`
|
|
||||||
*/
|
|
||||||
// #region Variables
|
|
||||||
export declare const one: number;
|
|
||||||
export declare const two: number;
|
|
||||||
// #endregion
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
/**
|
|
||||||
* Generated by tsnapi — public API snapshot of `pkg-placeholder`
|
|
||||||
*/
|
|
||||||
// #region Variables
|
|
||||||
export var one /* const */
|
|
||||||
export var two /* const */
|
|
||||||
// #endregion
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
import { fileURLToPath } from 'node:url'
|
|
||||||
import { guardStaleBuild } from 'tsdown-stale-guard'
|
|
||||||
import { snapshotApiPerEntry } from 'tsnapi/vitest'
|
|
||||||
import { beforeAll, describe } from 'vitest'
|
|
||||||
|
|
||||||
const root = fileURLToPath(new URL('..', import.meta.url))
|
|
||||||
|
|
||||||
describe('api snapshot', () => {
|
|
||||||
beforeAll(async () => {
|
|
||||||
await guardStaleBuild({ root })
|
|
||||||
})
|
|
||||||
|
|
||||||
snapshotApiPerEntry(root)
|
|
||||||
})
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import { describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
|
describe('should', () => {
|
||||||
|
it('exported', () => {
|
||||||
|
expect(1).toEqual(1)
|
||||||
|
})
|
||||||
|
})
|
||||||
+5
-7
@@ -1,15 +1,13 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ESNext",
|
"target": "es2018",
|
||||||
"lib": ["ESNext"],
|
"lib": ["esnext"],
|
||||||
"module": "ESNext",
|
"module": "esnext",
|
||||||
"moduleResolution": "Bundler",
|
"moduleResolution": "node",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
"noEmit": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"verbatimModuleSyntax": true,
|
|
||||||
"skipDefaultLibCheck": true,
|
"skipDefaultLibCheck": true,
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
import { defineConfig } from 'tsdown'
|
|
||||||
import { StaleGuardRecorder } from 'tsdown-stale-guard'
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
entry: [
|
|
||||||
'src/index.ts',
|
|
||||||
],
|
|
||||||
dts: true,
|
|
||||||
exports: true,
|
|
||||||
publint: true,
|
|
||||||
plugins: [
|
|
||||||
StaleGuardRecorder(),
|
|
||||||
],
|
|
||||||
})
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import { defineConfig } from 'vitest/config'
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
test: {
|
|
||||||
},
|
|
||||||
})
|
|
||||||
Reference in new issue
Block a user