New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec Parser: Move generated spec parser to package #13493

Merged
merged 3 commits into from Jan 25, 2019

Conversation

Projects
4 participants
@aduth
Copy link
Member

aduth commented Jan 24, 2019

This pull request seeks to treat lib/parser.php as a generated build artifact of the block-serialization-spec-parser package, both removing it from lib/ and from source altogether, assumed to be generated as part of npm run build in time for a package publish. This treatment has been applied to the parser.js generated result as well.

Testing instructions:

lib/parser.php is not actually used by Gutenberg, so it should have no impact on the effective behavior of the plugin.

Verify that parser.js and parser.php are generated to packages/block-serialization-spec-parser after npm install.

Ensure that tests pass covering the generated files:

npm run test-unit packages/block-serialization-spec-parser

@aduth aduth requested a review from dmsnell Jan 24, 2019

@@ -21,16 +21,6 @@ fi

npm run build || exit 1

# Make sure phpegjs parser is up to date
node bin/create-php-parser.js || exit 1
if ! git diff --quiet --exit-code lib/parser.php; then

This comment has been minimized.

@aduth

aduth Jan 24, 2019

Author Member

This check is already accounted for in CI by:

  • The files are automatically built as a postinstall step
  • CI runs check-local-changes to verify no commit-able files

This comment has been minimized.

@gziolo
@dmsnell
Copy link
Contributor

dmsnell left a comment

Thanks @aduth! This seems like a good improvement on code organization and reducing noise in the repo.

@gziolo

gziolo approved these changes Jan 25, 2019

Copy link
Member

gziolo left a comment

Yes, this is all good. As long as those files land on npm they can be ingored from git repository.

Very nice refactor.

@@ -21,16 +21,6 @@ fi

npm run build || exit 1

# Make sure phpegjs parser is up to date
node bin/create-php-parser.js || exit 1
if ! git diff --quiet --exit-code lib/parser.php; then

This comment has been minimized.

@gziolo

@gziolo gziolo added this to the 5.0 (Gutenberg) milestone Jan 25, 2019

@aduth

This comment has been minimized.

Copy link
Member Author

aduth commented Jan 25, 2019

As long as those files land on npm they can be ingored from git repository.

I think this might not actually be working as expected yet. I learned recently that apparently npm will inherit a gitignore when there's no other whitelist / blacklist. I tracked it down to:

If there is a .gitignore file, and .npmignore is missing, .gitignore’s contents will be used instead.

https://docs.npmjs.com/files/package.json#files

Indeed, running npm pack && tar -tf wordpress-block-serialization-spec-parser-2.0.3.tgz reveals there is no parser.js nor parser.php.

We could define files, or alternatively just add an empty .npmignore. I'll see which works better.

@aduth

This comment has been minimized.

Copy link
Member Author

aduth commented Jan 25, 2019

Started with a whitelist, but apparently some of the main exports of the package include tests, so switched to an empty .npmignore instead, which appears to work well.

@gziolo

This comment has been minimized.

Copy link
Member

gziolo commented Jan 25, 2019

Thanks for exploring it further. I took it by surprise that it works this way. It should be okey to proceed as is 💯

@mcsf

This comment has been minimized.

Copy link
Contributor

mcsf commented Jan 25, 2019

Thanks for this!

@aduth aduth merged commit ef1c0e8 into master Jan 25, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@aduth aduth deleted the move/generated-spec-parser branch Jan 25, 2019

@aduth aduth added this to In Progress in Remove PHP via automation Jan 25, 2019

@aduth aduth moved this from In Progress to Done in Remove PHP Jan 25, 2019

daniloercoli added a commit that referenced this pull request Jan 26, 2019

Merge branch 'master' of https://github.com/WordPress/gutenberg into …
…rnmobile/372-enter-key-detection-to-title

* 'master' of https://github.com/WordPress/gutenberg: (29 commits)
  Update for RangeControl documentation (#12564)
  Plugin: Deprecate gutenberg_load_list_reusable_blocks (#13456)
  Update the columns attribute in onSelectImages so that if images are removed via the media modal, the columns can't be higher than the new number of images (#13488)
  Replace the fullscreen "exit" icon with a back arrow (#13403)
  Include :visited links in button color (#12183)
  Amazon Kindle block (#13510)
  Plugin: Deprecate gutenberg_prepare_blocks_for_js (#13457)
  Add watcher on Linux: change fs to node-watch (#13448)
  Plugin: Deprecate `gutenberg` theme support (#13458)
  Datepicker: Add inValidDay support (#12962)
  Block Switcher: Render disabled button even if multi-selection (#13431)
  Plugin: Deprecate gutenberg_register_post_types (#13468)
  Plugin: Deprecate register_tinymce_scripts (#13466)
  Set minimum of words for RSS excerpt (#13502)
  Plugin: Deprecate gutenberg_get_block_categories (#13454)
  Plugin: Deprecate gutenberg_content_block_version (#13469)
  API Fetch: Expose nonce on created middleware function (#13451)
  Plugin: Remove list screens integrations (#13459)
  Plugin: Remove core-defined block detection functions (#13467)
  Spec Parser: Move generated spec parser to package (#13493)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment