Skip to content

Commit 16b27af

Browse files
committed
Update all commands
1 parent 6ce6b15 commit 16b27af

File tree

4 files changed

+39
-26
lines changed

4 files changed

+39
-26
lines changed

docs/en/docs/commands/build.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ In this example, the build targets all supported browsers and includes polyfills
110110

111111
## Best Practices
112112

113-
- **Check Build Logs:** After the build, review the logs to ensure there are no warnings or errors. The build logs will highlight any issues with compatibility or missing assets.
113+
- **Check Build Logs:** After the build, review the logs to ensure there are no warnings or errors. The build logs will highlight any issues with missing assets.
114114
- **Optimize Your Manifest:** Ensure that your `manifest.json` is optimized and fully compatible with all targeted browsers to avoid build issues.
115115
- **Custom Build Artifacts:** You can define custom names for your build artifacts using the `--zip-filename` option, which is useful for organizing builds.
116116

docs/en/docs/commands/create.mdx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
11
import { PackageManagerTabs } from "@theme";
22
import { AvatarImage } from "../../../../theme/components/avatar-image";
3+
import {CarouselTemplates} from "../../../../theme/components/carousel-templates";
34

45
<AvatarImage icon="extension" />
56

67
# Create Command
78

8-
The `create` command is responsible for setting up a new browser extension project using Extension.js.
9+
The `create` command is **responsible** for setting up a new browser extension project using Extension.js.
910
This command accepts flags like `--template` for initializing your extension with various templates,
1011
and allows you to define the directory or path where the extension will be created.
1112
The command is designed to simplify the setup process for developers,
1213
providing a streamlined way to get started with cross-browser extension development.
1314

15+
## How it Works?
16+
17+
![Create Command](https://github.com/user-attachments/assets/666c4f07-7303-4bdc-971f-9c3684adb06f)
18+
19+
Given a folder or template URL, the `create` command initializes a new extension project in the specified directory applying the chosen template and relevant metadata to the project.
20+
1421
## Usage
1522

1623
You can run the `create` command using the following syntax.
1724
Replace `<extension-name|extension-path>` with your project name or path and set any required options:
1825

26+
![Demo Video](https://placehold.co/600x400)
27+
1928
<PackageManagerTabs
2029
command={{
2130
npm: "npx extension@latest create <extension-name|extension-path> [options]",
@@ -26,6 +35,8 @@ Replace `<extension-name|extension-path>` with your project name or path and set
2635

2736
**Example Usage with Templates**
2837

38+
![Demo Video](https://placehold.co/600x400)
39+
2940
<PackageManagerTabs
3041
command={{
3142
npm: "npx extension@latest create my-extension --template=react",
@@ -44,9 +55,9 @@ If no path is provided, it defaults to the current working directory.
4455

4556
<PackageManagerTabs
4657
command={{
47-
npm: "npx extension@latest create path/to/my-extension --template=react",
48-
pnpm: "pnpx extension@latest create path/to/my-extension --template=react",
49-
yarn: "yarn dlx extension@latest create path/to/my-extension --template=react",
58+
npm: "extension create path/to/my-extension --template=react",
59+
pnpm: "extension create path/to/my-extension --template=react",
60+
yarn: "extension create path/to/my-extension --template=react",
5061
}}
5162
/>
5263

@@ -60,6 +71,7 @@ The `create` command accepts several arguments and flags to customize the behavi
6071
| ---------------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
6172
| `[path or name]` | The extension path or name | If a path is defined, loads the local extension. If a name is provided, loads the extension in the current working directory. | `process.cwd()` |
6273
| -t, --template | Name of the template used to bootstrap your extension | Bootstrap your extension using a template | [new](../getting-started/templates#template-new) |
74+
| --install | Whether or not to auto install the template dependencies | Install dependencies and devDependencies during creation time | `true` |
6375

6476
- **Path or Name:** If a path is provided, the extension is created at that location. If a name is provided, it is created in the current working directory.
6577
- **`--template`:** Specifies the template to use when bootstrapping the extension (e.g., `react`, `typescript`).
@@ -78,18 +90,14 @@ This command creates a new extension named my-new-extension using the React temp
7890

7991
## Available Templates
8092

81-
Users can choose from a variety of templates when creating their extension projects, including:
93+
<CarouselTemplates />
8294

83-
- React: For building new tab or content scripts using React.
84-
- TypeScript: Initializes an extension with TypeScript support.
85-
- Custom: You can also specify external templates by providing a URL to a GitHub repo or any npm package.
8695

8796
## Best Practices
8897

89-
- Use meaningful names: When naming your extension or path, use meaningful names that reflect the project's purpose.
90-
- Customizing Templates: You can always customize your extension after it's created. For example, if you want to add TypeScript support to a React template, it's easy to do so afterward.
9198
- Starting from a Template: Using a template is the fastest way to get started with browser extension development in Extension.js.
9299

93100
## Next Steps
94101

95-
Once your extension is created, you can start developing by running extension dev. For more details on development workflows, check out the Development Guide.
102+
- Learn how to [develop](/docs/commands/dev) your extension.
103+
- Use the `extension.config.js` file to [configure your extension](../features/config.mdx).

docs/en/docs/commands/dev.mdx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ import { AvatarImage } from "../../../../theme/components/avatar-image";
77

88
> **Warning**: This feature is a work in progress and may be incomplete or subject to change. If you see an error or something that could be improved, please make a pull-request. The link that documents this feature can be found at the bottom of the page.
99
10-
11-
The `dev` command watches for changes in your extension's files, recompiles them, and reloads the extension in real time. If you provide a URL, Extension.js will download and run the extension as if it were local.
10+
The `dev` command watches for changes in your extension's files, recompiles them, and reloads the extension in real-time. If you provide a URL, Extension.js will download and run the extension as if it were local.
1211

1312
## How it Works?
1413

15-
For development frameworks, it's an industry-standard practice to have a development server that watches for changes in your files and recompiles them in real-time. Given the complex nature of browser extensions, the `dev` command in Extension.js handles the watch and recompile process for all the different contexts (HTML or not) of your extension.
14+
For development frameworks, it's an industry-standard practice to have a development server that watches for changes in your files and recompiles them in real time. Given the complex nature of browser extensions, the `dev` command in Extension.js handles the watch and recompile process for all the different contexts (HTML or not) of your extension.
1615

1716
The `dev` command also provides a way to run remote extensions by providing a URL. This is useful when you want to test an extension from source without having to clone the repository.
1817

@@ -47,14 +46,16 @@ In this example, the extension is developed in the `path/to/my-extension` direct
4746

4847
Below is a breakdown of the available flags for the `dev` command:
4948

50-
| Flag | Argument | What it does | Defaults to |
51-
| ------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- |
52-
| [path or url] | The extension path or the remote extension URL | If a path is defined, it loads the local extension. If a URL is provided, it pulls the extension from a remote source and loads it as a local extension | `process.cwd()` |
53-
| -b, --browser | The browser that will run the extension | Changes the browser (`chrome`, `edge`, `firefox`, `all`) | `"chrome"` |
54-
| --chromium-binary | The path to the Chromium binary | The path to the Chromium binary. This is useful when you want to run the extension with Chromium-based browsers not supported by Extension.js. [Read how](../browsers/unsupported.mdx) | `undefined` |
55-
| --gecko-binary | The path to the Gecko binary | The path to the Gecko binary. This is useful when you want to run the extension with Firefox-based browsers not supported by Extension.js. . [Read how](../browsers/unsupported.mdx) | `undefined` |
56-
| -o, --open | True or false | Opens the browser when the extension is ready | `true` |
57-
| --polyfill | True or false | Allow the `browser.*` API namespace to run with all Chromium-based browsers**.** | `false` |
49+
| Flag | Argument | What it does | Defaults to |
50+
| ----------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
51+
| `[path or url]` | Extension path or remote URL | If a path is defined, it loads the local extension. If a URL is provided, it pulls the extension from a remote source and loads it as a local extension | `process.cwd()` |
52+
| `--polyfill` | Boolean | Enables compatibility for the `browser.*` API in Chromium-based browsers | `false` |
53+
| `--profile` | Profile path | Specifies a path to a browser profile for testing | `default` |
54+
| `-b, --browser` | Browser to run the extension | Specifies the browser to run (`chrome`, `edge`, `firefox`, `all`) | `"chrome"` |
55+
| `--chromium-binary` | Path to the Chromium binary | Provides the path to a custom Chromium-based browser binary [Read more](../browsers/unsupported.mdx) | `undefined` |
56+
| `--gecko-binary` | Path to the Gecko binary | Provides the path to a custom Gecko-based browser binary [Read more](../browsers/unsupported.mdx) | `undefined` |
57+
| `--starting-url` | URL | Starting URL for testing with the extension | `chrome://newtab` |
58+
| `--open` | Boolean | Whether or not to automatically open the browser upon starting dev | `true` |
5859

5960
## Examples
6061

@@ -120,8 +121,8 @@ Below is a breakdown of the available flags for the `dev` command:
120121

121122
## Best Practices
122123

123-
- **Browser Specific Configurations:** You can use the `--browser` flag to run your extension in different browsers during the development process.
124-
- **Remote Extensions:** Test them with the `--browser` flag to test your extension in different browsers without having to clone the repository.
124+
- **Browser Compatibility:** Test your extension in different browsers to ensure compatibility with the target audience.
125+
- **Polyfilling:** If Firefox or a Gecko-based browser is also a target, use the `--polyfill` flag to enable compatibility for the `browser.*` API in Chromium-based browsers.
125126

126127
## Next Steps
127128

docs/en/docs/commands/preview.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ In this example, the extension is created in the `path/to/my-extension` director
4343
| Flag | Argument | What it does | Defaults to |
4444
| ------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- |
4545
| [path or url] | The extension path or the remote extension URL | If a path is defined, previews the local extension. If a URL is provided, pulls the extension from remote source and previews it as a local extension | `process.cwd()` |
46-
| -b, --browser | The browser that will run the extension | Specifies the browser (`chrome`, `edge`, `all`) | `"chrome"` |
46+
| `--profile` | Profile path | Specifies a path to a browser profile for testing | `default` |
47+
| `-b, --browser` | Browser to run the extension | Specifies the browser to run (`chrome`, `edge`, `firefox`, `all`) | `"chrome"` |
48+
| `--chromium-binary` | Path to the Chromium binary | Provides the path to a custom Chromium-based browser binary [Read more](../browsers/unsupported.mdx) | `undefined` |
49+
| `--gecko-binary` | Path to the Gecko binary | Provides the path to a custom Gecko-based browser binary [Read more](../browsers/unsupported.mdx) | `undefined` |
50+
| `--starting-url` | URL | Starting URL for testing with the extension | `chrome://newtab` |
4751

4852
## Examples
4953

0 commit comments

Comments
 (0)