Skip to content

Commit

Permalink
refactor: rename api.ts to index.ts to improve internal autoimport logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ssalbdivad committed Jun 13, 2024
1 parent c1f9431 commit a2fe439
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 31 deletions.
4 changes: 1 addition & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
"out",
// too many overlapping names, easy to import in schema/arktype where we don't want it
// should just import as * as ts when we need it in attest
"typescript",
"./ark/type/api.ts"
// "./ark/schema/api.ts"
"typescript"
],
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
// IF YOU UPDATE THE MOCHA CONFIG HERE, PLEASE ALSO UPDATE package.json/mocha AND ark/repo/mocha.jsonc
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions ark/attest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"url": "https://arktype.io"
},
"type": "module",
"main": "./out/api.js",
"types": "./out/api.d.ts",
"main": "./out/index.js",
"types": "./out/index.d.ts",
"exports": {
".": "./out/api.js",
".": "./out/index.js",
"./internal/*": "./out/*"
},
"files": [
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions ark/fs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"url": "https://arktype.io"
},
"type": "module",
"main": "./out/api.js",
"types": "./out/api.d.ts",
"main": "./out/index.js",
"types": "./out/index.d.ts",
"exports": {
".": "./out/api.js",
".": "./out/index.js",
"./internal/*": "./out/*"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion ark/repo/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ module.exports = defineConfig({
message: `Use a specifier like '@arktype/util' to import from a package`
},
{
group: ["**/api.js"],
group: ["**/index.js"],
message: `Use a path like '../original/definition.js' instead of a package entrypoint`
}
]
Expand Down
8 changes: 2 additions & 6 deletions ark/repo/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "out",
"noEmit": false,
"paths": {}
},
"exclude": ["out", "__tests__"]
"rootDir": "."
}
}
2 changes: 2 additions & 0 deletions ark/schema/api.ts → ark/schema/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ export * from "./refinements/min.js"
export * from "./refinements/minLength.js"
export * from "./refinements/range.js"
export * from "./refinements/regex.js"
export * from "./roots/domain.js"
export * from "./roots/intersection.js"
export * from "./roots/morph.js"
export * from "./roots/proto.js"
export * from "./roots/root.js"
export * from "./roots/union.js"
export * from "./roots/unit.js"
Expand Down
6 changes: 3 additions & 3 deletions ark/schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"url": "https://github.com/arktypeio/arktype.git"
},
"type": "module",
"main": "./out/api.js",
"types": "./out/api.d.ts",
"main": "./out/index.js",
"types": "./out/index.d.ts",
"exports": {
".": "./out/api.js",
".": "./out/index.js",
"./config": "./out/config.js",
"./internal/*": "./out/*"
},
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions ark/type/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"url": "https://github.com/arktypeio/arktype.git"
},
"type": "module",
"main": "./out/api.js",
"types": "./out/api.d.ts",
"main": "./out/index.js",
"types": "./out/index.d.ts",
"exports": {
".": "./out/api.js",
".": "./out/index.js",
"./config": "./out/config.js",
"./internal/*": "./out/*"
},
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion ark/type/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import {
type array,
type conform
} from "@arktype/util"

import { Generic, type validateParameterString } from "./generic.js"
import type {
inferDefinition,
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions ark/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"url": "https://arktype.io"
},
"type": "module",
"main": "./out/api.js",
"types": "./out/api.d.ts",
"main": "./out/index.js",
"types": "./out/index.d.ts",
"exports": {
".": "./out/api.js",
".": "./out/index.js",
"./internal/*": "./out/*",
"./tsconfig.base.json": "./tsconfig.base.json"
},
Expand Down
10 changes: 5 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// "noErrorTruncation": true,
// "isolatedDeclarations": true,
"paths": {
"arktype": ["./ark/type/api.ts"],
"arktype": ["./ark/type/index.ts"],
"arktype/config": ["./ark/type/config.ts"],
"@arktype/util": ["./ark/util/api.ts"],
"@arktype/fs": ["./ark/fs/api.ts"],
"@arktype/attest": ["./ark/attest/api.ts"],
"@arktype/schema": ["./ark/schema/api.ts"],
"@arktype/util": ["./ark/util/index.ts"],
"@arktype/fs": ["./ark/fs/index.ts"],
"@arktype/attest": ["./ark/attest/index.ts"],
"@arktype/schema": ["./ark/schema/index.ts"],
"@arktype/schema/config": ["./ark/schema/config.ts"]
},
"types": ["mocha", "node"]
Expand Down

0 comments on commit a2fe439

Please sign in to comment.