Skip to content

Commit

Permalink
fix: import error
Browse files Browse the repository at this point in the history
  • Loading branch information
graykode committed Apr 10, 2024
1 parent 6e29140 commit d6a265b
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 30 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@clober/v2-sdk",
"version": "0.0.2-a",
"version": "0.0.3",
"description": "🛠 An SDK for building applications on top of Clober V2",
"files": [
"dist"
Expand All @@ -25,9 +25,10 @@
"docs": "typedoc --out docs src/index.ts --sort kind",
"test": "vitest --root test --config vitest.config.ts --max-concurrency=0",
"clean": "rm -rf dist",
"build": "npm run clean && npm run build:cjs && npm run build:esm+types",
"build:cjs": "tsc --project tsconfig.build.json --module commonjs --verbatimModuleSyntax false --outDir ./dist/cjs && echo > ./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm+types": "tsc --project tsconfig.build.json --module es2020 --outDir ./dist/esm --declaration --declarationMap --declarationDir ./dist/types && echo > ./dist/esm/package.json '{\"type\":\"module\"}'"
"build": "npm run clean && npm run build:cjs && npm run build:esm && npm run build:types",
"build:cjs": "tsc --project tsconfig.build.json --module commonjs --outDir ./dist/cjs --removeComments && printf '{\"type\":\"commonjs\"}' > ./dist/cjs/package.json",
"build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir ./dist/esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/esm/package.json",
"build:types": "tsc --project tsconfig.build.json --module esnext --outDir ./dist/types --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap"
},
"keywords": [],
"author": "Clober<[email protected]>",
Expand Down
41 changes: 24 additions & 17 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,44 @@
{
// This tsconfig file contains the shared config for the build (tsconfig.build.json) and type checking (tsconfig.json) config.
"include": [],
"compilerOptions": {
// Incremental builds
// NOTE: Enabling incremental builds speeds up `tsc`. Keep in mind though that it does not reliably bust the cache when the `tsconfig.json` file changes.
"incremental": true,

// Type checking
"strict": true,
"skipLibCheck": true,
"useDefineForClassFields": true,
"useDefineForClassFields": true, // Not enabled by default in `strict` mode unless we bump `target` to ES2022.
"noFallthroughCasesInSwitch": true, // Not enabled by default in `strict` mode.
"noImplicitReturns": true, // Not enabled by default in `strict` mode.
"useUnknownInCatchVariables": true, // TODO: This would normally be enabled in `strict` mode but would require some adjustments to the codebase.
"noImplicitOverride": true, // Not enabled by default in `strict` mode.
"noUnusedLocals": true, // Not enabled by default in `strict` mode.
"noUnusedParameters": true, // Not enabled by default in `strict` mode.
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noUncheckedIndexedAccess": true,

// Modules
"module": "ES2022",
"moduleResolution": "node",
// TODO: Uncomment and fix types.
// "noUncheckedIndexedAccess": true,

// JavaScript support
"allowJs": false,
"checkJs": false,

// Interop constraints
"esModuleInterop": false,
"allowSyntheticDefaultImports": false,
"forceConsistentCasingInFileNames": true,
"importHelpers": true, // This is only used for build validation. Since we do not have `tslib` installed, this will fail if we accidentally make use of anything that'd require injection of helpers.

// Language and environment
"lib": ["ESNext"],
"target": "ESNext",
"moduleResolution": "NodeNext",
"module": "NodeNext",
"target": "ES2021", // Setting this to `ES2021` enables native support for `Node v16+`: https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping.
"lib": [
"ES2022", // By using ES2022 we get access to the `.cause` property on `Error` instances.
"DOM" // We are adding `DOM` here to get the `fetch`, etc. types. This should be removed once these types are available via DefinitelyTyped.
],

// Sourcemaps
"sourceMap": true
// Skip type checking for node modules
"skipLibCheck": true,
}
}
}
8 changes: 5 additions & 3 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
// This file is used to compile the for cjs and esm (see package.json build scripts). It should exclude all test files.
"extends": "./tsconfig.base.json",
"include": ["src/**/*.ts"],
"exclude": ["src/**/*.test.ts"],
"compilerOptions": {
"types": ["node"],
"lib": ["DOM"]
"moduleResolution": "node",
"sourceMap": true,
"rootDir": "./src"
}
}
}
5 changes: 1 addition & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
"extends": "./tsconfig.base.json",
"include": ["src/**/*.ts"],
"exclude": ["src/**/*.test.ts"],
"compilerOptions": {
"types": ["node"],
"lib": ["DOM"]
}
"references": [{ "path": "./scripts/tsconfig.json" }]
}

0 comments on commit d6a265b

Please sign in to comment.