Skip to content

Commit

Permalink
Sync with trunk (#31427)
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinan authored May 3, 2021
1 parent 264959f commit f204684
Show file tree
Hide file tree
Showing 889 changed files with 10,226 additions and 14,930 deletions.
7 changes: 6 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
/packages/block-library/src/gallery @mkevins
/packages/block-library/src/social-links @mkaz
/packages/block-library/src/social-link @mkaz
/packages/block-library/src/image @ajlende

# Duotone
/lib/block-supports/duotone.php @ajlende
/packages/block-editor/src/components/duotone-control @ajlende
/packages/block-editor/src/hooks/duotone.js @ajlende
/packages/components/src/duotone-picker @ajlende

# Editor
/packages/annotations @atimmer
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/end2end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- trunk
- 'release/**'
- 'wp/**'

jobs:
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/static-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- trunk
- 'release/**'
- 'wp/**'

jobs:
Expand Down Expand Up @@ -42,9 +43,6 @@ jobs:
- name: Lint JavaScript and Styles
run: npm run lint

- name: Lint ES5 built files (IE11)
run: npx eslint --parser-options=ecmaVersion:5 --no-eslintrc --no-ignore ./build/**/*.js

- name: Type checking
run: npm run build:package-types

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/storybook-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./storybook/build
force_orphan: true
1 change: 1 addition & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches:
- trunk
- 'release/**'
- 'wp/**'

jobs:
Expand Down
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.cache
build
build-module
build-types
packages/block-serialization-spec-parser/parser.js
packages/e2e-tests/plugins
packages/react-native-editor/bundle
vendor
12 changes: 12 additions & 0 deletions bin/packages/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ function createStyleEntryTransform() {
const entries = await glob(
path.resolve( PACKAGES_DIR, packageName, 'src/*.scss' )
);

// Account for the specific case where block styles in
// block-library package also need rebuilding.
if (
packageName === 'block-library' &&
[ 'style.scss', 'editor.scss' ].includes(
path.basename( file )
)
) {
entries.push( file );
}

entries.forEach( ( entry ) => this.push( entry ) );

// Find other stylesheets that need to be rebuilt because
Expand Down
35 changes: 33 additions & 2 deletions bin/packages/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ function exists( filename ) {
return false;
}

/**
* Is the path name a directory?
*
* @param {string} pathname
*
* @return {boolean} True if the given path is a directory.
*/
function isDirectory( pathname ) {
try {
return fs.statSync( pathname ).isDirectory();
} catch ( e ) {}
return false;
}

/**
* Determine if a file is source code.
*
Expand All @@ -43,12 +57,16 @@ function exists( filename ) {
* @return {boolean} True if the file a source file.
*/
function isSourceFile( filename ) {
// Only run this regex on the relative path, otherwise we might run
// into some false positives when eg. the project directory contains `src`
const relativePath = path.relative( process.cwd(), filename );

return (
/\/src\/.+\.(js|json|scss)$/.test( filename ) &&
/\/src\/.+\.(js|json|scss)$/.test( relativePath ) &&
! [
/\/(benchmark|__mocks__|__tests__|test|storybook|stories)\/.+/,
/.\.(spec|test)\.js$/,
].some( ( regex ) => regex.test( filename ) )
].some( ( regex ) => regex.test( relativePath ) )
);
}

Expand Down Expand Up @@ -77,6 +95,13 @@ function isModulePackage( filename ) {
* @return {boolean | symbol} True if the file should be watched.
*/
function isWatchableFile( filename, skip ) {
// Recursive file watching is not available on a Linux-based OS. If this is the case,
// the watcher library falls back to watching changes in the subdirectories
// and passes the directories to this filter callback instead.
if ( isDirectory( filename ) ) {
return true;
}

return isSourceFile( filename ) && isModulePackage( filename )
? true
: skip;
Expand Down Expand Up @@ -147,6 +172,12 @@ watch(
PACKAGES_DIR,
{ recursive: true, delay: 500, filter: isWatchableFile },
( event, filename ) => {
// Double check whether we're dealing with a file that needs watching, to accomodate for
// the inability to watch recursively on linux-based operating systems.
if ( ! isSourceFile( filename ) || ! isModulePackage( filename ) ) {
return;
}

switch ( event ) {
case 'update':
updateBuildFile( event, filename );
Expand Down
1 change: 1 addition & 0 deletions bin/plugin/commands/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ function calculateVersionBumpFromChangelog(
if (
lineNormalized.startsWith( '### deprecation' ) ||
lineNormalized.startsWith( '### enhancement' ) ||
lineNormalized.startsWith( '### new api' ) ||
lineNormalized.startsWith( '### new feature' )
) {
versionBump = 'minor';
Expand Down
Loading

0 comments on commit f204684

Please sign in to comment.