Skip to content

Commit

Permalink
Use JS script
Browse files Browse the repository at this point in the history
  • Loading branch information
pvditto committed May 23, 2024
1 parent aedb21e commit 2efe0d7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"plugin:react/recommended",
"prettier"
],
"exclude": ["scripts/*.js"],
"rules": {
"deprecation/deprecation": "error",
"react-hooks/rules-of-hooks": "error",
Expand Down
20 changes: 0 additions & 20 deletions fix-exports-type.sh

This file was deleted.

23 changes: 23 additions & 0 deletions scripts/fix-exports-type.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env node
// This script defines the type of exports in the dist directory using minimal
// package.json files. Setting the type in the main package.json file does not
// work because we want to support both CommonJS and ES Module exports in the
// same package.

const FS = require('node:fs')

const DIST_DIR = 'dist'

FS.writeFileSync(
`${DIST_DIR}/cjs/package.json`,
JSON.stringify({
type: 'commonjs',
}),
)

FS.writeFileSync(
`${DIST_DIR}/esm/package.json`,
JSON.stringify({
type: 'module',
}),
)

0 comments on commit 2efe0d7

Please sign in to comment.