Skip to content

Commit

Permalink
Use .mjs for module code
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
leebyron committed Feb 15, 2018
1 parent d640f9f commit 8a33f21
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "0.13.0",
"description": "A Query Language and Runtime which can target any service.",
"license": "MIT",
"main": "index.js",
"module": "module/index.js",
"main": "index",
"module": "index.mjs",
"homepage": "https://github.com/graphql/graphql-js",
"bugs": {
"url": "https://github.com/graphql/graphql-js/issues"
Expand All @@ -28,14 +28,13 @@
"prettier": "prettier --write 'src/**/*.js'",
"check": "flow check",
"check-cover": "for file in {src/*.js,src/**/*.js}; do echo $file; flow coverage $file; done",
"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",
"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",
"build:clean": "rm -rf ./dist && mkdir ./dist",
"build:cp": "cp README.md LICENSE ./dist",
"build:package-json": "node ./resources/copy-package-json.js",
"build:npm": "babel src --optional runtime --ignore __tests__ --out-dir dist/",
"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",
"build:module": "BABEL_MODULES=1 babel src --optional runtime --ignore __tests__ --out-dir dist/module/",
"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",
"build:cjs": "babel src --optional runtime --ignore __tests__ --out-dir dist/",
"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",
"build:flow": "find ./src -name '*.js' -not -path '*/__tests__*' | while read filepath; do cp $filepath `echo $filepath | sed 's/\\/src\\//\\/dist\\//g'`.flow; done",
"preversion": ". ./resources/checkgit.sh && npm test",
"prepublish": ". ./resources/prepublish.sh",
"gitpublish": ". ./resources/gitpublish.sh"
Expand Down

0 comments on commit 8a33f21

Please sign in to comment.