Skip to content
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

[doc] TargetableModule.spliceSource() examples and debugging instructions #3168

Merged
merged 4 commits into from
May 18, 2021

Conversation

jcalcaben
Copy link
Contributor

Description

Adds examples for using the TargetableModule.spliceSource() function as well as debugging instructions.

Related Issue

Closes PWA-1710 and Closes #3155

Acceptance

Any core developer
@Jordaneisenburger (optional)

Verification Stakeholders

Any core developer
@Jordaneisenburger (optional)

Specification

Verification Steps

  1. Navigate to the docs directory: cd pwa-devdocs
  2. Run the HTML preview server: yarn develop
  3. Navigate to the TargetableModule docs: /pwa-buildpack/reference/targetables/TargetableModule/
  4. Verify examples make sense and accurate
  5. Verify debugging steps are correct and make sense

Screenshots / Screen Captures (if appropriate)

Checklist

  • I have added tests to cover my changes, if necessary.
  • I have added translations for new strings, if necessary.
  • I have updated the documentation accordingly, if necessary.

@jcalcaben jcalcaben added pkg:pwa-devdocs documentation This pertains to documentation. version: Patch This changeset includes backwards compatible bug fixes. docs documentation labels May 7, 2021
@PWAStudioBot
Copy link
Contributor

PWAStudioBot commented May 7, 2021

Messages
📖 DangerCI Failures related to missing labels/description/linked issues/etc will persist until the next push or next nightly build run (assuming they are fixed).
📖

Access a deployed version of this PR here. Make sure to wait for the "pwa-pull-request-deploy" job to complete.

Generated by 🚫 dangerJS against 7c9a0ee

| `before` | string | Code changes are applied at the start of this string in the code |
| `after` | string | Code changes are applied to the end of this string in the code |

Instruction objects can only have **one** location property (`at`, `before`, `after`), but one or both action properties (`insert`, `remove`).
Copy link
Contributor

Choose a reason for hiding this comment

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

Good note; this wouldn't necessarily be obvious.

### Splice code using instructions

The `spliceSource()` function is a low level code modification function that apply changes based on an instruction object.
The `insertAfterSource()`, `insertBeforeSource()`, and `prependSource()` functions provide a simpler interface and are [facade functions][] for `spliceSource()`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Good to recommend the sweeter syntax. 👍

@supernova-at supernova-at merged commit 2eadf27 into develop May 18, 2021
@supernova-at supernova-at deleted the jimothy/pwa-1710_spliceSource-examples branch May 18, 2021 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs documentation documentation This pertains to documentation. pkg:pwa-devdocs Progress: done version: Patch This changeset includes backwards compatible bug fixes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[doc]: Better spliceSource documentation
4 participants