Skip to content

Commit

Permalink
Set up Typescript environment to build project for both es2022 and co…
Browse files Browse the repository at this point in the history
…mmonjs

Fixes #38
  • Loading branch information
Elius94 committed May 20, 2022
1 parent 07c4def commit 941171c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
{
"name": "console-gui-tools",
"version": "1.1.21",
"version": "1.1.22",
"description": "A simple library to draw option menu, text popup or other widgets and layout on a Node.js console.",
"main": "dist/ConsoleGui.js",
"main": "dist/cjs/ConsoleGui.js",
"module": "dist/esm/ConsoleGui.js",
"typings": "dist/ConsoleGui.d.ts",
"types": "dist/ConsoleGui.d.ts",
"type": "module",
"files": [
"dist/"
],
"scripts": {
"lint": "eslint ./src/ --ext .ts",
"build": "tsc",
"build": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json",
"prepare": "npm run build",
"test": "npm run build && node ./examples/tcp_simulator.mjs",
"start": "npm run build && node ./dist/ConsoqleGui.js",
Expand Down Expand Up @@ -47,4 +51,4 @@
"jsdoc-to-markdown": "^7.1.1",
"typescript": "^4.6.4"
}
}
}
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": "./dist/cjs"
}
}
10 changes: 5 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"compilerOptions": {
"target": "esnext",
"lib": ["dom", "esnext"],
"module": "esnext",
"target": "ES2019",
"lib": ["ES2020", "ES2021", "ES2019"],
"module": "ES2022",
"declaration": true,
"outDir": "./dist",
"outDir": "./dist/esm",
// match output dir to input dir. e.g. dist/index instead of dist/src/index
//"rootDir": "./src",
"rootDir": "./src",
"strict": true,
"allowJs": false,
"sourceMap": true,
Expand Down

0 comments on commit 941171c

Please sign in to comment.