extension-create 2.0.0-rc.31 → 2.0.0-rc.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,4 +4,5 @@ export declare function moveDirectoryContents(source: string, destination: strin
4
4
  export declare function getInstallCommand(): Promise<string>;
5
5
  export declare function getTemplatePath(workingDir: string): string;
6
6
  export declare function isDirectoryWriteable(directory: string, projectName: string): Promise<boolean>;
7
+ export declare function isExternalTemplate(_templateName: string): boolean;
7
8
  export declare function isTypeScriptTemplate(templateName: string): boolean;
package/dist/module.d.ts CHANGED
@@ -3,8 +3,4 @@ export interface CreateOptions {
3
3
  install?: boolean;
4
4
  cliVersion?: string;
5
5
  }
6
- export declare function extensionCreate(projectNameInput: string | undefined, { cliVersion, template, install }: {
7
- cliVersion?: string;
8
- template?: string;
9
- install?: boolean;
10
- }): Promise<void>;
6
+ export declare function extensionCreate(projectNameInput: string | undefined, { cliVersion, template, install }: CreateOptions): Promise<void>;
package/dist/module.js CHANGED
@@ -237,6 +237,9 @@ async function isDirectoryWriteable(directory, projectName) {
237
237
  return false;
238
238
  }
239
239
  }
240
+ function isExternalTemplate(_templateName) {
241
+ return true;
242
+ }
240
243
  function isTypeScriptTemplate(templateName) {
241
244
  return templateName.includes("typescript") || templateName.includes('react') || templateName.includes('preact') || templateName.includes('svelte') || templateName.includes('solid');
242
245
  }
@@ -308,9 +311,9 @@ const extensionJsPackageJsonScripts = {
308
311
  start: 'development' === process.env.EXTENSION_ENV ? 'node node_modules/extension start' : 'extension start',
309
312
  build: 'development' === process.env.EXTENSION_ENV ? 'node node_modules/extension build' : 'extension build'
310
313
  };
311
- async function overridePackageJson(projectPath, projectName, { cliVersion }) {
314
+ async function overridePackageJson(projectPath, projectName, { template, cliVersion }) {
312
315
  const templatePath = getTemplatePath(process.cwd());
313
- const packageJsonPath = external_path_namespaceObject.join(templatePath, 'package.json');
316
+ const packageJsonPath = isExternalTemplate(template) ? external_path_namespaceObject.join(projectPath, 'package.json') : external_path_namespaceObject.join(templatePath, 'package.json');
314
317
  const packageJsonContent = await promises_namespaceObject.readFile(packageJsonPath);
315
318
  const packageJson = JSON.parse(packageJsonContent.toString());
316
319
  packageJson.scripts = packageJson.scripts || {};
@@ -0,0 +1 @@
1
+ export declare function importLocalTemplate(projectPath: string, projectName: string, template: string): Promise<void>;
@@ -2,5 +2,5 @@ interface OverridePackageJsonOptions {
2
2
  template: string;
3
3
  cliVersion?: string;
4
4
  }
5
- export declare function overridePackageJson(projectPath: string, projectName: string, { cliVersion }: OverridePackageJsonOptions): Promise<void>;
5
+ export declare function overridePackageJson(projectPath: string, projectName: string, { template, cliVersion }: OverridePackageJsonOptions): Promise<void>;
6
6
  export {};
@@ -0,0 +1,35 @@
1
+ # [projectName]
2
+
3
+ > [templateDescription]
4
+
5
+ ## Available Scripts
6
+
7
+ In the project directory, you can run the following scripts:
8
+
9
+ ### [runCommand] dev
10
+
11
+ **Development Mode**: This command runs your extension in development mode. It will launch a new browser instance with your extension loaded. The page will automatically reload whenever you make changes to your code, allowing for a smooth development experience.
12
+
13
+ ```bash
14
+ [runCommand] dev
15
+ ```
16
+
17
+ ### [runCommand] start
18
+
19
+ **Production Preview**: This command runs your extension in production mode. It will launch a new browser instance with your extension loaded, simulating the environment and behavior of your extension as it will appear once published.
20
+
21
+ ```bash
22
+ [runCommand] start
23
+ ```
24
+
25
+ ### [runCommand] build
26
+
27
+ **Build for Production**: This command builds your extension for production. It optimizes and bundles your extension, preparing it for deployment to the target browser's store.
28
+
29
+ ```bash
30
+ [runCommand] build
31
+ ```
32
+
33
+ ## Learn More
34
+
35
+ To learn more about creating cross-browser extensions with Extension.js, visit the [official documentation](https://extension.js.org).
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/chrome-manifest.json",
3
+ "manifest_version": 3,
4
+ "version": "1.0",
5
+ "name": "Default Extension",
6
+ "description": "A minimum extension template. This template includes a manifest file."
7
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "license": "MIT",
3
+ "repository": {
4
+ "type": "git",
5
+ "url": "https://github.com/extension-js/extension.git",
6
+ "directory": "examples/init"
7
+ },
8
+ "type": "module",
9
+ "name": "init",
10
+ "description": "An Extension.js example.",
11
+ "version": "0.0.1",
12
+ "keywords": [
13
+ "extension",
14
+ "browser-extension",
15
+ "web-extension",
16
+ "template"
17
+ ]
18
+ }
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  "dist"
22
22
  ],
23
23
  "name": "extension-create",
24
- "version": "2.0.0-rc.31",
24
+ "version": "2.0.0-rc.32",
25
25
  "description": "The create step of Extension.js",
26
26
  "author": {
27
27
  "name": "Cezar Augusto",
@@ -50,7 +50,7 @@
50
50
  "scripts": {
51
51
  "clean": "rm -rf dist",
52
52
  "watch": "rslib build --watch",
53
- "compile": "rslib build",
53
+ "compile": "rslib build && bash install_scripts.sh",
54
54
  "test:create": "vitest run",
55
55
  "test:coverage": "vitest run --coverage"
56
56
  }