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

Merge Modular 4 Changes to Main #2264

Merged
merged 30 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4f986a7
Node 18 & Jest 29 (#2210)
AlbertoBrusa Nov 22, 2022
2fb5c22
Update to ESLint 8 & Supported TypeScript to >4.5.3 (#2216)
AlbertoBrusa Nov 29, 2022
8f1ceff
Remove commands and update documentation (#2220)
AlbertoBrusa Dec 5, 2022
2e87968
Merge main (#2225)
AlbertoBrusa Dec 5, 2022
c84b426
Use Config file instead of Environment Variables (#2227)
AlbertoBrusa Dec 19, 2022
9bf3ecf
Merge branch 'main' of https://github.com/jpmorganchase/modular into …
AlbertoBrusa Dec 19, 2022
ba6770f
Add jsx to test glob pattern (#2234)
AlbertoBrusa Dec 19, 2022
6b84149
Merge main into Modular 4 (#2237)
AlbertoBrusa Dec 19, 2022
aff62fd
Merge branch 'feature/v4' of https://github.com/jpmorganchase/modular…
AlbertoBrusa Dec 19, 2022
a27388b
Sunset modular-site
AlbertoBrusa Dec 19, 2022
b48dec8
Revert "Sunset modular-site"
AlbertoBrusa Dec 19, 2022
9dac71c
Sunset modular-site (#2238)
AlbertoBrusa Dec 20, 2022
05bc1f0
Remove requirement for Apps to be private in modualr check (#2241)
AlbertoBrusa Dec 23, 2022
24b0423
Update lockfile
Jan 3, 2023
72fec9b
Merge branch 'main' into feature/v4
Jan 3, 2023
2624def
Docs/support (#2248)
cristiano-belloni Jan 5, 2023
aaaa5ee
Document package types (#2246)
cristiano-belloni Jan 10, 2023
225c153
Generate nicer READMEs inside new projects / apps / views / packages …
cristiano-belloni Jan 12, 2023
728b5fd
Sunset philosophy / views, write intro, fix web workers, correct temp…
cristiano-belloni Jan 12, 2023
8c2c6f3
Enhance modular-scripts Tests (#2240)
AlbertoBrusa Jan 13, 2023
53da3f5
Modify getConfig to get workspace specific configuration (#2258)
AlbertoBrusa Jan 16, 2023
c107d96
Document supported CRA features (#2255)
cristiano-belloni Jan 17, 2023
16011e3
Test default template tests work (#2260)
AlbertoBrusa Jan 18, 2023
29e71cf
Unify modular test command interface (#2259)
cristiano-belloni Jan 19, 2023
aa39350
various docs fixes (#2262)
cristiano-belloni Jan 20, 2023
4540da8
Small fixes (#2261)
AlbertoBrusa Jan 20, 2023
b929204
More small fixes (#2263)
AlbertoBrusa Jan 20, 2023
a438571
Update 4.0.x release notes
AlbertoBrusa Jan 23, 2023
cf63722
Slight changes to release notes
AlbertoBrusa Jan 23, 2023
ee28e79
Additions to release doc
Jan 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/blue-turtles-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'modular-scripts': major
---

Removed commands: convert, init, port, rename
6 changes: 6 additions & 0 deletions .changeset/cyan-flowers-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'modular-scripts': major
---

Changed default CDN from Skypack to esm.sh as skypack is no longer actively
maintained. Add support for configuring modular through a configuration file.
5 changes: 5 additions & 0 deletions .changeset/fair-kangaroos-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'modular-scripts': patch
---

Test pattern now includes jsx
14 changes: 14 additions & 0 deletions .changeset/fluffy-dragons-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
'create-modular-react-app': major
'eslint-config-modular-app': major
'modular-scripts': major
'modular-template-app': patch
'modular-template-esm-view': patch
'modular-template-view': patch
---

Added Node 18 engine support
Upgraded Jest from 26 to 29 as 26 wasn't compatible with Node 18
Upgraded to rollup-plugin-esbuild 5, dropping support for Node 14.17 and below
Supported Node versions now: ^14.18.0 || >=16.10.0 || >=18.0.0
Changed Jest flag --watchAll default to false (was previously true if running locally and not in CI)
5 changes: 5 additions & 0 deletions .changeset/green-shrimps-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"modular-scripts": major
---

Fully selective `modular test` command interface, compatible with `modular build`.
6 changes: 6 additions & 0 deletions .changeset/itchy-dancers-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'eslint-config-modular-app': major
'modular-scripts': major
---

Updated eslint to ^8.0.0 and minimum supported TypeScript version to 4.5.3
5 changes: 5 additions & 0 deletions .changeset/light-countries-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-modular-react-app': major
---

Bumped default TypeScript version to ^4.8.3
12 changes: 12 additions & 0 deletions .changeset/odd-bees-speak.md
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
5 changes: 5 additions & 0 deletions .changeset/purple-numbers-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'modular-scripts': minor
---

App type modular packages are no longer required to be private
5 changes: 5 additions & 0 deletions .changeset/wet-gifts-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'modular-scripts': major
---

Sunset modular-site package
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3.3.0
with:
node-version: '14.17.0'
node-version: '14.18.0'
registry-url: https://registry.npmjs.org/
cache: 'yarn'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3.3.0
with:
node-version: '14.17.0'
node-version: '14.18.0'
cache: 'yarn'

- name: 'Install Dependencies'
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest]
node-version: ['14.17.0', '16.x']
node-version: ['14.18.0', '16.x', '18.x']

steps:
- uses: actions/checkout@v3
Expand All @@ -34,4 +34,6 @@ jobs:
- name: 'Build internal prerequisites'
run: yarn workspace @modular-scripts/workspace-resolver build
- name: Run Windows tests
run: yarn test esmView.test.ts workspace-resolver addPackage.test.ts
run:
yarn test --regex esmView.test.ts workspace-resolver
addPackage.test.ts
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
node-version: ['14.17.0', '16.x']
node-version: ['14.18.0', '16.x', '18.x']

steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,9 @@ yarn-error.log*
.tsbuildinfo
*.tsbuildinfo

# Local Jekyll preview of docs
docs/_site
docs/.bundle
docs/vendor
docs/Gemfile*

1 change: 1 addition & 0 deletions __fixtures__/templates/modular-template-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This is a README placeholder for this template fixture
1 change: 1 addition & 0 deletions __fixtures__/templates/modular-template-filter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This is a README placeholder for this template fixture
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This is a README placeholder for this template fixture
3 changes: 3 additions & 0 deletions __fixtures__/test-config/.modular.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
useModularEsbuild: true,
};
7 changes: 0 additions & 7 deletions docs/building-apps/index.md

This file was deleted.

85 changes: 58 additions & 27 deletions docs/commands/add.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,79 @@ parent: Commands
title: modular add
---

# `modular add <packageName>`
# `modular add [options] [packageName]`

Adds a new package by creating a new workspace at `packages/<packageName>`,
omitting the scope if the package is
Adds a new package by creating a new package at the workspace located at
`packages/<packageName>`, omitting the scope if the package is
[scoped](https://docs.npmjs.com/cli/v8/using-npm/scope). If `--path <somePath>`
is specified, create the workspace at `<somePath>/<packageName>`.
is specified, the command creates the workspace at `<somePath>/<packageName>`.

(i.e. `modular add my-app` would create a package in `packages/my-app`,
`modular add @scoped/my-scoped-app` would create a package in
`packages/my-scoped-app` and `modular add lib-a --path libs` would create a
package in `libs/lib-a`)

Packages can currently be one of the following types:
The `modular add` command prompts the user to choose the Modular `type` of the
package it's about to create. The next section briefly describes the various
types that can be created by the `modular add` command. For an in-depth
discussion of the available package types and their characteristics, please see
[this page](../package-types/index.md).

- A standalone `app`. This corresponds to a static Single Page Application (SPA)
project in a workspace. Inside this workspace, you can import packages from
other workspaces freely, and features like jsx and typechecking work out of
the box.
### Standalone (bundled) package types

- An `esm-view`, which is a package that typically exports a React component by
default. ESM Views are built as ES modules that can be `import`ed at runtime
by a host to implement a [micro frontend](../concepts/microfrontends.md)
architecture or started as a normal standalone application. See also
[the view building reference](../esm-views/index.md)
These package types are built with [Webpack v5](https://webpack.js.org/) or, if
specified in the [configuration](../configuration.md),
[esbuild](https://esbuild.github.io/). Modules imported in the source of these
package types are bundled in the final result (in case of `esm-view`s, only
local modules get bundled, and external dependencies are rewritten to use an
external ESM CDN. [This section](../esm-views/index.md) explains the process in
more depth).

- A `view`, which is a `package` that exports a React component by default. Read
more about Views in [this explainer](../concepts/views.md).
- [`app`](../package-types/app.md). This package type corresponds to a static
Single Page Application (SPA) project in a workspace. It's possible to specify
a custom `index.html` file and public assets in the `public` directory. See
[this page](../package-types/#app) for more information about apps.

- A generic JavaScript `package`. You can use this to create a library with an
entry point that gets transpiled to Common JS and ES Module format when built.
Packages can be [built](../commands/build.md) but not
[start](../commands/start.md)ed by Modular.
- [`esm-view`](../package-types/esm-view.md). This package type is an app that
gets built as an ES module that can be imported at runtime. `esm-view`s are
typically used to implement a [micro-frontend](../concepts/microfrontends.md)
architecture. `esm-views`, when [built](./build.md) or [started](./start.md)
will also generate a `index.html` file that tries to load the ES Module and
render its default export as a React component onto the DOM (standalone mode).
See also [the esm-view reference](../esm-views/index.md) for an in-depth
introduction.

- A `source`, which is a shared package that is imported by other packages from
source (i.e. directly importing its source), and it's never built standalone
or published. This kind of package is never [built](../commands/build.md) or
[start](../commands/start.md)ed by Modular.
### Library package types

These package types are either built with
[Rollup.js](https://rollupjs.org/guide/en/) as CommonJS and ES Modules or, in
case of `source` modules, they are not built at all. Library package types get
typically published to NPM (`package` and `view` types) or get imported by other
packages in the monorepo (`source` type). For this reason, files are transpiled
separately on build and external dependencies are never "pulled in" (i.e. not
included in a bundle).

- [`package`](../package-types/package.md). This is a generic package with a
single entry point. It's normally used to create a publishable library that
gets transpiled to CommonJS and ES Module format when built. Packages can be
[built](../commands/build.md) but not [start](../commands/start.md)ed by
Modular.

- [`view`](../package-types/view.md). This is a `package` that exports a default
React component. Views are built exactly like `package`s, but, since Modular
knows that the default export can be rendered, `view`s can be
[`modular start`](../start.md)ed to preview them locally.

- [`source`](../package-types/source.md). A shared package that is imported by
other package types in the monorepo, directly specifying one or more of its
source files. This kind of package can be never [built](../commands/build.md)
or [start](../commands/start.md)ed by Modular.

## Options:

`--path`: Optionally set the directory in which the workspace is created. If the
provided path is outside (i.e., not a descendant) of the paths specified in
`--path <targetPath>`: Optionally set the directory in which the workspace is
created. If the provided path is outside (i.e., not a descendant) of the paths
specified in
[the `workspaces` field](https://classic.yarnpkg.com/lang/en/docs/workspaces/#toc-how-to-use-it)
of the root `package.json`, the command will fail

Expand All @@ -55,4 +86,4 @@ of the root `package.json`, the command will fail

`--template <templateName>`: Use the package `templateName` from the repository
or the registry as a template for the new package. Find more information about
Modular templates [in this page](../concepts/templates.md)
Modular templates [in this page](../package-types/template.md)
11 changes: 9 additions & 2 deletions docs/commands/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ parent: Commands
title: modular build
---

# `modular build [packages...]`
# `modular build [options] [packages...]`

Search workspaces based on their `name` field in the `package.json` and build
them according to their respective `modular.type`, in order of dependency (e.g.
Expand All @@ -13,6 +13,13 @@ The output directory for built artifacts is `dist/`, which has a flat structure
of modular package names. Each built app/view/package is added to the `dist/` as
its own folder.

When `packages` is empty and no selective options have been specified (for
example when running `yarn modular build`), all packages in the monorepo will be
built. When `packages` contains one or more non-existing package name, the
non-existing packages will be ignored without an error. If any package or
selective option have been defined but the final set of regular expressions is
empty, Modular will write a message to `stdout` and exit with code `0`.

For views and packages, package names are transformed to `Param case` (e.g.
this-is-param-case) in `dist/`

Expand All @@ -25,7 +32,7 @@ this-is-param-case) in `dist/`

`--preserve-modules`: Preserve module structure in generated modules.

`--changed`: Build only packages whose workspaces contain files that have
`--changed`: Build only the packages whose workspaces contain files that have
changed. Files that have changed are calculated comparing the current state of
the repository with the branch specified by `compareBranch` or, if
`compareBranch` is not set, with the default git branch.
Expand Down
6 changes: 4 additions & 2 deletions docs/commands/check.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ parent: Commands
title: modular check
---

# `modular check`
# `modular check [options]`

Checks the modular root repo has yarn workspaces and modular packages are set up
properly and checks your package tree for issues with your dependencies.

## Options:

`--fix`: Run autofix over applications.
`--fix`: Run autofix over applications

`--verbose`: Run yarn commands with the --verbose flag set
30 changes: 0 additions & 30 deletions docs/commands/convert.md

This file was deleted.

19 changes: 0 additions & 19 deletions docs/commands/init.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/commands/lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ parent: Commands
title: modular lint
---

# `modular lint`
# `modular lint [options] [regexes...]`

`modular lint` will check the diff between the current branch and your remote
origin default branch (i.e. `master` or `main`) and only lint the `.ts`, `.tsx`,
Expand Down
Loading