diff --git a/package.json b/package.json index 2d350dca92d..9fc43ccd400 100644 --- a/package.json +++ b/package.json @@ -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" @@ -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"