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

Remove commands and update documentation #2220

Merged
merged 8 commits into from
Dec 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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.

69 changes: 0 additions & 69 deletions docs/commands/port.md

This file was deleted.

25 changes: 0 additions & 25 deletions docs/commands/rename.md

This file was deleted.

30 changes: 30 additions & 0 deletions docs/how-to/convert-react-app.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
parent: How To
nav_order: 1
title: Convert CRA Project to Modular Project
---

# Convert a Create React App project to a Modular Project

To convert an existing [Create React App](https://create-react-app.dev/) project
into a Modular app, start by creating a new Modular project as shown in the
[getting started documentation](../index.md):

`yarn create modular-react-app my-new-modular-project`

Once created:

- Replace the source code within the `app` workspace inside the `packages/`
directory with your React app source content.
- Copy the dependencies from the old root package.json to the new Modular one
within the `app` workspace.
- Ensure the React version and other dependencies in the root Modular
package.json are the same as those used in the React app.
- Copy over any necessary custom configurations, and ensure `modular start`
`test` and `build` scripts succesfully start, test and build your app.

Your app will now be a Modular `app` package. You can change the package type in
the package's package.json `modular.type` field to `view` if more appropriate.

Feel free to rename the workspace by following this guide:
[Rename Package](./rename-package).
44 changes: 44 additions & 0 deletions docs/how-to/create-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
parent: How To
nav_order: 3
title: Create Template
---

# Create a Modular Template

To create a [Modular Template](../concepts/templates.md), start with any Modular
package type for which you want to create a template for (`app`, `package`,
etc). The package's contents will be copied into any new package created using
the template.

To convert the package into a template, make the following changes to the
package's package.json:

- Change `modular.type` field to `"template"`
- Add `modular.templateType` with the desired target package type

Example configuration for a template that generates `esm-view`s.

```json
{
"modular": {
"type": "template",
"templateType": "esm-view"
}
}
```

Optionally, include a `files` array pattern containing any files that Modular
should include from the template when creating a new package using it. Example:

```json
{
"files": [
"path/to/file-to-include-1.tsx",
"path/to/file-to-include-2.ts",
"folder-to-include"
]
}
```

If not specified, Modular will include all files.
7 changes: 7 additions & 0 deletions docs/how-to/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
has_children: true
title: How To
nav_order: 300
---

# How To
16 changes: 16 additions & 0 deletions docs/how-to/rename-package.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
parent: How To
nav_order: 2
title: Rename Modular Package
---

# Rename a Modular Package

To rename a Modular package, find and replace the package name in the following
places:

- The `name` field in the package's package.json
- All places where the package is imported/referenced

Feel free to rename the package directory, although this will not have an impact
on the package.
10 changes: 6 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,22 @@ It supports three flags:

## Commands

- [`init`](./commands/init.md)
- [`workspace`](./commands/workspace.md)
- [`check`](./commands/check.md)
- [`add`](./commands/add.md)
- [`start`](./commands/start.md)
- [`test`](./commands/test.md)
- [`build`](./commands/build.md)
- [`convert`](./commands/convert.md)
- [`port`](./commands/port.md)
- [`typecheck`](./commands/typecheck.md)
- [`lint`](./commands/lint.md)
- [`rename`](./commands/rename.md)

## Concepts

- [Views](./concepts/views.md)
- [Linting](./concepts/linting.md)

## How to

- [`Create a Template`](./how-to/create-template.md)
- [`Convert Existing CRA Project`](./how-to/convert-react-app.md)
- [`Rename a Modular Package`](./how-to/rename-package.md)
11 changes: 9 additions & 2 deletions docs/releases/4.0.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,15 @@ the update.

### Removed Commands

We no longer provide the following commands: (FILL AS NEEDED) (PROVIDE/LINK
DOCUMENTATION FOR HOW TO REPLICATE COMMAND BEHAVIOUR MANUALLY)
We no longer provide the following commands:

- `modular convert `
- `modular init`
- `modular port`
- `modular rename`

Refer to the [How To](../how-to/index.md) section for instructions on how to
manually complete the tasks previously covered by these commands.

### Other

Expand Down

This file was deleted.

Loading