diff --git a/README.md b/README.md index f2f6cc5..c287d72 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ A collection of templates for [tsdown](https://tsdown.dev). +- [Default](./default) +- [Minimal](./minimal) - [Vue](./vue) - [React](./react) - [Solid](./solid) diff --git a/default/.gitignore b/default/.gitignore new file mode 100644 index 0000000..7535211 --- /dev/null +++ b/default/.gitignore @@ -0,0 +1,4 @@ +node_modules +dist +*.log +.DS_Store diff --git a/default/README.md b/default/README.md new file mode 100644 index 0000000..35e132a --- /dev/null +++ b/default/README.md @@ -0,0 +1,23 @@ +# tsdown-starter + +A starter for creating a TypeScript package. + +## Development + +- Install dependencies: + +```bash +npm install +``` + +- Run the unit tests: + +```bash +npm run test +``` + +- Build the library: + +```bash +npm run build +``` diff --git a/default/package.json b/default/package.json new file mode 100644 index 0000000..fa2136d --- /dev/null +++ b/default/package.json @@ -0,0 +1,39 @@ +{ + "name": "tsdown-starter", + "version": "0.0.0", + "description": "A starter for creating a TypeScript package.", + "type": "module", + "license": "MIT", + "homepage": "https://github.com/author/library#readme", + "bugs": { + "url": "https://github.com/author/library/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/author/library.git" + }, + "author": "Author Name ", + "files": [ + "dist" + ], + "main": "./dist/index.js", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + ".": "./dist/index.js", + "./package.json": "./package.json" + }, + "scripts": { + "build": "tsdown", + "dev": "tsdown --watch", + "test": "vitest", + "typecheck": "tsc --noEmit" + }, + "devDependencies": { + "@types/node": "^24.7.2", + "bumpp": "^10.3.1", + "tsdown": "^0.15.6", + "typescript": "^5.9.3", + "vitest": "^3.2.4" + } +} diff --git a/default/src/index.ts b/default/src/index.ts new file mode 100644 index 0000000..ff0fb70 --- /dev/null +++ b/default/src/index.ts @@ -0,0 +1,3 @@ +export function fn() { + return 'Hello, tsdown!' +} diff --git a/default/tests/index.test.ts b/default/tests/index.test.ts new file mode 100644 index 0000000..54579bb --- /dev/null +++ b/default/tests/index.test.ts @@ -0,0 +1,6 @@ +import { expect, test } from 'vitest' +import { fn } from '../src' + +test('fn', () => { + expect(fn()).toBe('Hello, tsdown!') +}) diff --git a/default/tsconfig.json b/default/tsconfig.json new file mode 100644 index 0000000..77b838a --- /dev/null +++ b/default/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "esnext", + "lib": ["es2023"], + "moduleDetection": "force", + "module": "preserve", + "moduleResolution": "bundler", + "resolveJsonModule": true, + "types": ["node"], + "strict": true, + "noUnusedLocals": true, + "declaration": true, + "emitDeclarationOnly": true, + "esModuleInterop": true, + "isolatedModules": true, + "verbatimModuleSyntax": true, + "skipLibCheck": true + }, + "include": ["src"] +} diff --git a/default/tsdown.config.ts b/default/tsdown.config.ts new file mode 100644 index 0000000..855d4f3 --- /dev/null +++ b/default/tsdown.config.ts @@ -0,0 +1,5 @@ +import { defineConfig } from 'tsdown' + +export default defineConfig({ + // ...config options +}) diff --git a/minimal/package.json b/minimal/package.json new file mode 100644 index 0000000..a9b98f6 --- /dev/null +++ b/minimal/package.json @@ -0,0 +1,24 @@ +{ + "name": "tsdown-starter", + "version": "0.0.0", + "private": true, + "description": "A simple example library built by tsdown", + "type": "module", + "files": [ + "dist" + ], + "main": "./dist/index.js", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + ".": "./dist/index.js", + "./package.json": "./package.json" + }, + "scripts": { + "build": "tsdown", + "dev": "tsdown --watch" + }, + "devDependencies": { + "tsdown": "^0.15.6" + } +} diff --git a/minimal/src/index.ts b/minimal/src/index.ts new file mode 100644 index 0000000..ff0fb70 --- /dev/null +++ b/minimal/src/index.ts @@ -0,0 +1,3 @@ +export function fn() { + return 'Hello, tsdown!' +} diff --git a/minimal/tsdown.config.ts b/minimal/tsdown.config.ts new file mode 100644 index 0000000..855d4f3 --- /dev/null +++ b/minimal/tsdown.config.ts @@ -0,0 +1,5 @@ +import { defineConfig } from 'tsdown' + +export default defineConfig({ + // ...config options +}) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0ead7e1..80f58d2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,6 +15,30 @@ importers: specifier: npm:rolldown-vite@^7.1.16 version: rolldown-vite@7.1.16(@types/node@24.7.2)(esbuild@0.25.10)(jiti@2.6.1)(yaml@2.8.1) + default: + devDependencies: + '@types/node': + specifier: ^24.7.2 + version: 24.7.2 + bumpp: + specifier: ^10.3.1 + version: 10.3.1 + tsdown: + specifier: ^0.15.6 + version: 0.15.6(typescript@5.9.3)(vue-tsc@3.1.1(typescript@5.9.3)) + typescript: + specifier: ^5.9.3 + version: 5.9.3 + vitest: + specifier: ^3.2.4 + version: 3.2.4(@types/node@24.7.2)(esbuild@0.25.10)(happy-dom@20.0.0)(jiti@2.6.1)(yaml@2.8.1) + + minimal: + devDependencies: + tsdown: + specifier: ^0.15.6 + version: 0.15.6(typescript@5.9.3)(vue-tsc@3.1.1(typescript@5.9.3)) + react: dependencies: react: