Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion bin/packages/get-packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ function isDirectory( file ) {
return fs.lstatSync( path.resolve( PACKAGES_DIR, file ) ).isDirectory();
}

/**
* Returns true if the given packages has type "module".
*
* @see https://medium.com/@nodejs/announcing-a-new-experimental-modules-1be8d2d6c2ff
*
* @param {string} file Packages directory file.
*
* @return {boolean} Whether file is a directory.
*/
function isModuleType( file ) {
const { type = 'module' } = require( path.resolve( PACKAGES_DIR, file, 'package.json' ) );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should confirm that 'module' is the default here. I don't think it is.


return type === 'module';
}

/**
* Filter predicate, returning true if the given base file name is to be
* included in the build.
Expand All @@ -32,7 +47,7 @@ function isDirectory( file ) {
*
* @return {boolean} Whether to include file in build.
*/
const filterPackages = overEvery( isDirectory );
const filterPackages = overEvery( isDirectory, isModuleType );

/**
* Returns the absolute path of all WordPress packages
Expand Down
1 change: 1 addition & 0 deletions packages/babel-plugin-import-jsx-pragma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"files": [
"index.js"
],
"type": "commonjs",
"main": "index.js",
"peerDependencies": {
"@babel/core": "^7.0.0"
Expand Down
1 change: 1 addition & 0 deletions packages/babel-preset-default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"files": [
"index.js"
],
"type": "commonjs",
"main": "index.js",
"dependencies": {
"@babel/core": "^7.4.4",
Expand Down
1 change: 1 addition & 0 deletions packages/block-serialization-spec-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"bugs": {
"url": "https://github.com/WordPress/gutenberg/issues"
},
"type": "commonjs",
"main": "parser.js",
"dependencies": {
"pegjs": "^0.10.0"
Expand Down
4 changes: 4 additions & 0 deletions packages/browserslist-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
"engines": {
"node": ">=8"
},
"files": [
"index.js"
],
"type": "commonjs",
"main": "index.js",
"publishConfig": {
"access": "public"
Expand Down
2 changes: 2 additions & 0 deletions packages/custom-templated-path-webpack-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"files": [
"index.js"
],
"type": "commonjs",
"main": "index.js",
"dependencies": {
"escape-string-regexp": "^1.0.5"
},
Expand Down
1 change: 1 addition & 0 deletions packages/dependency-extraction-webpack-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"index.js",
"util.js"
],
"type": "commonjs",
"main": "index.js",
"dependencies": {
"webpack": "^4.8.3",
Expand Down
8 changes: 8 additions & 0 deletions packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
"bugs": {
"url": "https://github.com/WordPress/gutenberg/issues"
},
"files": [
"configs",
"docs",
"rules",
"index.js"
],
"type": "commonjs",
"main": "index.js",
"dependencies": {
"babel-eslint": "^10.0.1",
"eslint-plugin-jsx-a11y": "^6.2.1",
Expand Down
2 changes: 2 additions & 0 deletions packages/is-shallow-equal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
},
"files": [
"arrays.js",
"index.js",
"objects.js"
],
"type": "commonjs",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.4.4"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-preset-default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
},
"files": [
"scripts",
"index.js",
"jest-preset.json"
],
"type": "commonjs",
"main": "index.js",
"dependencies": {
"@wordpress/jest-console": "file:../jest-console",
Expand Down
2 changes: 2 additions & 0 deletions packages/library-export-default-webpack-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"files": [
"index.js"
],
"type": "commonjs",
"main": "index.js",
"dependencies": {
"lodash": "^4.17.11",
"webpack-sources": "^1.1.0"
Expand Down
6 changes: 6 additions & 0 deletions packages/npm-package-json-lint-config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Master

### New Feature

- Added `type` to the order of preferred properties.

## 1.2.0 (2019-03-06)

### Internal
Expand Down
1 change: 1 addition & 0 deletions packages/npm-package-json-lint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const defaultConfig = {
'engines',
'directories',
'files',
'type',
'main',
'module',
'bin',
Expand Down
4 changes: 4 additions & 0 deletions packages/npm-package-json-lint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
"engines": {
"node": ">=8"
},
"files": [
"index.js"
],
"type": "commonjs",
"main": "index.js",
"peerDependencies": {
"npm-package-json-lint": ">=3.6.0"
Expand Down
1 change: 1 addition & 0 deletions packages/postcss-themes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"files": [
"index.js"
],
"type": "commonjs",
"main": "index.js",
"dependencies": {
"autoprefixer": "^9.4.5",
Expand Down
1 change: 1 addition & 0 deletions packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"scripts",
"utils"
],
"type": "commonjs",
"bin": {
"wp-scripts": "./bin/wp-scripts.js"
},
Expand Down