@gjuchault/typescript-library-starter
Advanced tools
Comparing version 2.0.5 to 2.1.0
@@ -9,6 +9,6 @@ { | ||
"parserOptions": { | ||
"project": "./tsconfig.lint.json" | ||
"project": "./tsconfig.json" | ||
}, | ||
"plugins": ["import", "@typescript-eslint"], | ||
"ignorePatterns": ["scripts/*", "esbuild-hook.js"], | ||
"ignorePatterns": ["scripts/*"], | ||
"extends": [ | ||
@@ -15,0 +15,0 @@ "eslint:recommended", |
@@ -1,6 +0,6 @@ | ||
## [2.0.5](https://github.com/gjuchault/typescript-library-starter/compare/v2.0.4...v2.0.5) (2022-08-16) | ||
# [2.1.0](https://github.com/gjuchault/typescript-library-starter/compare/v2.0.5...v2.1.0) (2023-03-15) | ||
### Bug Fixes | ||
### Features | ||
* **build:** missing bundle mode ([ff379fc](https://github.com/gjuchault/typescript-library-starter/commit/ff379fc1a57d0515236ccd63d0f0566a4d263e15)) | ||
* **node:** migrate to full esm ([b23d2a4](https://github.com/gjuchault/typescript-library-starter/commit/b23d2a4f889c1e1224b380e31137eff6d2bbe8af)), closes [#338](https://github.com/gjuchault/typescript-library-starter/issues/338) |
{ | ||
"name": "@gjuchault/typescript-library-starter", | ||
"version": "2.0.5", | ||
"version": "2.1.0", | ||
"description": "Yet another typescript library starter template", | ||
@@ -15,13 +15,13 @@ "keywords": [ | ||
"repository": "gjuchault/typescript-library-starter", | ||
"main": "./build/cjs/index.js", | ||
"module": "./build/esm/index.js", | ||
"type": "module", | ||
"exports": "./build/index.js", | ||
"types": "./build/src/index.d.ts", | ||
"license": "MIT", | ||
"engines": { | ||
"node": "^18.7.0 || >= 16", | ||
"npm": "^8.16.0 || >= 8" | ||
"node": "^18.15.0", | ||
"npm": "^9.5.0" | ||
}, | ||
"volta": { | ||
"node": "18.7.0", | ||
"npm": "8.16.0" | ||
"node": "18.15.0", | ||
"npm": "9.5.0" | ||
}, | ||
@@ -32,7 +32,7 @@ "publishConfig": { | ||
"scripts": { | ||
"setup": "node -r ./esbuild-hook ./scripts/setup", | ||
"setup": "tsx ./scripts/setup", | ||
"build": "npm run clean && npm run type:dts && npm run build:main", | ||
"build:main": "node -r ./esbuild-hook ./scripts/build", | ||
"clean": "node -r ./esbuild-hook ./scripts/clean", | ||
"type:dts": "tsc --emitDeclarationOnly", | ||
"build:main": "tsx ./scripts/build", | ||
"clean": "tsx ./scripts/clean", | ||
"type:dts": "tsc --emitDeclarationOnly --project tsconfig.build.json", | ||
"type:check": "tsc --noEmit", | ||
@@ -46,3 +46,3 @@ "format": "prettier \"src/**/*.ts\" --write", | ||
"test:coverage": "vitest run --coverage", | ||
"test:setup": "node -r ./esbuild-hook ./scripts/testSetup", | ||
"test:setup": "tsx ./scripts/testSetup", | ||
"spell:check": "cspell \"{README.md,CODE_OF_CONDUCT.md,CONTRIBUTING.md,.github/*.md,src/**/*.ts}\"", | ||
@@ -55,27 +55,28 @@ "cz": "cz", | ||
"@ryansonshine/cz-conventional-changelog": "^3.3.4", | ||
"@semantic-release/changelog": "^6.0.1", | ||
"@semantic-release/changelog": "^6.0.2", | ||
"@semantic-release/commit-analyzer": "^9.0.2", | ||
"@semantic-release/github": "^8.0.5", | ||
"@semantic-release/npm": "^9.0.1", | ||
"@semantic-release/github": "^8.0.7", | ||
"@semantic-release/npm": "^10.0.0-beta.4", | ||
"@semantic-release/release-notes-generator": "^10.0.3", | ||
"@types/node": "^18.7.3", | ||
"@types/prompts": "^2.0.14", | ||
"@typescript-eslint/eslint-plugin": "^5.33.0", | ||
"@typescript-eslint/parser": "^5.33.0", | ||
"c8": "^7.12.0", | ||
"cspell": "^6.6.1", | ||
"esbuild": "^0.14.54", | ||
"eslint": "^8.22.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-import-resolver-typescript": "^3.4.1", | ||
"@types/node": "^18.15.3", | ||
"@types/prompts": "^2.4.3", | ||
"@typescript-eslint/eslint-plugin": "^5.55.0", | ||
"@typescript-eslint/parser": "^5.55.0", | ||
"c8": "^7.13.0", | ||
"cspell": "^6.29.3", | ||
"esbuild": "^0.17.11", | ||
"eslint": "^8.36.0", | ||
"eslint-config-prettier": "^8.7.0", | ||
"eslint-import-resolver-typescript": "^3.5.3", | ||
"eslint-plugin-eslint-comments": "^3.2.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.7.1", | ||
"prettier": "^2.8.4", | ||
"prompts": "^2.4.2", | ||
"semantic-release": "^19.0.3", | ||
"semantic-release": "^20.1.1", | ||
"slugify": "^1.6.5", | ||
"source-map-support": "^0.5.21", | ||
"typescript": "^4.7.4", | ||
"vitest": "^0.21.1" | ||
"tsx": "^3.12.5", | ||
"typescript": "^4.9.5", | ||
"vitest": "^0.29.2" | ||
}, | ||
@@ -82,0 +83,0 @@ "overrides": { |
@@ -37,11 +37,11 @@ # Typescript Library Starter | ||
Leverages [esbuild](https://github.com/evanw/esbuild) for blazing fast builds, but keeps `tsc` to generate `.d.ts` files. | ||
Generates two builds to support both ESM and CJS. | ||
Generates a single ESM build. | ||
Commands: | ||
- `build`: runs typechecking then generates CJS, ESM and `d.ts` files in the `build/` directory | ||
- `build`: runs typechecking then ESM and `d.ts` files in the `build/` directory | ||
- `clean`: removes the `build/` directory | ||
- `type:dts`: only generates `d.ts` | ||
- `type:check`: only run typechecking | ||
- `type:build`: only generates CJS and ESM | ||
- `type:build`: only generates ESM | ||
@@ -48,0 +48,0 @@ ### Tests |
@@ -1,8 +0,11 @@ | ||
import path from "path"; | ||
import path from "node:path"; | ||
import url from "node:url"; | ||
import { build as esbuild, BuildOptions } from "esbuild"; | ||
const __dirname = url.fileURLToPath(new URL(".", import.meta.url)); | ||
const baseConfig: BuildOptions = { | ||
platform: "node", | ||
target: "esnext", | ||
format: "cjs", | ||
target: "node18", | ||
format: "esm", | ||
nodePaths: [path.join(__dirname, "../src")], | ||
@@ -17,16 +20,11 @@ sourcemap: true, | ||
...baseConfig, | ||
outdir: path.join(__dirname, "../build/cjs"), | ||
outdir: path.join(__dirname, "../build"), | ||
entryPoints: [path.join(__dirname, "../src/index.ts")], | ||
}); | ||
await esbuild({ | ||
...baseConfig, | ||
format: "esm", | ||
outdir: path.join(__dirname, "../build/esm"), | ||
entryPoints: [path.join(__dirname, "../src/index.ts")], | ||
}); | ||
} | ||
if (require.main === module) { | ||
main(); | ||
if (import.meta.url.startsWith("file:")) { | ||
if (process.argv[1] === url.fileURLToPath(import.meta.url)) { | ||
await main(); | ||
} | ||
} |
@@ -1,4 +0,7 @@ | ||
import fs from "fs/promises"; | ||
import path from "path"; | ||
import fs from "node:fs/promises"; | ||
import url from "node:url"; | ||
import path from "node:path"; | ||
const __dirname = url.fileURLToPath(new URL(".", import.meta.url)); | ||
async function main() { | ||
@@ -15,4 +18,6 @@ await Promise.all([rmrf("build"), rmrf("coverage"), rmrf(".nyc_output")]); | ||
if (require.main === module) { | ||
main(); | ||
if (import.meta.url.startsWith("file:")) { | ||
if (process.argv[1] === url.fileURLToPath(import.meta.url)) { | ||
await main(); | ||
} | ||
} |
@@ -1,9 +0,12 @@ | ||
import path from "path"; | ||
import path from "node:path"; | ||
import fs from "node:fs/promises"; | ||
import childProcess from "node:child_process"; | ||
import { promisify } from "node:util"; | ||
import url from "node:url"; | ||
import slugify from "slugify"; | ||
import fs from "fs/promises"; | ||
import childProcess from "child_process"; | ||
import { promisify } from "util"; | ||
import prompts from "prompts"; | ||
const exec = promisify(childProcess.exec); | ||
const __filename = url.fileURLToPath(import.meta.url); | ||
const __dirname = url.fileURLToPath(new URL(".", import.meta.url)); | ||
@@ -234,4 +237,6 @@ const rootPath = path.join(__dirname, ".."); | ||
if (require.main === module) { | ||
main(); | ||
if (import.meta.url.startsWith("file:")) { | ||
if (process.argv[1] === url.fileURLToPath(import.meta.url)) { | ||
await main(); | ||
} | ||
} |
@@ -1,3 +0,4 @@ | ||
import childProcess from "child_process"; | ||
import { promisify } from "util"; | ||
import childProcess from "node:child_process"; | ||
import { promisify } from "node:util"; | ||
import url from "node:url"; | ||
import { run } from "./setup"; | ||
@@ -63,4 +64,6 @@ | ||
if (require.main === module) { | ||
main(); | ||
if (import.meta.url.startsWith("file:")) { | ||
if (process.argv[1] === url.fileURLToPath(import.meta.url)) { | ||
await main(); | ||
} | ||
} |
import { describe, expect, it } from "vitest"; | ||
import { foobar } from "../index"; | ||
import { foobar } from "../index.js"; | ||
@@ -4,0 +4,0 @@ describe("foobar()", () => { |
@@ -1,3 +0,3 @@ | ||
import { bar } from "./bar"; | ||
import { foo } from "./foo"; | ||
import { bar } from "./bar.js"; | ||
import { foo } from "./foo.js"; | ||
@@ -4,0 +4,0 @@ export function foobar(a: number, b: number) { |
{ | ||
"include": ["./src/**/*.ts"], | ||
"exclude": ["./src/**/__tests__"], | ||
"compilerOptions": { | ||
"lib": ["es2020"], | ||
"module": "commonjs", | ||
"target": "es2020", | ||
"lib": ["es2022"], | ||
"module": "esnext", | ||
"target": "es2022", | ||
"moduleResolution": "nodenext", | ||
@@ -9,0 +9,0 @@ "rootDir": "./", |
Sorry, the diff of this file is not supported yet
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
1
Yes
28607
28
30
480