From da2b4f7b6cb42125658720543e2bc4dce4f693af Mon Sep 17 00:00:00 2001 From: Chris Holt Date: Thu, 31 Mar 2022 10:19:52 -0700 Subject: [PATCH] update scripts to support esm syntax (#4) * update scripts to support esm syntax * update package version --- build/{clean.js => clean.cjs} | 0 package.json | 5 +++-- src/index.ts | 8 ++++---- src/jsdom-tests.spec.ts | 11 ++++------- src/node-tests.spec.ts | 11 ++++------- 5 files changed, 15 insertions(+), 20 deletions(-) rename build/{clean.js => clean.cjs} (100%) diff --git a/build/clean.js b/build/clean.cjs similarity index 100% rename from build/clean.js rename to build/clean.cjs diff --git a/package.json b/package.json index 0ffd628..96656e0 100644 --- a/package.json +++ b/package.json @@ -17,18 +17,19 @@ "author": { "name": "Chris Holt" }, - "version": "1.0.0", + "version": "1.1.0", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/chrisdholt/exenv-es6.git" }, + "type": "module", "readme": "README.md", "main": "./dist/index.js", "types": "./dist/index.d.ts", "homepage": "https://github.com/chrisdholt/exenv-es6#readme", "scripts": { - "clean:dist": "node ./build/clean.js dist", + "clean:dist": "node ./build/clean.cjs dist", "prepare": "npm run clean:dist && tsc -p ./tsconfig.json", "test": "npm run tslint && npm run unit-tests", "tslint": "tslint -c ./tslint.json '**/*.ts'", diff --git a/src/index.ts b/src/index.ts index fc12a6b..507f211 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -export * from "./can-use-dom"; -export * from "./can-use-event-listeners"; -export * from "./can-use-viewport"; -export * from "./can-use-workers"; +export * from "./can-use-dom.js"; +export * from "./can-use-event-listeners.js"; +export * from "./can-use-viewport.js"; +export * from "./can-use-workers.js"; diff --git a/src/jsdom-tests.spec.ts b/src/jsdom-tests.spec.ts index 2b98589..02fbc7c 100644 --- a/src/jsdom-tests.spec.ts +++ b/src/jsdom-tests.spec.ts @@ -1,13 +1,10 @@ /** * @jest-environment jsdom */ - -import { - canUseDOM, - canUseEventListeners, - canUseViewport, - canUseWorkers -} from "./index"; +import { canUseDOM } from "./can-use-dom"; +import { canUseEventListeners } from "./can-use-event-listeners"; +import { canUseViewport } from "./can-use-viewport"; +import { canUseWorkers } from "./can-use-workers"; describe("canUseDOM", (): void => { test("should return true when jsdom is enabled and mocking the browser", (): void => { diff --git a/src/node-tests.spec.ts b/src/node-tests.spec.ts index 84a289f..daf0a13 100644 --- a/src/node-tests.spec.ts +++ b/src/node-tests.spec.ts @@ -1,13 +1,10 @@ /** * @jest-environment node */ - -import { - canUseDOM, - canUseEventListeners, - canUseViewport, - canUseWorkers -} from "./index"; +import { canUseDOM } from "./can-use-dom"; +import { canUseEventListeners } from "./can-use-event-listeners"; +import { canUseViewport } from "./can-use-viewport"; +import { canUseWorkers } from "./can-use-workers"; describe("canUseDOM", (): void => { test("should return false in a node environment where the browser is not available", (): void => {