Skip to content

Commit c368b03

Browse files
committed
setup @thirdweb-dev/nexus package
1 parent f790c9f commit c368b03

File tree

10 files changed

+220
-3
lines changed

10 files changed

+220
-3
lines changed

packages/nexus/biome.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
3+
"extends": "//",
4+
"overrides": [
5+
{
6+
"assist": {
7+
"actions": {
8+
"source": {
9+
"useSortedKeys": "off"
10+
}
11+
}
12+
},
13+
"includes": ["package.json"]
14+
}
15+
]
16+
}

packages/nexus/knip.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "https://unpkg.com/knip@5/schema.json",
3+
"entry": ["src/exports/**"],
4+
"ignore": ["src/**/__generated__/**", "**/*.bench.ts"],
5+
"ignoreBinaries": ["printf"],
6+
"ignoreDependencies": ["tslib"],
7+
"project": ["src/**/*.{ts,tsx}"],
8+
"rules": {
9+
"enumMembers": "off",
10+
"optionalPeerDependencies": "off"
11+
}
12+
}

packages/nexus/package.json

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"author": "thirdweb eng <[email protected]>",
3+
"browser": {
4+
"crypto": false
5+
},
6+
"bugs": {
7+
"url": "https://github.com/thirdweb-dev/js/issues"
8+
},
9+
"dependencies": {},
10+
"devDependencies": {
11+
"@biomejs/biome": "2.0.6",
12+
"knip": "5.60.2",
13+
"size-limit": "11.2.0",
14+
"typescript": "5.8.3",
15+
"rimraf": "6.0.1"
16+
},
17+
"engines": {
18+
"node": ">=22"
19+
},
20+
"exports": {
21+
".": {
22+
"types": "./dist/types/exports/nexus.d.ts",
23+
"import": "./dist/esm/exports/nexus.js",
24+
"default": "./dist/cjs/exports/nexus.js"
25+
}
26+
},
27+
"files": [
28+
"dist/*",
29+
"src/*",
30+
"!**/*.tsbuildinfo",
31+
"!**/*.test.ts",
32+
"!**/*.test.tsx",
33+
"!**/*.test.ts.snap",
34+
"!**/*.test-d.ts",
35+
"!**/*.bench.ts",
36+
"!tsconfig.build.json"
37+
],
38+
"license": "Apache-2.0",
39+
"main": "./dist/cjs/nexus/thirdweb.js",
40+
"module": "./dist/esm/nexus/thirdweb.js",
41+
"name": "@thirdweb-dev/nexus",
42+
"peerDependencies": {
43+
"typescript": ">=5.0.4"
44+
},
45+
"peerDependenciesMeta": {
46+
"typescript": {
47+
"optional": true
48+
}
49+
},
50+
"repository": {
51+
"type": "git",
52+
"url": "git+https://github.com/thirdweb-dev/js.git#main"
53+
},
54+
"scripts": {
55+
"build": "pnpm clean && pnpm build:types && pnpm build:cjs && pnpm build:esm",
56+
"build:cjs": "tsc --noCheck --project ./tsconfig.build.json --module commonjs --outDir ./dist/cjs --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./dist/cjs/package.json",
57+
"build:esm": "tsc --noCheck --project ./tsconfig.build.json --module es2020 --outDir ./dist/esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/esm/package.json",
58+
"build:types": "tsc --project ./tsconfig.build.json --module nodenext --moduleResolution nodenext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
59+
"clean": "rimraf dist",
60+
"dev": "tsc --project ./tsconfig.build.json --module nodenext --moduleResolution nodenext --outDir ./dist/esm --watch",
61+
"dev:cjs": "printf '{\"type\":\"commonjs\"}' > ./dist/cjs/package.json && tsc --noCheck --project ./tsconfig.build.json --module commonjs --outDir ./dist/cjs --verbatimModuleSyntax false --watch",
62+
"dev:esm": "printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/esm/package.json && tsc --noCheck --project ./tsconfig.build.json --module es2020 --outDir ./dist/esm --watch",
63+
"fix": "biome check ./src --fix",
64+
"format": "biome format ./src --write",
65+
"knip": "knip",
66+
"lint": "knip && biome check ./src && tsc --project ./tsconfig.build.json --module nodenext --moduleResolution nodenext --noEmit",
67+
"size": "size-limit",
68+
"typecheck": "tsc --project ./tsconfig.build.json --module nodenext --moduleResolution nodenext --noEmit",
69+
"update-version": "node scripts/version.mjs"
70+
},
71+
"sideEffects": false,
72+
"type": "module",
73+
"types": "./dist/types/exports/nexus.d.ts",
74+
"typings": "./dist/types/exports/nexus.d.ts",
75+
"version": "0.1.0"
76+
}

packages/nexus/scripts/version.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { readFile, writeFile } from "node:fs/promises";
2+
3+
const packageVersion = JSON.parse(await readFile("./package.json")).version;
4+
5+
await writeFile(
6+
"./src/version.ts",
7+
`// this file is auto-generated by the version.mjs script
8+
export const version = "${packageVersion}";\n`,
9+
);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { version } from "../version.js";
2+
3+
console.log("Hello, nexus!", version);

packages/nexus/src/version.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// this file is auto-generated by the version.mjs script
2+
export const version = "0.0.0";

packages/nexus/tsconfig.base.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
// This tsconfig file contains the shared config for the build (tsconfig.build.json) and type checking (tsconfig.json) config.
3+
"compilerOptions": {
4+
// Incremental builds
5+
// 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.
6+
"allowJs": false,
7+
"allowSyntheticDefaultImports": true,
8+
"checkJs": false,
9+
10+
// Interop constraints
11+
"esModuleInterop": false,
12+
"exactOptionalPropertyTypes": false,
13+
"forceConsistentCasingInFileNames": true,
14+
"importHelpers": true,
15+
// Incremental builds
16+
// 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.
17+
"incremental": false,
18+
19+
// jsx for "/react" portion
20+
"jsx": "react-jsx",
21+
"lib": [
22+
"ES2022", // By using ES2022 we get access to the `.cause` property on `Error` instances.
23+
"DOM" // We are adding `DOM` here to get the `fetch`, etc. types. This should be removed once these types are available via DefinitelyTyped.
24+
],
25+
"module": "NodeNext",
26+
27+
// Language and environment
28+
"moduleResolution": "NodeNext",
29+
"noFallthroughCasesInSwitch": true,
30+
"noImplicitOverride": true,
31+
"noImplicitReturns": true,
32+
"noUncheckedIndexedAccess": true,
33+
"noUnusedLocals": true,
34+
"noUnusedParameters": true,
35+
36+
// Skip type checking for node modules
37+
"skipLibCheck": true,
38+
39+
// Type checking
40+
"strict": true,
41+
"target": "ES2021",
42+
"useDefineForClassFields": true,
43+
"useUnknownInCatchVariables": true,
44+
"verbatimModuleSyntax": true
45+
},
46+
// This tsconfig file contains the shared config for the build (tsconfig.build.json) and type checking (tsconfig.json) config.
47+
"include": []
48+
}

packages/nexus/tsconfig.build.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"compilerOptions": {
3+
"moduleResolution": "node",
4+
"rootDir": "./src",
5+
"sourceMap": true
6+
},
7+
"exclude": [
8+
"src/**/*.test.ts",
9+
"src/**/*.test.tsx",
10+
"src/**/*.test-d.ts",
11+
"src/**/*.bench.ts",
12+
"src/**/*.macro.ts"
13+
],
14+
"extends": "./tsconfig.base.json",
15+
"include": ["src"]
16+
}

packages/nexus/tsconfig.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
// This configuration is used for local development and type checking.
3+
"compilerOptions": {
4+
"baseUrl": ".",
5+
"outDir": "./dist",
6+
"paths": {
7+
"~test/*": ["./test/src/*"]
8+
}
9+
},
10+
"exclude": [],
11+
"extends": "./tsconfig.base.json",
12+
"include": ["src", "test"]
13+
}

pnpm-lock.yaml

Lines changed: 25 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)