Skip to content

Commit

Permalink
refactor: improve config and esm emit (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt authored Feb 18, 2023
1 parent eecdfb5 commit 83bfa6b
Show file tree
Hide file tree
Showing 32 changed files with 154 additions and 210 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
.vscode
.github
node_modules
dist
build
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
],
"overrides": [],
"rules": {
"@typescript-eslint/consistent-type-imports": "warn",
// Enforce backticks
// Note you must disable the base rule as it can report incorrect errors.
"quotes": "off",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: pnpm format:check:prettier
- run: pnpm check:format
eslint:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: pnpm lint:check
- run: pnpm check:lint
types:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: pnpm types:check
- run: pnpm check:types
test:
needs: setup
uses: ./.github/workflows/test.yml
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ typings/

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
Expand All @@ -102,4 +101,4 @@ dist
.DS_Store

# This library
dist
build
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dist
build
pnpm-lock.yaml
6 changes: 4 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"search.exclude": {
"**/dist": true,
"**/__snpshots__": true
"**/build": true,
"**/__snapshots__": true,
"**/pnpm-lock.yaml": true,
"**/*.tsbuildinfo": true
},
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
Expand Down
29 changes: 13 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,37 @@
"packageManager": "pnpm@7.27.1",
"license": "MIT",
"type": "module",
"types": "./dist/esm/index.d.ts",
"types": "./build/esm/index.d.ts",
"files": [
"src",
"dist"
"build"
],
"exports": {
".": {
"require": {
"types": "./dist/cjs/index.d.cts",
"default": "./dist/cjs/index.cjs"
"types": "./build/cjs/index.d.cts",
"default": "./build/cjs/index.cjs"
},
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
"types": "./build/esm/index.d.ts",
"default": "./build/esm/index.js"
}
}
},
"scripts": {
"ts-node": "ts-node-esm",
"build:toc": "markdown-toc README.md -i --maxdepth 4 && prettier --write README.md",
"format": "pnpm format:prettier",
"format:prettier": "prettier --write .",
"format:check": "pnpm format:check:prettier",
"format:check:prettier": "prettier --check .",
"format": "prettier --write .",
"lint": "eslint . --ext .ts,.tsx --fix",
"lint:check": "eslint . --ext .ts,.tsx --max-warnings 0",
"types:check": "pnpm tsc --noEmit",
"check:format": "prettier --check .",
"check:lint": "eslint . --ext .ts,.tsx --max-warnings 0",
"check:types": "pnpm tsc --noEmit",
"dev": "pnpm clean && tsc --build --watch tsconfig.cjs.json tsconfig.esm.json",
"build": "pnpm clean && pnpm build:cjs && pnpm build:esm",
"build:cjs": "ts-node scripts/build-cjs",
"build:cjs": "pnpm tsc --project tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > build/cjs/package.json",
"build:esm": "tsc --project tsconfig.esm.json",
"test": "vitest",
"clean": "rm -rf dist node_modules/.cache",
"clean": "tsc --build --clean && rm -rf build",
"release:pr": "dripip pr",
"release:canary": "dripip preview",
"release:stable": "dripip stable",
Expand All @@ -54,8 +52,7 @@
"@prisma-labs/prettier-config": "0.1.0",
"@swc/core": "1.3.35",
"@swc/helpers": "0.4.14",
"@tsconfig/node16": "1.0.3",
"@tsconfig/recommended": "1.0.2",
"@tsconfig/node16-strictest": "^1.0.4",
"@types/lodash.ismatch": "4.4.7",
"@types/node": "18.14.0",
"@types/semver": "7.3.13",
Expand Down
50 changes: 30 additions & 20 deletions pnpm-lock.yaml

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

81 changes: 0 additions & 81 deletions scripts/build-cjs.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/core/internal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { z } from 'zod'
import type { z } from 'zod'

export type SomeSchema = z.ZodObject<z.ZodRawShape>

Expand Down
10 changes: 5 additions & 5 deletions src/core/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { DecoderMethods, EncoderMethods } from '../data/types/Controller.js'
import { AssertString, ObjectValues, UnionToIntersection } from '../lib/utils.js'
import { RecordController } from '../record/types/controller.js'
import { SomeStoredRecord, StoredRecord } from '../record/types/StoredRecord.js'
import { z } from 'zod'
import type { DecoderMethods, EncoderMethods } from '../data/types/Controller.js'
import type { AssertString, ObjectValues, UnionToIntersection } from '../lib/utils.js'
import type { RecordController } from '../record/types/controller.js'
import type { SomeStoredRecord, StoredRecord } from '../record/types/StoredRecord.js'
import type { z } from 'zod'

export type OmitTag<T> = Omit<T, '_tag'>

Expand Down
Loading

0 comments on commit 83bfa6b

Please sign in to comment.