Skip to content

Commit

Permalink
build: undo the ESM stuff for now
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone committed Jul 12, 2021
1 parent b751d57 commit 6dbb034
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 175 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/test-and-release.yml
Expand Up @@ -139,14 +139,9 @@ jobs:
run: yarn run build

# Test that the generated packages are ok
- if: matrix.node-version == '10.x'
name: Import main entry point (CommonJS)
- name: Import main entry point
run: yarn node -e 'require("zwave-js")'

- if: matrix.node-version != '10.x'
name: Import main entry point (ESM)
run: yarn node --input-type=module --es-module-specifier-resolution=node -e 'import "zwave-js"'

- name: Run component tests
run: yarn run test:ci
env:
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -30,7 +30,6 @@
"@actions/core": "^1.4.0",
"@actions/exec": "^1.1.0",
"@actions/github": "^5.0.0",
"@alcalzone/esm2cjs": "^1.1.0",
"@alcalzone/jsonl-db": "^1.3.0",
"@alcalzone/release-script": "^2.2.0",
"@babel/core": "^7.14.6",
Expand Down
16 changes: 3 additions & 13 deletions packages/config/package.json
Expand Up @@ -6,16 +6,8 @@
"access": "public"
},
"keywords": [],
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"exports": {
".": {
"import": "./build/esm/index.js",
"require": "./build/cjs/index.js"
},
"./package.json": "./package.json"
},
"types": "build/esm/index.d.ts",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
"build/**/*.{js,d.ts,map}",
"config/"
Expand All @@ -41,15 +33,13 @@
},
"scripts": {
"prebuild": "yarn ts maintenance/prebuild.ts",
"build": "yarn prebuild && tsc -b tsconfig.build.json && yarn postbuild",
"postbuild": "yarn esm2cjs --in=build/esm --out=build/cjs -l error",
"build": "yarn prebuild && tsc -b tsconfig.build.json",
"clean": "tsc -b tsconfig.build.json --clean",
"watch": "yarn run build --watch --pretty",
"lint_config": "yarn ts maintenance/lintConfigFiles.ts",
"ts": "node -r esbuild-register"
},
"dependencies": {
"@alcalzone/esm2cjs": "^1.1.0",
"@zwave-js/core": "8.0.0-alpha.0",
"@zwave-js/shared": "8.0.0-alpha.0",
"alcalzone-shared": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/config/tsconfig.build.json
Expand Up @@ -3,7 +3,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/esm"
"outDir": "build"
},
"references": [
{
Expand Down
16 changes: 3 additions & 13 deletions packages/core/package.json
Expand Up @@ -6,16 +6,8 @@
"access": "public"
},
"keywords": [],
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"exports": {
".": {
"import": "./build/esm/index.js",
"require": "./build/cjs/index.js"
},
"./package.json": "./package.json"
},
"types": "build/esm/index.d.ts",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
"build/**/*.{js,d.ts,map}"
],
Expand All @@ -39,13 +31,11 @@
"node": ">=v12.22.2"
},
"scripts": {
"build": "tsc -b tsconfig.build.json && yarn postbuild",
"postbuild": "yarn esm2cjs --in=build/esm --out=build/cjs -l error",
"build": "tsc -b tsconfig.build.json",
"clean": "yarn run build --clean",
"watch": "yarn run build --watch --pretty"
},
"dependencies": {
"@alcalzone/esm2cjs": "^1.1.0",
"@alcalzone/jsonl-db": "^1.3.0",
"@zwave-js/shared": "8.0.0-alpha.0",
"@zwave-js/winston-daily-rotate-file": "^4.5.6-0",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/tsconfig.build.json
Expand Up @@ -3,7 +3,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/esm"
"outDir": "build"
},
"references": [
{
Expand Down
16 changes: 3 additions & 13 deletions packages/maintenance/package.json
Expand Up @@ -4,16 +4,8 @@
"description": "zwave-js: maintenance scripts",
"private": true,
"keywords": [],
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"exports": {
".": {
"import": "./build/esm/index.js",
"require": "./build/cjs/index.js"
},
"./package.json": "./package.json"
},
"types": "build/esm/index.d.ts",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
"build/**/*.{js,d.ts,map}"
],
Expand All @@ -37,13 +29,11 @@
"node": ">=v12.22.2"
},
"scripts": {
"build": "tsc -b tsconfig.build.json && yarn postbuild",
"postbuild": "yarn esm2cjs --in=build/esm --out=build/cjs -l error",
"build": "tsc -b tsconfig.build.json",
"clean": "yarn run build --clean",
"watch": "yarn run build --watch --pretty"
},
"devDependencies": {
"@alcalzone/esm2cjs": "^1.1.0",
"@types/clipboardy": "^2",
"@types/fs-extra": "^9.0.11",
"@types/jest": "^26.0.23",
Expand Down
2 changes: 1 addition & 1 deletion packages/maintenance/tsconfig.build.json
Expand Up @@ -3,7 +3,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/esm"
"outDir": "build"
},
"references": [
{
Expand Down
16 changes: 3 additions & 13 deletions packages/serial/package.json
Expand Up @@ -6,16 +6,8 @@
"access": "public"
},
"keywords": [],
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"exports": {
".": {
"import": "./build/esm/index.js",
"require": "./build/cjs/index.js"
},
"./package.json": "./package.json"
},
"types": "build/esm/index.d.ts",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
"build/**/*.{js,d.ts,map}"
],
Expand All @@ -39,8 +31,7 @@
"node": ">=v12.22.2"
},
"scripts": {
"build": "tsc -b tsconfig.build.json && yarn postbuild",
"postbuild": "yarn esm2cjs --in=build/esm --out=build/cjs -l error",
"build": "tsc -b tsconfig.build.json",
"clean": "yarn run build --clean",
"watch": "yarn run build --watch --pretty"
},
Expand All @@ -53,7 +44,6 @@
"winston": "^3.3.3"
},
"devDependencies": {
"@alcalzone/esm2cjs": "^1.1.0",
"@serialport/binding-mock": "^9.0.7",
"@types/jest": "^26.0.23",
"@types/node": "^15.12.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/serial/tsconfig.build.json
Expand Up @@ -3,7 +3,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/esm"
"outDir": "build"
},
"references": [
{
Expand Down
16 changes: 3 additions & 13 deletions packages/shared/package.json
Expand Up @@ -6,16 +6,8 @@
"access": "public"
},
"keywords": [],
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"exports": {
".": {
"import": "./build/esm/index.js",
"require": "./build/cjs/index.js"
},
"./package.json": "./package.json"
},
"types": "build/esm/index.d.ts",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
"build/**/*.{js,d.ts,map}"
],
Expand Down Expand Up @@ -43,13 +35,11 @@
"fs-extra": "^10.0.0"
},
"scripts": {
"build": "tsc -b tsconfig.build.json && yarn postbuild",
"postbuild": "yarn esm2cjs --in=build/esm --out=build/cjs -l error",
"build": "tsc -b tsconfig.build.json",
"clean": "yarn run build --clean",
"watch": "yarn run build --watch --pretty"
},
"devDependencies": {
"@alcalzone/esm2cjs": "^1.1.0",
"@types/fs-extra": "^9.0.11",
"@types/jest": "^26.0.23",
"@types/node": "^15.12.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/tsconfig.build.json
Expand Up @@ -3,7 +3,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/esm"
"outDir": "build"
},
"include": ["src/**/*.ts"],
"exclude": ["src/**/*.test.ts"]
Expand Down
16 changes: 3 additions & 13 deletions packages/testing/package.json
Expand Up @@ -4,16 +4,8 @@
"description": "zwave-js: testing utilities",
"private": true,
"keywords": [],
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"exports": {
".": {
"import": "./build/esm/index.js",
"require": "./build/cjs/index.js"
},
"./package.json": "./package.json"
},
"types": "build/esm/index.d.ts",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
"build/**/*.{js,d.ts,map}"
],
Expand All @@ -37,13 +29,11 @@
"node": ">=v12.22.2"
},
"scripts": {
"build": "tsc -b tsconfig.build.json && yarn postbuild",
"postbuild": "yarn esm2cjs --in=build/esm --out=build/cjs -l error",
"build": "tsc -b tsconfig.build.json",
"clean": "yarn run build --clean",
"watch": "yarn run build --watch --pretty"
},
"devDependencies": {
"@alcalzone/esm2cjs": "^1.1.0",
"@types/jest": "^26.0.23",
"@types/node": "^15.12.5",
"@types/triple-beam": "^1.3.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/testing/tsconfig.build.json
Expand Up @@ -3,7 +3,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/esm"
"outDir": "build"
},
"references": [
{
Expand Down
32 changes: 5 additions & 27 deletions packages/zwave-js/package.json
Expand Up @@ -3,33 +3,13 @@
"version": "8.0.0-alpha.2",
"description": "Z-Wave driver written entirely in JavaScript/TypeScript",
"keywords": [],
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"main": "build/index.js",
"exports": {
".": {
"import": "./build/esm/index.js",
"require": "./build/cjs/index.js"
},
".": "./build/index.js",
"./package.json": "./package.json",
"./*": {
"import": "./build/esm/*.js",
"require": "./build/cjs/*.js"
}
},
"types": "build/esm/index.d.ts",
"typesVersions": {
"*": {
"build/esm/index.d.ts": [
"build/esm/index.d.ts"
],
"build/cjs/index.d.ts": [
"build/esm/index.d.ts"
],
"*": [
"build/esm/*"
]
}
"./*": "./build/*.js"
},
"types": "build/index.d.ts",
"files": [
"build/**/*.{js,d.ts,map}"
],
Expand All @@ -56,8 +36,7 @@
"b": "yarn ts maintenance/_build.ts",
"deprecated": "node -p '\"\\n \\n \\033[31;1;4mThe \\\"build:full\\\" script has been deprecated. Use \\\"build\\\" instead!\\033[0m\\n \\n\"'",
"build_full": "yarn run deprecated && yarn run build",
"build": "tsc -b tsconfig.build.json && yarn postbuild",
"postbuild": "esm2cjs --in=build/esm --out=build/cjs -l error",
"build": "tsc -b tsconfig.build.json",
"clean": "tsc -b tsconfig.build.json --clean",
"prewatch": "yarn b prebuild",
"watch": "yarn prewatch && tsc -b tsconfig.build.json --watch --pretty",
Expand Down Expand Up @@ -87,7 +66,6 @@
"xstate": "^4.20.2"
},
"devDependencies": {
"@alcalzone/esm2cjs": "^1.1.0",
"@types/fs-extra": "^9.0.11",
"@types/jest": "^26.0.23",
"@types/node": "^15.12.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/zwave-js/tsconfig.build.json
Expand Up @@ -3,7 +3,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/esm"
"outDir": "build"
},
"references": [
{
Expand Down
3 changes: 0 additions & 3 deletions tsconfig.json
Expand Up @@ -11,9 +11,6 @@
"declaration": true,
"declarationMap": true,

// For ES modules
"module": "ES2020",
// "target": "ES2020",
"moduleResolution": "node",
// To enable Babel support
"allowSyntheticDefaultImports": true,
Expand Down

0 comments on commit 6dbb034

Please sign in to comment.