Skip to content

Commit

Permalink
package: build system
Browse files Browse the repository at this point in the history
  • Loading branch information
missinglink committed Jul 17, 2024
1 parent bac0d9a commit f172f0b
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
package-lock.json
3 changes: 3 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import s2 from './s2/_index'

export default { s2 }
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
{
"name": "s2",
"version": "1.0.0",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"module": "dist/s2.esm.js",
"scripts": {
"build": "tsdx build --entry index.ts",
"test": "node --import tsx --test **/*_test.ts"
},
"author": "Peter Johnson",
"license": "MIT",
"description": "javascript port of s2 geometry",
"devDependencies": {
"@types/node": "^20.14.11",
"tsdx": "^0.14.1",
"tsx": "^4.16.2"
}
}
3 changes: 3 additions & 0 deletions s2/_index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import * as cellid from './cellid'

export default { cellid }
32 changes: 32 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"exclude": ["**/*_test.ts"],
"compilerOptions": {
"module": "esnext",
"lib": ["dom", "esnext"],
"importHelpers": true,
// output .d.ts declaration files for consumers
"declaration": true,
// output .js.map sourcemap files for consumers
"sourceMap": true,
// match output dir to input dir. e.g. dist/index instead of dist/src/index
"rootDir": ".",
// stricter type-checking for stronger correctness. Recommended by TS
"strict": true,
// linter checks for common issues
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
// noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative
"noUnusedLocals": true,
"noUnusedParameters": true,
// use Node's module resolution algorithm, instead of the legacy TS one
"moduleResolution": "node",
// interop between ESM and CJS modules. Recommended by TS
"esModuleInterop": true,
// significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS
"skipLibCheck": true,
// error out if import and file system have a casing mismatch. Recommended by TS
"forceConsistentCasingInFileNames": true,
// `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc`
"noEmit": true
}
}

0 comments on commit f172f0b

Please sign in to comment.