Skip to content

Commit

Permalink
fix(package): fix "module" field in package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Jul 18, 2023
1 parent 9725f5f commit efc54f8
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: npm run test:ci

- name: Run module tests
run: npm run test:module
run: npm run test:esm

- name: Codecov
uses: codecov/codecov-action@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jspm_packages
# Build files
cjs/
docs/
esm/

# Vim swap files
*.swp
Expand Down
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@

npm run lint:tsc
npm run test:ci
npm run test:esm
npx lint-staged
1 change: 0 additions & 1 deletion module/index.mjs

This file was deleted.

17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,27 @@
"description": "Track users, send messages, export data, and more with Braze API.",
"author": "Mark <mark@remarkablemark.org>",
"main": "cjs/index.js",
"module": "index.mjs",
"module": "esm/index.js",
"exports": {
"types": "./cjs/index.d.ts",
"import": "./module/index.mjs",
"import": "./esm/index.js",
"require": "./cjs/index.js"
},
"scripts": {
"build": "tsc",
"clean": "rm -rf coverage cjs docs",
"build": "npm run build:cjs && npm run build:esm",
"build:cjs": "tsc",
"build:esm": "tsc --module nodenext --outDir esm",
"clean": "rm -rf cjs coverage docs esm",
"docs": "typedoc",
"docs:watch": "npm run docs -- --watch",
"lint": "eslint --ignore-path .gitignore --ext .js,.mjs,.ts .",
"lint:fix": "npm run lint -- --fix",
"lint:tsc": "tsc --noEmit && tsc --project tsconfig.test.json",
"postinstall": "husky install",
"postpublish": "pinst --enable",
"prepublishOnly": "pinst --disable && npm run lint && npm run lint:tsc && npm run test:ci && npm run clean && npm run build",
"prepublishOnly": "pinst --disable && npm run lint && npm run lint:tsc && npm run test:ci && npm run test:esm && npm run clean && npm run build",
"test": "jest",
"test:ci": "CI=true jest --ci --colors --coverage",
"test:module": "npm run build && node --test module",
"test:esm": "npm run build:esm && node --test src",
"test:watch": "jest --watch"
},
"repository": {
Expand Down Expand Up @@ -65,7 +66,7 @@
},
"files": [
"cjs/",
"module/"
"esm/"
],
"engines": {
"node": ">=14"
Expand Down
2 changes: 1 addition & 1 deletion module/index.test.mjs → src/index.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, it } from 'node:test'

import assert from 'assert'

import { Braze } from './index.mjs'
import { Braze } from '../esm/index.js'

describe('index', () => {
it('exports "Braze" class', () => {
Expand Down

0 comments on commit efc54f8

Please sign in to comment.