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

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 || {};
@@ -417,17 +420,17 @@ async function writeManifestJson(projectPath, projectName) {
417
420
  }
418
421
  async function generateExtensionTypes(projectPath, projectName) {
419
422
  const extensionEnvFile = external_path_namespaceObject.join(projectPath, 'extension-env.d.ts');
420
- const typePath = 'development' === process.env.EXTENSION_ENV ? external_path_namespaceObject.resolve(process.cwd(), 'programs/cli/types') : 'extension/dist/types';
423
+ const typePath = 'development' === process.env.EXTENSION_ENV ? external_path_namespaceObject.resolve(process.cwd(), 'programs/cli/types') : 'extension';
421
424
  const fileContent = `\
422
425
  // Required Extension.js types for TypeScript projects.
423
426
  // This file is auto-generated and should not be excluded.
424
427
  // If you need additional types, consider creating a new *.d.ts file and
425
428
  // referencing it in the "include" array of your tsconfig.json file.
426
429
  // See https://www.typescriptlang.org/tsconfig#include for more information.
427
- /// <reference types="${typePath}/index.d.ts" />
430
+ /// <reference types="${typePath}" />
428
431
 
429
- // Polyfill types for browser.* APIs.
430
- /// <reference types="${typePath}/polyfill.d.ts" />
432
+ // Polyfill types for browser.* APIs
433
+ /// <reference types="${typePath}/polyfill" />
431
434
  `;
432
435
  try {
433
436
  await promises_namespaceObject.mkdir(projectPath, {
@@ -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.33",
25
25
  "description": "The create step of Extension.js",
26
26
  "author": {
27
27
  "name": "Cezar Augusto",
@@ -29,7 +29,6 @@
29
29
  "url": "https://cezaraugusto.com"
30
30
  },
31
31
  "dependencies": {
32
- "@types/firefox-webext-browser": "^120.0.4",
33
32
  "chalk": "^5.3.0",
34
33
  "cross-spawn": "^7.0.6",
35
34
  "go-git-it": "4.0.0",
@@ -40,7 +39,6 @@
40
39
  "@rslib/core": "^0.6.9",
41
40
  "@types/cross-spawn": "^6.0.6",
42
41
  "@types/node": "^22.10.1",
43
- "@types/react-dom": "^19.0.1",
44
42
  "@vitest/coverage-v8": "^1.3.1",
45
43
  "globals": "^15.13.0",
46
44
  "tsconfig": "*",
@@ -50,7 +48,7 @@
50
48
  "scripts": {
51
49
  "clean": "rm -rf dist",
52
50
  "watch": "rslib build --watch",
53
- "compile": "rslib build",
51
+ "compile": "rslib build && bash install_scripts.sh",
54
52
  "test:create": "vitest run",
55
53
  "test:coverage": "vitest run --coverage"
56
54
  }