Skip to content

Commit

Permalink
dual package expt.
Browse files Browse the repository at this point in the history
  • Loading branch information
marihachi committed Jul 29, 2023
1 parent 3b8a3fe commit f0fee77
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ node_modules
.vscode

# app dir
build
built
temp
20 changes: 9 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"name": "terrario",
"version": "0.9.0",
"version": "0.10.0-dev.1",
"description": "A refined, expressive parser combinator library.",
"license": "MIT",
"author": "Marihachi",
"type": "module",
"module": "./built/index.js",
"main": "./built/cjs/index.cjs",
"types": "./built/index.d.ts",
"module": "./build/esm/index.js",
"main": "./build/cjs/index.js",
"contributors": [
"ThinaticSystem <[email protected]> (https://thinaticsystem.com/)"
],
Expand All @@ -25,18 +24,17 @@
},
"scripts": {
"build": "npm run build:esm && npm run build:cjs",
"build:esm": "tsc",
"build:cjs": "npx tsc --outdir built/cjs --module CommonJS && npm run build:cjs:rename",
"build:cjs:rename": "node -e \"require('fs').renameSync('./built/cjs/index.js', './built/cjs/index.cjs')\"",
"build:esm": "tsc -p tsconfig.esm.json && cp -r ./template/esm ./build",
"build:cjs": "tsc -p tsconfig.cjs.json && cp -r ./template/cjs ./build",
"test": "jest --verbose",
"typedoc": "typedoc --plugin typedoc-plugin-markdown --out temp/docs src/index.ts",
"api-init": "api-extractor init",
"api": "api-extractor run --local --verbose"
},
"exports": {
"import": "./built/index.js",
"require": "./built/cjs/index.cjs",
"default": "./built/index.js"
"import": "./build/esm/index.js",
"require": "./build/cjs/index.js",
"default": "./build/esm/index.js"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.36.3",
Expand All @@ -49,7 +47,7 @@
"typescript": "5.1.6"
},
"files": [
"built/**/*",
"build/**/*",
"CHANGELOG.md"
]
}
4 changes: 4 additions & 0 deletions template/cjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "commonjs",
"types": "./index.d.ts"
}
4 changes: 4 additions & 0 deletions template/esm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "module",
"types": "./index.d.ts"
}
7 changes: 7 additions & 0 deletions tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "./build/cjs/",
}
}
7 changes: 7 additions & 0 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "esnext",
"outDir": "./build/esm/",
}
}
7 changes: 3 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "Node",
"target": "es2020",
"module": "esnext",
"moduleResolution": "node",
"declaration": true,
"rootDir": "./src/",
"outDir": "./built/",
"skipLibCheck": true,
"removeComments": false,
"strict": true,
Expand Down

0 comments on commit f0fee77

Please sign in to comment.