From 4a18f3d1fcf77ea787d4471a11d1aebf13dc897f Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Thu, 7 Nov 2019 15:57:53 +0000 Subject: [PATCH 1/6] fix: output umd build for main key --- package.json | 4 ++-- tsconfig.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 45fc291..7210b56 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@github/remote-input-element", "version": "0.2.0", "description": "An input element that sends its value to a server endpoint and renders the response body.", - "main": "dist/index.js", + "main": "dist/umd/index.js", "module": "dist/index.js", "types": "dist/index.d.ts", "license": "MIT", @@ -14,7 +14,7 @@ "clean": "rm -rf dist", "lint": "github-lint", "prebuild": "npm run clean && npm run lint", - "build": "tsc", + "build": "tsc --outDir dist/umd --module umd && tsc", "pretest": "npm run build", "test": "karma start test/karma.config.js", "prepublishOnly": "npm run build", diff --git a/tsconfig.json b/tsconfig.json index 02c96aa..9cf7595 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "esnext", - "target": "es2018", + "target": "es5", "strict": true, "declaration": true, "outDir": "dist", From 26f88b981444c78f7451ee9647d497a7d43ab88a Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Thu, 7 Nov 2019 16:04:31 +0000 Subject: [PATCH 2/6] chore: add lib to fix type checker --- tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/tsconfig.json b/tsconfig.json index 9cf7595..09ede2c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "module": "esnext", "target": "es5", + "lib": ["es2018", "dom"], "strict": true, "declaration": true, "outDir": "dist", From 330f5b5f7f83708293ed3a563ba1a1ca056e2467 Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Thu, 7 Nov 2019 17:22:46 +0000 Subject: [PATCH 3/6] test: use umd for test --- test/karma.config.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/test/karma.config.js b/test/karma.config.js index 803ea25..578096a 100644 --- a/test/karma.config.js +++ b/test/karma.config.js @@ -25,13 +25,7 @@ function reply(request, response, next) { module.exports = function(config) { config.set({ frameworks: ['mocha', 'chai'], - files: [ - { - pattern: '../dist/index.js', - type: 'module' - }, - 'test.js' - ], + files: ['../dist/umd/index.js', 'test.js'], reporters: ['mocha'], port: 9876, colors: true, From 58535a905ce3d16a102abd86d0c4b83a17b3f2c7 Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Thu, 7 Nov 2019 17:32:43 +0000 Subject: [PATCH 4/6] build: targer es2017 with async/await --- tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 09ede2c..03f15b1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "esnext", - "target": "es5", + "target": "es2017", "lib": ["es2018", "dom"], "strict": true, "declaration": true, From 90beb06fd8f421fac0b6299f711196924e15e746 Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Thu, 14 Nov 2019 12:19:13 +0000 Subject: [PATCH 5/6] test: add bootstrap file to allow for umd import --- test/bootstrap.js | 4 ++++ test/karma.config.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 test/bootstrap.js diff --git a/test/bootstrap.js b/test/bootstrap.js new file mode 100644 index 0000000..82373dc --- /dev/null +++ b/test/bootstrap.js @@ -0,0 +1,4 @@ +// Stub out CommonJS for tests +window.module = {exports: {}} +window.exports = module.exports +window.require = Function.prototype diff --git a/test/karma.config.js b/test/karma.config.js index 578096a..7facfc6 100644 --- a/test/karma.config.js +++ b/test/karma.config.js @@ -25,7 +25,7 @@ function reply(request, response, next) { module.exports = function(config) { config.set({ frameworks: ['mocha', 'chai'], - files: ['../dist/umd/index.js', 'test.js'], + files: ['bootstrap.js', '../dist/umd/index.js', 'test.js'], reporters: ['mocha'], port: 9876, colors: true, From a884d8fbee387a1ea30d2ab2e53a26d9c5d2aaa8 Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Thu, 19 Mar 2020 13:30:56 +0000 Subject: [PATCH 6/6] test: use ESM not UMD bundle --- test/bootstrap.js | 4 ---- test/karma.config.js | 8 +++++++- 2 files changed, 7 insertions(+), 5 deletions(-) delete mode 100644 test/bootstrap.js diff --git a/test/bootstrap.js b/test/bootstrap.js deleted file mode 100644 index 82373dc..0000000 --- a/test/bootstrap.js +++ /dev/null @@ -1,4 +0,0 @@ -// Stub out CommonJS for tests -window.module = {exports: {}} -window.exports = module.exports -window.require = Function.prototype diff --git a/test/karma.config.js b/test/karma.config.js index 7facfc6..803ea25 100644 --- a/test/karma.config.js +++ b/test/karma.config.js @@ -25,7 +25,13 @@ function reply(request, response, next) { module.exports = function(config) { config.set({ frameworks: ['mocha', 'chai'], - files: ['bootstrap.js', '../dist/umd/index.js', 'test.js'], + files: [ + { + pattern: '../dist/index.js', + type: 'module' + }, + 'test.js' + ], reporters: ['mocha'], port: 9876, colors: true,