diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000000000..0605f83bf9078 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,3 @@ +// Import the default config file and expose it in the project root. +// Useful for editor integrations. +module.exports = require( '@wordpress/scripts/config/.prettierrc.js' ); diff --git a/package-lock.json b/package-lock.json index 8070e078e471c..1c409785d2cf2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10517,6 +10517,7 @@ "dev": true, "requires": { "babel-eslint": "^10.0.3", + "eslint-config-prettier": "^6.10.0", "eslint-plugin-jest": "^22.15.1", "eslint-plugin-jsdoc": "^15.8.0", "eslint-plugin-jsx-a11y": "^6.2.3", @@ -10762,6 +10763,7 @@ "command-exists": "^1.2.8", "cross-spawn": "^5.1.0", "decompress-zip": "^0.2.2", + "dir-glob": "^3.0.1", "eslint": "^6.1.0", "eslint-plugin-markdown": "1.0.1", "jest": "^24.9.0", @@ -10770,6 +10772,7 @@ "lodash": "^4.17.15", "minimist": "^1.2.0", "npm-package-json-lint": "^4.0.3", + "prettier": "npm:wp-prettier@1.19.1", "puppeteer": "^2.0.0", "read-pkg-up": "^1.0.1", "request": "^2.88.0", @@ -10784,55 +10787,6 @@ "webpack-bundle-analyzer": "^3.3.2", "webpack-cli": "^3.1.2", "webpack-livereload-plugin": "^2.2.0" - }, - "dependencies": { - "big.js": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", - "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", - "dev": true - }, - "json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", - "dev": true, - "requires": { - "minimist": "^1.2.0" - } - }, - "loader-utils": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.2.3.tgz", - "integrity": "sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==", - "dev": true, - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^2.0.0", - "json5": "^1.0.1" - } - }, - "schema-utils": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.6.4.tgz", - "integrity": "sha512-VNjcaUxVnEeun6B2fiiUDjXXBtD4ZSH7pdbfIu1pOFwgptDPLMo/z9jr4sUfsjFVPqDCEin/F7IYlq7/E6yDbQ==", - "dev": true, - "requires": { - "ajv": "^6.10.2", - "ajv-keywords": "^3.4.1" - } - }, - "url-loader": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/url-loader/-/url-loader-3.0.0.tgz", - "integrity": "sha512-a84JJbIA5xTFTWyjjcPdnsu+41o/SNE8SpXMdUvXs6Q+LuhCD9E2+0VCiuDWqgo3GGXVlFHzArDmBpj9PgWn4A==", - "dev": true, - "requires": { - "loader-utils": "^1.2.3", - "mime": "^2.4.4", - "schema-utils": "^2.5.0" - } - } } }, "@wordpress/server-side-render": { @@ -15478,6 +15432,17 @@ "ignore": "^3.3.5", "pify": "^3.0.0", "slash": "^1.0.0" + }, + "dependencies": { + "dir-glob": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.2.tgz", + "integrity": "sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==", + "dev": true, + "requires": { + "path-type": "^3.0.0" + } + } } }, "is-extglob": { @@ -16671,13 +16636,20 @@ } }, "dir-glob": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.0.0.tgz", - "integrity": "sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "dev": true, "requires": { - "arrify": "^1.0.1", - "path-type": "^3.0.0" + "path-type": "^4.0.0" + }, + "dependencies": { + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + } } }, "direction": { @@ -17737,6 +17709,23 @@ } } }, + "eslint-config-prettier": { + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.10.0.tgz", + "integrity": "sha512-AtndijGte1rPILInUdHjvKEGbIV06NuvPrqlIEaEaWtbtvJh464mDeyGMdZEQMsGvC0ZVkiex1fSNcC4HAbRGg==", + "dev": true, + "requires": { + "get-stdin": "^6.0.0" + }, + "dependencies": { + "get-stdin": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", + "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", + "dev": true + } + } + }, "eslint-import-resolver-node": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz", @@ -31965,9 +31954,9 @@ "dev": true }, "prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "version": "npm:wp-prettier@1.19.1", + "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-1.19.1.tgz", + "integrity": "sha512-mqAC2r1NDmRjG+z3KCJ/i61tycKlmADIjxnDhQab+KBxSAGbF/W7/zwB2guy/ypIeKrrftNsIYkNZZQKf3vJcg==", "dev": true }, "pretty-error": { @@ -33032,6 +33021,18 @@ "ignore": "^3.3.5", "pify": "^3.0.0", "slash": "^1.0.0" + }, + "dependencies": { + "dir-glob": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.0.0.tgz", + "integrity": "sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag==", + "dev": true, + "requires": { + "arrify": "^1.0.1", + "path-type": "^3.0.0" + } + } } }, "gzip-size": { @@ -39486,6 +39487,55 @@ } } }, + "url-loader": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-loader/-/url-loader-3.0.0.tgz", + "integrity": "sha512-a84JJbIA5xTFTWyjjcPdnsu+41o/SNE8SpXMdUvXs6Q+LuhCD9E2+0VCiuDWqgo3GGXVlFHzArDmBpj9PgWn4A==", + "dev": true, + "requires": { + "loader-utils": "^1.2.3", + "mime": "^2.4.4", + "schema-utils": "^2.5.0" + }, + "dependencies": { + "big.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", + "dev": true + }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.2.3.tgz", + "integrity": "sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^2.0.0", + "json5": "^1.0.1" + } + }, + "schema-utils": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.6.4.tgz", + "integrity": "sha512-VNjcaUxVnEeun6B2fiiUDjXXBtD4ZSH7pdbfIu1pOFwgptDPLMo/z9jr4sUfsjFVPqDCEin/F7IYlq7/E6yDbQ==", + "dev": true, + "requires": { + "ajv": "^6.10.2", + "ajv-keywords": "^3.4.1" + } + } + } + }, "url-parse": { "version": "1.4.7", "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz", diff --git a/package.json b/package.json index f4f3ac73ae5bb..c3676ef905b1c 100644 --- a/package.json +++ b/package.json @@ -146,6 +146,7 @@ "node-watch": "0.6.0", "postcss": "7.0.13", "postcss-loader": "3.0.0", + "prettier": "npm:wp-prettier@1.19.1", "progress": "2.0.3", "react": "16.9.0", "react-dom": "16.9.0", @@ -186,6 +187,7 @@ "fixtures:server-registered": "packages/env/bin/wp-env run wordpress ./wp-content/plugins/gutenberg/bin/get-server-blocks.php > test/integration/full-content/server-registered.json", "fixtures:generate": "npm run fixtures:server-registered && cross-env GENERATE_MISSING_FIXTURES=y npm run test-unit", "fixtures:regenerate": "npm run fixtures:clean && npm run fixtures:generate", + "format-js": "wp-scripts format-js", "lint": "concurrently \"npm run lint-js\" \"npm run lint-pkg-json\" \"npm run lint-css\" \"npm run lint-types\"", "lint-js": "wp-scripts lint-js", "lint-js:fix": "npm run lint-js -- --fix", diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 39a9fd1a021d3..daf6d49ac0e5a 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -1,3 +1,10 @@ +## Master + +### New Features + +- The `recommended` config no longer enables rules that check code formatting (whitespace, indenting, etc.) and that could conflict with Prettier. +- There is a new `recommended-with-formatting` config that has the code formatting rules still enabled, for projects that want to opt out from Prettier and continue checking code formatting with ESLint. + ## 3.3.0 (2019-12-19) ### Bug Fixes diff --git a/packages/eslint-plugin/configs/es5.js b/packages/eslint-plugin/configs/es5.js index 7ed0b7ff9d072..2abee331d47ae 100644 --- a/packages/eslint-plugin/configs/es5.js +++ b/packages/eslint-plugin/configs/es5.js @@ -57,7 +57,7 @@ module.exports = { 'no-with': 'error', 'object-curly-spacing': [ 'error', 'always' ], 'one-var-declaration-per-line': [ 'error', 'initializations' ], - 'operator-linebreak': [ 'error', 'after' ], + 'operator-linebreak': 'error', 'padded-blocks': [ 'error', 'never' ], 'quote-props': [ 'error', 'as-needed' ], quotes: [ 'error', 'single', { avoidEscape: true } ], diff --git a/packages/eslint-plugin/configs/recommended-with-formatting.js b/packages/eslint-plugin/configs/recommended-with-formatting.js new file mode 100644 index 0000000000000..71d8625cd961b --- /dev/null +++ b/packages/eslint-plugin/configs/recommended-with-formatting.js @@ -0,0 +1,39 @@ +module.exports = { + parser: 'babel-eslint', + extends: [ + require.resolve( './jsx-a11y.js' ), + require.resolve( './custom.js' ), + require.resolve( './react.js' ), + require.resolve( './esnext.js' ), + ], + env: { + node: true, + }, + globals: { + window: true, + document: true, + wp: 'readonly', + }, + overrides: [ + { + // Unit test files and their helpers only. + files: [ + '**/@(test|__tests__)/**/*.js', + '**/?(*.)test.js', + ], + extends: [ + require.resolve( './test-unit.js' ), + ], + }, + { + // End-to-end test files and their helpers only. + files: [ + '**/specs/**/*.js', + '**/?(*.)spec.js', + ], + extends: [ + require.resolve( './test-e2e.js' ), + ], + }, + ], +}; diff --git a/packages/eslint-plugin/configs/recommended.js b/packages/eslint-plugin/configs/recommended.js index 71d8625cd961b..b2bbe922820aa 100644 --- a/packages/eslint-plugin/configs/recommended.js +++ b/packages/eslint-plugin/configs/recommended.js @@ -1,39 +1,3 @@ module.exports = { - parser: 'babel-eslint', - extends: [ - require.resolve( './jsx-a11y.js' ), - require.resolve( './custom.js' ), - require.resolve( './react.js' ), - require.resolve( './esnext.js' ), - ], - env: { - node: true, - }, - globals: { - window: true, - document: true, - wp: 'readonly', - }, - overrides: [ - { - // Unit test files and their helpers only. - files: [ - '**/@(test|__tests__)/**/*.js', - '**/?(*.)test.js', - ], - extends: [ - require.resolve( './test-unit.js' ), - ], - }, - { - // End-to-end test files and their helpers only. - files: [ - '**/specs/**/*.js', - '**/?(*.)spec.js', - ], - extends: [ - require.resolve( './test-e2e.js' ), - ], - }, - ], + extends: [ require.resolve( './recommended-with-formatting.js' ), 'eslint-config-prettier' ], }; diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 691dae1e2a4b1..476aa97e33990 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -25,6 +25,7 @@ "main": "index.js", "dependencies": { "babel-eslint": "^10.0.3", + "eslint-config-prettier": "^6.10.0", "eslint-plugin-jest": "^22.15.1", "eslint-plugin-jsdoc": "^15.8.0", "eslint-plugin-jsx-a11y": "^6.2.3", diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md index bba559b103edd..0644bc133e81b 100644 --- a/packages/scripts/CHANGELOG.md +++ b/packages/scripts/CHANGELOG.md @@ -1,5 +1,10 @@ ## Master +### Breaking Changes + +- This package requires now `node` v10.0.0 or later, and `npm` v6.9.0 or later ([#18048](https://github.com/WordPress/gutenberg/pull/18048)). +- The minimum version required for `npm` in `check-engines` script was increased to `6.9.0+` ([#18048](https://github.com/WordPress/gutenberg/pull/18048)). + ### New Features - Add SVGR support to compile SVG files to React components using the `@svgr/webpack` plugin ([#18243](https://github.com/WordPress/gutenberg/pull/18243)). @@ -10,7 +15,7 @@ ### Bug Fixes -- Update `jest-preset-default` dependency to fix preset file extension for inclusion in NPM deployments. ([#19306](https://github.com/WordPress/gutenberg/pull/19306)). +- Update `jest-preset-default` dependency to fix preset file extension for inclusion in NPM deployments ([#19306](https://github.com/WordPress/gutenberg/pull/19306)). ## 6.1.0 (2019-12-20) diff --git a/packages/scripts/README.md b/packages/scripts/README.md index 7e6c23eb1f630..560bef7330f45 100644 --- a/packages/scripts/README.md +++ b/packages/scripts/README.md @@ -16,6 +16,8 @@ You only need to install one npm module: npm install @wordpress/scripts --save-dev ``` +**Note**: This package requires `npm` 6.9.0 or later, and is not compatible with older versions. + ## Setup This package offers a command-line interface and exposes a binary called `wp-scripts` so you can call it directly with `npx` – an npm package runner. However, this module is designed to be configured using the `scripts` section in the `package.json` file of your project. This comprehensive example demonstrates the most of the capabilities included. diff --git a/packages/scripts/config/.prettierrc.js b/packages/scripts/config/.prettierrc.js new file mode 100644 index 0000000000000..61b185ac2c203 --- /dev/null +++ b/packages/scripts/config/.prettierrc.js @@ -0,0 +1,12 @@ +module.exports = { + useTabs: true, + tabWidth: 2, + printWidth: 100, + singleQuote: true, + trailingComma: 'es5', + bracketSpacing: true, + parenSpacing: true, + jsxBracketSameLine: false, + semi: true, + arrowParens: 'always', +}; diff --git a/packages/scripts/package.json b/packages/scripts/package.json index 5009eb80d2ef9..e9514c78f8d4f 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -20,7 +20,8 @@ "url": "https://github.com/WordPress/gutenberg/issues" }, "engines": { - "node": ">=8" + "node": ">=10", + "npm": ">=6.9" }, "files": [ "bin", @@ -45,6 +46,7 @@ "command-exists": "^1.2.8", "cross-spawn": "^5.1.0", "decompress-zip": "^0.2.2", + "dir-glob": "^3.0.1", "eslint": "^6.1.0", "eslint-plugin-markdown": "1.0.1", "jest": "^24.9.0", @@ -53,6 +55,7 @@ "lodash": "^4.17.15", "minimist": "^1.2.0", "npm-package-json-lint": "^4.0.3", + "prettier": "npm:wp-prettier@1.19.1", "puppeteer": "^2.0.0", "read-pkg-up": "^1.0.1", "request": "^2.88.0", diff --git a/packages/scripts/scripts/check-engines.js b/packages/scripts/scripts/check-engines.js index aba446313e5a9..bead8796a6936 100644 --- a/packages/scripts/scripts/check-engines.js +++ b/packages/scripts/scripts/check-engines.js @@ -21,7 +21,7 @@ const hasConfig = hasArgInCLI( '--package' ) || const config = ! hasConfig ? [ '--node', '>=10.0.0', - '--npm', '>=6.0.0', + '--npm', '>=6.9.0', ] : []; diff --git a/packages/scripts/scripts/format-js.js b/packages/scripts/scripts/format-js.js new file mode 100644 index 0000000000000..046a9c8b70532 --- /dev/null +++ b/packages/scripts/scripts/format-js.js @@ -0,0 +1,114 @@ +/** + * Node dependencies + */ +const { exit, stdout } = require( 'process' ); + +/** + * External dependencies + */ +const chalk = require( 'chalk' ); +const { sync: spawn } = require( 'cross-spawn' ); +const { sync: resolveBin } = require( 'resolve-bin' ); +const { sync: dirGlob } = require( 'dir-glob' ); +const { sync: readPkgUp } = require( 'read-pkg-up' ); + +/** + * Internal dependencies + */ +const { + fromConfigRoot, + fromProjectRoot, + getArgFromCLI, + getFileArgsFromCLI, + hasArgInCLI, + hasPackageProp, + hasProjectFile, +} = require( '../utils' ); + +// Check if the project has wp-prettier installed and if the project has a Prettier config +function checkPrettier() { + try { + const prettierResolvePath = require.resolve( 'prettier' ); + const prettierPackageJson = readPkgUp( { cwd: prettierResolvePath } ); + const prettierPackageName = prettierPackageJson.pkg.name; + + if ( ! [ 'wp-prettier', '@wordpress/prettier' ].includes( prettierPackageName ) ) { + return { + success: false, + message: + chalk.red( 'Incompatible version of Prettier was found in your project\n' ) + + "You need to install the 'wp-prettier' package to get " + + 'code formatting compliant with the WordPress coding standards.\n\n', + }; + } + } catch { + return { + success: false, + message: + chalk.red( "The 'prettier' package was not found in your project\n" ) + + "You need to install the 'wp-prettier' package under an alias to get " + + 'code formatting compliant with the WordPress coding standards.\n\n', + }; + } + + // See: https://prettier.io/docs/en/configuration.html + const hasProjectPrettierConfig = + hasProjectFile( '.prettierrc' ) || + hasProjectFile( '.prettierrc.json' ) || + hasProjectFile( '.prettierrc.yaml' ) || + hasProjectFile( '.prettierrc.yml' ) || + hasProjectFile( '.prettierrc.js' ) || + hasProjectFile( '.prettierrc.config.js' ) || + hasProjectFile( '.prettierrc.toml' ) || + hasPackageProp( 'prettier' ); + + if ( ! hasProjectPrettierConfig ) { + return { + success: false, + message: + chalk.red( 'The Prettier config file was not found in your project\n' ) + + 'You need to create a top-level Prettier config file in your project to get ' + + 'automatic code formatting that works with IDE and editor integrations.\n\n', + }; + } + + return { success: true }; +} + +const checkResult = checkPrettier(); +if ( ! checkResult.success ) { + stdout.write( checkResult.message ); + exit( 1 ); +} + +// If `--ignore-path` is not explicitly specified, use the project's or global .eslintignore +let ignorePath = getArgFromCLI( '--ignore-path' ); +if ( ! ignorePath ) { + if ( hasProjectFile( '.eslintignore' ) ) { + ignorePath = fromProjectRoot( '.eslintignore' ); + } else { + ignorePath = fromConfigRoot( '.eslintignore' ); + } +} +const ignoreArgs = [ '--ignore-path', ignorePath ]; + +// forward the --require-pragma option that formats only files that already have the @format +// pragma in the first docblock. +const pragmaArgs = hasArgInCLI( '--require-pragma' ) ? [ '--require-pragma' ] : []; + +// Get the files and directories to format and convert them to globs +let fileArgs = getFileArgsFromCLI(); +if ( fileArgs.length === 0 ) { + fileArgs = [ '.' ]; +} + +// Converts `foo/bar` directory to `foo/bar/**/*.js` +const globArgs = dirGlob( fileArgs, { extensions: [ 'js' ] } ); + +const result = spawn( + resolveBin( 'prettier' ), + [ '--write', ...ignoreArgs, ...pragmaArgs, ...globArgs ], + { stdio: 'inherit' } +); + +process.exit( result.status ); diff --git a/packages/scripts/utils/file.js b/packages/scripts/utils/file.js index 7f66c5e0ade78..24dd8ad505e4b 100644 --- a/packages/scripts/utils/file.js +++ b/packages/scripts/utils/file.js @@ -25,6 +25,7 @@ const hasScriptFile = ( scriptName ) => existsSync( fromScriptsRoot( scriptName ) ); module.exports = { + fromProjectRoot, fromConfigRoot, fromScriptsRoot, hasProjectFile, diff --git a/packages/scripts/utils/index.js b/packages/scripts/utils/index.js index 3d5e3bd7ac438..ea826a4b4ca12 100644 --- a/packages/scripts/utils/index.js +++ b/packages/scripts/utils/index.js @@ -20,6 +20,7 @@ const { mergeYAMLConfigs, } = require( './env' ); const { + fromProjectRoot, fromConfigRoot, hasProjectFile, } = require( './file' ); @@ -33,6 +34,7 @@ const { module.exports = { buildWordPress, camelCaseDash, + fromProjectRoot, fromConfigRoot, getArgFromCLI, getArgsFromCLI,