-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate nicer READMEs inside new projects / apps / views / packages (#…
…2253) * Start documenting package types * Describe App and ESM View types * Packages * Views, sources and templates * Link add command page * Link package types in index * Update docs/commands/add.md Co-authored-by: Sam Brown <sam.brown@jpmorgan.com> * Update docs/concepts/package-types.md Co-authored-by: Sam Brown <sam.brown@jpmorgan.com> * Update docs/concepts/package-types.md Co-authored-by: Sam Brown <sam.brown@jpmorgan.com> * Link esm-views section in add page * Update docs/commands/add.md Co-authored-by: Sam Brown <sam.brown@jpmorgan.com> * Link app section for more info * Update docs/concepts/package-types.md Co-authored-by: Sam Brown <sam.brown@jpmorgan.com> * Clarify manifest -> package.json + fix incorrect description * Add reasons why we don't support things * Disambiguate words * Phrase 'default export' concept better * Update docs/concepts/package-types.md Co-authored-by: Sam Brown <sam.brown@jpmorgan.com> * Update docs/concepts/package-types.md Co-authored-by: Sam Brown <sam.brown@jpmorgan.com> * Update docs/commands/add.md Co-authored-by: Sam Brown <sam.brown@jpmorgan.com> * Reword tricky sentence * Update docs/commands/add.md Co-authored-by: Sam Brown <sam.brown@jpmorgan.com> * Update docs/concepts/package-types.md Co-authored-by: Sam Brown <sam.brown@jpmorgan.com> * Split long sentence * Add all package types to configuration docs * Various typos * Split packge types and move template page * Fix links to package types and fix table layout * Slim down table * build/start/entrypoint/template sections * Add root project README * Add per-package READMEs + fix docs * Lint view documentation * Update snapshots * Upddate app snapshots * Update snapshots in index test * Update app.esbuild.test snapshots * update cmra tests * Correct snapshots for cmra * Update snapshots for cli.test.ts * Remove packages README + fix all READMEs * Add README to fixtures + update snapshots * Update various snapshots * Update app.esbuild.test snapshots * Add default workspace README * Update index snapshots * Create odd-bees-speak.md * Update fixture READMEs Co-authored-by: Sam Brown <sam.brown@jpmorgan.com> Co-authored-by: Alberto Brusa <alberto.brusa@live.com>
- Loading branch information
1 parent
aaaa5ee
commit 225c153
Showing
23 changed files
with
355 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
"create-modular-react-app": minor | ||
"modular-scripts": minor | ||
"modular-template-app": minor | ||
"modular-template-esm-view": minor | ||
"modular-template-package": minor | ||
"modular-template-source": minor | ||
"modular-template-view": minor | ||
--- | ||
|
||
Generate README inside newly created packages | ||
Improve root and default workspaces container README |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# This is a README placeholder for this template fixture |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# This is a README placeholder for this template fixture |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# This is a README placeholder for this template fixture |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,75 @@ | ||
This is the `README.md` for the whole monorepo. | ||
This is a monorepository initialised with [Modular](https://modular.js.org/) | ||
|
||
## Commands available | ||
|
||
- [Add](https://modular.js.org/commands/add/) - Add a new Modular package to the | ||
monorepo | ||
- [Analyze](https://modular.js.org/commands/analyze/) - Analyzes the | ||
dependencies of a package from its source code, emitting JSON to `stdout`. | ||
- [Build](https://modular.js.org/commands/build/) - Search workspaces based on | ||
their name field in the `package.json` and build them according to their | ||
respective `modular.type`, in order of dependency. | ||
- [Check](https://modular.js.org/commands/check/) - Check the modular root repo | ||
has [Yarn workspaces](https://classic.yarnpkg.com/lang/en/docs/workspaces/), | ||
modular packages are set up properly and check the package tree for issues | ||
with dependencies. | ||
- [Lint](https://modular.js.org/commands/lint/) - Check the diff between the | ||
current branch and the remote origin default branch and lint the source files | ||
that have changes. In CI, lint the entire codebase. | ||
- [Start](https://modular.js.org/commands/start/) - Run the selected Modular | ||
`app`, `esm-view` or `view` locally. | ||
- [Test](https://modular.js.org/commands/test/) - Run [Jest](https://jestjs.io/) | ||
tests against a selection of Modular packages. | ||
- [Typecheck](https://modular.js.org/commands/typecheck/) - Report the semantic, | ||
syntactic, and declaration type errors found in your code. | ||
- [Workspace](https://modular.js.org/commands/workspace/) - Prints information | ||
about the monorepository to the console. Like | ||
[`yarn workspaces info`](https://classic.yarnpkg.com/lang/en/docs/cli/workspaces/#toc-yarn-workspaces-info), | ||
but extended with modular metadata about package type and public/private | ||
status. | ||
|
||
## Package types | ||
|
||
| Type | [start](https://modular.js.org/commands/start/) | [build](https://modular.js.org/commands/build/) | [test](https://modular.js.org/commands/test/) | [lint](https://modular.js.org/commands/lint/) | Custom index / assets | Bundled | Entry-point | | ||
| ------------------------------------------------------------ | ----------------------------------------------- | ----------------------------------------------- | --------------------------------------------- | --------------------------------------------- | -------------------------- | --------------------- | ------------------------------ | | ||
| [`app`](https://modular.js.org/package-types/app/) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | `src/index.tsx` | | ||
| [`esm-view`](https://modular.js.org/package-types/esm-view/) | ✅ | ✅ | ✅ | ✅ | ❌ | ✅† | `src/index.tsx` | | ||
| [`package`](https://modular.js.org/package-types/package/) | ❌ | ✅ | ✅ | ✅ | **N/A** | ❌ | `main` field of `package.json` | | ||
| [`view`](https://modular.js.org/package-types/view/) | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | `main` field of `package.json` | | ||
| [`source`](https://modular.js.org/package-types/source/) | ❌ | ❌ | ✅ | ✅ | **N/A** | **N/A** - never built | **N/A** - never built | | ||
| [`template`](https://modular.js.org/package-types/template/) | ❌ | ❌ | ✅ | ✅ | Depends on the target type | **N/A** - never built | **N/A** - never built | | ||
|
||
† For ESM Views, external dependencies are rewritten to point to a CDN | ||
|
||
## Configuration | ||
|
||
### Example with defaults | ||
|
||
##### `.modular.js` | ||
|
||
```js | ||
module.exports = { | ||
useModularEsbuild: false, | ||
externalCdnTemplate: 'https://esm.sh/[name]@[resolution]', | ||
externalBlockList: [], | ||
externalAllowList: ['**'], | ||
publicUrl: '', | ||
generateSourceMap: true, | ||
}; | ||
``` | ||
|
||
### Options | ||
|
||
- `useModularEsbuild`: Use [esbuild](https://esbuild.github.io/) instead of | ||
default Webpack. Only affects Apps and ESM Views. Default: _false_. | ||
- `externalCdnTemplate`: Template to resolve the URL used to fetch packages from | ||
a CDN. Only applies to ESM Views. Default: | ||
`https://esm.sh/[name]@[resolution]` | ||
- `externalBlockList`: External oackages that should be bundled and not fetched | ||
from a CDN. Applies only to ESM Views. Default: _no package_. | ||
- `externalAllowList`: External packages that should be fetched from a CDN. | ||
Applies only to ESM Views. Default: _all_. | ||
- `publicUrl`: Sub-path from which the SPA is served. Applies only to Apps and | ||
ESM Views when served standalone. Default: _/_. | ||
- `generateSourceMap`: Should build process generate source maps? Default: | ||
_true_. |
11 changes: 10 additions & 1 deletion
11
packages/create-modular-react-app/template/packages/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
This will be the readme inside /packages | ||
# Workspaces | ||
|
||
This is the default | ||
[workspaces](https://classic.yarnpkg.com/lang/en/docs/workspaces/) root created | ||
by Create Modular React App. Packages added by the | ||
[`modular add`](https://modular.js.org/commands/add/) command will be located | ||
here by default, unless a different directory (included in the root | ||
package.json's | ||
[`workspaces` field](https://classic.yarnpkg.com/lang/en/docs/workspaces/#toc-how-to-use-it)) | ||
is specified using the `--path` option. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# `PackageName__` | ||
|
||
This is a [Modular App](https://modular.js.org/package-types/app) | ||
|
||
## Build | ||
|
||
To [build](https://modular.js.org/commands/build) your app for deployment, run: | ||
|
||
```bash | ||
modular build PackageName__ | ||
``` | ||
|
||
The resulting output is an optimized site that can be served statically. All | ||
code (files in `src` plus external dependencies required in the code) is bundled | ||
in a single blob of code that can be split in different files. | ||
|
||
## Start | ||
|
||
To run your app locally on a development server, run | ||
[start](https://modular.js.org/commands/start): | ||
|
||
```bash | ||
modular start PackageName__ | ||
``` | ||
|
||
This causes a developer server to run on port 3000, serving the app with an | ||
additional runtime layer that provides developer experience functionalities like | ||
hot reloading and on-screen error overlay. | ||
|
||
## Entry-point | ||
|
||
Apps need an entry-point file located at `src/index.tsx`, which typically uses | ||
React to render components to the DOM, generated at `public/index.html`. | ||
|
||
## Template | ||
|
||
Apps are generated by `modular add` using the | ||
[`modular-template-app`](https://github.com/jpmorganchase/modular/tree/main/packages/modular-template-app) | ||
[template](https://modular.js.org/package-types/template). |
Oops, something went wrong.