Skip to content

Commit 1393449

Browse files
authored
feat(tsconfig): add tsconfig.build.json for distribution (#22)
This commit adds a `tsconfig.build.json` file to the project, which is a specialized TypeScript configuration for building the distribution package. The key changes include: - Setting `noEmit` to `false` to enable compilation - Enabling `declaration` and `declarationMap` to generate type definitions - Setting `sourceMap` to `true` to generate source maps - Configuring `outDir` and `rootDir` to output the compiled files to the `dist` directory - Excluding test files, distribution, and node_modules from the build
1 parent cef66dc commit 1393449

5 files changed

Lines changed: 169 additions & 34 deletions

File tree

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
permissions:
9+
contents: read
10+
id-token: write
11+
12+
jobs:
13+
release:
14+
name: Release
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout Repo
20+
uses: actions/checkout@v5
21+
22+
- name: Setup Bun
23+
uses: oven-sh/setup-bun@v2
24+
with:
25+
bun-version: 1.2.21
26+
27+
- name: Set package version
28+
env:
29+
VERSION: ${{ github.ref_name }}
30+
run: |
31+
echo $(jq --arg v "${{ env.VERSION }}" '(.version) = $v' package.json) > package.json
32+
33+
- name: Install Dependencies
34+
run: bun install --frozen-lockfile
35+
36+
- name: Publish
37+
env:
38+
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
39+
TAG: ${{ github.event.release.prerelease && 'canary' || 'latest' }}
40+
run: bun publish --tag=${{ env.TAG }}

bun.lock

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

eslint.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import globals from 'globals'
55
import tseslint from 'typescript-eslint'
66

77
export default defineConfig([
8+
{
9+
ignores: ['dist/**/*'],
10+
},
811
{
912
languageOptions: {
1013
globals: globals.browser,

package.json

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,35 @@
11
{
22
"name": "@daxserver/validation-schema-codegen",
3-
"version": "0.1.0",
4-
"description": "Codegen for validation schemas",
5-
"private": true,
6-
"main": "src/index.ts",
7-
"module": "src/index.ts",
3+
"version": "dev",
4+
"description": "Code generator for validation schemas for Typebox",
5+
"keywords": [
6+
"typebox",
7+
"codegenerator",
8+
"validation"
9+
],
10+
"author": {
11+
"name": "Srihari Thalla",
12+
"email": "daxserver@icloud.com"
13+
},
814
"type": "module",
15+
"main": "dist/index.js",
16+
"module": "dist/index.js",
17+
"types": "dist/index.d.ts",
18+
"exports": {
19+
".": {
20+
"import": "./dist/index.js",
21+
"types": "./dist/index.d.ts"
22+
}
23+
},
24+
"files": [
25+
"dist"
26+
],
27+
"private": false,
28+
"publishConfig": {
29+
"access": "public",
30+
"provenance": true,
31+
"tag": "latest"
32+
},
933
"dependencies": {
1034
"graphology": "^0.26.0",
1135
"graphology-dag": "^0.4.1",
@@ -29,15 +53,17 @@
2953
"prettier": "^3.6.2",
3054
"prettier-plugin-organize-imports": "^4.2.0",
3155
"ts-morph": "^26.0.0",
32-
"typescript-eslint": "^8.41.0",
33-
"wikibase-sdk": "^10.2.3"
56+
"tsc-alias": "^1.8.16",
57+
"typescript-eslint": "^8.41.0"
3458
},
3559
"peerDependencies": {
3660
"typescript": "~5.9.2"
3761
},
3862
"scripts": {
63+
"build": "tsc --project tsconfig.build.json && tsc-alias -p tsconfig.build.json",
3964
"format": "prettier --cache --write .",
40-
"typecheck": "tsc --noEmit",
41-
"lint": "eslint"
65+
"lint": "eslint",
66+
"prepublishOnly": "bun run build",
67+
"typecheck": "tsc --noEmit"
4268
}
4369
}

tsconfig.build.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"noEmit": false,
5+
"declaration": true,
6+
"declarationMap": true,
7+
"sourceMap": true,
8+
"outDir": "dist",
9+
"rootDir": "src",
10+
"moduleResolution": "node",
11+
"module": "ESNext",
12+
"target": "ES2022",
13+
"allowImportingTsExtensions": false,
14+
"verbatimModuleSyntax": false
15+
},
16+
"include": [
17+
"src/**/*"
18+
],
19+
"exclude": [
20+
"tests/**/*",
21+
"**/*.test.ts",
22+
"**/*.spec.ts",
23+
"dist",
24+
"node_modules"
25+
]
26+
}

0 commit comments

Comments
 (0)