-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
docs: Migrate Service Worker to Standalone #51687
Conversation
Although there are several pages, only `service-worker-getting-started.md` has an example. That example code was migrated. Worked around the few references to NgModule. Other changes as follows: **Revised "Getting Started"** The original service worker example page (`service-worker-getting-started.md`) is full of holes! I don’t know how anyone got this working just by following this page - it doesn’t tell you where to get the example (and it isn’t generated by AIO) - it doesn’t tell you that ng serve doesn’t support service worker apps - it mentions http-server in passing but not what that is or where to get it. - several commands tell you to supply the “project-name” but (a) it doesn’t tell you how to find that name and (b) you never actually have to provide a name at all. That includes on the command that gets http-server going. **Hid section on `ngsw-config` tool** Hid the discussion of the `ngsw-config` tool in `service-worker-config.md` because (a) the command invoke it didn't seem to work and (b) it referenced `<project-name>` without explaining what that is or where to find it. Left the hidden text in the page in case someone wants to do something about this. Meanwhile, you seem to be able to edit the `ngsw-config.json` and then rebuild. That should suffice. **Disabled E2E** The AIO CI will no longer attempt to run the (thin) E2E tests. These tests could lightly test the app with the dev server but couldn't test the Service Worker aspects; that would require launching the app with something other than `ng serve` and the AIO CI is not set up for that. The existing tests appeared to pass when run locally with the dev server. However, only one of them actually ran; test runner reported. "There were tests whose specified size is too big." Decided to bypass E2E testing of this project for now.
3ef6450
to
2332cc1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wardbell Can you please let me know about these couple of comments and then I think we can get this merged, thanks!
aio/content/examples/service-worker-getting-started/src/app/app.component.html
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we need to delete this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we want the CLI to create it dynamically; that's its job.
See https://angular.io/guide/service-worker-getting-started#adding-a-service-worker-to-your-project.
Creates the service worker configuration file called ngsw-config.json, which specifies the caching behaviors and other settings.
I stripped the example down to the state of an app prior to running the Service Worker CLI command. Before this change, the example was kind of half-way there with some (not all) of the CLI command artifacts.
I also added clear instructions on that guide page about what you should do if you choose to play along by downloading the example. Now that actually works (the example didn't work before and you had no clear idea what to do).
I might have kept it if any of the guide pages displayed it. But they don't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR was merged into the repository by commit 9f3b549. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Although there are several pages, only `service-worker-getting-started.md` has an example. That example code was migrated. Worked around the few references to NgModule. Other changes as follows: **Revised "Getting Started"** The original service worker example page (`service-worker-getting-started.md`) is full of holes! I don’t know how anyone got this working just by following this page - it doesn’t tell you where to get the example (and it isn’t generated by AIO) - it doesn’t tell you that ng serve doesn’t support service worker apps - it mentions http-server in passing but not what that is or where to get it. - several commands tell you to supply the “project-name” but (a) it doesn’t tell you how to find that name and (b) you never actually have to provide a name at all. That includes on the command that gets http-server going. **Hid section on `ngsw-config` tool** Hid the discussion of the `ngsw-config` tool in `service-worker-config.md` because (a) the command invoke it didn't seem to work and (b) it referenced `<project-name>` without explaining what that is or where to find it. Left the hidden text in the page in case someone wants to do something about this. Meanwhile, you seem to be able to edit the `ngsw-config.json` and then rebuild. That should suffice. **Disabled E2E** The AIO CI will no longer attempt to run the (thin) E2E tests. These tests could lightly test the app with the dev server but couldn't test the Service Worker aspects; that would require launching the app with something other than `ng serve` and the AIO CI is not set up for that. The existing tests appeared to pass when run locally with the dev server. However, only one of them actually ran; test runner reported. "There were tests whose specified size is too big." Decided to bypass E2E testing of this project for now. PR Close angular#51687
Although there are several pages, only
service-worker-getting-started.md
has an example. That example code was migrated.Worked around the few references to NgModule.
Other changes as follows:
Revised "Getting Started"
The original service worker example page (
service-worker-getting-started.md
) is full of holes! I don’t know how anyone got this working just by following this pageHid section on
ngsw-config
toolHid the discussion of the
ngsw-config
tool inservice-worker-config.md
because (a) the command invoke it didn't seem to work and (b) it referenced<project-name>
without explaining what that is or where to find it.Left the hidden text in the page in case someone wants to do something about this.
Meanwhile, you seem to be able to edit the
ngsw-config.json
and then rebuild. That should suffice.Disabled E2E
The AIO CI will no longer attempt to run the (thin) E2E tests.
These tests could lightly test the app with the dev server but couldn't test the Service Worker aspects; that would require launching the app with something other than
ng serve
and the AIO CI is not set up for that.The existing tests appeared to pass when run locally with the dev server. However, only one of them actually ran; test runner reported. "There were tests whose specified size is too big."
Decided to bypass E2E testing of this project for now.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information