-
Notifications
You must be signed in to change notification settings - Fork 30
Add "targets" Docs To Dev Server #13869
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
Conversation
DCAR uses webpack's built-in dev server for development; when running `make dev` this is the server that's started up to listen on port 3030. Its main purpose is to handle compilation and reloading for client-side assets. However, DCAR is primarily a server-side application, and so similar functionality for server-side code is useful. To achieve this, DCAR extends the webpack dev server. It's an instance of an express app, which can be customised with `setupMiddlewares`, so we use this to add extra routes and middlewares. To achieve automatic re-compilation and live reloading of the browser, we rely on the `webpack-hot-server-middleware` library. Any code for which we require these features must be built via this library, and must be implemented as express middleware. Due to these constraints we don't have access to the original express app object and its associated routing functionality, and the dev server is using a custom routing implementation based on a `switch` statement. However, express has a concept of a `router`, which both supports much of the functionality of the core app object, such as routing, and also behaves like middleware. Therefore we can re-write the dev server as a router, allowing us to use express's built-in routing directly, and mount further middleware. This means we no longer have to implement custom routing, and it should make it easier to extend the dev server with more features in future. Furthermore, it allows us to mount `getContentFromURLMiddleware` only on the routes for which it's needed, and get both re-compilation and live reloading whenever we make changes to it. It will also allow us to re-write it in TypeScript in the future.
This begins adding some documentation to the DCAR dev server, to provide more information about what the project can do. There are two ways of breaking this down. You can either describe the project in terms of the targets it can render content for, such as dotcom and the live apps, or you can describe it in terms of the pages it can render, like articles, fronts, and so on. This change provides documentation structured in both ways, as either can be useful for understanding the project. It introduces two new paths: - `/pages` - `/targets` each with corresponding documentation and links to further information. The links do not yet point anywhere as their content will be added in subsequent updates, to keep changes smaller and easier to review.
There are four targets that DCAR can render content for, and this change adds documentation pages for each of them, on the following paths: - `/targets/dotcom` - `/targets/live-apps` - `/targets/editions-app` - `/targets/amp` The links on the `/targets` page now work. However the links on each of these new documentation pages do not yet point anywhere. These pages will be added in a future update, in the interests of keeping changes smaller and easier to review.
Size Change: 0 B Total Size: 973 kB ℹ️ View Unchanged
|
Hello 👋! When you're ready to run Chromatic, please apply the You will need to reapply the label each time you want to run Chromatic. |
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.
Nice, looks good
Seen on PROD (merged by @JamieB-gu 8 minutes and 55 seconds ago) Please check your changes! |
There are four targets that DCAR can render content for, and this change adds documentation pages for each of them, on the following paths:
/targets/dotcom
/targets/live-apps
/targets/editions-app
/targets/amp
The links on the
/targets
page now work. However the links on each of these new documentation pages do not yet point anywhere. These pages will be added in a future update, in the interests of keeping changes smaller and easier to review.Part of #13737.