extension 0.2.2 → 1.1.1

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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) Cezar Augusto <boss@cezaraugusto.net (https://cezaraugusto.net)
3
+ Copyright (c) 2024 Cezar Augusto <boss@cezaraugusto.net> (https://cezaraugusto.com)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -0,0 +1,111 @@
1
+ [action-image]: https://github.com/cezaraugusto/extension-create/actions/workflows/ci.yml/badge.svg?branch=main
2
+ [action-url]: https://github.com/cezaraugusto/extension-create/actions
3
+ [npm-image]: https://img.shields.io/npm/v/extension-create.svg
4
+ [npm-url]: https://npmjs.org/package/extension-create
5
+ [downloads-image]: https://img.shields.io/npm/dm/extension-create.svg
6
+ [downloads-url]: https://npmjs.org/package/extension-create
7
+ [node]: https://img.shields.io/node/v/extension-create.svg
8
+ [node-url]: https://nodejs.org
9
+ [prs]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg
10
+ [prs-url]: https://github.com/cezaraugusto/extension-create/blob/main/CONTRIBUTING.md
11
+ [vunlerabilities]: https://snyk.io/test/github/cezaraugusto/extension-create/badge.svg
12
+ [fossa-image]: https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcezaraugusto%2Fextension-create.svg?type=shield
13
+ [fossa-url]: https://app.fossa.com/projects/git%2Bgithub.com%2Fcezaraugusto%2Fextension-create?ref=badge_large
14
+
15
+ # extension-create [![npm][npm-image]][npm-url] [![fossa][fossa-image]][fossa-url] [![workflow][action-image]][action-url] [![downloads][downloads-image]][downloads-url] [![PR's welcome][prs]][prs-url]
16
+
17
+ <img alt="Logo" align="right" src="https://user-images.githubusercontent.com/4672033/102850460-4d22aa80-43f8-11eb-82db-9efce586f73e.png" width="25%" />
18
+
19
+ Create cross-browser extensions with no build configuration.
20
+
21
+ - [Creating an extension](#creating-an-extension) — How to create a new extension.
22
+ - [Getting started immediately](#getting-started-immediately) — Get work done in no time.
23
+ - [I have an extension](#i-have-an-extension) - Use only specific parts of `extension-create`.
24
+
25
+ `extension-create` helps you develop cross-browser extensions with built-in support for module imports/exports, auto-reload, and more.
26
+
27
+ ## Creating an Extension
28
+
29
+ ```sh
30
+ npx extension-create@latest create my-extension-hello
31
+ cd my-extension-hello
32
+ npm run dev
33
+ ```
34
+
35
+ A new browser instance will open up with your extension ready for development.
36
+
37
+ You are done. Time to hack on your extension!
38
+
39
+ <p align="center">
40
+ <img src="https://user-images.githubusercontent.com/4672033/106184765-ba0c2b80-6180-11eb-9d0f-d9d00d168290.gif" width="720" alt="npm start">
41
+ </p>
42
+
43
+ ## Getting Started Immediately
44
+
45
+ ### Kickstart any sample from Chrome Extension Samples
46
+
47
+ The [chrome-extensions-sample](https://github.com/GoogleChrome/chrome-extensions-samples/) project is a great way to kickstart developing your extension.
48
+
49
+ If we go to the samples repository and look for an extension sample to work, let's say the [page-redder](https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/functional-samples/sample.page-redder) sample, all we need is to copy and paste it's URL as an argument for the start command:
50
+
51
+ #### Command
52
+
53
+ ```sh
54
+ # This command will:
55
+ # 1. Download the Chrome extension sample URL to the current working directory
56
+ # 2. Bundle the downloaded extension using extension-create
57
+ # 3. Enable the extension in Chrome using a fresh user profile
58
+ npx extension-create dev https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/functional-samples/sample.page-redder
59
+ ```
60
+
61
+ <p align="center">
62
+ <img src="https://user-images.githubusercontent.com/4672033/106188671-04dc7200-6186-11eb-940a-52aebab46f31.gif" width="720" alt="npm start">
63
+ </p>
64
+
65
+ Will not only download the extension but also kickstart a Chrome instance in a fresh profile with your sample extension loaded and default auto-reload support. Try it yourself!
66
+
67
+ ### Use `Microsoft Edge` to kickstart any sample from [chrome-extesions-sample](https://github.com/GoogleChrome/chrome-extensions-samples/)
68
+
69
+ **You read it!** Just run the command above with the `--browser=edge` flag:
70
+
71
+ ```sh
72
+ npx extension-create dev --browser=edge https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/functional-samples/sample.page-redder
73
+ ```
74
+
75
+ And see a Chrome Extension sample running automatically. On Edge!
76
+
77
+ ## I have an extension
78
+
79
+ Just add `extension-create` to your npm scripts. Here's how it should look in your `package.json`:
80
+
81
+ ```js
82
+ {
83
+ // ...npm stuff,
84
+ "scripts": {
85
+ "start": "npx extension-create start",
86
+ "dev": "npx extension-create dev",
87
+ "build": "npx extension-create build"
88
+ },
89
+ "devDependencies": {
90
+ "extension-create": "latest"
91
+ }
92
+ }
93
+ ```
94
+
95
+ #### Using a specific browser for development
96
+
97
+ | <img width=120 src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/chrome/chrome.svg" alt="Chrome browser logo"> | <img width=120 src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/edge/edge.svg" alt="Microsoft Edge browser logo"> | <img width=120 src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox.svg" alt="Mozilla Firefox browser logo"> | <img width=120 src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/safari/safari.svg" alt="Apple Safari browser logo"> | <img width=120 src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/opera/opera.svg" alt="Opera browser logo"> | <img width=120 src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/chromium/chromium.svg" alt="Chromium browser logo"> |
98
+ | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
99
+ | Google Chrome ✅ | Microsoft Edge ✅ | Mozilla Firefox ⛔️ | Apple Safari ⛔️ | Opera browser ⛔️ | Chromium (forks) 🤔 |
100
+
101
+ If you want to target a specific browser, just pass the `--browser` flag to the dev/start command (Chrome or Edge, soon others), like `npx extension-create dev --browser=edge`.
102
+
103
+ That's it!
104
+
105
+ ## Program Options Table
106
+
107
+ For a list of all commands available, see [OPTIONS_TABLE.md](OPTIONS_TABLE.md).
108
+
109
+ ## License
110
+
111
+ MIT (c) Cezar Augusto.
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/cli.js ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // cli.ts
5
+ var import_child_process = require("child_process");
6
+ function runCli() {
7
+ (0, import_child_process.exec)("@extension-create/cli", (error, stdout, stderr) => {
8
+ if (error) {
9
+ console.error(`exec error: ${error}`);
10
+ return;
11
+ }
12
+ console.log(`stdout: ${stdout}`);
13
+ console.error(`stderr: ${stderr}`);
14
+ });
15
+ }
16
+ runCli();
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/module.js ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+
26
+ // module.ts
27
+ var import_cli = __toESM(require("@extension-create/cli"));
28
+ (0, import_cli.default)();
package/package.json CHANGED
@@ -2,30 +2,46 @@
2
2
  "license": "MIT",
3
3
  "repository": {
4
4
  "type": "git",
5
- "url": "https://github.com/cezaraugusto/extension.git"
5
+ "url": "https://github.com/cezaraugusto/extension-create.git"
6
6
  },
7
7
  "engines": {
8
- "node": ">=10"
8
+ "node": ">=18"
9
9
  },
10
10
  "name": "extension",
11
- "version": "0.2.2",
12
- "description": "Extension",
13
- "main": "module.js",
11
+ "version": "1.1.1",
12
+ "description": "Create cross-browser extensions with no build configuration.",
13
+ "main": "./dist/cli.js",
14
+ "types": "./dist/cli.d.ts",
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "bin": {
19
+ "extension": "./dist/cli.js"
20
+ },
14
21
  "author": {
15
22
  "name": "Cezar Augusto",
16
23
  "email": "boss@cezaraugusto.net",
17
- "url": "https://cezaraugusto.net"
24
+ "url": "https://cezaraugusto.com"
18
25
  },
19
26
  "scripts": {
20
- "test": "jest"
27
+ "compile:readme-files": "node ./scripts/copyMarkdownFilesToCli.js",
28
+ "compile:cli": "tsup-node ./cli.ts --format cjs --dts --target=node18",
29
+ "compile": "yarn compile:readme-files && yarn compile:cli"
21
30
  },
22
- "files": [
23
- "module.js"
24
- ],
25
31
  "keywords": [
26
- "extension"
32
+ "zero-config",
33
+ "build",
34
+ "develop",
35
+ "browser",
36
+ "extension",
37
+ "chrome extension",
38
+ "edge extension",
39
+ "firefox extension",
40
+ "web",
41
+ "react",
42
+ "typescript"
27
43
  ],
28
- "devDependencies": {
29
- "jest": "^26.6.1"
44
+ "dependencies": {
45
+ "@extension-create/cli": "*"
30
46
  }
31
47
  }
package/module.js DELETED
@@ -1,8 +0,0 @@
1
- function sleepySays (input, isSleepySleeping) {
2
- if (isSleepySleeping) {
3
- return '(◡ ‿ ◡ ✿) zZZz'
4
- }
5
- return `( o ‿ ~ ✿) ${input}`
6
- }
7
-
8
- module.exports = sleepySays