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 code within ./module
* Add a top level index.mjs file (which simply redirects to ./module)

Fixes #1217
  • Loading branch information
leebyron committed Feb 14, 2018
1 parent 7e68984 commit 059cfba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 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 Down Expand Up @@ -34,8 +34,8 @@
"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:module": "BABEL_MODULES=1 babel src --optional runtime --ignore __tests__ --out-dir dist/module/ && for file in $(find dist/module -name '*.js'); do mv \"$file\" \"${file%.js}.mjs\"; done && echo \"export * from './module'; /*:: export type * from './module'; */\" > dist/index.mjs",
"build:module-flow": "find ./src -name '*.js' -not -path '*/__tests__*' | while read filepath; do cp $filepath `echo $filepath | sed 's/\\/src\\//\\/dist\\/module\\//g; s/.js$/.mjs.flow/g'`; done",
"preversion": ". ./resources/checkgit.sh && npm test",
"prepublish": ". ./resources/prepublish.sh",
"gitpublish": ". ./resources/gitpublish.sh"
Expand Down

0 comments on commit 059cfba

Please sign in to comment.