diff --git a/bin/packages/get-packages.js b/bin/packages/get-packages.js index ed271db0434f23..de0147435dad23 100644 --- a/bin/packages/get-packages.js +++ b/bin/packages/get-packages.js @@ -3,7 +3,7 @@ */ const fs = require( 'fs' ); const path = require( 'path' ); -const { overEvery } = require( 'lodash' ); +const { isEmpty, overEvery } = require( 'lodash' ); /** * Absolute path to packages directory. @@ -24,6 +24,19 @@ function isDirectory( file ) { return fs.lstatSync( path.resolve( PACKAGES_DIR, file ) ).isDirectory(); } +/** + * Returns true if the given packages has "module" field. + * + * @param {string} file Packages directory file. + * + * @return {boolean} Whether file is a directory. + */ +function hasModuleField( file ) { + const { module } = require( path.resolve( PACKAGES_DIR, file, 'package.json' ) ); + + return ! isEmpty( module ); +} + /** * Filter predicate, returning true if the given base file name is to be * included in the build. @@ -32,7 +45,7 @@ function isDirectory( file ) { * * @return {boolean} Whether to include file in build. */ -const filterPackages = overEvery( isDirectory ); +const filterPackages = overEvery( isDirectory, hasModuleField ); /** * Returns the absolute path of all WordPress packages diff --git a/packages/browserslist-config/package.json b/packages/browserslist-config/package.json index a1480a4a821de0..331b74b323fadd 100644 --- a/packages/browserslist-config/package.json +++ b/packages/browserslist-config/package.json @@ -21,6 +21,9 @@ "engines": { "node": ">=8" }, + "files": [ + "index.js" + ], "main": "index.js", "publishConfig": { "access": "public" diff --git a/packages/custom-templated-path-webpack-plugin/package.json b/packages/custom-templated-path-webpack-plugin/package.json index b861d700441de3..bf7af1e6a461f3 100644 --- a/packages/custom-templated-path-webpack-plugin/package.json +++ b/packages/custom-templated-path-webpack-plugin/package.json @@ -24,6 +24,7 @@ "files": [ "index.js" ], + "main": "index.js", "dependencies": { "escape-string-regexp": "^1.0.5" }, diff --git a/packages/dom-ready/package.json b/packages/dom-ready/package.json index 8213415b081db5..d390d8db4ea3b0 100644 --- a/packages/dom-ready/package.json +++ b/packages/dom-ready/package.json @@ -19,6 +19,7 @@ }, "main": "build/index.js", "module": "build-module/index.js", + "react-native": "src/index", "dependencies": { "@babel/runtime": "^7.4.4" }, diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 736b49aa1bcccd..9d009fd22b1b3f 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -17,6 +17,12 @@ "bugs": { "url": "https://github.com/WordPress/gutenberg/issues" }, + "files": [ + "configs", + "rules", + "index.js" + ], + "main": "index.js", "dependencies": { "babel-eslint": "^10.0.1", "eslint-plugin-jsx-a11y": "^6.2.1", diff --git a/packages/html-entities/package.json b/packages/html-entities/package.json index f395b10b352477..85c504daaad1c3 100644 --- a/packages/html-entities/package.json +++ b/packages/html-entities/package.json @@ -4,7 +4,6 @@ "description": "HTML entity utilities for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", - "react-native": "src/index", "keywords": [ "wordpress", "html", @@ -21,6 +20,7 @@ }, "main": "build/index.js", "module": "build-module/index.js", + "react-native": "src/index", "dependencies": { "@babel/runtime": "^7.4.4" }, diff --git a/packages/is-shallow-equal/package.json b/packages/is-shallow-equal/package.json index af3f44c51a85f3..5e1effc9c00767 100644 --- a/packages/is-shallow-equal/package.json +++ b/packages/is-shallow-equal/package.json @@ -21,6 +21,7 @@ }, "files": [ "arrays.js", + "index.js", "objects.js" ], "main": "index.js", diff --git a/packages/jest-preset-default/package.json b/packages/jest-preset-default/package.json index 9f5eeeaf8117c5..fa4e413adbfeeb 100644 --- a/packages/jest-preset-default/package.json +++ b/packages/jest-preset-default/package.json @@ -26,6 +26,7 @@ }, "files": [ "scripts", + "index.js", "jest-preset.json" ], "main": "index.js", diff --git a/packages/library-export-default-webpack-plugin/package.json b/packages/library-export-default-webpack-plugin/package.json index d9fc8d12afc763..fcaf8a3de299e5 100644 --- a/packages/library-export-default-webpack-plugin/package.json +++ b/packages/library-export-default-webpack-plugin/package.json @@ -24,6 +24,7 @@ "files": [ "index.js" ], + "main": "index.js", "dependencies": { "lodash": "^4.17.11", "webpack-sources": "^1.1.0" diff --git a/packages/npm-package-json-lint-config/CHANGELOG.md b/packages/npm-package-json-lint-config/CHANGELOG.md index 11259b591308d6..2fbfc480934313 100644 --- a/packages/npm-package-json-lint-config/CHANGELOG.md +++ b/packages/npm-package-json-lint-config/CHANGELOG.md @@ -1,3 +1,9 @@ +## Master + +### Braking Change + +- Added `type` and `react-native` to the order of preferred properties. + ## 1.2.0 (2019-03-06) ### Internal diff --git a/packages/npm-package-json-lint-config/index.js b/packages/npm-package-json-lint-config/index.js index 5af34472e68b1e..d6a93751371b16 100644 --- a/packages/npm-package-json-lint-config/index.js +++ b/packages/npm-package-json-lint-config/index.js @@ -53,8 +53,10 @@ const defaultConfig = { 'engines', 'directories', 'files', + 'type', 'main', 'module', + 'react-native', 'bin', 'dependencies', 'devDependencies', diff --git a/packages/npm-package-json-lint-config/package.json b/packages/npm-package-json-lint-config/package.json index 885a8a5b66bba8..e9af2edfa81ce9 100644 --- a/packages/npm-package-json-lint-config/package.json +++ b/packages/npm-package-json-lint-config/package.json @@ -21,6 +21,9 @@ "engines": { "node": ">=8" }, + "files": [ + "index.js" + ], "main": "index.js", "peerDependencies": { "npm-package-json-lint": ">=3.6.0" diff --git a/packages/plugins/package.json b/packages/plugins/package.json index 5e93869577524f..f0859bb278f4fe 100644 --- a/packages/plugins/package.json +++ b/packages/plugins/package.json @@ -19,6 +19,7 @@ }, "main": "build/index.js", "module": "build-module/index.js", + "react-native": "src/index", "dependencies": { "@babel/runtime": "^7.4.4", "@wordpress/compose": "file:../compose", diff --git a/packages/token-list/package.json b/packages/token-list/package.json index 5d14fab2f65321..206bb71eef2987 100644 --- a/packages/token-list/package.json +++ b/packages/token-list/package.json @@ -18,6 +18,7 @@ }, "main": "build/index.js", "module": "build-module/index.js", + "react-native": "src/index", "dependencies": { "@babel/runtime": "^7.4.4", "lodash": "^4.17.11" diff --git a/packages/wordcount/package.json b/packages/wordcount/package.json index af4448b1d46f53..a8f74123873112 100644 --- a/packages/wordcount/package.json +++ b/packages/wordcount/package.json @@ -19,6 +19,7 @@ }, "main": "build/index.js", "module": "build-module/index.js", + "react-native": "src/index", "dependencies": { "@babel/runtime": "^7.4.4", "lodash": "^4.17.11"