Skip to content

Commit 65afbaf

Browse files
authored
Use .mjs for module code (#1244)
* Writes .mjs instead of .js for esmodules code. * Moves .mjs out of ./module into the top level since it no longer conflicts with .js Fixes #1217
1 parent d640f9f commit 65afbaf

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

package.json

+6-7
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"version": "0.13.0",
44
"description": "A Query Language and Runtime which can target any service.",
55
"license": "MIT",
6-
"main": "index.js",
7-
"module": "module/index.js",
6+
"main": "index",
7+
"module": "index.mjs",
88
"homepage": "https://github.com/graphql/graphql-js",
99
"bugs": {
1010
"url": "https://github.com/graphql/graphql-js/issues"
@@ -28,14 +28,13 @@
2828
"prettier": "prettier --write 'src/**/*.js'",
2929
"check": "flow check",
3030
"check-cover": "for file in {src/*.js,src/**/*.js}; do echo $file; flow coverage $file; done",
31-
"build": "npm run build:clean && npm run build:cp && npm run build:npm && npm run build:npm-flow && npm run build:module && npm run build:module-flow && npm run build:package-json",
31+
"build": "npm run build:clean && npm run build:cp && npm run build:package-json && npm run build:cjs && npm run build:mjs && npm run build:flow",
3232
"build:clean": "rm -rf ./dist && mkdir ./dist",
3333
"build:cp": "cp README.md LICENSE ./dist",
3434
"build:package-json": "node ./resources/copy-package-json.js",
35-
"build:npm": "babel src --optional runtime --ignore __tests__ --out-dir dist/",
36-
"build:npm-flow": "find ./src -name '*.js' -not -path '*/__tests__*' | while read filepath; do cp $filepath `echo $filepath | sed 's/\\/src\\//\\/dist\\//g'`.flow; done",
37-
"build:module": "BABEL_MODULES=1 babel src --optional runtime --ignore __tests__ --out-dir dist/module/",
38-
"build:module-flow": "find ./src -name '*.js' -not -path '*/__tests__*' | while read filepath; do cp $filepath `echo $filepath | sed 's/\\/src\\//\\/dist\\/module\\//g'`.flow; done",
35+
"build:cjs": "babel src --optional runtime --ignore __tests__ --out-dir dist/",
36+
"build:mjs": "BABEL_MODULES=1 babel src --optional runtime --ignore __tests__ --out-dir dist/module/ && for file in $(find dist/module -name '*.js'); do mv \"$file\" `echo \"$file\" | sed 's/dist\\/module/dist/g; s/.js$/.mjs/g'`; done && rm -rf dist/module",
37+
"build:flow": "for file in $(find ./src -name '*.js' -not -path '*/__tests__*'); do cp \"$file\" `echo \"$file\" | sed 's/\\/src\\//\\/dist\\//g'`.flow; done",
3938
"preversion": ". ./resources/checkgit.sh && npm test",
4039
"prepublish": ". ./resources/prepublish.sh",
4140
"gitpublish": ". ./resources/gitpublish.sh"

0 commit comments

Comments
 (0)