-
Notifications
You must be signed in to change notification settings - Fork 67
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
Generate nicer READMEs inside new projects / apps / views / packages #2253
Merged
Merged
Changes from 51 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
4aafc87
Start documenting package types
4655c35
Describe App and ESM View types
048f7e3
Packages
8d2848c
Views, sources and templates
56ecf0d
Link add command page
a724457
Link package types in index
e82dbc1
Update docs/commands/add.md
cristiano-belloni 286fd60
Update docs/concepts/package-types.md
cristiano-belloni 35114b0
Update docs/concepts/package-types.md
cristiano-belloni 7bb2648
Merge remote-tracking branch 'origin/feature/v4' into feature/documen…
e9d18f3
Link esm-views section in add page
ea4774d
Update docs/commands/add.md
cristiano-belloni 77d3643
Link app section for more info
0b72782
Update docs/concepts/package-types.md
cristiano-belloni 1a8aafe
Clarify manifest -> package.json + fix incorrect description
89302d2
Merge branch 'feature/document-package-types' of https://github.com/j…
71e12a4
Add reasons why we don't support things
9cbd85b
Disambiguate words
c0a46c7
Phrase 'default export' concept better
217ae18
Update docs/concepts/package-types.md
cristiano-belloni 137d28a
Update docs/concepts/package-types.md
cristiano-belloni 96565ad
Update docs/commands/add.md
cristiano-belloni 35fbad8
Reword tricky sentence
b8a7aa6
Update docs/commands/add.md
cristiano-belloni e08ef2a
Update docs/concepts/package-types.md
cristiano-belloni db62b30
Split long sentence
faeb1f1
Add all package types to configuration docs
bad4cba
Various typos
2f7b79f
Split packge types and move template page
09e501d
Fix links to package types and fix table layout
b44505b
Slim down table
af864c7
build/start/entrypoint/template sections
9779803
Add root project README
83d4f60
Add per-package READMEs + fix docs
4308a84
Merge branch 'feature/v4' into feature/better-readmes
cristiano-belloni dab1eb6
Lint view documentation
cdadc52
Update snapshots
c330811
Upddate app snapshots
6e912d0
Update snapshots in index test
c1e7632
Update app.esbuild.test snapshots
e7726da
update cmra tests
e208d81
Correct snapshots for cmra
8ab9b31
Update snapshots for cli.test.ts
AlbertoBrusa 53289fc
Remove packages README + fix all READMEs
419396a
Merge branch 'feature/better-readmes' of https://github.com/jpmorganc…
df551c9
Add README to fixtures + update snapshots
d20faba
Update various snapshots
ef9042d
Update app.esbuild.test snapshots
85b1652
Add default workspace README
ea47860
Update index snapshots
1005cb4
Create odd-bees-speak.md
cristiano-belloni 6bdf317
Update fixture READMEs
bc6a2f4
Merge branch 'feature/better-readmes' of https://github.com/jpmorganc…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,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). |
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). |
39 changes: 39 additions & 0 deletions
39
__fixtures__/templates/modular-template-no-filter/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 |
---|---|---|
@@ -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). |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
very nit-picky but This starts a developer server on port 3000
might sound a bit cleaner here
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.
Done. I also replaced all the fixture READMEs with a placeholder, since we don't need to necessarily sync them with the real READMEs.