Skip to content

Commit

Permalink
Documentation v2
Browse files Browse the repository at this point in the history
  • Loading branch information
cezaraugusto committed Sep 11, 2024
1 parent 164623f commit 34d9b8f
Show file tree
Hide file tree
Showing 54 changed files with 77 additions and 96 deletions.
7 changes: 0 additions & 7 deletions _WIP_Configuration Files/_Webpack.md

This file was deleted.

10 changes: 0 additions & 10 deletions _WIP_Features/The Manifest File.md

This file was deleted.

File renamed without changes.
19 changes: 17 additions & 2 deletions docs/en/docs/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,22 @@
},
{
"type": "dir",
"name": "guides",
"label": "Guides"
"name": "features",
"label": "Features"
},
{
"type": "dir",
"name": "languages-and-frameworks",
"label": "Languages and Frameworks"
},
{
"type": "dir",
"name": "api-support",
"label": "API Support"
},
{
"type": "dir",
"name": "commands",
"label": "Commands Reference"
}
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Cross-browser manifest support is not something easy to think as well, so Extens

Fields like the action page and browser page overrides runs in the context of an HTML page. Adding any of these fields to your package JSON will make your .html file an entrypoint for your extension.

![New extension template](../../../../../../assets/guides/development/new-template.png)
![New extension template](../../../../../assets/guides/development/new-template.png)

> A new extension from Extension.
Expand Down Expand Up @@ -62,7 +62,7 @@ The `storage.managed_schema` property [indicates a file within the extension tha

### Scripts Fields

![The background inspect window](../../../../../../assets/guides/development/service_worker.png)
![The background inspect window](../../../../../assets/guides/development/service_worker.png)

Support for both `background.scripts` (Manifest V2) and `background.service_worker` (Manifest V3). All scripts have [hot-module-replacement](https://webpack.js.org/concepts/hot-module-replacement/) support, except for `background.service_worker` (which is live-reloaded).

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ In an ideal world, browser vendors would agree between conventions and developer

## Check For Required Fields

![Required Field]((../../../../../../assets/guides/development/required_field.png)
![Required Field]((../../../../../assets/guides/development/required_field.png)

It is a common standard across all browsers vendors that the minimum Manifest file should contain a `name`, a `version`, and a `manifest_version` field as requirements. Missing one of these fields results in a runtime error.

Expand All @@ -16,6 +16,6 @@ Fields such as [`options_page`](https://developer.mozilla.org/en-US/docs/Mozilla

## Check For Invalid Field Types

![Invalid Field]((../../../../../../assets/guides/development/invalid_field.png)
![Invalid Field]((../../../../../assets/guides/development/invalid_field.png)

While the [`action` page in Chrome](https://developer.chrome.com/docs/extensions/reference/api/action) accepts a `default_icon` field value as a string, per the [official Manifest JSON Schema](https://json.schemastore.org/chrome-manifest.json) it is expected to be an object in Manifest V3. Using invalid field types results in a warning message.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
> [!warning]
> This feature is not stable yet. You can track its development [here](https://github.com/cezaraugusto/extension/issues/40).
Take for example, our ChatGPT $([Template](../../getting-started/templates)).
Take for example, our ChatGPT $([Template](../getting-started/templates)).

![ChatGPT Extension Template](../../../../../assets/guides/development/chatgpt-template.png)
![ChatGPT Extension Template](../../../../assets/guides/development/chatgpt-template.png)

See that it expects the `EXTENSION_OPENAI_API_KEY` environment variable? Create an `.env` file at the project root so Extension can parse its contents at runtime.

Expand Down
21 changes: 21 additions & 0 deletions docs/en/docs/features/error-handling.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Manifest Compatibility

The manifest.json file is the only required file in an extension. While very similar between browsers and versions, different versions and different browser vendors can have slightly different requirements between them.

In an ideal world, browser vendors would agree between conventions and developers shouldn't worry about cross-browser compatibilities. While this doesn't happen, `Extension` has an ever growing support for the different manifest files across `manifest_version`s and browser vendors.

## Check For Required Fields

![Required Field]((../../../../../assets/guides/development/required_field.png)

It is a common standard across all browsers vendors that the minimum Manifest file should contain a `name`, a `version`, and a `manifest_version` field as requirements. Missing one of these fields results in a runtime error.

## Check For Deprecated Fields

Fields such as [`options_page`](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/options_page) are deprecated in current valid Manifest versions. ~~Using deprecated fields results in a runtime error~~. [This feature is being tracked for future implementation](https://github.com/cezaraugusto/extension/issues/43).

## Check For Invalid Field Types

![Invalid Field]((../../../../../assets/guides/development/invalid_field.png)

While the [`action` page in Chrome](https://developer.chrome.com/docs/extensions/reference/api/action) accepts a `default_icon` field value as a string, per the [official Manifest JSON Schema](https://json.schemastore.org/chrome-manifest.json) it is expected to be an object in Manifest V3. Using invalid field types results in a warning message.
Empty file.
Empty file.
21 changes: 21 additions & 0 deletions docs/en/docs/features/polyfill.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Manifest Compatibility

The manifest.json file is the only required file in an extension. While very similar between browsers and versions, different versions and different browser vendors can have slightly different requirements between them.

In an ideal world, browser vendors would agree between conventions and developers shouldn't worry about cross-browser compatibilities. While this doesn't happen, `Extension` has an ever growing support for the different manifest files across `manifest_version`s and browser vendors.

## Check For Required Fields

![Required Field]((../../../../../assets/guides/development/required_field.png)

It is a common standard across all browsers vendors that the minimum Manifest file should contain a `name`, a `version`, and a `manifest_version` field as requirements. Missing one of these fields results in a runtime error.

## Check For Deprecated Fields

Fields such as [`options_page`](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/options_page) are deprecated in current valid Manifest versions. ~~Using deprecated fields results in a runtime error~~. [This feature is being tracked for future implementation](https://github.com/cezaraugusto/extension/issues/43).

## Check For Invalid Field Types

![Invalid Field]((../../../../../assets/guides/development/invalid_field.png)

While the [`action` page in Chrome](https://developer.chrome.com/docs/extensions/reference/api/action) accepts a `default_icon` field value as a string, per the [official Manifest JSON Schema](https://json.schemastore.org/chrome-manifest.json) it is expected to be an object in Manifest V3. Using invalid field types results in a warning message.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Special folders are folders that allows you to work with files outside the scope

To work with complementary HTML files (such as internal page links or `<iframe>`s), add the file into a `pages/` folder.

![Pages Folder](../../../../../assets/guides/development/pages-folder2.png)
![Pages Folder](../../../../assets/guides/development/pages-folder2.png)

**Example:**
An iframe as a sandboxed frame. [See the sandbox sample from Chrome Samples repository](https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/api-samples/sandbox/sandbox). The iframe is likely to be edited several times during development, so adding it inside a `pages/` folder guarantees support for hot page reloads and full integration with JavaScript/CSS pre/post-processors.
Expand All @@ -25,7 +25,7 @@ An iframe as a sandboxed frame. [See the sandbox sample from Chrome Samples repo

For scripts without the need of HTML files, add the file into a `scripts/` folder. Any JavaScript-like file in this folder is a valid entry point.

![Scripts Folder](../../../../../assets/guides/development/scripts-folder.png)
![Scripts Folder](../../../../assets/guides/development/scripts-folder.png)

**Example:**

Expand All @@ -37,11 +37,11 @@ For files that you don't want Extension to parse, or if you want a predictable o

See thee example below using the previous [sandbox sample from Chrome Samples repository](https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/api-samples/sandbox/sandbox). `handlebars.js` is an external lib that we don't want to parse, so we add it to the `/public` path, and `Extension` will output the file as-is, skipping the compilation process.

![Public Folder](../../../../../assets/guides/development/public-folder.png)
![Public Folder](../../../../assets/guides/development/public-folder.png)

## Next Steps

- Check the different types of [Templates](../../getting-started/templates) to bootstrap your next extension.
- Check the different types of [Templates](../getting-started/templates) to bootstrap your next extension.
- Learn more about how `Extension` handles [Manifest Compatibility Checker](./manifest-json/manifest-compatibility).

---
File renamed without changes.
12 changes: 0 additions & 12 deletions docs/en/docs/guides/_meta.json

This file was deleted.

5 changes: 0 additions & 5 deletions docs/en/docs/guides/development/manifest-json/_meta.json

This file was deleted.

17 changes: 0 additions & 17 deletions docs/en/docs/guides/development/manifest-json/overview.mdx

This file was deleted.

5 changes: 0 additions & 5 deletions docs/en/docs/guides/development/modern-css/_meta.json

This file was deleted.

3 changes: 0 additions & 3 deletions docs/en/docs/guides/development/modern-css/less.mdx

This file was deleted.

3 changes: 0 additions & 3 deletions docs/en/docs/guides/development/modern-css/sass.mdx

This file was deleted.

6 changes: 0 additions & 6 deletions docs/en/docs/guides/development/modern-javascript/_meta.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
[
{
"type": "dir",
"name": "manifest-json",
"label": "Manifest JSON"
},
{
"type": "dir",
"name": "modern-css",
Expand All @@ -15,12 +10,9 @@
"label": "Modern JavaScript"
},
{
"name": "environment-variables",
"label": "Environment Variables"
},
{
"name": "special-folders",
"label": "Special Folders"
"type": "dir",
"name": "configuration",
"label": "Configuration"
},
{
"name": "webassembly",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ React is the library for web and native user interfaces.

Extension comes with a default React template for new projects, which you can use as a starting point for your next React-based Extension. This is the easiest way to have React integrated with Extension.

![React Extension Template](../../../../../../assets/guides/development/react-template.png)
![React Extension Template](../../../../../assets/guides/development/react-template.png)

### Try it yourself

Expand All @@ -26,7 +26,7 @@ Extension comes with a default React template for new projects, which you can us

Alternatively, `Extension` also supports a React+TypeScript template for a more robust UI.

![React Extension Template](../../../../../../assets/guides/development/react-ts-template.png)
![React Extension Template](../../../../../assets/guides/development/react-ts-template.png)

### Try it yourself

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ TypeScript is JavaScript with syntax for types.

`Extension` comes with a default TypeScript template for new projects, which you can use as a starting point for your next TypeScript-based Extension. This is the easiest way to have TypeScript integrated with `Extension`.

![TypeScript Extension Template](../../../../../../assets/guides/development/ts-template.png)
![TypeScript Extension Template](../../../../../assets/guides/development/ts-template.png)

#### Try it yourself

Expand Down Expand Up @@ -91,7 +91,7 @@ compilerOptions: {

In order to handle the multiple import capabilities such as `import()` of JavaScript modules and file assets, `Extension` injects a `extension.d.ts` file at the root of your project folder.

![TypeScript Extension Type Definition](../../../../../../assets/guides/development/extension-type-definition.png)
![TypeScript Extension Type Definition](../../../../../assets/guides/development/extension-type-definition.png)

> [!tip]
> Ensure the `extension.d.ts` file is added to your `.gitignore` file as it is auto-generated and only useful during `development` mode.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ With WebAssembly, developers can write parts of the extension in languages like
}}
/>

![WASM Sample Extension](../../../../../assets/guides/development/wasm.png)
![WASM Sample Extension](../../../../assets/guides/development/wasm.png)

- Learn how `Extension` works with extensions using [Modern JavaScript](../development/modern-javascript/overview).

0 comments on commit 34d9b8f

Please sign in to comment.