diff --git a/aaa.sh b/aaa.sh new file mode 100644 index 00000000..eee1c00e --- /dev/null +++ b/aaa.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Get the absolute path of the root directory +ROOT_DIR=$(pwd) + +# Function to recursively remove .git folders +remove_git_folders() { + local dir="$1" + + # Iterate over all directories in the current directory + for subdir in "$dir"/*; do + if [ -d "$subdir" ]; then + # Skip node_modules directories + if [[ $(basename "$subdir") == "node_modules" ]]; then + continue + fi + + # Remove .git directory if it's not the root level + if [[ $(basename "$subdir") == ".git" ]] && [[ "$subdir" != "$ROOT_DIR/.git" ]]; then + echo "Removing $subdir" + rm -rf "$subdir" + fi + + # Recurse into subdirectories + remove_git_folders "$subdir" + fi + done +} + +# Start the recursive removal from the current directory +remove_git_folders "$ROOT_DIR" diff --git a/eslint.config.mjs b/eslint.config.mjs index 585f3e6c..c08353d3 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -19,7 +19,7 @@ export default [ '**/webpack.config.js', '**/postcss.config.js', '**/tailwind.config.js', - '**/stylelint.config.js' + '**/stylelint.config.json' ] } ] diff --git a/examples/chatgpt/.env.example b/examples/action-chatgpt/.env.example similarity index 100% rename from examples/chatgpt/.env.example rename to examples/action-chatgpt/.env.example diff --git a/examples/chatgpt/.gitignore b/examples/action-chatgpt/.gitignore similarity index 100% rename from examples/chatgpt/.gitignore rename to examples/action-chatgpt/.gitignore diff --git a/examples/action-chatgpt/action/ActionApp.tsx b/examples/action-chatgpt/action/ActionApp.tsx new file mode 100644 index 00000000..07f355bd --- /dev/null +++ b/examples/action-chatgpt/action/ActionApp.tsx @@ -0,0 +1,116 @@ +import {useState, type FormEvent} from 'react' +import OpenAI from 'openai' +import chatgptLogo from '../images/chatgpt.png' +import extensionJsLogo from '../images/extension_128.png' + +const openai = new OpenAI({ + apiKey: process.env.EXTENSION_OPENAI_API_KEY!, + dangerouslyAllowBrowser: true +}) + +interface Message { + content: string + role: 'user' | 'assistant' +} + +function ActionApp() { + const [messages, setMessages] = useState([ + { + content: + 'Hello there! This is your ChatGPT extension sample, ' + + 'built with React, Tailwind.css, and DaisyUI. ' + + 'For it to work, create a .env file with your EXTENSION_OPENAI_API_KEY. ' + + "You can get an API key from OpenAI's website????", + role: 'assistant' + }, + { + content: 'https://platform.openai.com/api-keys', + role: 'assistant' + } + ]) + + const [isTyping, setIsTyping] = useState(false) + + const handleSubmit = async (e: FormEvent) => { + e.preventDefault() + + const form = e.target as HTMLFormElement + const input = form[0] as HTMLInputElement + + const newMessage: Message = { + content: input.value, + role: 'user' + } + + const newMessages = [...messages, newMessage] + + setMessages(newMessages) + setIsTyping(true) + form.reset() + + const completion = await openai.chat.completions.create({ + model: 'gpt-3.5-turbo', + messages: newMessages + }) + + setMessages([...newMessages, completion.choices[0].message as Message]) + setIsTyping(false) + } + + return ( +
+
+
+ {messages.length && + messages.map((msg, i) => ( +
+
+
+ avatar +
+
+
{msg.content}
+
+ ))} +
+ +
+
+ {isTyping && ( + + ChatGPT Extension is typing... + + )} + + + +
+
+
+
+ ) +} + +export default ActionApp diff --git a/examples/chatgpt/action/index.html b/examples/action-chatgpt/action/index.html similarity index 88% rename from examples/chatgpt/action/index.html rename to examples/action-chatgpt/action/index.html index 12494f55..fa6a3dbe 100644 --- a/examples/chatgpt/action/index.html +++ b/examples/action-chatgpt/action/index.html @@ -9,5 +9,5 @@
- + diff --git a/examples/chatgpt/action/scripts.jsx b/examples/action-chatgpt/action/scripts.tsx similarity index 98% rename from examples/chatgpt/action/scripts.jsx rename to examples/action-chatgpt/action/scripts.tsx index 7d2aecdf..7bf04819 100644 --- a/examples/chatgpt/action/scripts.jsx +++ b/examples/action-chatgpt/action/scripts.tsx @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom/client' import ActionApp from './ActionApp' import './styles.css' -const root = ReactDOM.createRoot(document.getElementById('root')) +const root = ReactDOM.createRoot(document.getElementById('root')!) root.render( diff --git a/examples/chatgpt/action/styles.css b/examples/action-chatgpt/action/styles.css similarity index 100% rename from examples/chatgpt/action/styles.css rename to examples/action-chatgpt/action/styles.css diff --git a/examples/action-chatgpt/extension-env.d.ts b/examples/action-chatgpt/extension-env.d.ts new file mode 100644 index 00000000..242b2bb9 --- /dev/null +++ b/examples/action-chatgpt/extension-env.d.ts @@ -0,0 +1,9 @@ +// Required Extension.js types for TypeScript projects. +// This file is auto-generated and should not be excluded. +// If you need extra types, consider creating a new *.d.ts and +// referencing it in the "include" array of your tsconfig.json file. +// See https://www.typescriptlang.org/tsconfig#include for info. +/// + +// Polyfill types for browser.* APIs. +/// diff --git a/examples/chatgpt/images/chatgpt.png b/examples/action-chatgpt/images/chatgpt.png similarity index 100% rename from examples/chatgpt/images/chatgpt.png rename to examples/action-chatgpt/images/chatgpt.png diff --git a/examples/action/images/extension.png b/examples/action-chatgpt/images/extension.png similarity index 100% rename from examples/action/images/extension.png rename to examples/action-chatgpt/images/extension.png diff --git a/examples/action-chatgpt/images/extension_128.png b/examples/action-chatgpt/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/action-chatgpt/images/extension_128.png differ diff --git a/examples/action-chatgpt/images/extension_16.png b/examples/action-chatgpt/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/action-chatgpt/images/extension_16.png differ diff --git a/examples/action-chatgpt/images/extension_48.png b/examples/action-chatgpt/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/action-chatgpt/images/extension_48.png differ diff --git a/examples/action-chatgpt/manifest.json b/examples/action-chatgpt/manifest.json new file mode 100644 index 00000000..3dd9485f --- /dev/null +++ b/examples/action-chatgpt/manifest.json @@ -0,0 +1,20 @@ +{ + "manifest_version": 3, + "version": "0.0.1", + "name": "Action ChatGPT Template", + "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, + "action": { + "default_icon": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, + "default_title": "ChatGPT", + "default_popup": "action/index.html" + } +} diff --git a/examples/chatgpt/package.json b/examples/action-chatgpt/package.json similarity index 54% rename from examples/chatgpt/package.json rename to examples/action-chatgpt/package.json index 336e244e..bc943b6b 100644 --- a/examples/chatgpt/package.json +++ b/examples/action-chatgpt/package.json @@ -1,11 +1,6 @@ { - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/chatgpt" - }, - "name": "chatgpt", + "private": true, + "name": "action-chatgpt", "description": "An Extension.js example.", "version": "0.0.1", "author": { @@ -13,16 +8,7 @@ "email": "boss@cezaraugusto.net", "url": "https://cezaraugusto.com" }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ], + "license": "MIT", "dependencies": { "daisyui": "^4.12.10", "openai": "^4.54.0", @@ -32,6 +18,7 @@ }, "devDependencies": { "@types/react": "^18.0.9", - "@types/react-dom": "^18.0.5" + "@types/react-dom": "^18.0.5", + "typescript": "5.3.3" } } diff --git a/examples/chatgpt/postcss.config.js b/examples/action-chatgpt/postcss.config.js similarity index 100% rename from examples/chatgpt/postcss.config.js rename to examples/action-chatgpt/postcss.config.js diff --git a/programs/create/templates/preact-typescript/template/tailwind.config.js b/examples/action-chatgpt/tailwind.config.js similarity index 80% rename from programs/create/templates/preact-typescript/template/tailwind.config.js rename to examples/action-chatgpt/tailwind.config.js index 069e1bc3..d517259d 100644 --- a/programs/create/templates/preact-typescript/template/tailwind.config.js +++ b/examples/action-chatgpt/tailwind.config.js @@ -4,5 +4,5 @@ module.exports = { theme: { extend: {} }, - plugins: [] + plugins: [require('daisyui')] } diff --git a/programs/create/templates/react-typescript/template/tsconfig.json b/examples/action-chatgpt/tsconfig.json similarity index 73% rename from programs/create/templates/react-typescript/template/tsconfig.json rename to examples/action-chatgpt/tsconfig.json index 520f3602..141572c3 100644 --- a/programs/create/templates/react-typescript/template/tsconfig.json +++ b/examples/action-chatgpt/tsconfig.json @@ -4,14 +4,17 @@ "allowSyntheticDefaultImports": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, - "isolatedModules": false, + "isolatedModules": true, "jsx": "react-jsx", "lib": ["dom", "dom.iterable", "esnext"], "moduleResolution": "node", "module": "esnext", "resolveJsonModule": true, "strict": true, - "target": "esnext" + "target": "esnext", + "verbatimModuleSyntax": true, + "useDefineForClassFields": true, + "skipLibCheck": true }, "include": ["./"], "exclude": ["node_modules", "dist"] diff --git a/examples/action/action/index.html b/examples/action/action/index.html index c2f3fd9d..b21c5ba7 100644 --- a/examples/action/action/index.html +++ b/examples/action/action/index.html @@ -21,7 +21,7 @@

The Extension logo @@ -29,7 +29,7 @@

Welcome to your Action Extension

- Learn more about creating browser extensions at + Learn more about creating cross-browser extensions at https://extension.js.org. diff --git a/examples/action/action/styles.css b/examples/action/action/styles.css index 23165ffb..a902761c 100644 --- a/examples/action/action/styles.css +++ b/examples/action/action/styles.css @@ -3,6 +3,7 @@ body { justify-content: center; align-items: center; width: 300px; + padding: 2em; } h1 { @@ -10,11 +11,6 @@ h1 { } .action { - border-radius: 24px; - border: 4px solid; - background: white; - border-color: #ccc; - border-radius: 24px; filter: grayscale(1); transition: filter 2s, diff --git a/examples/action/images/extension_128.png b/examples/action/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/action/images/extension_128.png differ diff --git a/examples/action/images/extension_16.png b/examples/action/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/action/images/extension_16.png differ diff --git a/examples/action/images/extension_48.png b/examples/action/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/action/images/extension_48.png differ diff --git a/examples/action/images/icons/icon_16.png b/examples/action/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/action/images/icons/icon_16.png and /dev/null differ diff --git a/examples/action/images/icons/icon_48.png b/examples/action/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/action/images/icons/icon_48.png and /dev/null differ diff --git a/examples/action/manifest.json b/examples/action/manifest.json index 9727f0b0..ac1ff93e 100644 --- a/examples/action/manifest.json +++ b/examples/action/manifest.json @@ -1,16 +1,20 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "action", + "name": "Action Template", "description": "An Extension.js example.", - "author": "Cezar Augusto", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "action": { "default_popup": "action/index.html", "default_title": "Action", "default_icon": { - "16": "test_16.png", - "48": "test_48.png", - "128": "public/icon.png" + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" } } } diff --git a/examples/action/package.json b/examples/action/package.json index 93122605..739f6573 100644 --- a/examples/action/package.json +++ b/examples/action/package.json @@ -1,11 +1,5 @@ { "private": true, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/extension-js/extension.git", - "directory": "examples/action" - }, "name": "action", "description": "An Extension.js example.", "version": "0.0.1", @@ -14,10 +8,5 @@ "email": "boss@cezaraugusto.net", "url": "https://cezaraugusto.com" }, - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] + "license": "MIT" } diff --git a/examples/action/public/icon.png b/examples/action/public/icon.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/action/public/icon.png and /dev/null differ diff --git a/examples/action/puzzle.png b/examples/action/puzzle.png deleted file mode 100644 index bed9389a..00000000 Binary files a/examples/action/puzzle.png and /dev/null differ diff --git a/examples/action/test_16.png b/examples/action/test_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/action/test_16.png and /dev/null differ diff --git a/examples/action/test_32.png b/examples/action/test_32.png deleted file mode 100644 index a411754c..00000000 Binary files a/examples/action/test_32.png and /dev/null differ diff --git a/examples/action/test_48.png b/examples/action/test_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/action/test_48.png and /dev/null differ diff --git a/examples/action/test_64.png b/examples/action/test_64.png deleted file mode 100644 index 53aea884..00000000 Binary files a/examples/action/test_64.png and /dev/null differ diff --git a/examples/chatgpt/action/ActionApp.jsx b/examples/chatgpt/action/ActionApp.jsx deleted file mode 100644 index 5da61afb..00000000 --- a/examples/chatgpt/action/ActionApp.jsx +++ /dev/null @@ -1,91 +0,0 @@ -import { useState } from 'react'; -import OpenAI from "openai"; -import chatgptLogo from '../images/chatgpt.png' -import extensionJsLogo from '../images/extension.png' - -const openai = new OpenAI({ - apiKey: process.env.EXTENSION_OPENAI_API_KEY, - dangerouslyAllowBrowser: true, -}); - -function ActionApp() { - const [messages, setMessages] = useState([ - { - content: ( - "Hello there! This is your ChatGPT extension sample, " + - "built with React, Tailwind.css, and DaisyUI. " + - "For it to work, create a .env file with your EXTENSION_OPENAI_API_KEY. " + - "You can get an API key from OpenAI's website." - ), - role: "assistant" - }, - { - content: "https://platform.openai.com/api-keys", - role: "assistant" - }, - ]); - - const [isTyping, setIsTyping] = useState(false); - - - const handleSubmit = async (e) => { - e.preventDefault(); - - const newMessage = { - content: e.target[0].value, - role: "user" - } - - const newMessages = [...messages, newMessage]; - - setMessages(newMessages); - setIsTyping(true); - e.target.reset(); - - const completion = await openai.chat.completions.create({ - model: "gpt-3.5-turbo", - messages: [...newMessages], - }); - - setMessages([...newMessages, completion.choices[0].message]); - setIsTyping(false); - } - - return ( -

-
-
- { - messages.length && messages.map((msg, i) => { - return ( -
-
-
- -
-
-
{msg.content}
-
- ) - }) - } -
- -
handleSubmit(e)}> -
- {isTyping && ChatGPT Extension is typing...} - - - -
-
-
-
- ); -} - -export default ActionApp; \ No newline at end of file diff --git a/examples/chatgpt/images/extension.png b/examples/chatgpt/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/examples/chatgpt/images/extension.png and /dev/null differ diff --git a/examples/chatgpt/images/icons/icon_16.png b/examples/chatgpt/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/chatgpt/images/icons/icon_16.png and /dev/null differ diff --git a/examples/chatgpt/images/icons/icon_48.png b/examples/chatgpt/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/chatgpt/images/icons/icon_48.png and /dev/null differ diff --git a/examples/chatgpt/manifest.json b/examples/chatgpt/manifest.json deleted file mode 100644 index aa4f4e8c..00000000 --- a/examples/chatgpt/manifest.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "manifest_version": 3, - "version": "0.0.1", - "name": "chatgpt", - "description": "An Extension.js example.", - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - }, - "action": { - "default_icon": { - "16": "images/chatgpt.png", - "24": "images/chatgpt.png", - "32": "images/chatgpt.png" - }, - "default_title": "ChatGPT", - "default_popup": "action/index.html" - } -} diff --git a/examples/chatgpt/tailwind.config.js b/examples/chatgpt/tailwind.config.js deleted file mode 100644 index c92094be..00000000 --- a/examples/chatgpt/tailwind.config.js +++ /dev/null @@ -1,8 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: ['**/*.html', '**/*.jsx'], - theme: { - extend: {} - }, - plugins: [require('daisyui')] -} diff --git a/examples/config-babel/images/extension.png b/examples/config-babel/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/examples/config-babel/images/extension.png and /dev/null differ diff --git a/examples/config-babel/images/extension_128.png b/examples/config-babel/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/config-babel/images/extension_128.png differ diff --git a/examples/config-babel/images/extension_16.png b/examples/config-babel/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/config-babel/images/extension_16.png differ diff --git a/examples/config-babel/images/extension_48.png b/examples/config-babel/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/config-babel/images/extension_48.png differ diff --git a/examples/config-babel/images/icons/icon_16.png b/examples/config-babel/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/config-babel/images/icons/icon_16.png and /dev/null differ diff --git a/examples/config-babel/images/icons/icon_48.png b/examples/config-babel/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/config-babel/images/icons/icon_48.png and /dev/null differ diff --git a/examples/config-babel/manifest.json b/examples/config-babel/manifest.json index 1e041f1f..cd570c18 100644 --- a/examples/config-babel/manifest.json +++ b/examples/config-babel/manifest.json @@ -1,8 +1,13 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "config-babel", + "name": "Config Babel Template", "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "chrome_url_overrides": { "newtab": "newtab/index.html" } diff --git a/examples/config-babel/newtab/index.html b/examples/config-babel/newtab/index.html index d3236715..fae57949 100644 --- a/examples/config-babel/newtab/index.html +++ b/examples/config-babel/newtab/index.html @@ -29,7 +29,7 @@

Welcome to your Babel Extension

- Learn more about creating browser extensions at + Learn more about creating cross-browser extensions at https://extension.js.org. diff --git a/examples/config-babel/package.json b/examples/config-babel/package.json index c03298ff..a5881a38 100644 --- a/examples/config-babel/package.json +++ b/examples/config-babel/package.json @@ -1,15 +1,14 @@ { - "devDependencies": { - "extension": "latest", - "stylelint": "^16.7.0" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "name": "config-babel", "private": true, + "name": "config-babel", + "description": "An Extension.js example.", "version": "0.0.1", - "description": "An Extension.js example." + "author": { + "name": "Cezar Augusto", + "email": "boss@cezaraugusto.net", + "url": "https://cezaraugusto.com" + }, + "devDependencies": { + "stylelint": "^16.7.0" + } } diff --git a/examples/config-stylelint/images/extension_128.png b/examples/config-stylelint/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/config-stylelint/images/extension_128.png differ diff --git a/examples/config-stylelint/images/extension_16.png b/examples/config-stylelint/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/config-stylelint/images/extension_16.png differ diff --git a/examples/config-stylelint/images/extension_48.png b/examples/config-stylelint/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/config-stylelint/images/extension_48.png differ diff --git a/examples/config-stylelint/images/icons/icon_16.png b/examples/config-stylelint/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/config-stylelint/images/icons/icon_16.png and /dev/null differ diff --git a/examples/config-stylelint/images/icons/icon_48.png b/examples/config-stylelint/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/config-stylelint/images/icons/icon_48.png and /dev/null differ diff --git a/examples/config-stylelint/manifest.json b/examples/config-stylelint/manifest.json index b8ba18f0..fac9f52b 100644 --- a/examples/config-stylelint/manifest.json +++ b/examples/config-stylelint/manifest.json @@ -1,8 +1,13 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "config-stylelint", + "name": "Config Stylelint Template", "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "chrome_url_overrides": { "newtab": "newtab/index.html" } diff --git a/examples/config-stylelint/newtab/index.html b/examples/config-stylelint/newtab/index.html index e5e30118..f046481e 100644 --- a/examples/config-stylelint/newtab/index.html +++ b/examples/config-stylelint/newtab/index.html @@ -29,7 +29,7 @@

Welcome to your Stylelint Extension

- Learn more about creating browser extensions at + Learn more about creating cross-browser extensions at https://extension.js.org. diff --git a/examples/config-stylelint/package.json b/examples/config-stylelint/package.json index 0b9c9c89..a9725e53 100644 --- a/examples/config-stylelint/package.json +++ b/examples/config-stylelint/package.json @@ -1,17 +1,18 @@ { - "devDependencies": { - "extension": "latest", - "stylelint": "^16.7.0", - "stylelint-config-standard": "^36.0.1" + "private": true, + "name": "config-stylelint", + "description": "An Extension.js example.", + "version": "0.0.1", + "author": { + "name": "Cezar Augusto", + "email": "boss@cezaraugusto.net", + "url": "https://cezaraugusto.com" }, "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build", "lint:css": "stylelint '**/*.css'" }, - "name": "config-stylelint", - "private": true, - "version": "0.0.1", - "description": "An Extension.js example." + "devDependencies": { + "stylelint": "^16.7.0", + "stylelint-config-standard": "^36.0.1" + } } diff --git a/examples/config-stylelint/.stylelintrc.json b/examples/config-stylelint/stylelint.config.json similarity index 100% rename from examples/config-stylelint/.stylelintrc.json rename to examples/config-stylelint/stylelint.config.json diff --git a/examples/content-css-module/content/Logo.module.css b/examples/content-css-module/content/Logo.module.css index abc7cf93..86b952a7 100644 --- a/examples/content-css-module/content/Logo.module.css +++ b/examples/content-css-module/content/Logo.module.css @@ -1,18 +1,11 @@ .logo { - background: white; width: 90px; align-self: flex-start; - border: 4px solid; - border-color: #ccc; - border-radius: 24px; filter: grayscale(1); - transition: - filter 2s, - border-color 2s; + transition: filter 2s; } .logo:hover { filter: grayscale(0); - border-color: aquamarine; } diff --git a/examples/content-css-module/content/scripts.js b/examples/content-css-module/content/scripts.js index 4dd3a994..5c44a036 100644 --- a/examples/content-css-module/content/scripts.js +++ b/examples/content-css-module/content/scripts.js @@ -1,4 +1,4 @@ -import extensionJsLogo from '../images/extension.png' +import extensionJsLogo from '../images/extension_128.png' import './styles.css' import styles from './Logo.module.css' diff --git a/examples/content-css-module/images/extension.png b/examples/content-css-module/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/examples/content-css-module/images/extension.png and /dev/null differ diff --git a/examples/content-css-module/images/extension_128.png b/examples/content-css-module/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/content-css-module/images/extension_128.png differ diff --git a/examples/content-css-module/images/extension_16.png b/examples/content-css-module/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/content-css-module/images/extension_16.png differ diff --git a/examples/content-css-module/images/extension_48.png b/examples/content-css-module/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/content-css-module/images/extension_48.png differ diff --git a/examples/content-css-module/images/icons/icon_16.png b/examples/content-css-module/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/content-css-module/images/icons/icon_16.png and /dev/null differ diff --git a/examples/content-css-module/images/icons/icon_48.png b/examples/content-css-module/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/content-css-module/images/icons/icon_48.png and /dev/null differ diff --git a/examples/content-css-module/manifest.json b/examples/content-css-module/manifest.json index 04df13e2..c26c9003 100644 --- a/examples/content-css-module/manifest.json +++ b/examples/content-css-module/manifest.json @@ -1,8 +1,13 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "content-css-module", + "name": "Content CSS Module Template", "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "permissions": ["activeTab", "scripting"], "host_permissions": [""], "background": { diff --git a/examples/content-css-module/package.json b/examples/content-css-module/package.json index 648467df..081b6288 100644 --- a/examples/content-css-module/package.json +++ b/examples/content-css-module/package.json @@ -1,15 +1,11 @@ { - "devDependencies": { - "extension": "latest" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "content-css-module", "private": true, + "name": "content-css-module", + "description": "An Extension.js example.", "version": "0.0.1", - "description": "An Extension.js example." + "author": { + "name": "Cezar Augusto", + "email": "boss@cezaraugusto.net", + "url": "https://cezaraugusto.com" + } } diff --git a/examples/content-less/content/scripts.js b/examples/content-less/content/scripts.js index 9396de64..1586b0f2 100644 --- a/examples/content-less/content/scripts.js +++ b/examples/content-less/content/scripts.js @@ -1,4 +1,4 @@ -import extensionJsLogo from '../images/extension.png' +import extensionJsLogo from '../images/extension_128.png' import './styles.less' console.log('hello from content_scripts') diff --git a/examples/content-less/content/styles.less b/examples/content-less/content/styles.less index d5243e3b..219a7115 100644 --- a/examples/content-less/content/styles.less +++ b/examples/content-less/content/styles.less @@ -17,21 +17,14 @@ } .content_script-logo { - background: white; width: 90px; align-self: flex-start; - border: 4px solid; - border-color: #ccc; - border-radius: 24px; filter: grayscale(1); - transition: - filter 2s, - border-color 2s; + transition: filter 2s; } .content_script-logo:hover { filter: grayscale(0); - border-color: aquamarine; } .content_script-title { diff --git a/examples/content-less/images/extension.png b/examples/content-less/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/examples/content-less/images/extension.png and /dev/null differ diff --git a/examples/content-less/images/extension_128.png b/examples/content-less/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/content-less/images/extension_128.png differ diff --git a/examples/content-less/images/extension_16.png b/examples/content-less/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/content-less/images/extension_16.png differ diff --git a/examples/content-less/images/extension_48.png b/examples/content-less/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/content-less/images/extension_48.png differ diff --git a/examples/content-less/images/icons/icon_16.png b/examples/content-less/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/content-less/images/icons/icon_16.png and /dev/null differ diff --git a/examples/content-less/images/icons/icon_48.png b/examples/content-less/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/content-less/images/icons/icon_48.png and /dev/null differ diff --git a/examples/content-less/manifest.json b/examples/content-less/manifest.json index 695b749c..2d66563e 100644 --- a/examples/content-less/manifest.json +++ b/examples/content-less/manifest.json @@ -1,8 +1,13 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "content-less", + "name": "Content Scripts Less Template", "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "permissions": ["activeTab", "scripting"], "host_permissions": [""], "background": { diff --git a/examples/content-less/package.json b/examples/content-less/package.json index 98e01c65..20c95b5d 100644 --- a/examples/content-less/package.json +++ b/examples/content-less/package.json @@ -1,16 +1,14 @@ { - "devDependencies": { - "extension": "latest", - "less": "^4.2.0" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "content-less", "private": true, + "name": "content-less", + "description": "An Extension.js example.", "version": "0.0.1", - "description": "An Extension.js example." + "author": { + "name": "Cezar Augusto", + "email": "boss@cezaraugusto.net", + "url": "https://cezaraugusto.com" + }, + "devDependencies": { + "less": "^4.2.0" + } } diff --git a/examples/content-main-world/background.js b/examples/content-main-world/background.js index bfd9ec37..8c694999 100644 --- a/examples/content-main-world/background.js +++ b/examples/content-main-world/background.js @@ -1,5 +1,3 @@ -console.log('hello from background script') - chrome.runtime.onMessage.addListener((request, sender) => { if (request.action === 'changeBackgroundColor') { changeBackgroundColor(request.color, sender.tab.id) diff --git a/examples/content-main-world/content/scripts.js b/examples/content-main-world/content/scripts.js index 3e579fb7..e7e9902c 100644 --- a/examples/content-main-world/content/scripts.js +++ b/examples/content-main-world/content/scripts.js @@ -1,4 +1,4 @@ -import extensionJsLogo from '../images/extension.png' +import extensionJsLogo from '../images/extension_128.png' import './styles.css' console.log('hello from content_scripts') diff --git a/examples/content-main-world/content/styles.css b/examples/content-main-world/content/styles.css index d5243e3b..219a7115 100644 --- a/examples/content-main-world/content/styles.css +++ b/examples/content-main-world/content/styles.css @@ -17,21 +17,14 @@ } .content_script-logo { - background: white; width: 90px; align-self: flex-start; - border: 4px solid; - border-color: #ccc; - border-radius: 24px; filter: grayscale(1); - transition: - filter 2s, - border-color 2s; + transition: filter 2s; } .content_script-logo:hover { filter: grayscale(0); - border-color: aquamarine; } .content_script-title { diff --git a/examples/content-main-world/images/extension.png b/examples/content-main-world/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/examples/content-main-world/images/extension.png and /dev/null differ diff --git a/examples/content-main-world/images/extension_128.png b/examples/content-main-world/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/content-main-world/images/extension_128.png differ diff --git a/examples/content-main-world/images/extension_16.png b/examples/content-main-world/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/content-main-world/images/extension_16.png differ diff --git a/examples/content-main-world/images/extension_48.png b/examples/content-main-world/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/content-main-world/images/extension_48.png differ diff --git a/examples/content-main-world/images/icons/icon_16.png b/examples/content-main-world/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/content-main-world/images/icons/icon_16.png and /dev/null differ diff --git a/examples/content-main-world/images/icons/icon_48.png b/examples/content-main-world/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/content-main-world/images/icons/icon_48.png and /dev/null differ diff --git a/examples/content-main-world/manifest.json b/examples/content-main-world/manifest.json index 83f0dcc8..c05ff2a4 100644 --- a/examples/content-main-world/manifest.json +++ b/examples/content-main-world/manifest.json @@ -1,8 +1,14 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "content-main-world", + "name": "Content Scripts Main World", + "id": "phfmcihmgbbaemimookenmjjkoicadnb", "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "permissions": ["activeTab", "scripting"], "host_permissions": [""], "background": { diff --git a/examples/content-main-world/package.json b/examples/content-main-world/package.json index 71a87473..d30f4bda 100644 --- a/examples/content-main-world/package.json +++ b/examples/content-main-world/package.json @@ -1,15 +1,11 @@ { - "devDependencies": { - "extension": "latest" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, + "private": true, "name": "content-main-world", "description": "An Extension.js example.", - "private": true, - "version": "0.0.1" + "version": "0.0.1", + "author": { + "name": "Cezar Augusto", + "email": "boss@cezaraugusto.net", + "url": "https://cezaraugusto.com" + } } diff --git a/examples/content-preact/images/extension_128.png b/examples/content-preact/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/content-preact/images/extension_128.png differ diff --git a/examples/content-preact/images/extension_16.png b/examples/content-preact/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/content-preact/images/extension_16.png differ diff --git a/examples/content-preact/images/extension_48.png b/examples/content-preact/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/content-preact/images/extension_48.png differ diff --git a/examples/content-preact/images/icons/icon_16.png b/examples/content-preact/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/content-preact/images/icons/icon_16.png and /dev/null differ diff --git a/examples/content-preact/images/icons/icon_48.png b/examples/content-preact/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/content-preact/images/icons/icon_48.png and /dev/null differ diff --git a/examples/content-preact/manifest.json b/examples/content-preact/manifest.json index bf6a1624..e6e461c4 100644 --- a/examples/content-preact/manifest.json +++ b/examples/content-preact/manifest.json @@ -1,8 +1,13 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "content-preact", + "name": "Content Scripts Preact", "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "background": { "chromium:service_worker": "background.ts", "firefox:scripts": ["background.ts"] @@ -13,9 +18,5 @@ "js": ["./content/scripts.tsx"], "css": ["./content/styles.css"] } - ], - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - } + ] } diff --git a/examples/content-preact/package.json b/examples/content-preact/package.json index 1cde55cd..2c0df32e 100644 --- a/examples/content-preact/package.json +++ b/examples/content-preact/package.json @@ -1,10 +1,5 @@ { - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/preact-typescript" - }, + "private": true, "name": "content-preact", "description": "An Extension.js example.", "version": "0.0.1", @@ -13,16 +8,7 @@ "email": "zxin088@gmail.com", "url": "https://hw404.cn" }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ], + "license": "MIT", "dependencies": { "@preact/signals": "^1.2.3", "preact": "^10.22.0", diff --git a/examples/content-react/content/ContentApp.tsx b/examples/content-react/content/ContentApp.tsx index 0fb6dc1a..245ca43e 100644 --- a/examples/content-react/content/ContentApp.tsx +++ b/examples/content-react/content/ContentApp.tsx @@ -1,5 +1,5 @@ import React from 'react' -import ReactLogo from '../images/logo.svg' +import reactLogo from '../images/react.png' import tailwindBg from '../images/tailwind_bg.png' import typescriptLogo from '../images/typescript.png' import tailwindLogo from '../images/tailwind.png' @@ -38,7 +38,11 @@ export default function ContentApp() {

- + React logo
+
TypeScript logo - React Logo - - - - - - - diff --git a/programs/cli/spec/fixtures/react-typescript/images/react.png b/examples/content-react/images/react.png similarity index 100% rename from programs/cli/spec/fixtures/react-typescript/images/react.png rename to examples/content-react/images/react.png diff --git a/examples/content-react/manifest.json b/examples/content-react/manifest.json index d3787e66..c2c459d6 100644 --- a/examples/content-react/manifest.json +++ b/examples/content-react/manifest.json @@ -1,8 +1,13 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "content-react", + "name": "Content Scripts React", "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "background": { "chromium:service_worker": "background.ts", "firefox:scripts": ["background.ts"] @@ -12,9 +17,5 @@ "matches": ["https://extension.js.org/*"], "js": ["./content/scripts.tsx"] } - ], - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - } + ] } diff --git a/examples/content-react/package.json b/examples/content-react/package.json index bf89c42f..e1da718f 100644 --- a/examples/content-react/package.json +++ b/examples/content-react/package.json @@ -1,10 +1,5 @@ { - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/react-typescript" - }, + "private": true, "name": "content-react", "description": "An Extension.js example.", "version": "0.0.1", @@ -13,16 +8,7 @@ "email": "boss@cezaraugusto.net", "url": "https://cezaraugusto.com" }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ], + "license": "MIT", "dependencies": { "react": "^18.1.0", "react-dom": "^18.1.0", diff --git a/examples/content-sass-module/content/Logo.module.css b/examples/content-sass-module/content/Logo.module.scss similarity index 100% rename from examples/content-sass-module/content/Logo.module.css rename to examples/content-sass-module/content/Logo.module.scss diff --git a/examples/content-sass-module/content/scripts.js b/examples/content-sass-module/content/scripts.js index 4dd3a994..0656e159 100644 --- a/examples/content-sass-module/content/scripts.js +++ b/examples/content-sass-module/content/scripts.js @@ -1,6 +1,6 @@ -import extensionJsLogo from '../images/extension.png' -import './styles.css' -import styles from './Logo.module.css' +import extensionJsLogo from '../images/extension_128.png' +import './styles.scss' +import styles from './Logo.module.scss' console.log('hello from content_scripts') diff --git a/examples/content-sass-module/content/styles.css b/examples/content-sass-module/content/styles.scss similarity index 100% rename from examples/content-sass-module/content/styles.css rename to examples/content-sass-module/content/styles.scss diff --git a/examples/content-sass-module/images/extension.png b/examples/content-sass-module/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/examples/content-sass-module/images/extension.png and /dev/null differ diff --git a/examples/content-sass-module/images/extension_128.png b/examples/content-sass-module/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/content-sass-module/images/extension_128.png differ diff --git a/examples/content-sass-module/images/extension_16.png b/examples/content-sass-module/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/content-sass-module/images/extension_16.png differ diff --git a/examples/content-sass-module/images/extension_48.png b/examples/content-sass-module/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/content-sass-module/images/extension_48.png differ diff --git a/examples/content-sass-module/images/icons/icon_16.png b/examples/content-sass-module/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/content-sass-module/images/icons/icon_16.png and /dev/null differ diff --git a/examples/content-sass-module/images/icons/icon_48.png b/examples/content-sass-module/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/content-sass-module/images/icons/icon_48.png and /dev/null differ diff --git a/examples/content-sass-module/manifest.json b/examples/content-sass-module/manifest.json index 252d3734..c8a07084 100644 --- a/examples/content-sass-module/manifest.json +++ b/examples/content-sass-module/manifest.json @@ -1,8 +1,13 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "content-sass-module", + "name": "Content Scripts SASS Module", "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "permissions": ["activeTab", "scripting"], "host_permissions": [""], "background": { diff --git a/examples/content-sass-module/package.json b/examples/content-sass-module/package.json index 8b611311..a7bb0bdd 100644 --- a/examples/content-sass-module/package.json +++ b/examples/content-sass-module/package.json @@ -1,16 +1,14 @@ { - "devDependencies": { - "extension": "latest", - "sass": "^1.77.8" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "content-sass-module", "private": true, + "name": "content-sass-module", + "description": "An Extension.js example.", "version": "0.0.1", - "description": "An Extension.js example." + "author": { + "name": "Cezar Augusto", + "email": "boss@cezaraugusto.net", + "url": "https://cezaraugusto.com" + }, + "devDependencies": { + "sass": "^1.77.8" + } } diff --git a/examples/content-sass/content/scripts.js b/examples/content-sass/content/scripts.js index 4b8f752d..d3f07cf5 100644 --- a/examples/content-sass/content/scripts.js +++ b/examples/content-sass/content/scripts.js @@ -1,4 +1,4 @@ -import extensionJsLogo from '../images/extension.png' +import extensionJsLogo from '../images/extension_128.png' import './styles.scss' console.log('hello from content_scripts') diff --git a/examples/content-sass/content/styles.scss b/examples/content-sass/content/styles.scss index d5243e3b..219a7115 100644 --- a/examples/content-sass/content/styles.scss +++ b/examples/content-sass/content/styles.scss @@ -17,21 +17,14 @@ } .content_script-logo { - background: white; width: 90px; align-self: flex-start; - border: 4px solid; - border-color: #ccc; - border-radius: 24px; filter: grayscale(1); - transition: - filter 2s, - border-color 2s; + transition: filter 2s; } .content_script-logo:hover { filter: grayscale(0); - border-color: aquamarine; } .content_script-title { diff --git a/examples/content-sass/images/extension.png b/examples/content-sass/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/examples/content-sass/images/extension.png and /dev/null differ diff --git a/examples/content-sass/images/extension_128.png b/examples/content-sass/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/content-sass/images/extension_128.png differ diff --git a/examples/content-sass/images/extension_16.png b/examples/content-sass/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/content-sass/images/extension_16.png differ diff --git a/examples/content-sass/images/extension_48.png b/examples/content-sass/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/content-sass/images/extension_48.png differ diff --git a/examples/content-sass/images/icons/icon_16.png b/examples/content-sass/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/content-sass/images/icons/icon_16.png and /dev/null differ diff --git a/examples/content-sass/images/icons/icon_48.png b/examples/content-sass/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/content-sass/images/icons/icon_48.png and /dev/null differ diff --git a/examples/content-sass/manifest.json b/examples/content-sass/manifest.json index e3abd041..ba2db7dc 100644 --- a/examples/content-sass/manifest.json +++ b/examples/content-sass/manifest.json @@ -3,6 +3,11 @@ "version": "0.0.1", "name": "content-sass", "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "permissions": ["activeTab", "scripting"], "host_permissions": [""], "background": { diff --git a/examples/content-sass/package.json b/examples/content-sass/package.json index 7d56d38d..30fd572c 100644 --- a/examples/content-sass/package.json +++ b/examples/content-sass/package.json @@ -1,15 +1,14 @@ { - "devDependencies": { - "extension": "latest", - "sass": "^1.77.8" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "name": "content-sass", "private": true, + "name": "content-sass", + "description": "An Extension.js example.", "version": "0.0.1", - "description": "An Extension.js example." + "author": { + "name": "Cezar Augusto", + "email": "boss@cezaraugusto.net", + "url": "https://cezaraugusto.com" + }, + "devDependencies": { + "sass": "^1.77.8" + } } diff --git a/examples/content-shadow-dom/images/extension_128.png b/examples/content-shadow-dom/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/content-shadow-dom/images/extension_128.png differ diff --git a/examples/content-shadow-dom/images/extension_16.png b/examples/content-shadow-dom/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/content-shadow-dom/images/extension_16.png differ diff --git a/examples/content-shadow-dom/images/extension_48.png b/examples/content-shadow-dom/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/content-shadow-dom/images/extension_48.png differ diff --git a/examples/content-shadow-dom/images/icons/icon_16.png b/examples/content-shadow-dom/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/content-shadow-dom/images/icons/icon_16.png and /dev/null differ diff --git a/examples/content-shadow-dom/images/icons/icon_48.png b/examples/content-shadow-dom/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/content-shadow-dom/images/icons/icon_48.png and /dev/null differ diff --git a/examples/content-shadow-dom/manifest.json b/examples/content-shadow-dom/manifest.json index ef018e29..606c0e3a 100644 --- a/examples/content-shadow-dom/manifest.json +++ b/examples/content-shadow-dom/manifest.json @@ -1,8 +1,13 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "content-shadow-dom", + "name": "Content Scripts Shadow DOM Template", "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "permissions": ["activeTab", "scripting"], "host_permissions": [""], "background": { diff --git a/examples/content-shadow-dom/package.json b/examples/content-shadow-dom/package.json index 7f68b169..1f6028c8 100644 --- a/examples/content-shadow-dom/package.json +++ b/examples/content-shadow-dom/package.json @@ -1,10 +1,5 @@ { - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/content-shadow-dom" - }, + "private": true, "name": "content-shadow-dom", "description": "An Extension.js example.", "version": "0.0.1", @@ -13,16 +8,7 @@ "email": "boss@cezaraugusto.net", "url": "https://cezaraugusto.com" }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ], + "license": "MIT", "dependencies": { "tailwindcss": "^3.4.1" } diff --git a/examples/content-tailwind/images/extension_128.png b/examples/content-tailwind/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/content-tailwind/images/extension_128.png differ diff --git a/examples/content-tailwind/images/extension_16.png b/examples/content-tailwind/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/content-tailwind/images/extension_16.png differ diff --git a/examples/content-tailwind/images/extension_48.png b/examples/content-tailwind/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/content-tailwind/images/extension_48.png differ diff --git a/examples/content-tailwind/images/icons/icon_16.png b/examples/content-tailwind/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/content-tailwind/images/icons/icon_16.png and /dev/null differ diff --git a/examples/content-tailwind/images/icons/icon_48.png b/examples/content-tailwind/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/content-tailwind/images/icons/icon_48.png and /dev/null differ diff --git a/examples/content-tailwind/manifest.json b/examples/content-tailwind/manifest.json index b5553bd0..61bc4052 100644 --- a/examples/content-tailwind/manifest.json +++ b/examples/content-tailwind/manifest.json @@ -1,8 +1,13 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "content-tailwind", + "name": "Content Scripts Tailwind Template", "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "permissions": ["activeTab", "scripting"], "host_permissions": [""], "background": { diff --git a/examples/content-tailwind/package.json b/examples/content-tailwind/package.json index afe2828e..12b9cb4f 100644 --- a/examples/content-tailwind/package.json +++ b/examples/content-tailwind/package.json @@ -1,10 +1,5 @@ { - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/tailwind" - }, + "private": true, "name": "content-tailwind", "description": "An Extension.js example.", "version": "0.0.1", @@ -13,16 +8,7 @@ "email": "boss@cezaraugusto.net", "url": "https://cezaraugusto.com" }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ], + "license": "MIT", "dependencies": { "tailwindcss": "^3.4.1" } diff --git a/examples/content-typescript/content/scripts.ts b/examples/content-typescript/content/scripts.ts index 98868399..69ab47b8 100644 --- a/examples/content-typescript/content/scripts.ts +++ b/examples/content-typescript/content/scripts.ts @@ -1,4 +1,4 @@ -import extensionJsLogo from '../images/extension.png' +import extensionJsLogo from '../images/extension_128.png' import './styles.css' console.log('hello from content_scripts') @@ -11,7 +11,7 @@ document.body.innerHTML += `

- Learn more about creating browser extensions at "], "background": { - "chromium:service_worker": "background.js", - "firefox:scripts": ["background.js"] + "chromium:service_worker": "background.ts", + "firefox:scripts": ["background.ts"] }, "content_scripts": [ { diff --git a/examples/content-typescript/package.json b/examples/content-typescript/package.json index 8122d423..9badd88c 100644 --- a/examples/content-typescript/package.json +++ b/examples/content-typescript/package.json @@ -1,15 +1,14 @@ { - "devDependencies": { - "typescript": "5.3.3" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "content-typescript", "private": true, + "name": "content-typescript", + "description": "An Extension.js example.", "version": "0.0.1", - "description": "An Extension.js example." + "author": { + "name": "Cezar Augusto", + "email": "boss@cezaraugusto.net", + "url": "https://cezaraugusto.com" + }, + "devDependencies": { + "typescript": "5.3.3" + } } diff --git a/examples/content-vue/images/extension_128.png b/examples/content-vue/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/content-vue/images/extension_128.png differ diff --git a/examples/content-vue/images/extension_16.png b/examples/content-vue/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/content-vue/images/extension_16.png differ diff --git a/examples/content-vue/images/extension_48.png b/examples/content-vue/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/content-vue/images/extension_48.png differ diff --git a/examples/content-vue/images/icons/icon_16.png b/examples/content-vue/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/content-vue/images/icons/icon_16.png and /dev/null differ diff --git a/examples/content-vue/images/icons/icon_48.png b/examples/content-vue/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/content-vue/images/icons/icon_48.png and /dev/null differ diff --git a/examples/content-vue/manifest.json b/examples/content-vue/manifest.json index f955d58f..69c3b6c1 100644 --- a/examples/content-vue/manifest.json +++ b/examples/content-vue/manifest.json @@ -1,8 +1,13 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "content-vue", + "name": "Content Scripts Vue Template", "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "background": { "chromium:service_worker": "background.ts", "firefox:scripts": ["background.ts"] @@ -13,9 +18,5 @@ "js": ["./content/scripts.ts"], "css": ["./content/styles.css"] } - ], - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - } + ] } diff --git a/examples/content-vue/package.json b/examples/content-vue/package.json index cc2d31a1..0ec2f678 100644 --- a/examples/content-vue/package.json +++ b/examples/content-vue/package.json @@ -1,10 +1,5 @@ { - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/vue-typescript" - }, + "private": true, "name": "content-vue", "description": "An Extension.js example.", "version": "0.0.1", @@ -13,16 +8,7 @@ "email": "zxin088@gmail.com", "url": "https://hw404.cn" }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ], + "license": "MIT", "dependencies": { "vue": "^3.4.27", "tailwindcss": "^3.4.1" diff --git a/examples/content/content/scripts.js b/examples/content/content/scripts.js index 3e579fb7..e7e9902c 100644 --- a/examples/content/content/scripts.js +++ b/examples/content/content/scripts.js @@ -1,4 +1,4 @@ -import extensionJsLogo from '../images/extension.png' +import extensionJsLogo from '../images/extension_128.png' import './styles.css' console.log('hello from content_scripts') diff --git a/examples/content/content/styles.css b/examples/content/content/styles.css index d5243e3b..3e90a639 100644 --- a/examples/content/content/styles.css +++ b/examples/content/content/styles.css @@ -17,12 +17,8 @@ } .content_script-logo { - background: white; width: 90px; align-self: flex-start; - border: 4px solid; - border-color: #ccc; - border-radius: 24px; filter: grayscale(1); transition: filter 2s, diff --git a/examples/content/images/extension.png b/examples/content/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/examples/content/images/extension.png and /dev/null differ diff --git a/examples/content/images/extension_128.png b/examples/content/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/content/images/extension_128.png differ diff --git a/examples/content/images/extension_16.png b/examples/content/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/content/images/extension_16.png differ diff --git a/examples/content/images/extension_48.png b/examples/content/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/content/images/extension_48.png differ diff --git a/examples/content/images/icons/icon_16.png b/examples/content/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/content/images/icons/icon_16.png and /dev/null differ diff --git a/examples/content/images/icons/icon_48.png b/examples/content/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/content/images/icons/icon_48.png and /dev/null differ diff --git a/examples/content/manifest.json b/examples/content/manifest.json index 4f27e046..b2a67c34 100644 --- a/examples/content/manifest.json +++ b/examples/content/manifest.json @@ -1,8 +1,13 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "content", + "name": "Content Scripts Template", "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "permissions": ["activeTab", "scripting"], "host_permissions": [""], "background": { diff --git a/examples/content/package.json b/examples/content/package.json index a0aaca15..6b8f2f38 100644 --- a/examples/content/package.json +++ b/examples/content/package.json @@ -1,15 +1,11 @@ { - "devDependencies": { - "extension": "latest" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "content", "private": true, + "name": "content", + "description": "An Extension.js example.", "version": "0.0.1", - "description": "An Extension.js example." + "author": { + "name": "Cezar Augusto", + "email": "boss@cezaraugusto.net", + "url": "https://cezaraugusto.com" + } } diff --git a/examples/data.ts b/examples/data.ts index 9e371513..0add43ec 100644 --- a/examples/data.ts +++ b/examples/data.ts @@ -27,7 +27,7 @@ const JS_TEMPLATES: Template[] = [ // css: 'css', // hasBackground: false, // hasEnv: false, - // configFiles: ['babel.config.js'] + // configFiles: ['babel.config.json'] // }, // { // name: 'config-extension-config', @@ -46,7 +46,7 @@ const JS_TEMPLATES: Template[] = [ css: 'css', hasBackground: false, hasEnv: false, - configFiles: ['stylelint.config.js'] + configFiles: ['stylelint.config.json'] }, { name: 'content', @@ -120,15 +120,6 @@ const JS_TEMPLATES: Template[] = [ hasEnv: false, configFiles: undefined }, - { - name: 'icons', - uiContext: undefined, - uiFramework: undefined, - css: 'css', - hasBackground: false, - hasEnv: false, - configFiles: undefined - }, { name: 'locales', uiContext: undefined, @@ -138,15 +129,6 @@ const JS_TEMPLATES: Template[] = [ hasEnv: false, configFiles: undefined }, - { - name: 'manager-extension', - uiContext: ['newTab'], - uiFramework: undefined, - css: 'css', - hasBackground: false, - hasEnv: false, - configFiles: undefined - }, { name: 'new-less', uiContext: ['newTab'], @@ -165,15 +147,15 @@ const JS_TEMPLATES: Template[] = [ hasEnv: false, configFiles: undefined }, - { - name: 'sidebar', - uiContext: ['sidebar'], - uiFramework: undefined, - css: 'css', - hasBackground: false, - hasEnv: false, - configFiles: undefined - }, + // { + // name: 'sidebar', + // uiContext: ['sidebar'], + // uiFramework: undefined, + // css: 'css', + // hasBackground: false, + // hasEnv: false, + // configFiles: undefined + // }, { name: 'special-folders-pages', uiContext: undefined, @@ -203,7 +185,7 @@ const JS_TEMPLATES: Template[] = [ } ] -// const WASM_TEMPLATES: Template[]: string[] = [] +const WASM_TEMPLATES: Template[] = [] const TS_TEMPLATES: Template[] = [ { @@ -228,14 +210,13 @@ const TS_TEMPLATES: Template[] = [ const CUSTOM_TEMPLATES: Template[] = [ { - name: 'chatgpt', + name: 'action-chatgpt', uiContext: ['popup'], uiFramework: 'react', css: 'css', hasBackground: false, hasEnv: true, - - configFiles: ['postcss.config.js', 'tailwind.config.js'] + configFiles: ['postcss.config.js', 'tailwind.config.js', 'tsconfig.json'] } ] @@ -305,7 +286,7 @@ const TAILWIND_TEMPLATES: Template[] = [ css: 'css', hasBackground: false, hasEnv: false, - configFiles: ['tailwind.config.js', 'postcss.config.js'] + configFiles: ['tailwind.config.js', 'postcss.config.js', 'tsconfig.json'] }, { name: 'new-tailwind', @@ -314,15 +295,15 @@ const TAILWIND_TEMPLATES: Template[] = [ css: 'css', hasBackground: false, hasEnv: false, - configFiles: ['postcss.config.js', 'tailwind.config.js'] + configFiles: ['postcss.config.js', 'tailwind.config.js', 'tsconfig.json'] } ] const ALL_TEMPLATES: Template[] = [ DEFAULT_TEMPLATE, - ...JS_TEMPLATES - // ...WASM_TEMPLATES, - // ...TS_TEMPLATES, + ...JS_TEMPLATES, + ...WASM_TEMPLATES, + ...TS_TEMPLATES // ...CUSTOM_TEMPLATES, // ...FRAMEWORK_TEMPLATES, // ...TAILWIND_TEMPLATES @@ -338,7 +319,7 @@ export { SUPPORTED_BROWSERS, DEFAULT_TEMPLATE, JS_TEMPLATES, - // WASM_TEMPLATES, + WASM_TEMPLATES, TS_TEMPLATES, CUSTOM_TEMPLATES, FRAMEWORK_TEMPLATES, diff --git a/examples/declarative_net_request/images/extension_128.png b/examples/declarative_net_request/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/declarative_net_request/images/extension_128.png differ diff --git a/examples/declarative_net_request/images/extension_16.png b/examples/declarative_net_request/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/declarative_net_request/images/extension_16.png differ diff --git a/examples/declarative_net_request/images/extension_48.png b/examples/declarative_net_request/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/declarative_net_request/images/extension_48.png differ diff --git a/examples/declarative_net_request/manifest.json b/examples/declarative_net_request/manifest.json index 2e4dfb97..451ea306 100644 --- a/examples/declarative_net_request/manifest.json +++ b/examples/declarative_net_request/manifest.json @@ -1,8 +1,13 @@ { - "name": "declarative_net_request", + "name": "Declarative Net Request Template", "version": "0.0.1", "manifest_version": 3, "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "declarative_net_request": { "rule_resources": [ { diff --git a/examples/declarative_net_request/package.json b/examples/declarative_net_request/package.json index 7dc2e681..7ab313f2 100644 --- a/examples/declarative_net_request/package.json +++ b/examples/declarative_net_request/package.json @@ -1,11 +1,5 @@ { "private": true, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/extension-js/extension.git", - "directory": "examples/declarative_net_request" - }, "name": "declarative_net_request", "description": "An Extension.js example.", "version": "0.0.1", @@ -14,10 +8,5 @@ "email": "boss@cezaraugusto.net", "url": "https://cezaraugusto.com" }, - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] + "license": "MIT" } diff --git a/examples/init/icons/.gitignore b/examples/init/icons/.gitignore deleted file mode 100644 index e6a7fd61..00000000 --- a/examples/init/icons/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# lock files -yarn.lock -package-lock.json diff --git a/examples/init/icons/manifest.json b/examples/init/icons/manifest.json deleted file mode 100644 index feab76c3..00000000 --- a/examples/init/icons/manifest.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "manifest_version": 2, - "version": "0.0.1", - "name": "icons", - "author": "Cezar Augusto", - "icons": { - "16": "test_16.png", - "48": "test_48.png" - }, - "description": "An Extension.js example." -} diff --git a/examples/init/icons/puzzle.png b/examples/init/icons/puzzle.png deleted file mode 100644 index bed9389a..00000000 Binary files a/examples/init/icons/puzzle.png and /dev/null differ diff --git a/examples/init/icons/test_16.png b/examples/init/icons/test_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/init/icons/test_16.png and /dev/null differ diff --git a/examples/init/icons/test_32.png b/examples/init/icons/test_32.png deleted file mode 100644 index a411754c..00000000 Binary files a/examples/init/icons/test_32.png and /dev/null differ diff --git a/examples/init/icons/test_48.png b/examples/init/icons/test_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/init/icons/test_48.png and /dev/null differ diff --git a/examples/init/icons/test_64.png b/examples/init/icons/test_64.png deleted file mode 100644 index 53aea884..00000000 Binary files a/examples/init/icons/test_64.png and /dev/null differ diff --git a/examples/init/images/extension_128.png b/examples/init/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/init/images/extension_128.png differ diff --git a/examples/init/images/extension_16.png b/examples/init/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/init/images/extension_16.png differ diff --git a/examples/init/images/extension_48.png b/examples/init/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/init/images/extension_48.png differ diff --git a/examples/init/manifest.json b/examples/init/manifest.json index ce3e0148..d99e35f4 100644 --- a/examples/init/manifest.json +++ b/examples/init/manifest.json @@ -2,5 +2,10 @@ "manifest_version": 3, "version": "0.0.1", "name": "init", - "description": "An Extension.js example." + "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + } } diff --git a/examples/init/package.json b/examples/init/package.json index 5e58009f..b003df97 100644 --- a/examples/init/package.json +++ b/examples/init/package.json @@ -1,10 +1,5 @@ { - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/extension-js/extension.git", - "directory": "examples/init" - }, + "private": true, "name": "init", "description": "An Extension.js example.", "version": "0.0.1", @@ -13,10 +8,5 @@ "email": "boss@cezaraugusto.net", "url": "https://cezaraugusto.com" }, - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] + "license": "MIT" } diff --git a/examples/locales/_locales/en/messages.json b/examples/locales/_locales/en/messages.json index 42190a6c..9190ac63 100644 --- a/examples/locales/_locales/en/messages.json +++ b/examples/locales/_locales/en/messages.json @@ -1,11 +1,10 @@ { - "extName": { - "message": "Demo extension" + "title": { + "message": "Welcome to your Action Extension", + "description": "The title of the extension page" }, - "extDesc": { - "message": "A demo extension." - }, - "ext_default_title": { - "message": "Demo extension title" + "learnMore": { + "message": "Learn more about creating cross-browser extensions at ", + "description": "The learn more text" } } diff --git a/examples/locales/_locales/gb/messages.json b/examples/locales/_locales/gb/messages.json deleted file mode 100644 index 42190a6c..00000000 --- a/examples/locales/_locales/gb/messages.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extName": { - "message": "Demo extension" - }, - "extDesc": { - "message": "A demo extension." - }, - "ext_default_title": { - "message": "Demo extension title" - } -} diff --git a/examples/locales/_locales/pt_BR/messages.json b/examples/locales/_locales/pt_BR/messages.json new file mode 100644 index 00000000..80e4f036 --- /dev/null +++ b/examples/locales/_locales/pt_BR/messages.json @@ -0,0 +1,10 @@ +{ + "title": { + "message": "Bem-vindo à sua extensão de ação", + "description": "The title of the extension page" + }, + "learnMore": { + "message": "Saiba mais sobre a criação de extensões multiplataforma em ", + "description": "The learn more text" + } +} diff --git a/examples/locales/action/index.html b/examples/locales/action/index.html new file mode 100644 index 00000000..8122c290 --- /dev/null +++ b/examples/locales/action/index.html @@ -0,0 +1,40 @@ + + + + + + Action Extension + + + + + +

+
+ The Extension logo +
+

+
+

+ + https://extension.js.org. +

+
+ + + diff --git a/examples/locales/action/scripts.js b/examples/locales/action/scripts.js new file mode 100644 index 00000000..573ffae1 --- /dev/null +++ b/examples/locales/action/scripts.js @@ -0,0 +1,3 @@ +document.getElementById('title').textContent = chrome.i18n.getMessage('title') +document.getElementById('learnMore').textContent = + chrome.i18n.getMessage('learnMore') diff --git a/examples/locales/action/styles.css b/examples/locales/action/styles.css new file mode 100644 index 00000000..a902761c --- /dev/null +++ b/examples/locales/action/styles.css @@ -0,0 +1,23 @@ +body { + display: flex; + justify-content: center; + align-items: center; + width: 300px; + padding: 2em; +} + +h1 { + font-size: 2.7em; +} + +.action { + filter: grayscale(1); + transition: + filter 2s, + border-color 2s; +} + +.action:hover { + filter: grayscale(0); + border-color: aquamarine; +} diff --git a/examples/locales/images/extension_128.png b/examples/locales/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/locales/images/extension_128.png differ diff --git a/examples/locales/images/extension_16.png b/examples/locales/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/locales/images/extension_16.png differ diff --git a/examples/locales/images/extension_48.png b/examples/locales/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/locales/images/extension_48.png differ diff --git a/examples/locales/manifest.json b/examples/locales/manifest.json index 7b78c4c8..c2a37870 100644 --- a/examples/locales/manifest.json +++ b/examples/locales/manifest.json @@ -1,8 +1,17 @@ { - "manifest_version": 2, + "manifest_version": 3, "version": "0.0.1", - "name": "locales", + "name": "Locales Template", "author": "Cezar Augusto", "default_locale": "en", - "description": "An Extension.js example." + "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, + "action": { + "default_popup": "action/index.html" + }, + "permissions": ["activeTab"] } diff --git a/examples/locales/package.json b/examples/locales/package.json index 84857031..f8ed2d70 100644 --- a/examples/locales/package.json +++ b/examples/locales/package.json @@ -1,11 +1,5 @@ { "private": true, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/extension-js/extension.git", - "directory": "examples/locales" - }, "name": "locales", "description": "An Extension.js example.", "version": "0.0.1", @@ -14,10 +8,5 @@ "email": "boss@cezaraugusto.net", "url": "https://cezaraugusto.com" }, - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] + "license": "MIT" } diff --git a/examples/manager-extension/.gitignore b/examples/manager-extension/.gitignore deleted file mode 100644 index e6a7fd61..00000000 --- a/examples/manager-extension/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# lock files -yarn.lock -package-lock.json diff --git a/examples/manager-extension/background.js b/examples/manager-extension/background.js deleted file mode 100644 index 9d383f3f..00000000 --- a/examples/manager-extension/background.js +++ /dev/null @@ -1,58 +0,0 @@ -// import {createExtensionsPageTab, handleFirstRun} from './define-initial-tab.js' -// import {connect, disconnect, keepAlive} from './reload-service.js' - -function bgbrightGreen(str) { - return `background: #0A0C10; color: #26FFB8; ${str}` -} -// chrome.tabs.query({active: true}, async ([initialTab]) => { -console.log( - `%c -██████████████████████████████████████████████████████████ -██████████████████████████████████████████████████████████ -████████████████████████████ ██████████████████████████ -█████████████████████████ ██████ ███████████████ -███████████████████████ ███ ███ ████████████ -██████████████████████ ██████ ███ ███████████ -███████████████████████ ██████ ██████ ███████████ -████████████████ ██████ ██████████████ ███████████ -█████████████ ████ ████████████ ████████████ -███████████ ██ █████████████ ███████████████ -██████████ ██████ █████████████████ █████████████ -███████████ ████████████████████████████ ███████████ -█████████████ █████████████████ ██████ ██████████ -███████████████ ██████████████ ██ ██████████ -████████████ ████████████ ████ █████████████ -███████████ █████████████ ██████ ███████████████ -███████████ ██████ ██████ ███████████████████████ -███████████ ████ ██████ ██████████████████████ -████████████ ██ ███ ███████████████████████ -███████████████ ██████ █████████████████████████ -██████████████████████████ ████████████████████████████ -██████████████████████████████████████████████████████████ -██████████████████████████████████████████████████████████ - -Extension.js (c) Cezar Augusto and the Extension.js authors.`, - bgbrightGreen('') -) - -// if ( -// initialTab.url === 'chrome://newtab/' || -// initialTab.url === 'chrome://welcome/' -// ) { -// await handleFirstRun() -// } else { -// createExtensionsPageTab(initialTab, 'chrome://extensions/') -// } -// }) - -// chrome.runtime.onInstalled.addListener(async () => { -// let isConnected = false - -// if (isConnected) { -// disconnect() -// } else { -// await connect() -// isConnected = true -// keepAlive() -// } -// }) diff --git a/examples/manager-extension/define-initial-tab.js b/examples/manager-extension/define-initial-tab.js deleted file mode 100644 index bb698034..00000000 --- a/examples/manager-extension/define-initial-tab.js +++ /dev/null @@ -1,67 +0,0 @@ -async function getDevExtension() { - const allExtensions = await new Promise((resolve) => { - chrome.management.getAll(resolve) - }) - - const devExtensions = allExtensions.filter((extension) => { - return ( - // Do not include itself - extension.id !== chrome.runtime.id && - // Reload extension - extension.id !== 'igcijhgmihmjbbahdabahfbpffalcfnn' && - // Show only unpackaged extensions - extension.installType === 'development' - ) - }) - - return devExtensions[0] -} - -// Ideas here are adapted from -// https://github.com/jeremyben/webpack-chrome-extension-launcher -// Released under MIT license. - -// Create a new tab and set it to background. -// We want the user-selected page to be active, -// not chrome://extensions. -export function createExtensionsPageTab(initialTab, url) { - // Check if url tab is open - chrome.tabs.query({url: 'chrome://extensions/'}, (tabs) => { - const extensionsTabExist = tabs.length > 0 - - // Return if url exists - if (extensionsTabExist) return - - // Create an inactive tab - chrome.tabs.create( - {url, active: false}, - function setBackgroundTab(extensionsTab) { - // Get current url tab and move it left. - // This action auto-activates the tab - chrome.tabs.move(extensionsTab.id, {index: 0}, () => { - // Get user-selected initial page tab and activate the right tab - setTimeout(() => { - chrome.tabs.update(initialTab.id, {active: true}) - }, 500) - }) - } - ) - }) -} - -// Function to handle first run logic -export async function handleFirstRun() { - chrome.tabs.update({url: 'chrome://extensions/'}) - - const devExtension = await getDevExtension() - - chrome.storage.local.get(devExtension.id, (result) => { - if (result[devExtension.id] && result[devExtension.id].didRun) { - return - } - - chrome.tabs.create({url: 'pages/welcome.html'}) - // Ensure the welcome page shows only once per extension installation - chrome.storage.local.set({[devExtension.id]: {didRun: true}}) - }) -} diff --git a/examples/manager-extension/manifest.json b/examples/manager-extension/manifest.json deleted file mode 100644 index cbd402e1..00000000 --- a/examples/manager-extension/manifest.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "Extension.js Developer Tools", - "description": "Utility for developers to manage their extensions.", - "version": "1.0", - "manifest_version": 3, - "background": { - "chromium:service_worker": "background.js", - "firefox:scripts": ["background.js"], - "type": "module" - }, - "icons": { - "16": "./public/logo.png", - "48": "./public/logo.png", - "128": "./public/logo.png" - }, - "permissions": ["management", "tabs", "storage"] -} diff --git a/examples/manager-extension/package.json b/examples/manager-extension/package.json deleted file mode 100644 index 52535d0c..00000000 --- a/examples/manager-extension/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "private": true, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/extension-js/extension.git", - "directory": "examples/manager-extension" - }, - "name": "extension-js-developer-tools", - "description": "Utility for developers to manage their extensions.", - "version": "1.0.0", - "author": { - "name": "Cezar Augusto", - "email": "boss@cezaraugusto.net", - "url": "https://cezaraugusto.com" - }, - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] -} diff --git a/examples/manager-extension/pages/sakura-dark.css b/examples/manager-extension/pages/sakura-dark.css deleted file mode 100644 index 2fd58722..00000000 --- a/examples/manager-extension/pages/sakura-dark.css +++ /dev/null @@ -1,268 +0,0 @@ -/* $color-text: #dedce5; */ -/* Sakura.css v1.5.0 - * ================ - * Minimal css theme. - * Project: https://github.com/oxalorg/sakura/ - */ -/* Body */ -html { - font-size: 62.5%; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, - 'Helvetica Neue', Arial, 'Noto Sans', sans-serif; -} - -body { - font-size: 1.8rem; - line-height: 1.618; - max-width: 38em; - margin: auto; - color: #c9c9c9; - background-color: #222222; - padding: 13px; -} - -@media (max-width: 684px) { - body { - font-size: 1.53rem; - } -} -@media (max-width: 382px) { - body { - font-size: 1.35rem; - } -} -h1, -h2, -h3, -h4, -h5, -h6 { - line-height: 1.1; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, - 'Helvetica Neue', Arial, 'Noto Sans', sans-serif; - font-weight: 700; - margin-top: 3rem; - margin-bottom: 1.5rem; - overflow-wrap: break-word; - word-wrap: break-word; - -ms-word-break: break-all; - word-break: break-word; -} - -h1 { - font-size: 2.35em; -} - -h2 { - font-size: 2em; -} - -h3 { - font-size: 1.75em; -} - -h4 { - font-size: 1.5em; -} - -h5 { - font-size: 1.25em; -} - -h6 { - font-size: 1em; -} - -p { - margin-top: 0px; - margin-bottom: 2.5rem; -} - -small, -sub, -sup { - font-size: 75%; -} - -hr { - border-color: #ffffff; -} - -a { - text-decoration: none; - color: #ffffff; -} -a:visited { - color: #e6e6e6; -} -a:hover { - color: #c9c9c9; - border-bottom: 2px solid #c9c9c9; -} - -ul { - padding-left: 1.4em; - margin-top: 0px; - margin-bottom: 2.5rem; -} - -li { - margin-bottom: 0.4em; -} - -blockquote { - margin-left: 0px; - margin-right: 0px; - padding-left: 1em; - padding-top: 0.8em; - padding-bottom: 0.8em; - padding-right: 0.8em; - border-left: 5px solid #ffffff; - margin-bottom: 2.5rem; - background-color: #4a4a4a; -} - -blockquote p { - margin-bottom: 0; -} - -img, -video { - height: auto; - max-width: 100%; - margin-top: 0px; - margin-bottom: 2.5rem; -} - -/* Pre and Code */ -pre { - background-color: #4a4a4a; - display: block; - padding: 1em; - overflow-x: auto; - margin-top: 0px; - margin-bottom: 2.5rem; - font-size: 0.9em; -} - -code, -kbd, -samp { - font-size: 0.9em; - padding: 0 0.5em; - background-color: #4a4a4a; - white-space: pre-wrap; -} - -pre > code { - padding: 0; - background-color: transparent; - white-space: pre; - font-size: 1em; -} - -/* Tables */ -table { - text-align: justify; - width: 100%; - border-collapse: collapse; - margin-bottom: 2rem; -} - -td, -th { - padding: 0.5em; - border-bottom: 1px solid #4a4a4a; -} - -/* Buttons, forms and input */ -input, -textarea { - border: 1px solid #c9c9c9; -} -input:focus, -textarea:focus { - border: 1px solid #ffffff; -} - -textarea { - width: 100%; -} - -.button, -button, -input[type='submit'], -input[type='reset'], -input[type='button'], -input[type='file']::file-selector-button { - display: inline-block; - padding: 5px 10px; - text-align: center; - text-decoration: none; - white-space: nowrap; - background-color: #ffffff; - color: #222222; - border-radius: 1px; - border: 1px solid #ffffff; - cursor: pointer; - box-sizing: border-box; -} -.button[disabled], -button[disabled], -input[type='submit'][disabled], -input[type='reset'][disabled], -input[type='button'][disabled], -input[type='file']::file-selector-button[disabled] { - cursor: default; - opacity: 0.5; -} -.button:hover, -button:hover, -input[type='submit']:hover, -input[type='reset']:hover, -input[type='button']:hover, -input[type='file']::file-selector-button:hover { - background-color: #c9c9c9; - color: #222222; - outline: 0; -} -.button:focus-visible, -button:focus-visible, -input[type='submit']:focus-visible, -input[type='reset']:focus-visible, -input[type='button']:focus-visible, -input[type='file']::file-selector-button:focus-visible { - outline-style: solid; - outline-width: 2px; -} - -textarea, -select, -input { - color: #c9c9c9; - padding: 6px 10px; /* The 6px vertically centers text on FF, ignored by Webkit */ - margin-bottom: 10px; - background-color: #4a4a4a; - border: 1px solid #4a4a4a; - border-radius: 4px; - box-shadow: none; - box-sizing: border-box; -} -textarea:focus, -select:focus, -input:focus { - border: 1px solid #ffffff; - outline: 0; -} - -input[type='checkbox']:focus { - outline: 1px dotted #ffffff; -} - -label, -legend, -fieldset { - display: block; - margin-bottom: 0.5rem; - font-weight: 600; -} diff --git a/examples/manager-extension/pages/sakura.css b/examples/manager-extension/pages/sakura.css deleted file mode 100644 index c6a249b0..00000000 --- a/examples/manager-extension/pages/sakura.css +++ /dev/null @@ -1,267 +0,0 @@ -/* Sakura.css v1.5.0 - * ================ - * Minimal css theme. - * Project: https://github.com/oxalorg/sakura/ - */ -/* Body */ -html { - font-size: 62.5%; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, - 'Helvetica Neue', Arial, 'Noto Sans', sans-serif; -} - -body { - font-size: 1.8rem; - line-height: 1.618; - max-width: 38em; - margin: auto; - color: #4a4a4a; - background-color: #f9f9f9; - padding: 13px; -} - -@media (max-width: 684px) { - body { - font-size: 1.53rem; - } -} -@media (max-width: 382px) { - body { - font-size: 1.35rem; - } -} -h1, -h2, -h3, -h4, -h5, -h6 { - line-height: 1.1; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, - 'Helvetica Neue', Arial, 'Noto Sans', sans-serif; - font-weight: 700; - margin-top: 3rem; - margin-bottom: 1.5rem; - overflow-wrap: break-word; - word-wrap: break-word; - -ms-word-break: break-all; - word-break: break-word; -} - -h1 { - font-size: 2.35em; -} - -h2 { - font-size: 2em; -} - -h3 { - font-size: 1.75em; -} - -h4 { - font-size: 1.5em; -} - -h5 { - font-size: 1.25em; -} - -h6 { - font-size: 1em; -} - -p { - margin-top: 0px; - margin-bottom: 2.5rem; -} - -small, -sub, -sup { - font-size: 75%; -} - -hr { - border-color: #1d7484; -} - -a { - text-decoration: none; - color: #1d7484; -} -a:visited { - color: #144f5a; -} -a:hover { - color: #982c61; - border-bottom: 2px solid #4a4a4a; -} - -ul { - padding-left: 1.4em; - margin-top: 0px; - margin-bottom: 2.5rem; -} - -li { - margin-bottom: 0.4em; -} - -blockquote { - margin-left: 0px; - margin-right: 0px; - padding-left: 1em; - padding-top: 0.8em; - padding-bottom: 0.8em; - padding-right: 0.8em; - border-left: 5px solid #1d7484; - margin-bottom: 2.5rem; - background-color: #f1f1f1; -} - -blockquote p { - margin-bottom: 0; -} - -img, -video { - height: auto; - max-width: 100%; - margin-top: 0px; - margin-bottom: 2.5rem; -} - -/* Pre and Code */ -pre { - background-color: #f1f1f1; - display: block; - padding: 1em; - overflow-x: auto; - margin-top: 0px; - margin-bottom: 2.5rem; - font-size: 0.9em; -} - -code, -kbd, -samp { - font-size: 0.9em; - padding: 0 0.5em; - background-color: #f1f1f1; - white-space: pre-wrap; -} - -pre > code { - padding: 0; - background-color: transparent; - white-space: pre; - font-size: 1em; -} - -/* Tables */ -table { - text-align: justify; - width: 100%; - border-collapse: collapse; - margin-bottom: 2rem; -} - -td, -th { - padding: 0.5em; - border-bottom: 1px solid #f1f1f1; -} - -/* Buttons, forms and input */ -input, -textarea { - border: 1px solid #4a4a4a; -} -input:focus, -textarea:focus { - border: 1px solid #1d7484; -} - -textarea { - width: 100%; -} - -.button, -button, -input[type='submit'], -input[type='reset'], -input[type='button'], -input[type='file']::file-selector-button { - display: inline-block; - padding: 5px 10px; - text-align: center; - text-decoration: none; - white-space: nowrap; - background-color: #1d7484; - color: #f9f9f9; - border-radius: 1px; - border: 1px solid #1d7484; - cursor: pointer; - box-sizing: border-box; -} -.button[disabled], -button[disabled], -input[type='submit'][disabled], -input[type='reset'][disabled], -input[type='button'][disabled], -input[type='file']::file-selector-button[disabled] { - cursor: default; - opacity: 0.5; -} -.button:hover, -button:hover, -input[type='submit']:hover, -input[type='reset']:hover, -input[type='button']:hover, -input[type='file']::file-selector-button:hover { - background-color: #982c61; - color: #f9f9f9; - outline: 0; -} -.button:focus-visible, -button:focus-visible, -input[type='submit']:focus-visible, -input[type='reset']:focus-visible, -input[type='button']:focus-visible, -input[type='file']::file-selector-button:focus-visible { - outline-style: solid; - outline-width: 2px; -} - -textarea, -select, -input { - color: #4a4a4a; - padding: 6px 10px; /* The 6px vertically centers text on FF, ignored by Webkit */ - margin-bottom: 10px; - background-color: #f1f1f1; - border: 1px solid #f1f1f1; - border-radius: 4px; - box-shadow: none; - box-sizing: border-box; -} -textarea:focus, -select:focus, -input:focus { - border: 1px solid #1d7484; - outline: 0; -} - -input[type='checkbox']:focus { - outline: 1px dotted #1d7484; -} - -label, -legend, -fieldset { - display: block; - margin-bottom: 0.5rem; - font-weight: 600; -} diff --git a/examples/manager-extension/pages/welcome.html b/examples/manager-extension/pages/welcome.html deleted file mode 100644 index cc191dda..00000000 --- a/examples/manager-extension/pages/welcome.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - Welcome! - - - - - - - - -
-

- Chrome Extension
-
- ready. -

-

-

- 🧩 Extension.js - is a development tool for browser extensions with built-in support for - TypeScript, WebAssembly, React, and modern JavaScript. -

- -
- - - diff --git a/examples/manager-extension/pages/welcome.js b/examples/manager-extension/pages/welcome.js deleted file mode 100644 index 6a8c54dd..00000000 --- a/examples/manager-extension/pages/welcome.js +++ /dev/null @@ -1,34 +0,0 @@ -async function getUserExtension() { - const allExtensions = await chrome.management.getAll() - - return allExtensions.filter((extension) => { - return ( - // Do not include itself - extension.id !== chrome.runtime.id && - // Reload extension - extension.id !== 'igcijhgmihmjbbahdabahfbpffalcfnn' && - // Show only unpackaged extensions - extension.installType === 'development' - ) - }) -} - -async function onStartup() { - const userExtension = await getUserExtension() - const extensionName = document.getElementById('extensionName') - const extensionDescription = document.getElementById('extensionDescription') - - extensionName.innerText = userExtension[0].name - extensionName.title = `• Name: ${userExtension[0].name} -• ID: ${userExtension[0].id} -• Version: ${userExtension[0].version}` - - extensionDescription.innerText = userExtension[0].description - - const learnMore = document.getElementById('learnMore') - learnMore.addEventListener('click', () => { - chrome.tabs.create({url: 'https://extension.js.org/'}) - }) -} - -onStartup() diff --git a/examples/manager-extension/public/logo.png b/examples/manager-extension/public/logo.png deleted file mode 100644 index 550b4a00..00000000 Binary files a/examples/manager-extension/public/logo.png and /dev/null differ diff --git a/examples/manager-extension/setup-reload-service.js b/examples/manager-extension/setup-reload-service.js deleted file mode 100644 index 72f8160d..00000000 --- a/examples/manager-extension/setup-reload-service.js +++ /dev/null @@ -1,145 +0,0 @@ -const TEN_SECONDS_MS = 10 * 1000 -let webSocket = null - -export async function connect() { - if (webSocket) { - // If already connected, do nothing - return - } - - webSocket = new WebSocket('ws://localhost:__RELOAD_PORT__') - - webSocket.onerror = (event) => { - console.error(`[Extension.js] Connection error: ${JSON.stringify(event)}`) - webSocket.close() - } - - webSocket.onopen = () => { - console.info(`[Extension.js] Connection opened.`) - } - - webSocket.onmessage = async (event) => { - const message = JSON.parse(event.data) - - if (message.status === 'serverReady') { - console.info('[Extension.js] Connection ready.') - await requestInitialLoadData() - } - - if (message.changedFile) { - console.info( - `[Extension.js] Changes detected on ${message.changedFile}. Reloading extension...` - ) - - await messageAllExtensions(message.changedFile) - } - } - - webSocket.onclose = () => { - console.info('[Extension.js] Connection closed.') - webSocket = null - } -} - -export function disconnect() { - if (webSocket) { - webSocket.close() - } -} - -async function getDevExtensions() { - const allExtensions = await new Promise((resolve) => { - chrome.management.getAll(resolve) - }) - - return allExtensions.filter((extension) => { - return ( - // Do not include itself - extension.id !== chrome.runtime.id && - // Manager extension - extension.id !== 'hkklidinfhnfidkjiknmmbmcloigimco' && - // Show only unpackaged extensions - extension.installType === 'development' - ) - }) -} - -async function messageAllExtensions(changedFile) { - // Check if the external extension is ready - const isExtensionReady = await checkExtensionReadiness() - - if (isExtensionReady) { - const devExtensions = await getDevExtensions() - const reloadAll = devExtensions.map((extension) => { - chrome.runtime.sendMessage(extension.id, {changedFile}, (response) => { - if (response) { - console.info('[Extension.js] Extension reloaded and ready.') - } - }) - - return true - }) - - await Promise.all(reloadAll) - } else { - console.info('[Extension.js] External extension is not ready.') - } -} - -async function requestInitialLoadData() { - const devExtensions = await getDevExtensions() - - const messagePromises = devExtensions.map(async (extension) => { - return await new Promise((resolve) => { - chrome.runtime.sendMessage( - extension.id, - {initialLoadData: true}, - (response) => { - if (chrome.runtime.lastError) { - console.error( - `Error sending message to ${extension.id}: ${chrome.runtime.lastError.message}` - ) - resolve(null) - } else { - resolve(response) - } - } - ) - }) - }) - - const responses = await Promise.all(messagePromises) - - // We received the info from the use extension. - // All good, client is ready. Inform the server. - if (webSocket && webSocket.readyState === WebSocket.OPEN) { - const message = JSON.stringify({ - status: 'clientReady', - data: responses[0] - }) - - webSocket.send(message) - } -} - -async function checkExtensionReadiness() { - // Delay for 1 second - await delay(1000) - // Assume the extension is ready - return true -} - -async function delay(ms) { - return await new Promise((resolve) => setTimeout(resolve, ms)) -} - -export function keepAlive() { - const keepAliveIntervalId = setInterval(() => { - if (webSocket) { - webSocket.send(JSON.stringify({status: 'ping'})) - console.info('[Extension.js] Listening for changes...') - } else { - clearInterval(keepAliveIntervalId) - } - }, TEN_SECONDS_MS) -} diff --git a/examples/new-less/images/extension.png b/examples/new-less/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/examples/new-less/images/extension.png and /dev/null differ diff --git a/examples/new-less/images/extension_128.png b/examples/new-less/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/new-less/images/extension_128.png differ diff --git a/examples/new-less/images/extension_16.png b/examples/new-less/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/new-less/images/extension_16.png differ diff --git a/examples/new-less/images/extension_48.png b/examples/new-less/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/new-less/images/extension_48.png differ diff --git a/examples/new-less/images/icons/icon_16.png b/examples/new-less/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/new-less/images/icons/icon_16.png and /dev/null differ diff --git a/examples/new-less/images/icons/icon_48.png b/examples/new-less/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/new-less/images/icons/icon_48.png and /dev/null differ diff --git a/examples/new-less/manifest.json b/examples/new-less/manifest.json index 302b8d8e..12001f9e 100644 --- a/examples/new-less/manifest.json +++ b/examples/new-less/manifest.json @@ -1,8 +1,13 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "new-less", + "name": "Newtab Less Template", "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "chrome_url_overrides": { "newtab": "newtab/index.html" } diff --git a/examples/new-less/newtab/index.html b/examples/new-less/newtab/index.html index 7f6ba7d7..96e19c7a 100644 --- a/examples/new-less/newtab/index.html +++ b/examples/new-less/newtab/index.html @@ -21,7 +21,7 @@

The Extension logo @@ -29,7 +29,7 @@

Welcome to your New Extension

- Learn more about creating browser extensions at + Learn more about creating cross-browser extensions at https://extension.js.org. diff --git a/examples/new-less/newtab/styles.less b/examples/new-less/newtab/styles.less index 0a439cb1..d97a88bf 100644 --- a/examples/new-less/newtab/styles.less +++ b/examples/new-less/newtab/styles.less @@ -10,18 +10,10 @@ h1 { } .new { - border-radius: 24px; - border: 4px solid; - background: white; - border-color: #ccc; - border-radius: 24px; filter: grayscale(1); - transition: - filter 2s, - border-color 2s; + transition: filter 2s; } .new:hover { filter: grayscale(0); - border-color: aquamarine; } \ No newline at end of file diff --git a/examples/new-less/package.json b/examples/new-less/package.json index 8ee6d576..801c7716 100644 --- a/examples/new-less/package.json +++ b/examples/new-less/package.json @@ -1,15 +1,14 @@ { - "devDependencies": { - "less": "^4.2.0" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "new-less", "private": true, + "name": "new-less", + "description": "An Extension.js example.", "version": "0.0.1", - "description": "An Extension.js example." + "author": { + "name": "Cezar Augusto", + "email": "boss@cezaraugusto.net", + "url": "https://cezaraugusto.com" + }, + "devDependencies": { + "less": "^4.2.0" + } } diff --git a/examples/new-preact/extension-env.d.ts b/examples/new-preact/extension-env.d.ts new file mode 100644 index 00000000..e78b2030 --- /dev/null +++ b/examples/new-preact/extension-env.d.ts @@ -0,0 +1,9 @@ +// Required Extension.js types for TypeScript projects. +// This file is auto-generated and should not be excluded. +// If you need extra types, consider creating a new *.d.ts and +// referencing it in the "include" array of your tsconfig.json file. +// See https://www.typescriptlang.org/tsconfig#include for info. +/// + +// Polyfill types for browser.* APIs. +/// diff --git a/examples/new-preact/images/extension_128.png b/examples/new-preact/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/new-preact/images/extension_128.png differ diff --git a/examples/new-preact/images/extension_16.png b/examples/new-preact/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/new-preact/images/extension_16.png differ diff --git a/examples/new-preact/images/extension_48.png b/examples/new-preact/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/new-preact/images/extension_48.png differ diff --git a/examples/new-preact/images/icons/icon_16.png b/examples/new-preact/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/new-preact/images/icons/icon_16.png and /dev/null differ diff --git a/examples/new-preact/images/icons/icon_48.png b/examples/new-preact/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/new-preact/images/icons/icon_48.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/preact-typescript/images/preact.png b/examples/new-preact/images/preact.png similarity index 100% rename from programs/cli/spec/fixtures/preact-typescript/images/preact.png rename to examples/new-preact/images/preact.png diff --git a/examples/new-preact/manifest.json b/examples/new-preact/manifest.json index 779ca24e..2eb45876 100644 --- a/examples/new-preact/manifest.json +++ b/examples/new-preact/manifest.json @@ -1,11 +1,12 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "new-preact", + "name": "Newtab Preact Template", "description": "An Extension.js example.", "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" }, "chrome_url_overrides": { "newtab": "newtab/index.html" diff --git a/examples/new-preact/newtab/NewTabApp.jsx b/examples/new-preact/newtab/NewTabApp.jsx deleted file mode 100644 index 78fb3d69..00000000 --- a/examples/new-preact/newtab/NewTabApp.jsx +++ /dev/null @@ -1,25 +0,0 @@ -import {Component} from 'preact' -import 'sakura.css' -import './styles.css' -import Logo from './logo' - -export default class NewTabApp extends Component { - render() { - return ( -

-

- -
- Welcome to your Preact Extension. -

-

- Learn more about creating browser extensions at{' '} - - https://extension.js.org - - . -

-
- ) - } -} diff --git a/examples/new-preact/newtab/NewTabApp.tsx b/examples/new-preact/newtab/NewTabApp.tsx new file mode 100644 index 00000000..0a8f9b92 --- /dev/null +++ b/examples/new-preact/newtab/NewTabApp.tsx @@ -0,0 +1,27 @@ +import 'sakura.css' +import './styles.css' +import preactLogo from '../images/preact.png' + +export default function ContentApp() { + return ( +
+

+ The Preact logo +
+ Welcome to your Preact Extension. +

+

+ Learn more about creating cross-browser extensions at{' '} + + https://extension.js.org + + . +

+
+ ) +} diff --git a/examples/new-preact/newtab/index.html b/examples/new-preact/newtab/index.html index 56192396..0d7167e1 100644 --- a/examples/new-preact/newtab/index.html +++ b/examples/new-preact/newtab/index.html @@ -9,5 +9,5 @@
- + diff --git a/examples/new-preact/newtab/logo.jsx b/examples/new-preact/newtab/logo.jsx deleted file mode 100644 index 93018894..00000000 --- a/examples/new-preact/newtab/logo.jsx +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Logo Component from Preact Website Logo - * https://github.dev/preactjs/preact-www/blob/master/src/index.jsx - */ -import {Component} from 'preact' - -export default class Logo extends Component { - state = {i: 0, hover: false} - - hover = () => { - this.setState({hover: true}) - } - - hoverOut = () => { - this.setState({hover: false}) - } - - frame = () => { - this.timer = null - if (!this.mounted) return - this.setState({i: this.state.i + 1}, this.next) - } - - next = () => { - let {hover} = this.state - if (!this.mounted || !hover || this.timer) return - this.timer = (requestAnimationFrame || setTimeout)(this.frame, 15) - } - - componentDidMount() { - this.mounted = true - this.startTimer = setTimeout(this.next, 5000) - } - - componentWillUnmount() { - clearTimeout(this.startTimer) - ;(cancelAnimationFrame || clearTimeout)(this.timer) - this.mounted = this.timer = false - } - - componentDidUpdate() { - this.next() - } - - renderEllipse(fg, deg, offset) { - let gapLength = Math.sin((offset / 500) * Math.PI) * 30 + 60 - let lineLength = 894 / 2 - gapLength - return ( - - ) - } - - render( - { - inverted = false, - fg = '#673ab8', - bg = 'white', - component, - title, - ...props - }, - {i} - ) { - if (inverted) [bg, fg] = [fg, bg] - - return ( - - - {this.renderEllipse(fg, 52, i)} - {this.renderEllipse(fg, -52, -0.7 * i)} - - - ) - } -} diff --git a/examples/new-preact/newtab/scripts.jsx b/examples/new-preact/newtab/scripts.jsx deleted file mode 100644 index 20684ed2..00000000 --- a/examples/new-preact/newtab/scripts.jsx +++ /dev/null @@ -1,5 +0,0 @@ -import {render} from 'preact' -import NewTabApp from './NewTabApp' -import './styles.css' - -render(, document.getElementById('root')) diff --git a/programs/cli/spec/fixtures/preact/newtab/scripts.jsx b/examples/new-preact/newtab/scripts.tsx similarity index 61% rename from programs/cli/spec/fixtures/preact/newtab/scripts.jsx rename to examples/new-preact/newtab/scripts.tsx index 20684ed2..83ced493 100644 --- a/programs/cli/spec/fixtures/preact/newtab/scripts.jsx +++ b/examples/new-preact/newtab/scripts.tsx @@ -2,4 +2,4 @@ import {render} from 'preact' import NewTabApp from './NewTabApp' import './styles.css' -render(, document.getElementById('root')) +render(, document.getElementById('root')!) diff --git a/examples/new-preact/newtab/styles.css b/examples/new-preact/newtab/styles.css index 1a72e896..33fd91cb 100644 --- a/examples/new-preact/newtab/styles.css +++ b/examples/new-preact/newtab/styles.css @@ -8,3 +8,25 @@ body { h1 { font-size: 4.7em; } + +.preact { + animation: shake 0.5s linear infinite; +} + +@keyframes shake { + 0% { + transform: translateX(0); + } + 25% { + transform: translateX(-2px); + } + 50% { + transform: translateX(2px); + } + 75% { + transform: translateX(-2px); + } + 100% { + transform: translateX(0); + } +} diff --git a/examples/new-preact/package.json b/examples/new-preact/package.json index 09076c3c..287811a6 100644 --- a/examples/new-preact/package.json +++ b/examples/new-preact/package.json @@ -1,10 +1,5 @@ { - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/preact" - }, + "private": true, "name": "new-preact", "description": "An Extension.js example.", "version": "0.0.1", @@ -13,22 +8,14 @@ "email": "zxin088@gmail.com", "url": "https://hw404.cn" }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ], + "license": "MIT", "dependencies": { "@preact/signals": "^1.3.0", "preact": "^10.22.0", "sakura.css": "^1.5.0" }, "devDependencies": { - "@babel/plugin-transform-react-jsx": "^7.25.2" + "@babel/plugin-transform-react-jsx": "^7.25.2", + "typescript": "5.3.3" } } diff --git a/programs/cli/spec/fixtures/react-typescript/tsconfig.json b/examples/new-preact/tsconfig.json similarity index 73% rename from programs/cli/spec/fixtures/react-typescript/tsconfig.json rename to examples/new-preact/tsconfig.json index 520f3602..141572c3 100644 --- a/programs/cli/spec/fixtures/react-typescript/tsconfig.json +++ b/examples/new-preact/tsconfig.json @@ -4,14 +4,17 @@ "allowSyntheticDefaultImports": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, - "isolatedModules": false, + "isolatedModules": true, "jsx": "react-jsx", "lib": ["dom", "dom.iterable", "esnext"], "moduleResolution": "node", "module": "esnext", "resolveJsonModule": true, "strict": true, - "target": "esnext" + "target": "esnext", + "verbatimModuleSyntax": true, + "useDefineForClassFields": true, + "skipLibCheck": true }, "include": ["./"], "exclude": ["node_modules", "dist"] diff --git a/examples/new-react/extension-env.d.ts b/examples/new-react/extension-env.d.ts new file mode 100644 index 00000000..242b2bb9 --- /dev/null +++ b/examples/new-react/extension-env.d.ts @@ -0,0 +1,9 @@ +// Required Extension.js types for TypeScript projects. +// This file is auto-generated and should not be excluded. +// If you need extra types, consider creating a new *.d.ts and +// referencing it in the "include" array of your tsconfig.json file. +// See https://www.typescriptlang.org/tsconfig#include for info. +/// + +// Polyfill types for browser.* APIs. +/// diff --git a/examples/new-react/images/extension_128.png b/examples/new-react/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/new-react/images/extension_128.png differ diff --git a/examples/new-react/images/extension_16.png b/examples/new-react/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/new-react/images/extension_16.png differ diff --git a/examples/new-react/images/extension_48.png b/examples/new-react/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/new-react/images/extension_48.png differ diff --git a/examples/new-react/images/icons/icon_16.png b/examples/new-react/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/new-react/images/icons/icon_16.png and /dev/null differ diff --git a/examples/new-react/images/icons/icon_48.png b/examples/new-react/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/new-react/images/icons/icon_48.png and /dev/null differ diff --git a/examples/new-react/manifest.json b/examples/new-react/manifest.json index 039c518b..ba7d813e 100644 --- a/examples/new-react/manifest.json +++ b/examples/new-react/manifest.json @@ -1,11 +1,12 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "new-react", + "name": "New React Template", "description": "An Extension.js example.", "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" }, "chrome_url_overrides": { "newtab": "newtab/index.html" diff --git a/examples/new-react/newtab/NewTabApp.jsx b/examples/new-react/newtab/NewTabApp.jsx deleted file mode 100644 index b57a8923..00000000 --- a/examples/new-react/newtab/NewTabApp.jsx +++ /dev/null @@ -1,23 +0,0 @@ -import React from 'react' -import 'sakura.css' -import './styles.css' -import reactLogo from '../images/react.png' - -export default function NewTabApp() { - return ( -
-

- The React logo -
- Welcome to your React Extension. -

-

- Learn more about creating browser extensions at{' '} - - https://extension.js.org - - . -

-
- ) -} diff --git a/programs/cli/spec/fixtures/react/newtab/NewtabApp.jsx b/examples/new-react/newtab/NewTabApp.tsx similarity index 65% rename from programs/cli/spec/fixtures/react/newtab/NewtabApp.jsx rename to examples/new-react/newtab/NewTabApp.tsx index b57a8923..e1aea196 100644 --- a/programs/cli/spec/fixtures/react/newtab/NewtabApp.jsx +++ b/examples/new-react/newtab/NewTabApp.tsx @@ -1,4 +1,3 @@ -import React from 'react' import 'sakura.css' import './styles.css' import reactLogo from '../images/react.png' @@ -7,12 +6,17 @@ export default function NewTabApp() { return (

- The React logo + The React logo
Welcome to your React Extension.

- Learn more about creating browser extensions at{' '} + Learn more about creating cross-browser extensions at{' '} https://extension.js.org diff --git a/examples/new-react/newtab/index.html b/examples/new-react/newtab/index.html index 75582e5f..9a42fa22 100644 --- a/examples/new-react/newtab/index.html +++ b/examples/new-react/newtab/index.html @@ -9,5 +9,5 @@

- + diff --git a/examples/new-react/newtab/scripts.jsx b/examples/new-react/newtab/scripts.jsx deleted file mode 100644 index f22d1f32..00000000 --- a/examples/new-react/newtab/scripts.jsx +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import NewtabApp from './NewTabApp' -import './styles.css' - -const root = ReactDOM.createRoot(document.getElementById('root')) - -root.render( - - - -) diff --git a/programs/create/templates/react/template/newtab/scripts.jsx b/examples/new-react/newtab/scripts.tsx similarity index 98% rename from programs/create/templates/react/template/newtab/scripts.jsx rename to examples/new-react/newtab/scripts.tsx index f22d1f32..815cf11c 100644 --- a/programs/create/templates/react/template/newtab/scripts.jsx +++ b/examples/new-react/newtab/scripts.tsx @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom/client' import NewtabApp from './NewTabApp' import './styles.css' -const root = ReactDOM.createRoot(document.getElementById('root')) +const root = ReactDOM.createRoot(document.getElementById('root')!) root.render( diff --git a/examples/new-react/newtab/styles.css b/examples/new-react/newtab/styles.css index 11e3a190..701e11d4 100644 --- a/examples/new-react/newtab/styles.css +++ b/examples/new-react/newtab/styles.css @@ -10,7 +10,7 @@ h1 { } .react { - animation: spin 5s linear infinite; + animation: spin 20s linear infinite; } @keyframes spin { diff --git a/examples/new-react/package.json b/examples/new-react/package.json index 8ef67832..e6cb4174 100644 --- a/examples/new-react/package.json +++ b/examples/new-react/package.json @@ -1,10 +1,5 @@ { - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/react" - }, + "private": true, "name": "new-react", "description": "An Extension.js example.", "version": "0.0.1", @@ -13,16 +8,7 @@ "email": "boss@cezaraugusto.net", "url": "https://cezaraugusto.com" }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ], + "license": "MIT", "dependencies": { "react": "^18.1.0", "react-dom": "^18.1.0", @@ -30,6 +16,7 @@ }, "devDependencies": { "@types/react": "^18.2.64", - "@types/react-dom": "^18.2.21" + "@types/react-dom": "^18.2.21", + "typescript": "5.3.3" } } diff --git a/programs/cli/spec/fixtures/typescript/tsconfig.json b/examples/new-react/tsconfig.json similarity index 73% rename from programs/cli/spec/fixtures/typescript/tsconfig.json rename to examples/new-react/tsconfig.json index 3c2220f7..141572c3 100644 --- a/programs/cli/spec/fixtures/typescript/tsconfig.json +++ b/examples/new-react/tsconfig.json @@ -4,14 +4,17 @@ "allowSyntheticDefaultImports": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, - "jsx": "preserve", + "isolatedModules": true, + "jsx": "react-jsx", "lib": ["dom", "dom.iterable", "esnext"], "moduleResolution": "node", "module": "esnext", "resolveJsonModule": true, "strict": true, "target": "esnext", - "isolatedModules": false + "verbatimModuleSyntax": true, + "useDefineForClassFields": true, + "skipLibCheck": true }, "include": ["./"], "exclude": ["node_modules", "dist"] diff --git a/examples/new-sass/images/extension.png b/examples/new-sass/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/examples/new-sass/images/extension.png and /dev/null differ diff --git a/examples/new-sass/images/extension_128.png b/examples/new-sass/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/new-sass/images/extension_128.png differ diff --git a/examples/new-sass/images/extension_16.png b/examples/new-sass/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/new-sass/images/extension_16.png differ diff --git a/examples/new-sass/images/extension_48.png b/examples/new-sass/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/new-sass/images/extension_48.png differ diff --git a/examples/new-sass/images/icons/icon_16.png b/examples/new-sass/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/new-sass/images/icons/icon_16.png and /dev/null differ diff --git a/examples/new-sass/images/icons/icon_48.png b/examples/new-sass/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/new-sass/images/icons/icon_48.png and /dev/null differ diff --git a/examples/new-sass/manifest.json b/examples/new-sass/manifest.json index 3cda56ec..f4e775a8 100644 --- a/examples/new-sass/manifest.json +++ b/examples/new-sass/manifest.json @@ -1,8 +1,13 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "new-sass", + "name": "Newtab SASS Template", "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "chrome_url_overrides": { "newtab": "newtab/index.html" } diff --git a/examples/new-sass/newtab/index.html b/examples/new-sass/newtab/index.html index fc6e882e..fd55180c 100644 --- a/examples/new-sass/newtab/index.html +++ b/examples/new-sass/newtab/index.html @@ -21,7 +21,7 @@

The Extension logo @@ -29,7 +29,7 @@

Welcome to your New Extension

- Learn more about creating browser extensions at + Learn more about creating cross-browser extensions at https://extension.js.org. diff --git a/examples/new-sass/newtab/styles.scss b/examples/new-sass/newtab/styles.scss index 0a439cb1..d97a88bf 100644 --- a/examples/new-sass/newtab/styles.scss +++ b/examples/new-sass/newtab/styles.scss @@ -10,18 +10,10 @@ h1 { } .new { - border-radius: 24px; - border: 4px solid; - background: white; - border-color: #ccc; - border-radius: 24px; filter: grayscale(1); - transition: - filter 2s, - border-color 2s; + transition: filter 2s; } .new:hover { filter: grayscale(0); - border-color: aquamarine; } \ No newline at end of file diff --git a/examples/new-sass/package.json b/examples/new-sass/package.json index d25edb98..9e7fdecd 100644 --- a/examples/new-sass/package.json +++ b/examples/new-sass/package.json @@ -1,14 +1,14 @@ { - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" + "private": true, + "name": "new-sass", + "description": "An Extension.js example.", + "version": "0.0.1", + "author": { + "name": "Cezar Augusto", + "email": "boss@cezaraugusto.net", + "url": "https://cezaraugusto.com" }, "dependencies": { "sass": "^1.77.8" - }, - "name": "new-sass", - "private": true, - "version": "0.0.1", - "description": "An Extension.js example." + } } diff --git a/examples/new-tailwind/extension-env.d.ts b/examples/new-tailwind/extension-env.d.ts new file mode 100644 index 00000000..e78b2030 --- /dev/null +++ b/examples/new-tailwind/extension-env.d.ts @@ -0,0 +1,9 @@ +// Required Extension.js types for TypeScript projects. +// This file is auto-generated and should not be excluded. +// If you need extra types, consider creating a new *.d.ts and +// referencing it in the "include" array of your tsconfig.json file. +// See https://www.typescriptlang.org/tsconfig#include for info. +/// + +// Polyfill types for browser.* APIs. +/// diff --git a/examples/new-tailwind/images/extension_128.png b/examples/new-tailwind/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/new-tailwind/images/extension_128.png differ diff --git a/examples/new-tailwind/images/extension_16.png b/examples/new-tailwind/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/new-tailwind/images/extension_16.png differ diff --git a/examples/new-tailwind/images/extension_48.png b/examples/new-tailwind/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/new-tailwind/images/extension_48.png differ diff --git a/examples/new-tailwind/images/icons/icon_16.png b/examples/new-tailwind/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/new-tailwind/images/icons/icon_16.png and /dev/null differ diff --git a/examples/new-tailwind/images/icons/icon_48.png b/examples/new-tailwind/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/new-tailwind/images/icons/icon_48.png and /dev/null differ diff --git a/examples/new-tailwind/manifest.json b/examples/new-tailwind/manifest.json index f5da0377..696aaeb7 100644 --- a/examples/new-tailwind/manifest.json +++ b/examples/new-tailwind/manifest.json @@ -1,11 +1,12 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "new-tailwind", + "name": "Newtab Tailwind Template", "description": "An Extension.js example.", "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" }, "chrome_url_overrides": { "newtab": "newtab/index.html" diff --git a/examples/new-tailwind/newtab/NewTabApp.jsx b/examples/new-tailwind/newtab/NewTabApp.jsx deleted file mode 100644 index 9d75a8b7..00000000 --- a/examples/new-tailwind/newtab/NewTabApp.jsx +++ /dev/null @@ -1,68 +0,0 @@ -import React from 'react' -import reactLogo from '../images/react.png' -import tailwindLogo from '../images/tailwind.png' -import chromeWindowBg from '../images/chromeWindow.png' - -export default function NewTabApp() { - return ( -

- -
-
- React logo -
+
- Tailwind logo -
-

- This is a new tab page running React and Tailwind.css. -

-

- Learn more about creating browser extensions at{' '} - - https://extension.js.org - - . -

-
-
- Chrome screenshot -
-
- ) -} diff --git a/programs/create/templates/tailwind/template/newtab/NewTabApp.jsx b/examples/new-tailwind/newtab/NewTabApp.tsx similarity index 96% rename from programs/create/templates/tailwind/template/newtab/NewTabApp.jsx rename to examples/new-tailwind/newtab/NewTabApp.tsx index 9d75a8b7..ddc22ca8 100644 --- a/programs/create/templates/tailwind/template/newtab/NewTabApp.jsx +++ b/examples/new-tailwind/newtab/NewTabApp.tsx @@ -1,4 +1,3 @@ -import React from 'react' import reactLogo from '../images/react.png' import tailwindLogo from '../images/tailwind.png' import chromeWindowBg from '../images/chromeWindow.png' @@ -43,7 +42,7 @@ export default function NewTabApp() { This is a new tab page running React and Tailwind.css.

- Learn more about creating browser extensions at{' '} + Learn more about creating cross-browser extensions at{' '} You need to enable JavaScript to run this extension.

- + diff --git a/examples/new-tailwind/newtab/scripts.jsx b/examples/new-tailwind/newtab/scripts.jsx deleted file mode 100644 index a6755c29..00000000 --- a/examples/new-tailwind/newtab/scripts.jsx +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import NewTabApp from './NewTabApp' -import './styles.css' - -const root = ReactDOM.createRoot(document.getElementById('root')) - -root.render( - - - -) diff --git a/programs/cli/spec/fixtures/tailwind/newtab/scripts.jsx b/examples/new-tailwind/newtab/scripts.tsx similarity index 98% rename from programs/cli/spec/fixtures/tailwind/newtab/scripts.jsx rename to examples/new-tailwind/newtab/scripts.tsx index a6755c29..c1e021b3 100644 --- a/programs/cli/spec/fixtures/tailwind/newtab/scripts.jsx +++ b/examples/new-tailwind/newtab/scripts.tsx @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom/client' import NewTabApp from './NewTabApp' import './styles.css' -const root = ReactDOM.createRoot(document.getElementById('root')) +const root = ReactDOM.createRoot(document.getElementById('root')!) root.render( diff --git a/examples/new-tailwind/package.json b/examples/new-tailwind/package.json index d3075284..f1705626 100644 --- a/examples/new-tailwind/package.json +++ b/examples/new-tailwind/package.json @@ -1,10 +1,5 @@ { - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/tailwind" - }, + "private": true, "name": "new-tailwind", "description": "An Extension.js example.", "version": "0.0.1", @@ -13,16 +8,7 @@ "email": "boss@cezaraugusto.net", "url": "https://cezaraugusto.com" }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ], + "license": "MIT", "dependencies": { "react": "^18.1.0", "react-dom": "^18.1.0", @@ -30,6 +16,7 @@ }, "devDependencies": { "@types/react": "^18.2.64", - "@types/react-dom": "^18.2.21" + "@types/react-dom": "^18.2.21", + "typescript": "5.3.3" } } diff --git a/examples/new-tailwind/tailwind.config.js b/examples/new-tailwind/tailwind.config.js index fe8d881a..069e1bc3 100644 --- a/examples/new-tailwind/tailwind.config.js +++ b/examples/new-tailwind/tailwind.config.js @@ -1,6 +1,6 @@ /** @type {import('tailwindcss').Config} */ module.exports = { - content: ['**/*.html', '**/*.jsx'], + content: ['**/*.html', '**/*.tsx'], theme: { extend: {} }, diff --git a/programs/create/templates/typescript/template/tsconfig.json b/examples/new-tailwind/tsconfig.json similarity index 73% rename from programs/create/templates/typescript/template/tsconfig.json rename to examples/new-tailwind/tsconfig.json index 3c2220f7..141572c3 100644 --- a/programs/create/templates/typescript/template/tsconfig.json +++ b/examples/new-tailwind/tsconfig.json @@ -4,14 +4,17 @@ "allowSyntheticDefaultImports": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, - "jsx": "preserve", + "isolatedModules": true, + "jsx": "react-jsx", "lib": ["dom", "dom.iterable", "esnext"], "moduleResolution": "node", "module": "esnext", "resolveJsonModule": true, "strict": true, "target": "esnext", - "isolatedModules": false + "verbatimModuleSyntax": true, + "useDefineForClassFields": true, + "skipLibCheck": true }, "include": ["./"], "exclude": ["node_modules", "dist"] diff --git a/examples/new-typescript/images/extension_128.png b/examples/new-typescript/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/new-typescript/images/extension_128.png differ diff --git a/examples/new-typescript/images/extension_16.png b/examples/new-typescript/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/new-typescript/images/extension_16.png differ diff --git a/examples/new-typescript/images/extension_48.png b/examples/new-typescript/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/new-typescript/images/extension_48.png differ diff --git a/examples/new-typescript/images/icons/icon_16.png b/examples/new-typescript/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/new-typescript/images/icons/icon_16.png and /dev/null differ diff --git a/examples/new-typescript/images/icons/icon_48.png b/examples/new-typescript/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/new-typescript/images/icons/icon_48.png and /dev/null differ diff --git a/examples/new-typescript/manifest.json b/examples/new-typescript/manifest.json index f063dbc7..1174820e 100644 --- a/examples/new-typescript/manifest.json +++ b/examples/new-typescript/manifest.json @@ -1,11 +1,12 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "new-typescript", + "name": "Newtab TypeScript Template", "description": "An Extension.js example.", "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" }, "chrome_url_overrides": { "newtab": "newtab/index.html" diff --git a/examples/new-typescript/newtab/index.html b/examples/new-typescript/newtab/index.html index 88ca346a..bef027c9 100644 --- a/examples/new-typescript/newtab/index.html +++ b/examples/new-typescript/newtab/index.html @@ -16,7 +16,7 @@

Welcome to your TypeScript Extension.

- Learn more about creating browser extensions at + Learn more about creating cross-browser extensions at https://extension.js.org.

diff --git a/examples/new-typescript/package.json b/examples/new-typescript/package.json index 3bbb4cb2..4b15e8dc 100644 --- a/examples/new-typescript/package.json +++ b/examples/new-typescript/package.json @@ -1,10 +1,5 @@ { - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/typescript" - }, + "private": true, "name": "new-typescript", "description": "An Extension.js example.", "version": "0.0.1", @@ -13,16 +8,7 @@ "email": "boss@cezaraugusto.net", "url": "https://cezaraugusto.com" }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ], + "license": "MIT", "devDependencies": { "typescript": "5.3.3" } diff --git a/examples/new-vue/extension-env.d.ts b/examples/new-vue/extension-env.d.ts new file mode 100644 index 00000000..242b2bb9 --- /dev/null +++ b/examples/new-vue/extension-env.d.ts @@ -0,0 +1,9 @@ +// Required Extension.js types for TypeScript projects. +// This file is auto-generated and should not be excluded. +// If you need extra types, consider creating a new *.d.ts and +// referencing it in the "include" array of your tsconfig.json file. +// See https://www.typescriptlang.org/tsconfig#include for info. +/// + +// Polyfill types for browser.* APIs. +/// diff --git a/examples/new-vue/images/extension_128.png b/examples/new-vue/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/new-vue/images/extension_128.png differ diff --git a/examples/new-vue/images/extension_16.png b/examples/new-vue/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/new-vue/images/extension_16.png differ diff --git a/examples/new-vue/images/extension_48.png b/examples/new-vue/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/new-vue/images/extension_48.png differ diff --git a/examples/new-vue/images/icons/icon_16.png b/examples/new-vue/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/new-vue/images/icons/icon_16.png and /dev/null differ diff --git a/examples/new-vue/images/icons/icon_48.png b/examples/new-vue/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/new-vue/images/icons/icon_48.png and /dev/null differ diff --git a/examples/new-vue/manifest.json b/examples/new-vue/manifest.json index 1ec29a6f..0a1658ac 100644 --- a/examples/new-vue/manifest.json +++ b/examples/new-vue/manifest.json @@ -1,11 +1,12 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "new-vue", + "name": "Newtab Vue Template", "description": "An Extension.js example.", "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" }, "chrome_url_overrides": { "newtab": "newtab/index.html" diff --git a/examples/new-vue/newtab/NewTabApp.vue b/examples/new-vue/newtab/NewTabApp.vue index 47fc2529..3e561696 100644 --- a/examples/new-vue/newtab/NewTabApp.vue +++ b/examples/new-vue/newtab/NewTabApp.vue @@ -1,4 +1,4 @@ - + diff --git a/examples/new-vue/newtab/scripts.js b/examples/new-vue/newtab/scripts.ts similarity index 100% rename from examples/new-vue/newtab/scripts.js rename to examples/new-vue/newtab/scripts.ts diff --git a/examples/new-vue/package.json b/examples/new-vue/package.json index b5b18964..2ea687a1 100644 --- a/examples/new-vue/package.json +++ b/examples/new-vue/package.json @@ -1,10 +1,5 @@ { - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/vue" - }, + "private": true, "name": "new-vue", "description": "An Extension.js example.", "version": "0.0.1", @@ -13,18 +8,12 @@ "email": "zxin088@gmail.com", "url": "https://hw404.cn" }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ], + "license": "MIT", "dependencies": { "vue": "^3.4.27", "sakura.css": "^1.5.0" + }, + "devDependencies": { + "typescript": "5.3.3" } } diff --git a/examples/new-vue/tsconfig.json b/examples/new-vue/tsconfig.json new file mode 100644 index 00000000..141572c3 --- /dev/null +++ b/examples/new-vue/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "allowJs": true, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "isolatedModules": true, + "jsx": "react-jsx", + "lib": ["dom", "dom.iterable", "esnext"], + "moduleResolution": "node", + "module": "esnext", + "resolveJsonModule": true, + "strict": true, + "target": "esnext", + "verbatimModuleSyntax": true, + "useDefineForClassFields": true, + "skipLibCheck": true + }, + "include": ["./"], + "exclude": ["node_modules", "dist"] +} diff --git a/examples/new/images/extension.png b/examples/new/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/examples/new/images/extension.png and /dev/null differ diff --git a/examples/new/images/extension_128.png b/examples/new/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/new/images/extension_128.png differ diff --git a/examples/new/images/extension_16.png b/examples/new/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/new/images/extension_16.png differ diff --git a/examples/new/images/extension_48.png b/examples/new/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/new/images/extension_48.png differ diff --git a/examples/new/images/icons/icon_16.png b/examples/new/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/new/images/icons/icon_16.png and /dev/null differ diff --git a/examples/new/images/icons/icon_48.png b/examples/new/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/new/images/icons/icon_48.png and /dev/null differ diff --git a/examples/new/manifest.json b/examples/new/manifest.json index aae387fc..df1203a0 100644 --- a/examples/new/manifest.json +++ b/examples/new/manifest.json @@ -1,8 +1,13 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "new", + "name": "Newtab Template", "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "chrome_url_overrides": { "newtab": "newtab/index.html" } diff --git a/examples/new/newtab/index.html b/examples/new/newtab/index.html index 7aef0cf4..532133d8 100644 --- a/examples/new/newtab/index.html +++ b/examples/new/newtab/index.html @@ -21,15 +21,14 @@

The Extension logo
Welcome to your New Extension

- Learn more about creating browser extensions at + Learn more about creating cross-browser extensions at https://extension.js.org. diff --git a/examples/new/newtab/styles.css b/examples/new/newtab/styles.css index 38aea81c..ab33f499 100644 --- a/examples/new/newtab/styles.css +++ b/examples/new/newtab/styles.css @@ -10,18 +10,10 @@ h1 { } .new { - border-radius: 24px; - border: 4px solid; - background: white; - border-color: #ccc; - border-radius: 24px; filter: grayscale(1); - transition: - filter 2s, - border-color 2s; + transition: filter 2s; } .new:hover { filter: grayscale(0); - border-color: aquamarine; } diff --git a/examples/new/package.json b/examples/new/package.json index 30968bbb..ea2810b7 100644 --- a/examples/new/package.json +++ b/examples/new/package.json @@ -1,15 +1,11 @@ { - "devDependencies": { - "extension": "latest" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "new", "private": true, + "name": "new", + "description": "An Extension.js example.", "version": "0.0.1", - "description": "An Extension.js example." + "author": { + "name": "Cezar Augusto", + "email": "boss@cezaraugusto.net", + "url": "https://cezaraugusto.com" + } } diff --git a/examples/sidebar/images/extension.png b/examples/sidebar/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/examples/sidebar/images/extension.png and /dev/null differ diff --git a/examples/sidebar/images/extension_128.png b/examples/sidebar/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/sidebar/images/extension_128.png differ diff --git a/examples/sidebar/images/extension_16.png b/examples/sidebar/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/sidebar/images/extension_16.png differ diff --git a/examples/sidebar/images/extension_48.png b/examples/sidebar/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/sidebar/images/extension_48.png differ diff --git a/examples/sidebar/images/icons/icon_16.png b/examples/sidebar/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/sidebar/images/icons/icon_16.png and /dev/null differ diff --git a/examples/sidebar/images/icons/icon_48.png b/examples/sidebar/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/sidebar/images/icons/icon_48.png and /dev/null differ diff --git a/examples/sidebar/manifest.json b/examples/sidebar/manifest.json index 885ddd1f..76a2e909 100644 --- a/examples/sidebar/manifest.json +++ b/examples/sidebar/manifest.json @@ -1,18 +1,23 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "sidebar", + "name": "Sidebar Template", "author": "Cezar Augusto", "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "chromium:side_panel": { "default_path": "sidebar/index.html", "default_title": "Sidebar Action", - "default_icon": "./images/icons/icon_16.png" + "default_icon": "images/extension_48.png" }, "firefox:sidebar_action": { - "default_icon": "images/icons/icon_16.png", + "default_panel": "sidebar/index.html", "default_title": "Sidebar Action", - "default_panel": "sidebar/index.html" + "default_icon": "images/extension_48.png" }, "permissions": ["sidePanel"] } diff --git a/examples/sidebar/package.json b/examples/sidebar/package.json index 63dcafee..1b058efd 100644 --- a/examples/sidebar/package.json +++ b/examples/sidebar/package.json @@ -1,11 +1,5 @@ { "private": true, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/extension-js/extension.git", - "directory": "examples/sidebar" - }, "name": "sidebar", "description": "An Extension.js example.", "version": "0.0.1", @@ -14,10 +8,5 @@ "email": "boss@cezaraugusto.net", "url": "https://cezaraugusto.com" }, - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] + "license": "MIT" } diff --git a/examples/sidebar/sidebar/index.html b/examples/sidebar/sidebar/index.html index 3f488c4f..49ae5500 100644 --- a/examples/sidebar/sidebar/index.html +++ b/examples/sidebar/sidebar/index.html @@ -21,15 +21,14 @@

The Extension logo
Welcome to your Sidebar Extension

- Learn more about creating browser extensions at + Learn more about creating cross-browser extensions at https://extension.js.org. diff --git a/examples/special-folders-pages/images/extension_128.png b/examples/special-folders-pages/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/special-folders-pages/images/extension_128.png differ diff --git a/examples/special-folders-pages/images/extension_16.png b/examples/special-folders-pages/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/special-folders-pages/images/extension_16.png differ diff --git a/examples/special-folders-pages/images/extension_48.png b/examples/special-folders-pages/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/special-folders-pages/images/extension_48.png differ diff --git a/examples/special-folders-pages/manifest.json b/examples/special-folders-pages/manifest.json index e60410fd..005b1676 100644 --- a/examples/special-folders-pages/manifest.json +++ b/examples/special-folders-pages/manifest.json @@ -1,16 +1,21 @@ { - "name": "special-folders-pages", + "name": "Special Folders Pages Template", "version": "0.0.1", "manifest_version": 3, + "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "background": { "chromium:service_worker": "background.js", "firefox:scripts": ["background.js"] }, - "description": "An Extension.js example.", "action": { "default_popup": "pages/main.html" }, "sandbox": { - "pages": ["sandboxed.html"] + "pages": ["sandbox/index.html"] } } diff --git a/examples/special-folders-pages/package.json b/examples/special-folders-pages/package.json index 9c6467a1..52fcfcf4 100644 --- a/examples/special-folders-pages/package.json +++ b/examples/special-folders-pages/package.json @@ -1,11 +1,5 @@ { "private": true, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/extension-js/extension.git", - "directory": "examples/special-folders-pages" - }, "name": "special-folders-pages", "description": "An Extension.js example.", "version": "0.0.1", @@ -14,10 +8,5 @@ "email": "boss@cezaraugusto.net", "url": "https://cezaraugusto.com" }, - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] + "license": "MIT" } diff --git a/examples/special-folders-pages/pages/custom.html b/examples/special-folders-pages/pages/custom.html index 26fc0d01..d520a3ba 100644 --- a/examples/special-folders-pages/pages/custom.html +++ b/examples/special-folders-pages/pages/custom.html @@ -3,5 +3,6 @@ Custom page - + I am a custom page + \ No newline at end of file diff --git a/examples/special-folders-pages/pages/main.html b/examples/special-folders-pages/pages/main.html index 33085a54..d3bde0ed 100644 --- a/examples/special-folders-pages/pages/main.html +++ b/examples/special-folders-pages/pages/main.html @@ -4,12 +4,11 @@ Sandboxed Content -

Main Window

I am the main window. I am not sandboxed.

- + diff --git a/examples/special-folders-pages/public/html/file.html b/examples/special-folders-pages/public/html/file.html index 7e0a21e6..1a413ee4 100644 --- a/examples/special-folders-pages/public/html/file.html +++ b/examples/special-folders-pages/public/html/file.html @@ -3,6 +3,6 @@ HTML file - Hello, world + Hello, Extension.js \ No newline at end of file diff --git a/examples/special-folders-pages/sandboxed.html b/examples/special-folders-pages/sandbox/index.html similarity index 58% rename from examples/special-folders-pages/sandboxed.html rename to examples/special-folders-pages/sandbox/index.html index f2c4c15f..5789c273 100644 --- a/examples/special-folders-pages/sandboxed.html +++ b/examples/special-folders-pages/sandbox/index.html @@ -3,22 +3,19 @@ Sandboxed Content - +

Sandboxed Content

I am the sandboxed iframe.

- - - + - - + diff --git a/examples/special-folders-pages/notpublic-file.js b/examples/special-folders-pages/sandbox/scripts.js similarity index 100% rename from examples/special-folders-pages/notpublic-file.js rename to examples/special-folders-pages/sandbox/scripts.js diff --git a/examples/special-folders-pages/pages/notpublic-file.css b/examples/special-folders-pages/sandbox/styles.css similarity index 100% rename from examples/special-folders-pages/pages/notpublic-file.css rename to examples/special-folders-pages/sandbox/styles.css diff --git a/examples/special-folders-scripts/images/extension.png b/examples/special-folders-scripts/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/examples/special-folders-scripts/images/extension.png and /dev/null differ diff --git a/examples/special-folders-scripts/images/extension_128.png b/examples/special-folders-scripts/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/special-folders-scripts/images/extension_128.png differ diff --git a/examples/special-folders-scripts/images/extension_16.png b/examples/special-folders-scripts/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/special-folders-scripts/images/extension_16.png differ diff --git a/examples/special-folders-scripts/images/extension_48.png b/examples/special-folders-scripts/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/special-folders-scripts/images/extension_48.png differ diff --git a/examples/special-folders-scripts/images/icons/icon_16.png b/examples/special-folders-scripts/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/examples/special-folders-scripts/images/icons/icon_16.png and /dev/null differ diff --git a/examples/special-folders-scripts/images/icons/icon_48.png b/examples/special-folders-scripts/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/examples/special-folders-scripts/images/icons/icon_48.png and /dev/null differ diff --git a/examples/special-folders-scripts/manifest.json b/examples/special-folders-scripts/manifest.json index 79035521..16dc7e32 100644 --- a/examples/special-folders-scripts/manifest.json +++ b/examples/special-folders-scripts/manifest.json @@ -1,8 +1,13 @@ { - "name": "special-folders-scripts", + "name": "Special Folders Scripts Template", "version": "0.0.1", "manifest_version": 3, "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "background": { "chromium:service_worker": "background.js", "firefox:scripts": ["background.js"] diff --git a/examples/special-folders-scripts/package.json b/examples/special-folders-scripts/package.json index b15dd551..8cafef66 100644 --- a/examples/special-folders-scripts/package.json +++ b/examples/special-folders-scripts/package.json @@ -1,11 +1,5 @@ { "private": true, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/extension-js/extension.git", - "directory": "examples/special-folders-scripts" - }, "name": "special-folders-scripts", "description": "An Extension.js example.", "version": "0.0.1", @@ -14,10 +8,5 @@ "email": "boss@cezaraugusto.net", "url": "https://cezaraugusto.com" }, - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] + "license": "MIT" } diff --git a/examples/storage/images/extension_128.png b/examples/storage/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/storage/images/extension_128.png differ diff --git a/examples/storage/images/extension_16.png b/examples/storage/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/storage/images/extension_16.png differ diff --git a/examples/storage/images/extension_48.png b/examples/storage/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/storage/images/extension_48.png differ diff --git a/examples/storage/manifest.json b/examples/storage/manifest.json index 12eb37fd..52867ab8 100644 --- a/examples/storage/manifest.json +++ b/examples/storage/manifest.json @@ -1,8 +1,13 @@ { - "name": "storage", - "description": "An Extension.js example.", + "name": "Storage Template", "version": "0.0.1", "manifest_version": 3, + "description": "An Extension.js example.", + "icons": { + "16": "images/extension_16.png", + "48": "images/extension_48.png", + "128": "images/extension_128.png" + }, "storage": { "managed_schema": "schema.json" } diff --git a/examples/storage/package.json b/examples/storage/package.json index 3e248151..853ad343 100644 --- a/examples/storage/package.json +++ b/examples/storage/package.json @@ -1,11 +1,5 @@ { "private": true, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/extension-js/extension.git", - "directory": "examples/storage" - }, "name": "storage", "description": "An Extension.js example.", "version": "0.0.1", @@ -14,10 +8,5 @@ "email": "boss@cezaraugusto.net", "url": "https://cezaraugusto.com" }, - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] + "license": "MIT" } diff --git a/examples/super-manifest/images/extension_128.png b/examples/super-manifest/images/extension_128.png new file mode 100644 index 00000000..c399dc75 Binary files /dev/null and b/examples/super-manifest/images/extension_128.png differ diff --git a/examples/super-manifest/images/extension_16.png b/examples/super-manifest/images/extension_16.png new file mode 100644 index 00000000..840b505e Binary files /dev/null and b/examples/super-manifest/images/extension_16.png differ diff --git a/examples/super-manifest/images/extension_48.png b/examples/super-manifest/images/extension_48.png new file mode 100644 index 00000000..9d83a03b Binary files /dev/null and b/examples/super-manifest/images/extension_48.png differ diff --git a/examples/super-manifest/package.json b/examples/super-manifest/package.json index 96efde5e..369b19e9 100644 --- a/examples/super-manifest/package.json +++ b/examples/super-manifest/package.json @@ -1,11 +1,5 @@ { "private": true, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/extension-js/extension.git", - "directory": "examples/super-manifest" - }, "name": "super-manifest", "description": "An Extension.js example.", "version": "0.0.1", @@ -14,10 +8,5 @@ "email": "boss@cezaraugusto.net", "url": "https://cezaraugusto.com" }, - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] + "license": "MIT" } diff --git a/examples/types.ts b/examples/types.ts index 742d02a3..10e2d5af 100644 --- a/examples/types.ts +++ b/examples/types.ts @@ -4,7 +4,7 @@ export type ConfigFiles = | 'tailwind.config.js' | 'tsconfig.json' | 'babel.config.js' - | 'stylelint.config.js' + | 'stylelint.config.json' | 'extension.config.js' export interface Template { diff --git a/package.json b/package.json index c538f88a..2abfcd56 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "clean": "turbo clean && rm -rf node_modules", "changeset": "changeset", "compile": "dotenv -- turbo run compile", - "cleanInstall": "yarn cache clean && yarn clean && rm -rf yarn.lock && yarn install && yarn compile && yarn format && yarn lint && yarn types && yarn test", + "cleanInstall": "yarn cache clean && yarn clean && rm -rf yarn.lock && yarn install && yarn compile && yarn format && yarn lint && yarn types", "extension": "dotenv -- ts-node ./programs/cli/dist/cli.js", "format": "prettier --write \"**/*.{ts,tsx,md,js,json}\"", "lint": "eslint .", diff --git a/programs/cli/spec/cli.spec.ts b/programs/cli/__spec__/cli.spec.ts similarity index 69% rename from programs/cli/spec/cli.spec.ts rename to programs/cli/__spec__/cli.spec.ts index 5dfe4616..1025b035 100644 --- a/programs/cli/spec/cli.spec.ts +++ b/programs/cli/__spec__/cli.spec.ts @@ -5,7 +5,17 @@ // ╚██████╗███████╗██║ // ╚═════╝╚══════╝╚═╝ -import {extensionProgram} from './fixtures/helpers' +import path from 'path' +import {exec} from 'child_process' +import {promisify} from 'util' + +const execAsync = promisify(exec) + +export async function extensionProgram(command: string = '') { + const cliDir = path.resolve(__dirname, '..', 'dist', 'cli.js') + const cliCommand = `node ${cliDir} ${command}` + return await execAsync(cliCommand) +} describe('CLI Commands', () => { it('returns usage instructions if no command is provided', async () => { diff --git a/programs/cli/cli.ts b/programs/cli/cli.ts index bc00519d..0c7b3db5 100755 --- a/programs/cli/cli.ts +++ b/programs/cli/cli.ts @@ -8,27 +8,19 @@ // ╚═════╝╚══════╝╚═╝ import {program} from 'commander' - -// Types -import type {CreateOptions} from '@extension-create/create' -import type {} from // BuildOptions, -// DevOptions, -// PreviewOptions, -// StartOptions -'extension-develop' -import type {BrowsersSupported} from './types' - -// Modules -import createExtension from '@extension-create/create' +import {extensionCreate, type CreateOptions} from '@extension-create/create' import { extensionDev, + // type DevOptions, extensionStart, + // type StartOptions, extensionBuild + // type BuildOptions // extensionPreview } from 'extension-develop' - -import checkUpdates from './check-updates' import * as messages from './cli-lib/messages' +import type {BrowsersSupported} from './types' +import checkUpdates from './check-updates' import packageJson from './package.json' // Before all, check for updates. @@ -69,7 +61,7 @@ extensionJs 'specify a template for the created project' ) .action(async function (pathOrRemoteUrl: string, {template}: CreateOptions) { - await createExtension(pathOrRemoteUrl, {template}) + await extensionCreate(pathOrRemoteUrl, {template}) }) // ██████╗ ███████╗██╗ ██╗ diff --git a/programs/cli/jest.config.js b/programs/cli/jest.config.js index 758fa133..0e6ffb72 100644 --- a/programs/cli/jest.config.js +++ b/programs/cli/jest.config.js @@ -1,4 +1,5 @@ module.exports = { preset: 'ts-jest', - testEnvironment: 'node' + testEnvironment: 'node', + testMatch: ['**/__spec__/**/*.spec.ts'] } diff --git a/programs/cli/package.json b/programs/cli/package.json index ddb66e6d..4cbec1e8 100644 --- a/programs/cli/package.json +++ b/programs/cli/package.json @@ -33,9 +33,7 @@ "compile:cli": "tsup-node ./cli.ts --format cjs --dts --target=node18", "compile": "yarn compile:readme-files && yarn compile:tailwind-config && yarn compile:stylelint-config &&yarn compile:cli", "clean": "rm -rf dist", - "before:test": "./spec/fixtures/install-npm-deps-for-fixtures.sh", - "test:cli": "npm run before:test && jest spec/cli.spec.ts", - "test:create": "npm run before:test && jest spec/create.spec.ts" + "test:cli": "jest __spec__/cli.spec.ts" }, "keywords": [ "zero-config", diff --git a/programs/cli/spec/build.spec.ts b/programs/cli/spec/build.spec.ts deleted file mode 100644 index 9cb97a51..00000000 --- a/programs/cli/spec/build.spec.ts +++ /dev/null @@ -1,135 +0,0 @@ -// ██████╗██╗ ██╗ -// ██╔════╝██║ ██║ -// ██║ ██║ ██║ -// ██║ ██║ ██║ -// ╚██████╗███████╗██║ -// ╚═════╝╚══════╝╚═╝ - -import path from 'path' -import fs from 'fs' -import {ALL_TEMPLATES, DEFAULT_TEMPLATE, BROWSERS} from './fixtures/constants' -import { - extensionProgram, - distFileExists, - removeAllTemplateFolders -} from './fixtures/helpers' - -describe('extension build', () => { - beforeEach(async () => { - await removeAllTemplateFolders() - }) - - describe('running built-in templates', () => { - it.each(ALL_TEMPLATES)( - `builds an extension created via "$name" template`, - async (template) => { - const extensionPath = path.join(__dirname, 'fixtures', template.name) - await extensionProgram(`build ${extensionPath}`) - - // Expect manifest file to exist - expect( - distFileExists(template.name, BROWSERS[0], 'manifest.json') - ).toBeTruthy() - - // TODO: cezaraugusto test ui context files output - - if (template.name !== 'init') { - expect( - distFileExists(template.name, BROWSERS[0], 'icons/icon_16.png') - ).toBeTruthy() - expect( - distFileExists(template.name, BROWSERS[0], 'icons/icon_48.png') - ).toBeTruthy() - } - }, - 80000 - ) - }) - - describe('using the --browser flag', () => { - it.each(ALL_TEMPLATES)( - `builds the "$name" extension template across all browsers`, - async (template) => { - const extensionPath = path.join(__dirname, 'fixtures', template.name) - // Firefox is skippeed because it can't handle service workers. - const [chrome, edge /*, firefox */] = BROWSERS - - await extensionProgram(`build ${extensionPath} --browser=chrome,edge`) - - expect(distFileExists(template.name, chrome)).toBeTruthy() - expect(distFileExists(template.name, edge)).toBeTruthy() - }, - 50000 - ) - }) - - describe.skip('using the --polyfill flag', () => { - it.skip.each(ALL_TEMPLATES)( - `builds an extension created via "$name" template with the polyfill code`, - async (template) => { - const extensionPath = path.join(__dirname, 'fixtures', template.name) - - await extensionProgram(`build ${extensionPath} --polyfill`) - - // TODO cezaraugusto test this - }, - 50000 - ) - }) - - describe('using the --zip flag', () => { - it.each([DEFAULT_TEMPLATE])( - `builds and zips the distribution files of an extension created via "$name" template`, - async (template) => { - const extensionPath = path.join(__dirname, 'fixtures', template.name) - - await extensionProgram(`build ${extensionPath} --zip`) - - expect(distFileExists(template.name, 'chrome')).toBeTruthy() - }, - 50000 - ) - - it.each([DEFAULT_TEMPLATE])( - `builds and zips the source files of an extension created via "$name" template`, - async (template) => { - const extensionPath = path.join(__dirname, 'fixtures', template.name) - const outputPath = path.join( - __dirname, - 'fixtures', - template.name, - 'dist' - ) - - await extensionProgram(`build ${extensionPath} --zip-source`) - - expect( - fs.existsSync( - path.join(outputPath, `${template.name}-1.0-source.zip`) - ) - ).toBeTruthy() - }, - 50000 - ) - - it.each([DEFAULT_TEMPLATE])( - `builds and zips the distribution files of an extension created via "$name" template with a custom output name using the --zip-filename flag`, - async (template) => { - const extensionPath = path.join(__dirname, 'fixtures', template.name) - - await extensionProgram( - `build ${extensionPath} --zip --zip-filename ${template.name}-nice` - ) - - expect( - distFileExists( - template.name, - BROWSERS[0], - `${template.name}-nice.zip` - ) - ).toBeTruthy() - }, - 50000 - ) - }) -}) diff --git a/programs/cli/spec/fixtures/chatgpt/.env.example b/programs/cli/spec/fixtures/chatgpt/.env.example deleted file mode 100644 index 37a04ea5..00000000 --- a/programs/cli/spec/fixtures/chatgpt/.env.example +++ /dev/null @@ -1 +0,0 @@ -EXTENSION_OPENAI_API_KEY='My API Key' diff --git a/programs/cli/spec/fixtures/chatgpt/.gitignore b/programs/cli/spec/fixtures/chatgpt/.gitignore deleted file mode 100644 index ed0a520d..00000000 --- a/programs/cli/spec/fixtures/chatgpt/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -yarn.lock -package-lock.json diff --git a/programs/cli/spec/fixtures/chatgpt/README.md b/programs/cli/spec/fixtures/chatgpt/README.md deleted file mode 100644 index a0785ea9..00000000 --- a/programs/cli/spec/fixtures/chatgpt/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# chatgpt - -> This project was bootstrapped using the Extension.js React-TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### yarn dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -yarn dev -``` - -### yarn start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -yarn start -``` - -### yarn build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -yarn run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/cli/spec/fixtures/chatgpt/images/chatgpt.png b/programs/cli/spec/fixtures/chatgpt/images/chatgpt.png deleted file mode 100644 index 37b27118..00000000 Binary files a/programs/cli/spec/fixtures/chatgpt/images/chatgpt.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/chatgpt/images/extension.png b/programs/cli/spec/fixtures/chatgpt/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/programs/cli/spec/fixtures/chatgpt/images/extension.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/chatgpt/images/icons/icon_16.png b/programs/cli/spec/fixtures/chatgpt/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/cli/spec/fixtures/chatgpt/images/icons/icon_16.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/chatgpt/images/icons/icon_48.png b/programs/cli/spec/fixtures/chatgpt/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/cli/spec/fixtures/chatgpt/images/icons/icon_48.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/chatgpt/manifest.json b/programs/cli/spec/fixtures/chatgpt/manifest.json deleted file mode 100644 index 900e6f42..00000000 --- a/programs/cli/spec/fixtures/chatgpt/manifest.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "chatgpt", - "description": "An Extension.js template integrated with ChatGPT. This template includes a sidebar panel.", - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - }, - "side_panel": { - "default_path": "sidebar/index.html" - }, - "permissions": ["sidePanel"] -} diff --git a/programs/cli/spec/fixtures/chatgpt/package.json b/programs/cli/spec/fixtures/chatgpt/package.json deleted file mode 100644 index 2f4fc321..00000000 --- a/programs/cli/spec/fixtures/chatgpt/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "devDependencies": { - "@types/react": "^18.0.9", - "@types/react-dom": "^18.0.5", - "daisyui": "^4.7.3", - "openai": "^4.28.4", - "react": "^18.1.0", - "react-dom": "^18.1.0", - "tailwindcss": "^3.4.1", - "extension": "latest" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "my-chatgpt", - "private": true, - "version": "0.0.0" -} diff --git a/programs/cli/spec/fixtures/chatgpt/postcss.config.js b/programs/cli/spec/fixtures/chatgpt/postcss.config.js deleted file mode 100644 index 85f717cc..00000000 --- a/programs/cli/spec/fixtures/chatgpt/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {} - } -} diff --git a/programs/cli/spec/fixtures/chatgpt/sidebar/SidebarApp.jsx b/programs/cli/spec/fixtures/chatgpt/sidebar/SidebarApp.jsx deleted file mode 100644 index 7a208a7f..00000000 --- a/programs/cli/spec/fixtures/chatgpt/sidebar/SidebarApp.jsx +++ /dev/null @@ -1,91 +0,0 @@ -import { useState } from 'react'; -import OpenAI from "openai"; -import chatgptLogo from '../images/chatgpt.png' -import extensionJsLogo from '../images/extension.png' - -const openai = new OpenAI({ - apiKey: process.env.EXTENSION_OPENAI_API_KEY, - dangerouslyAllowBrowser: true, -}); - -function SidebarApp() { - const [messages, setMessages] = useState([ - { - content: ( - "Hello there! This is your ChatGPT extension sample, " + - "built with React, Tailwind.css, and DaisyUI. " + - "For it to work, create a .env file with your EXTENSION_OPENAI_API_KEY. " + - "You can get an API key from OpenAI's website." - ), - role: "assistant" - }, - { - content: "https://platform.openai.com/api-keys", - role: "assistant" - }, - ]); - - const [isTyping, setIsTyping] = useState(false); - - - const handleSubmit = async (e) => { - e.preventDefault(); - - const newMessage = { - content: e.target[0].value, - role: "user" - } - - const newMessages = [...messages, newMessage]; - - setMessages(newMessages); - setIsTyping(true); - e.target.reset(); - - const completion = await openai.chat.completions.create({ - model: "gpt-3.5-turbo", - messages: [...newMessages], - }); - - setMessages([...newMessages, completion.choices[0].message]); - setIsTyping(false); - } - - return ( -
-
-
- { - messages.length && messages.map((msg, i) => { - return ( -
-
-
- -
-
-
{msg.content}
-
- ) - }) - } -
- -
handleSubmit(e)}> -
- {isTyping && ChatGPT Extension is typing...} - - - -
-
-
-
- ); -} - -export default SidebarApp; \ No newline at end of file diff --git a/programs/cli/spec/fixtures/chatgpt/sidebar/index.html b/programs/cli/spec/fixtures/chatgpt/sidebar/index.html deleted file mode 100644 index a6e44c73..00000000 --- a/programs/cli/spec/fixtures/chatgpt/sidebar/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - ChatGPT Template - - - -
- - - diff --git a/programs/cli/spec/fixtures/chatgpt/sidebar/sidebar.jsx b/programs/cli/spec/fixtures/chatgpt/sidebar/sidebar.jsx deleted file mode 100644 index 2d965775..00000000 --- a/programs/cli/spec/fixtures/chatgpt/sidebar/sidebar.jsx +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import SidebarApp from './SidebarApp' -import './styles.css' - -const root = ReactDOM.createRoot(document.getElementById('root')) - -root.render( - - - -) diff --git a/programs/cli/spec/fixtures/chatgpt/sidebar/styles.css b/programs/cli/spec/fixtures/chatgpt/sidebar/styles.css deleted file mode 100644 index b5c61c95..00000000 --- a/programs/cli/spec/fixtures/chatgpt/sidebar/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; diff --git a/programs/cli/spec/fixtures/chatgpt/tailwind.config.js b/programs/cli/spec/fixtures/chatgpt/tailwind.config.js deleted file mode 100644 index c92094be..00000000 --- a/programs/cli/spec/fixtures/chatgpt/tailwind.config.js +++ /dev/null @@ -1,8 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: ['**/*.html', '**/*.jsx'], - theme: { - extend: {} - }, - plugins: [require('daisyui')] -} diff --git a/programs/cli/spec/fixtures/constants.ts b/programs/cli/spec/fixtures/constants.ts deleted file mode 100644 index 5fcb4ea7..00000000 --- a/programs/cli/spec/fixtures/constants.ts +++ /dev/null @@ -1,161 +0,0 @@ -type UIContext = 'sidebar' | 'newTab' | 'content' | 'popup' | 'devTools' -type ConfigFiles = - | 'postcss.config.js' - | 'tailwind.config.js' - | 'tsconfig.json' - | 'babel.config.js' - | 'stylelint.config.js' - -interface Template { - name: string - uiContext: UIContext[] | undefined - uiFramework: 'react' | 'preact' | 'vue' | undefined - hasBackground: boolean - hasEnv: boolean - configFiles: ConfigFiles[] | undefined -} - -const DEFAULT_TEMPLATE: Template = { - name: 'init', - uiContext: undefined, - uiFramework: undefined, - hasBackground: false, - hasEnv: false, - configFiles: undefined -} - -const JS_TEMPLATES: Template[] = [ - { - name: 'new', - uiContext: ['newTab'], - uiFramework: undefined, - hasBackground: false, - hasEnv: false, - configFiles: undefined - }, - { - name: 'content', - uiContext: ['content'], - uiFramework: undefined, - hasBackground: true, - hasEnv: false, - configFiles: undefined - } -] - -// const WASM_TEMPLATES: Template[]: string[] = [] - -const TS_TEMPLATES: Template[] = [ - { - name: 'typescript', - uiContext: ['newTab'], - uiFramework: undefined, - hasBackground: false, - hasEnv: false, - configFiles: ['tsconfig.json'] - } -] - -const CUSTOM_TEMPLATES: Template[] = [ - { - name: 'chatgpt', - uiContext: ['sidebar'], - uiFramework: 'react', - hasBackground: false, - hasEnv: true, - - configFiles: ['postcss.config.js', 'tailwind.config.js'] - } -] - -const FRAMEWORK_TEMPLATES: Template[] = [ - { - name: 'react', - uiContext: ['newTab'], - uiFramework: 'react', - hasBackground: false, - hasEnv: false, - configFiles: undefined - }, - { - name: 'react-typescript', - uiContext: ['content'], - uiFramework: 'react', - hasBackground: false, - hasEnv: false, - configFiles: ['postcss.config.js', 'tailwind.config.js', 'tsconfig.json'] - }, - { - name: 'preact', - uiContext: ['newTab'], - uiFramework: 'preact', - hasBackground: false, - hasEnv: false, - configFiles: undefined - }, - { - name: 'preact-typescript', - uiContext: ['content'], - uiFramework: 'preact', - hasBackground: false, - hasEnv: false, - - configFiles: ['postcss.config.js', 'tailwind.config.js', 'tsconfig.json'] - }, - { - name: 'vue', - uiContext: ['newTab'], - uiFramework: 'vue', - hasBackground: false, - hasEnv: false, - configFiles: undefined - }, - { - name: 'vue-typescript', - uiContext: ['content'], - uiFramework: 'vue', - hasBackground: false, - hasEnv: false, - configFiles: ['postcss.config.js', 'tailwind.config.js', 'tsconfig.json'] - } -] - -const TAILWIND_TEMPLATES: Template[] = [ - { - name: 'tailwind', - uiContext: ['newTab'], - uiFramework: 'react', - hasBackground: false, - hasEnv: false, - configFiles: ['postcss.config.js', 'tailwind.config.js'] - } -] - -const ALL_TEMPLATES: Template[] = [ - DEFAULT_TEMPLATE, - ...JS_TEMPLATES, - // ...WASM_TEMPLATES, - ...TS_TEMPLATES, - ...CUSTOM_TEMPLATES, - ...FRAMEWORK_TEMPLATES, - ...TAILWIND_TEMPLATES -] - -const ALL_TEMPLATES_BUT_DEFAULT = ALL_TEMPLATES.filter( - (template) => template.name !== 'init' -) - -const BROWSERS = ['chrome', 'edge', 'firefox'] - -export { - BROWSERS, - DEFAULT_TEMPLATE, - JS_TEMPLATES, - // WASM_TEMPLATES, - TS_TEMPLATES, - CUSTOM_TEMPLATES, - FRAMEWORK_TEMPLATES, - TAILWIND_TEMPLATES, - ALL_TEMPLATES, - ALL_TEMPLATES_BUT_DEFAULT -} diff --git a/programs/cli/spec/fixtures/content/.gitignore b/programs/cli/spec/fixtures/content/.gitignore deleted file mode 100644 index ed0a520d..00000000 --- a/programs/cli/spec/fixtures/content/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -yarn.lock -package-lock.json diff --git a/programs/cli/spec/fixtures/content/README.md b/programs/cli/spec/fixtures/content/README.md deleted file mode 100644 index f4fd5c08..00000000 --- a/programs/cli/spec/fixtures/content/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# content - -> This project was bootstrapped using the Extension.js TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### yarn dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -yarn dev -``` - -### yarn start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -yarn start -``` - -### yarn build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -yarn run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/cli/spec/fixtures/content/background.js b/programs/cli/spec/fixtures/content/background.js deleted file mode 100644 index 262e3995..00000000 --- a/programs/cli/spec/fixtures/content/background.js +++ /dev/null @@ -1,25 +0,0 @@ -console.log('hello from background script') - -chrome.runtime.onMessage.addListener((request, sender) => { - if (request.action === 'changeBackgroundColor') { - changeBackgroundColor(request.color, sender.tab?.id) - } -}) - -function changeBackgroundColor(color, tabId) { - if (!tabId) { - return - } - - chrome.scripting - .executeScript({ - target: {tabId}, - func: setPageBackgroundColor, - args: [color] - }) - .catch(console.error) -} - -function setPageBackgroundColor(color) { - document.body.style.backgroundColor = color -} diff --git a/programs/cli/spec/fixtures/content/content/scripts.js b/programs/cli/spec/fixtures/content/content/scripts.js deleted file mode 100644 index d49a238a..00000000 --- a/programs/cli/spec/fixtures/content/content/scripts.js +++ /dev/null @@ -1,30 +0,0 @@ -import extensionJsLogo from '../images/extension.png' -import './styles.css' - -document.body.innerHTML += ` -
- -

- Change the background-color ⬇ -

- -

- Learn more about creating browser extensions at - https://extension.js.org - -

-
-` - -document.getElementById('colorPicker').addEventListener('input', (event) => { - chrome.runtime - .sendMessage({ - action: 'changeBackgroundColor', - color: event.target.value - }) - .catch(console.error) -}) diff --git a/programs/cli/spec/fixtures/content/content/styles.css b/programs/cli/spec/fixtures/content/content/styles.css deleted file mode 100644 index 01c6bc63..00000000 --- a/programs/cli/spec/fixtures/content/content/styles.css +++ /dev/null @@ -1,56 +0,0 @@ - -.content_script-box { - background: white; - position: fixed; - right: 0; - bottom: 0; - z-index: 9; - width: 315px; - height: 345px; - margin: 1em; - padding: 1em; - display: flex; - align-items: center; - justify-content: center; - flex-direction: column; - gap: 1em; - box-shadow: 0px 0px 4px 1px #ccc; -} - -.content_script-logo { - background: white; - width: 90px; - align-self: flex-start; - border: 4px solid; - border-color: #ccc; - border-radius: 24px; - filter: grayscale(1); - transition: filter 2s, border-color 2s; -} - -.content_script-logo:hover { - filter: grayscale(0); - border-color: aquamarine; -} - -.content_script-title { - font-size: 1.85em; - color: #333; - line-height: 1.1; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; - font-weight: 700; - overflow-wrap: break-word; - word-wrap: break-word; - -ms-word-break: break-all; - word-break: break-word; -} - -.content_script-description { - color: #999; -} - -.content_script-colorPicker { - display: block; - width: 100%; - height: 50px; -} diff --git a/programs/cli/spec/fixtures/content/images/extension.png b/programs/cli/spec/fixtures/content/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/programs/cli/spec/fixtures/content/images/extension.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/content/images/icons/icon_16.png b/programs/cli/spec/fixtures/content/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/cli/spec/fixtures/content/images/icons/icon_16.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/content/images/icons/icon_48.png b/programs/cli/spec/fixtures/content/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/cli/spec/fixtures/content/images/icons/icon_48.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/content/manifest.json b/programs/cli/spec/fixtures/content/manifest.json deleted file mode 100644 index 906760bf..00000000 --- a/programs/cli/spec/fixtures/content/manifest.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "content", - "description": "An Extension.js template using web technologies. This template includes a content script.", - "permissions": ["activeTab", "scripting"], - "host_permissions": [""], - "background": { - "service_worker": "background.js" - }, - "content_scripts": [ - { - "matches": [""], - "js": ["content/scripts.js"] - } - ], - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - } -} diff --git a/programs/cli/spec/fixtures/content/package.json b/programs/cli/spec/fixtures/content/package.json deleted file mode 100644 index 996ce59a..00000000 --- a/programs/cli/spec/fixtures/content/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "devDependencies": { - "extension": "latest" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "my-content", - "private": true, - "version": "0.0.0" -} diff --git a/programs/cli/spec/fixtures/helpers.ts b/programs/cli/spec/fixtures/helpers.ts deleted file mode 100644 index cc21af07..00000000 --- a/programs/cli/spec/fixtures/helpers.ts +++ /dev/null @@ -1,84 +0,0 @@ -// ██████╗██╗ ██╗ -// ██╔════╝██║ ██║ -// ██║ ██║ ██║ -// ██║ ██║ ██║ -// ╚██████╗███████╗██║ -// ╚═════╝╚══════╝╚═╝ - -import path from 'path' -import fs from 'fs' -import {exec} from 'child_process' -import {promisify} from 'util' -import {ALL_TEMPLATES} from './constants' - -const execAsync = promisify(exec) - -export async function extensionProgram(command: string = '') { - const cliCommand = `npx -y extension@latest ${command}` - return await execAsync(cliCommand) -} - -export async function localExtensionProgram(command: string = '') { - const cliCommand = `node ${path.join( - __dirname, - '..', - '..', - 'dist', - 'cli.js' - )} ${command}` - return await execAsync(cliCommand) -} - -export function fileExists(template: string, filePath?: string): boolean { - const templatePath = path.join(__dirname, '..', '..', 'dist', template) - return fs.existsSync(path.join(templatePath, filePath || '')) -} - -export function distFileExists( - template: string, - browser: string, - filePath?: string -): boolean { - const templatePath = path.join(__dirname, template, 'dist', browser) - - return fs.existsSync(path.join(templatePath, filePath || '')) -} - -export async function removeDir(dirPath: string) { - if (fs.existsSync(dirPath)) { - await fs.promises.rm(dirPath, {recursive: true}) - } -} - -export async function removeAllTemplateFolders() { - await Promise.all( - ALL_TEMPLATES.map(async (template) => { - const templatePath = path.join( - __dirname, - '..', - '..', - 'dist', - template.name - ) - - await removeDir(templatePath) - return true - }) - ) -} - -export async function removeAllTemplateDistFolders() { - await Promise.all( - ALL_TEMPLATES.map(async (template) => { - const templatePath = path.join( - __dirname, - 'fixtures', - template.name, - 'dist' - ) - - await removeDir(templatePath) - return true - }) - ) -} diff --git a/programs/cli/spec/fixtures/init/.gitignore b/programs/cli/spec/fixtures/init/.gitignore deleted file mode 100644 index 7f06b448..00000000 --- a/programs/cli/spec/fixtures/init/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -yarn.lock -package-lock.json - -yarn.lock -package-lock.json diff --git a/programs/cli/spec/fixtures/init/README.md b/programs/cli/spec/fixtures/init/README.md deleted file mode 100644 index 45ba120f..00000000 --- a/programs/cli/spec/fixtures/init/README.md +++ /dev/null @@ -1,60 +0,0 @@ -# [projectName] - -> This project was bootstrapped using the Extension.js web template. - -## Directory Structure: - -``` -./[projectName] -├── manifest.json -├── newtab -│ ├── newtab.html -│ ├── newtab.js -│ └── styles.css -├── popup -│ ├── popup.html -│ ├── popup.js -│ └── popup.css -├── public -│ ├── icon -│ │ ├── icon_16.png -│ │ ├── icon_32.png -│ │ └── icon_64.png -│ └── puzzle.png -├── .gitignore -├── README.md -``` - -## Scripts Available - -In the project directory, you can run: - -### [projectPackageManager] dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -[projectPackageManager] dev -``` - -### [projectPackageManager] start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -[projectPackageManager] start -``` - -### [projectPackageManager] build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -[projectPackageManager] run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/cli/spec/fixtures/init/manifest.json b/programs/cli/spec/fixtures/init/manifest.json deleted file mode 100644 index 2d94053b..00000000 --- a/programs/cli/spec/fixtures/init/manifest.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "init", - "description": "A minimum extension template. This template includes a manifest file." -} diff --git a/programs/cli/spec/fixtures/init/package.json b/programs/cli/spec/fixtures/init/package.json deleted file mode 100644 index 034a3d29..00000000 --- a/programs/cli/spec/fixtures/init/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "devDependencies": { - "extension": "latest" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "my-init", - "private": true, - "version": "0.0.0" -} diff --git a/programs/cli/spec/fixtures/install-npm-deps-for-fixtures.sh b/programs/cli/spec/fixtures/install-npm-deps-for-fixtures.sh deleted file mode 100755 index b37dc833..00000000 --- a/programs/cli/spec/fixtures/install-npm-deps-for-fixtures.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -# Navigate to the fixtures directory -cd ./spec/fixtures/ - -# Loop through each top-level directory -for dir in */; do - if [ -d "$dir" ]; then - echo "Running npm install in $dir" - (cd "$dir" && npm install) - fi -done - -echo "All installations are complete." \ No newline at end of file diff --git a/programs/cli/spec/fixtures/new/.gitignore b/programs/cli/spec/fixtures/new/.gitignore deleted file mode 100644 index 7f06b448..00000000 --- a/programs/cli/spec/fixtures/new/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -yarn.lock -package-lock.json - -yarn.lock -package-lock.json diff --git a/programs/cli/spec/fixtures/new/README.md b/programs/cli/spec/fixtures/new/README.md deleted file mode 100644 index 65e2e6a6..00000000 --- a/programs/cli/spec/fixtures/new/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# new - -> This project was bootstrapped using the Extension.js TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### yarn dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -yarn dev -``` - -### yarn start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -yarn start -``` - -### yarn build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -yarn run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/cli/spec/fixtures/new/images/extension.png b/programs/cli/spec/fixtures/new/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/programs/cli/spec/fixtures/new/images/extension.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/new/images/icons/icon_16.png b/programs/cli/spec/fixtures/new/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/cli/spec/fixtures/new/images/icons/icon_16.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/new/images/icons/icon_48.png b/programs/cli/spec/fixtures/new/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/cli/spec/fixtures/new/images/icons/icon_48.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/new/manifest.json b/programs/cli/spec/fixtures/new/manifest.json deleted file mode 100644 index bc84d70b..00000000 --- a/programs/cli/spec/fixtures/new/manifest.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "new", - "description": "An Extension.js template using web technologies. This template includes a new tab override.", - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - }, - "chrome_url_overrides": { - "newtab": "newtab/index.html" - } -} diff --git a/programs/cli/spec/fixtures/new/newtab/index.html b/programs/cli/spec/fixtures/new/newtab/index.html deleted file mode 100644 index 58a5e51a..00000000 --- a/programs/cli/spec/fixtures/new/newtab/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - New Extension - - - - - -
-

- The Extension logo -
- Welcome to your New Extension. -

-

- Learn more about creating browser extensions at - https://extension.js.org. -

-
- - - diff --git a/programs/cli/spec/fixtures/new/newtab/scripts.js b/programs/cli/spec/fixtures/new/newtab/scripts.js deleted file mode 100644 index 5c74d4cf..00000000 --- a/programs/cli/spec/fixtures/new/newtab/scripts.js +++ /dev/null @@ -1,10 +0,0 @@ -function getManifest() { - return chrome.runtime.getManifest() -} -const manifest = getManifest() - -console.table({ - name: manifest.name, - version: manifest.version, - description: manifest.description -}) diff --git a/programs/cli/spec/fixtures/new/newtab/styles.css b/programs/cli/spec/fixtures/new/newtab/styles.css deleted file mode 100644 index 17313d18..00000000 --- a/programs/cli/spec/fixtures/new/newtab/styles.css +++ /dev/null @@ -1,25 +0,0 @@ -body { - display: flex; - justify-content: center; - align-items: center; - height: calc(100vh - 26px); -} - -h1 { - font-size: 4.7em; -} - -.new { - border-radius: 24px; - border: 4px solid; - background: white; - border-color: #ccc; - border-radius: 24px; - filter: grayscale(1); - transition: filter 2s, border-color 2s; -} - -.new:hover { - filter: grayscale(0); - border-color: aquamarine; -} diff --git a/programs/cli/spec/fixtures/new/package.json b/programs/cli/spec/fixtures/new/package.json deleted file mode 100644 index d143ca21..00000000 --- a/programs/cli/spec/fixtures/new/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "devDependencies": { - "extension": "latest" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "my-new", - "private": true, - "version": "0.0.0" -} diff --git a/programs/cli/spec/fixtures/preact-typescript/.gitignore b/programs/cli/spec/fixtures/preact-typescript/.gitignore deleted file mode 100644 index ed0a520d..00000000 --- a/programs/cli/spec/fixtures/preact-typescript/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -yarn.lock -package-lock.json diff --git a/programs/cli/spec/fixtures/preact-typescript/background.ts b/programs/cli/spec/fixtures/preact-typescript/background.ts deleted file mode 100644 index 798d5018..00000000 --- a/programs/cli/spec/fixtures/preact-typescript/background.ts +++ /dev/null @@ -1 +0,0 @@ -console.log('Hello from the background script!') diff --git a/programs/cli/spec/fixtures/preact-typescript/content/ContentApp.tsx b/programs/cli/spec/fixtures/preact-typescript/content/ContentApp.tsx deleted file mode 100644 index b69c8202..00000000 --- a/programs/cli/spec/fixtures/preact-typescript/content/ContentApp.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import {Component} from 'preact' -import {signal} from '@preact/signals' - -import preactLogo from '../images/preact.png' -import tailwindBg from '../images/tailwind_bg.png' -import typescriptLogo from '../images/typescript.png' -import tailwindLogo from '../images/tailwind.png' -import chromeWindowBg from '../images/chromeWindow.png' - -export default function ContentApp() { - const isdialogOpen = signal(true) - - const setIsDialogOpen = (bool: boolean) => { - isdialogOpen.value = bool - } - - if (!isdialogOpen) { - return ( -
- -
- ) - } - - return ( -
-
-
-
- - - -
-
-
-
- Preact logo -
+
- TypeScript logo -
+
- Tailwind logo -
-

- This is a content script running Preact, TypeScript, and - Tailwind.css. -

-

- Learn more about creating cross-browser extensions by{' '} - - . -

-
-
- Chrome window screenshot -
-
-
- ) -} diff --git a/programs/cli/spec/fixtures/preact-typescript/content/scripts.tsx b/programs/cli/spec/fixtures/preact-typescript/content/scripts.tsx deleted file mode 100644 index bed0b743..00000000 --- a/programs/cli/spec/fixtures/preact-typescript/content/scripts.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import {render} from 'preact' -import ContentApp from './ContentApp' -import './styles.css' - -setTimeout(initial, 1000) - -function initial() { - // Create a new div element and append it to the document's body - const rootDiv = document.createElement('div') - rootDiv.id = 'extension-root' - document.body.appendChild(rootDiv) - - render(, rootDiv) -} diff --git a/programs/cli/spec/fixtures/preact-typescript/content/styles.css b/programs/cli/spec/fixtures/preact-typescript/content/styles.css deleted file mode 100644 index dc79ebb5..00000000 --- a/programs/cli/spec/fixtures/preact-typescript/content/styles.css +++ /dev/null @@ -1,10 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -#extension-root { - position: fixed; - bottom: 0; - right: 0; - z-index: 99999; -} diff --git a/programs/cli/spec/fixtures/preact-typescript/extension-env.d.ts b/programs/cli/spec/fixtures/preact-typescript/extension-env.d.ts deleted file mode 100644 index 6908c3a9..00000000 --- a/programs/cli/spec/fixtures/preact-typescript/extension-env.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Required Extension.js types for TypeScript projects. -// This file auto-generated and should not be excluded. -// If you need extra types, consider creating a new *.d.ts and -// referencing it in the "include" array in your tsconfig.json file. -// See https://www.typescriptlang.org/tsconfig#include for info. -/// - -// Polyfill types for browser.* APIs. -/// diff --git a/programs/cli/spec/fixtures/preact-typescript/images/chromeWindow.png b/programs/cli/spec/fixtures/preact-typescript/images/chromeWindow.png deleted file mode 100644 index da525dd8..00000000 Binary files a/programs/cli/spec/fixtures/preact-typescript/images/chromeWindow.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/preact-typescript/images/icons/icon_16.png b/programs/cli/spec/fixtures/preact-typescript/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/cli/spec/fixtures/preact-typescript/images/icons/icon_16.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/preact-typescript/images/icons/icon_48.png b/programs/cli/spec/fixtures/preact-typescript/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/cli/spec/fixtures/preact-typescript/images/icons/icon_48.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/preact-typescript/images/tailwind.png b/programs/cli/spec/fixtures/preact-typescript/images/tailwind.png deleted file mode 100644 index 83ed5e12..00000000 Binary files a/programs/cli/spec/fixtures/preact-typescript/images/tailwind.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/preact-typescript/images/tailwind_bg.png b/programs/cli/spec/fixtures/preact-typescript/images/tailwind_bg.png deleted file mode 100644 index edc40be8..00000000 Binary files a/programs/cli/spec/fixtures/preact-typescript/images/tailwind_bg.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/preact-typescript/manifest.json b/programs/cli/spec/fixtures/preact-typescript/manifest.json deleted file mode 100644 index d4205dc2..00000000 --- a/programs/cli/spec/fixtures/preact-typescript/manifest.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "preact-typescript", - "description": "An extension template using Preact and TypeScript. This template includes a content script using Tailwind.css. To see it in action, visit https://extension.js.org.", - "background": { - "service_worker": "./background.ts" - }, - "content_scripts": [ - { - "matches": ["https://extension.js.org/*"], - "js": ["./content/scripts.tsx"] - } - ], - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - } -} diff --git a/programs/cli/spec/fixtures/preact-typescript/package.json b/programs/cli/spec/fixtures/preact-typescript/package.json deleted file mode 100644 index 9185c926..00000000 --- a/programs/cli/spec/fixtures/preact-typescript/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "devDependencies": { - "@preact/signals": "^1.2.3", - "preact": "^10.22.0", - "tailwindcss": "^3.4.1", - "typescript": "5.3.3", - "extension": "latest" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "my-preact-typescript", - "private": true, - "version": "0.0.0" -} diff --git a/programs/cli/spec/fixtures/preact-typescript/postcss.config.js b/programs/cli/spec/fixtures/preact-typescript/postcss.config.js deleted file mode 100644 index 85f717cc..00000000 --- a/programs/cli/spec/fixtures/preact-typescript/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {} - } -} diff --git a/programs/cli/spec/fixtures/preact-typescript/tailwind.config.js b/programs/cli/spec/fixtures/preact-typescript/tailwind.config.js deleted file mode 100644 index 069e1bc3..00000000 --- a/programs/cli/spec/fixtures/preact-typescript/tailwind.config.js +++ /dev/null @@ -1,8 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: ['**/*.html', '**/*.tsx'], - theme: { - extend: {} - }, - plugins: [] -} diff --git a/programs/cli/spec/fixtures/preact-typescript/tsconfig.json b/programs/cli/spec/fixtures/preact-typescript/tsconfig.json deleted file mode 100644 index 1d045996..00000000 --- a/programs/cli/spec/fixtures/preact-typescript/tsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compilerOptions": { - "allowJs": true, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "isolatedModules": false, - "jsx": "react-jsx", - "lib": ["dom", "dom.iterable", "esnext"], - "moduleResolution": "node", - "module": "esnext", - "resolveJsonModule": true, - "strict": true, - "target": "esnext", - "skipLibCheck": true, - "baseUrl": "./", - "paths": { - "react": ["./node_modules/preact/compat/"], - "react/jsx-runtime": ["./node_modules/preact/jsx-runtime"], - "react-dom": ["./node_modules/preact/compat/"], - "react-dom/*": ["./node_modules/preact/compat/*"] - } - }, - "include": ["./"], - "exclude": ["node_modules", "dist"] -} diff --git a/programs/cli/spec/fixtures/preact/.gitignore b/programs/cli/spec/fixtures/preact/.gitignore deleted file mode 100644 index ed0a520d..00000000 --- a/programs/cli/spec/fixtures/preact/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -yarn.lock -package-lock.json diff --git a/programs/cli/spec/fixtures/preact/README.md b/programs/cli/spec/fixtures/preact/README.md deleted file mode 100644 index 946bd64b..00000000 --- a/programs/cli/spec/fixtures/preact/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# preact - -> This project was bootstrapped using the Extension.js Preact-TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### yarn dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -yarn dev -``` - -### yarn start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -yarn start -``` - -### yarn build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -yarn run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/cli/spec/fixtures/preact/babel.config.json b/programs/cli/spec/fixtures/preact/babel.config.json deleted file mode 100644 index 1a720f1c..00000000 --- a/programs/cli/spec/fixtures/preact/babel.config.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "plugins": [ - [ - "@babel/plugin-transform-react-jsx", - { - "runtime": "automatic", - "importSource": "preact" - } - ] - ] -} diff --git a/programs/cli/spec/fixtures/preact/images/icons/icon_16.png b/programs/cli/spec/fixtures/preact/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/cli/spec/fixtures/preact/images/icons/icon_16.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/preact/images/icons/icon_48.png b/programs/cli/spec/fixtures/preact/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/cli/spec/fixtures/preact/images/icons/icon_48.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/preact/manifest.json b/programs/cli/spec/fixtures/preact/manifest.json deleted file mode 100644 index 4db6fd6c..00000000 --- a/programs/cli/spec/fixtures/preact/manifest.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "preact", - "description": "An Extension.js template using Preact. This template includes a new tab override.", - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - }, - "chrome_url_overrides": { - "newtab": "newtab/index.html" - } -} diff --git a/programs/cli/spec/fixtures/preact/newtab/NewTabApp.jsx b/programs/cli/spec/fixtures/preact/newtab/NewTabApp.jsx deleted file mode 100644 index 78fb3d69..00000000 --- a/programs/cli/spec/fixtures/preact/newtab/NewTabApp.jsx +++ /dev/null @@ -1,25 +0,0 @@ -import {Component} from 'preact' -import 'sakura.css' -import './styles.css' -import Logo from './logo' - -export default class NewTabApp extends Component { - render() { - return ( -
-

- -
- Welcome to your Preact Extension. -

-

- Learn more about creating browser extensions at{' '} - - https://extension.js.org - - . -

-
- ) - } -} diff --git a/programs/cli/spec/fixtures/preact/newtab/index.html b/programs/cli/spec/fixtures/preact/newtab/index.html deleted file mode 100644 index 56192396..00000000 --- a/programs/cli/spec/fixtures/preact/newtab/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - Preact Template - - - -
- - - diff --git a/programs/cli/spec/fixtures/preact/newtab/logo.jsx b/programs/cli/spec/fixtures/preact/newtab/logo.jsx deleted file mode 100644 index 93018894..00000000 --- a/programs/cli/spec/fixtures/preact/newtab/logo.jsx +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Logo Component from Preact Website Logo - * https://github.dev/preactjs/preact-www/blob/master/src/index.jsx - */ -import {Component} from 'preact' - -export default class Logo extends Component { - state = {i: 0, hover: false} - - hover = () => { - this.setState({hover: true}) - } - - hoverOut = () => { - this.setState({hover: false}) - } - - frame = () => { - this.timer = null - if (!this.mounted) return - this.setState({i: this.state.i + 1}, this.next) - } - - next = () => { - let {hover} = this.state - if (!this.mounted || !hover || this.timer) return - this.timer = (requestAnimationFrame || setTimeout)(this.frame, 15) - } - - componentDidMount() { - this.mounted = true - this.startTimer = setTimeout(this.next, 5000) - } - - componentWillUnmount() { - clearTimeout(this.startTimer) - ;(cancelAnimationFrame || clearTimeout)(this.timer) - this.mounted = this.timer = false - } - - componentDidUpdate() { - this.next() - } - - renderEllipse(fg, deg, offset) { - let gapLength = Math.sin((offset / 500) * Math.PI) * 30 + 60 - let lineLength = 894 / 2 - gapLength - return ( - - ) - } - - render( - { - inverted = false, - fg = '#673ab8', - bg = 'white', - component, - title, - ...props - }, - {i} - ) { - if (inverted) [bg, fg] = [fg, bg] - - return ( - - - {this.renderEllipse(fg, 52, i)} - {this.renderEllipse(fg, -52, -0.7 * i)} - - - ) - } -} diff --git a/programs/cli/spec/fixtures/preact/newtab/styles.css b/programs/cli/spec/fixtures/preact/newtab/styles.css deleted file mode 100644 index 1a72e896..00000000 --- a/programs/cli/spec/fixtures/preact/newtab/styles.css +++ /dev/null @@ -1,10 +0,0 @@ -body { - display: flex; - justify-content: center; - align-items: center; - height: calc(100vh - 26px); -} - -h1 { - font-size: 4.7em; -} diff --git a/programs/cli/spec/fixtures/preact/package.json b/programs/cli/spec/fixtures/preact/package.json deleted file mode 100644 index bd680c30..00000000 --- a/programs/cli/spec/fixtures/preact/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "devDependencies": { - "preact": "^10.22.0", - "sakura.css": "^1.5.0", - "extension": "latest" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "my-preact", - "private": true, - "version": "0.0.0" -} diff --git a/programs/cli/spec/fixtures/react-typescript/.gitignore b/programs/cli/spec/fixtures/react-typescript/.gitignore deleted file mode 100644 index ed0a520d..00000000 --- a/programs/cli/spec/fixtures/react-typescript/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -yarn.lock -package-lock.json diff --git a/programs/cli/spec/fixtures/react-typescript/README.md b/programs/cli/spec/fixtures/react-typescript/README.md deleted file mode 100644 index 741e4fe7..00000000 --- a/programs/cli/spec/fixtures/react-typescript/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# react-typescript - -> This project was bootstrapped using the Extension.js React-TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### yarn dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -yarn dev -``` - -### yarn start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -yarn start -``` - -### yarn build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -yarn run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/cli/spec/fixtures/react-typescript/background.ts b/programs/cli/spec/fixtures/react-typescript/background.ts deleted file mode 100644 index 798d5018..00000000 --- a/programs/cli/spec/fixtures/react-typescript/background.ts +++ /dev/null @@ -1 +0,0 @@ -console.log('Hello from the background script!') diff --git a/programs/cli/spec/fixtures/react-typescript/content/ContentApp.tsx b/programs/cli/spec/fixtures/react-typescript/content/ContentApp.tsx deleted file mode 100644 index 446e3add..00000000 --- a/programs/cli/spec/fixtures/react-typescript/content/ContentApp.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import React from 'react' -import reactLogo from '../images/react.png' -import tailwindBg from '../images/tailwind_bg.png' -import typescriptLogo from '../images/typescript.png' -import tailwindLogo from '../images/tailwind.png' -import chromeWindowBg from '../images/chromeWindow.png' - -export default function ContentApp() { - const [isdialogOpen, setIsDialogOpen] = React.useState(true) - - if (!isdialogOpen) { - return ( -
- -
- ) - } - - return ( -
-
-
-
- - - -
-
-
-
- React logo -
+
- TypeScript logo -
+
- Tailwind logo -
-

- This is a content script running React, TypeScript, and - Tailwind.css. -

-

- Learn more about creating cross-browser extensions by{' '} - - . -

-
-
- Chrome window screenshot -
-
-
- ) -} diff --git a/programs/cli/spec/fixtures/react-typescript/content/scripts.tsx b/programs/cli/spec/fixtures/react-typescript/content/scripts.tsx deleted file mode 100644 index 89050dc3..00000000 --- a/programs/cli/spec/fixtures/react-typescript/content/scripts.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import ReactDOM from 'react-dom/client' -import ContentApp from './ContentApp' -import './styles.css' - -setTimeout(initial, 1000) - -function initial() { - // Create a new div element and append it to the document's body - const rootDiv = document.createElement('div') - rootDiv.id = 'extension-root' - document.body.appendChild(rootDiv) - - // Use `createRoot` to create a root, then render the component - // Note that `createRoot` takes the container DOM node, not the React element - const root = ReactDOM.createRoot(rootDiv) - root.render() -} diff --git a/programs/cli/spec/fixtures/react-typescript/content/styles.css b/programs/cli/spec/fixtures/react-typescript/content/styles.css deleted file mode 100644 index dc79ebb5..00000000 --- a/programs/cli/spec/fixtures/react-typescript/content/styles.css +++ /dev/null @@ -1,10 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -#extension-root { - position: fixed; - bottom: 0; - right: 0; - z-index: 99999; -} diff --git a/programs/cli/spec/fixtures/react-typescript/extension-env.d.ts b/programs/cli/spec/fixtures/react-typescript/extension-env.d.ts deleted file mode 100644 index 6908c3a9..00000000 --- a/programs/cli/spec/fixtures/react-typescript/extension-env.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Required Extension.js types for TypeScript projects. -// This file auto-generated and should not be excluded. -// If you need extra types, consider creating a new *.d.ts and -// referencing it in the "include" array in your tsconfig.json file. -// See https://www.typescriptlang.org/tsconfig#include for info. -/// - -// Polyfill types for browser.* APIs. -/// diff --git a/programs/cli/spec/fixtures/react-typescript/images/chromeWindow.png b/programs/cli/spec/fixtures/react-typescript/images/chromeWindow.png deleted file mode 100644 index da525dd8..00000000 Binary files a/programs/cli/spec/fixtures/react-typescript/images/chromeWindow.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/react-typescript/images/icons/icon_16.png b/programs/cli/spec/fixtures/react-typescript/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/cli/spec/fixtures/react-typescript/images/icons/icon_16.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/react-typescript/images/icons/icon_48.png b/programs/cli/spec/fixtures/react-typescript/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/cli/spec/fixtures/react-typescript/images/icons/icon_48.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/react-typescript/images/tailwind.png b/programs/cli/spec/fixtures/react-typescript/images/tailwind.png deleted file mode 100644 index 83ed5e12..00000000 Binary files a/programs/cli/spec/fixtures/react-typescript/images/tailwind.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/react-typescript/images/tailwind_bg.png b/programs/cli/spec/fixtures/react-typescript/images/tailwind_bg.png deleted file mode 100644 index edc40be8..00000000 Binary files a/programs/cli/spec/fixtures/react-typescript/images/tailwind_bg.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/react-typescript/images/typescript.png b/programs/cli/spec/fixtures/react-typescript/images/typescript.png deleted file mode 100644 index 93614694..00000000 Binary files a/programs/cli/spec/fixtures/react-typescript/images/typescript.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/react-typescript/manifest.json b/programs/cli/spec/fixtures/react-typescript/manifest.json deleted file mode 100644 index 7351b9fe..00000000 --- a/programs/cli/spec/fixtures/react-typescript/manifest.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "react-typescript", - "description": "An extension template using React and TypeScript. This template includes a content script using Tailwind.css. To see it in action, visit https://extension.js.org.", - "background": { - "service_worker": "./background.ts" - }, - "content_scripts": [ - { - "matches": ["https://extension.js.org/*"], - "js": ["./content/scripts.tsx"] - } - ], - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - } -} diff --git a/programs/cli/spec/fixtures/react-typescript/package.json b/programs/cli/spec/fixtures/react-typescript/package.json deleted file mode 100644 index 27b261ff..00000000 --- a/programs/cli/spec/fixtures/react-typescript/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "devDependencies": { - "@types/react": "^18.0.9", - "@types/react-dom": "^18.0.5", - "react": "^18.1.0", - "react-dom": "^18.1.0", - "tailwindcss": "^3.4.1", - "typescript": "5.3.3", - "extension": "latest" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "my-react-typescript", - "private": true, - "version": "0.0.0" -} diff --git a/programs/cli/spec/fixtures/react-typescript/postcss.config.js b/programs/cli/spec/fixtures/react-typescript/postcss.config.js deleted file mode 100644 index 85f717cc..00000000 --- a/programs/cli/spec/fixtures/react-typescript/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {} - } -} diff --git a/programs/cli/spec/fixtures/react-typescript/tailwind.config.js b/programs/cli/spec/fixtures/react-typescript/tailwind.config.js deleted file mode 100644 index 069e1bc3..00000000 --- a/programs/cli/spec/fixtures/react-typescript/tailwind.config.js +++ /dev/null @@ -1,8 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: ['**/*.html', '**/*.tsx'], - theme: { - extend: {} - }, - plugins: [] -} diff --git a/programs/cli/spec/fixtures/react/.gitignore b/programs/cli/spec/fixtures/react/.gitignore deleted file mode 100644 index ed0a520d..00000000 --- a/programs/cli/spec/fixtures/react/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -yarn.lock -package-lock.json diff --git a/programs/cli/spec/fixtures/react/README.md b/programs/cli/spec/fixtures/react/README.md deleted file mode 100644 index 386b8944..00000000 --- a/programs/cli/spec/fixtures/react/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# react - -> This project was bootstrapped using the Extension.js TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### yarn dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -yarn dev -``` - -### yarn start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -yarn start -``` - -### yarn build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -yarn run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/cli/spec/fixtures/react/images/icons/icon_16.png b/programs/cli/spec/fixtures/react/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/cli/spec/fixtures/react/images/icons/icon_16.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/react/images/icons/icon_48.png b/programs/cli/spec/fixtures/react/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/cli/spec/fixtures/react/images/icons/icon_48.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/react/images/react.png b/programs/cli/spec/fixtures/react/images/react.png deleted file mode 100644 index 9080fddd..00000000 Binary files a/programs/cli/spec/fixtures/react/images/react.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/react/manifest.json b/programs/cli/spec/fixtures/react/manifest.json deleted file mode 100644 index 857f16e3..00000000 --- a/programs/cli/spec/fixtures/react/manifest.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "react", - "description": "An Extension.js template using React. This template includes a new tab override.", - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - }, - "chrome_url_overrides": { - "newtab": "newtab/index.html" - } -} diff --git a/programs/cli/spec/fixtures/react/newtab/index.html b/programs/cli/spec/fixtures/react/newtab/index.html deleted file mode 100644 index 75582e5f..00000000 --- a/programs/cli/spec/fixtures/react/newtab/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - React Template - - - -
- - - diff --git a/programs/cli/spec/fixtures/react/newtab/scripts.jsx b/programs/cli/spec/fixtures/react/newtab/scripts.jsx deleted file mode 100644 index 1c7a64d0..00000000 --- a/programs/cli/spec/fixtures/react/newtab/scripts.jsx +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import NewtabApp from './NewtabApp' -import './styles.css' - -const root = ReactDOM.createRoot(document.getElementById('root')) - -root.render( - - - -) diff --git a/programs/cli/spec/fixtures/react/newtab/styles.css b/programs/cli/spec/fixtures/react/newtab/styles.css deleted file mode 100644 index 11e3a190..00000000 --- a/programs/cli/spec/fixtures/react/newtab/styles.css +++ /dev/null @@ -1,23 +0,0 @@ -body { - display: flex; - justify-content: center; - align-items: center; - height: calc(100vh - 26px); -} - -h1 { - font-size: 4.7em; -} - -.react { - animation: spin 5s linear infinite; -} - -@keyframes spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} \ No newline at end of file diff --git a/programs/cli/spec/fixtures/react/package.json b/programs/cli/spec/fixtures/react/package.json deleted file mode 100644 index 6f8db0c1..00000000 --- a/programs/cli/spec/fixtures/react/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "devDependencies": { - "@types/react": "^18.2.64", - "@types/react-dom": "^18.2.21", - "react": "^18.1.0", - "react-dom": "^18.1.0", - "sakura.css": "^1.5.0", - "extension": "latest" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "my-react", - "private": true, - "version": "0.0.0" -} diff --git a/programs/cli/spec/fixtures/tailwind/.gitignore b/programs/cli/spec/fixtures/tailwind/.gitignore deleted file mode 100644 index ed0a520d..00000000 --- a/programs/cli/spec/fixtures/tailwind/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -yarn.lock -package-lock.json diff --git a/programs/cli/spec/fixtures/tailwind/README.md b/programs/cli/spec/fixtures/tailwind/README.md deleted file mode 100644 index 4ef90769..00000000 --- a/programs/cli/spec/fixtures/tailwind/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# tailwind - -> This project was bootstrapped using the Extension.js Tailwind template. - -## Scripts Available - -In the project directory, you can run: - -### yarn dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -yarn dev -``` - -### yarn start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -yarn start -``` - -### yarn build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -yarn run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/cli/spec/fixtures/tailwind/images/chromeWindow.png b/programs/cli/spec/fixtures/tailwind/images/chromeWindow.png deleted file mode 100644 index d70571be..00000000 Binary files a/programs/cli/spec/fixtures/tailwind/images/chromeWindow.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/tailwind/images/icons/icon_16.png b/programs/cli/spec/fixtures/tailwind/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/cli/spec/fixtures/tailwind/images/icons/icon_16.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/tailwind/images/icons/icon_48.png b/programs/cli/spec/fixtures/tailwind/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/cli/spec/fixtures/tailwind/images/icons/icon_48.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/tailwind/images/react.png b/programs/cli/spec/fixtures/tailwind/images/react.png deleted file mode 100644 index 9080fddd..00000000 Binary files a/programs/cli/spec/fixtures/tailwind/images/react.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/tailwind/images/tailwind.png b/programs/cli/spec/fixtures/tailwind/images/tailwind.png deleted file mode 100644 index 83ed5e12..00000000 Binary files a/programs/cli/spec/fixtures/tailwind/images/tailwind.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/tailwind/images/tailwind_bg.png b/programs/cli/spec/fixtures/tailwind/images/tailwind_bg.png deleted file mode 100644 index edc40be8..00000000 Binary files a/programs/cli/spec/fixtures/tailwind/images/tailwind_bg.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/tailwind/manifest.json b/programs/cli/spec/fixtures/tailwind/manifest.json deleted file mode 100644 index 3f88c51a..00000000 --- a/programs/cli/spec/fixtures/tailwind/manifest.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "tailwind", - "description": "An extension template using Tailwind. This template includes a new tab override.", - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - }, - "chrome_url_overrides": { - "newtab": "newtab/index.html" - } -} diff --git a/programs/cli/spec/fixtures/tailwind/newtab/NewTabApp.jsx b/programs/cli/spec/fixtures/tailwind/newtab/NewTabApp.jsx deleted file mode 100644 index 9d75a8b7..00000000 --- a/programs/cli/spec/fixtures/tailwind/newtab/NewTabApp.jsx +++ /dev/null @@ -1,68 +0,0 @@ -import React from 'react' -import reactLogo from '../images/react.png' -import tailwindLogo from '../images/tailwind.png' -import chromeWindowBg from '../images/chromeWindow.png' - -export default function NewTabApp() { - return ( -
- -
-
- React logo -
+
- Tailwind logo -
-

- This is a new tab page running React and Tailwind.css. -

-

- Learn more about creating browser extensions at{' '} - - https://extension.js.org - - . -

-
-
- Chrome screenshot -
-
- ) -} diff --git a/programs/cli/spec/fixtures/tailwind/newtab/index.html b/programs/cli/spec/fixtures/tailwind/newtab/index.html deleted file mode 100644 index c6dff892..00000000 --- a/programs/cli/spec/fixtures/tailwind/newtab/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - Tailwind Template - - - -
- - - diff --git a/programs/cli/spec/fixtures/tailwind/newtab/styles.css b/programs/cli/spec/fixtures/tailwind/newtab/styles.css deleted file mode 100644 index b5c61c95..00000000 --- a/programs/cli/spec/fixtures/tailwind/newtab/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; diff --git a/programs/cli/spec/fixtures/tailwind/package.json b/programs/cli/spec/fixtures/tailwind/package.json deleted file mode 100644 index 8cec52a5..00000000 --- a/programs/cli/spec/fixtures/tailwind/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "devDependencies": { - "@types/react": "^18.2.64", - "@types/react-dom": "^18.2.21", - "react": "^18.1.0", - "react-dom": "^18.1.0", - "tailwindcss": "^3.4.1", - "extension": "latest" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "my-tailwind", - "private": true, - "version": "0.0.0" -} diff --git a/programs/cli/spec/fixtures/tailwind/postcss.config.js b/programs/cli/spec/fixtures/tailwind/postcss.config.js deleted file mode 100644 index 85f717cc..00000000 --- a/programs/cli/spec/fixtures/tailwind/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {} - } -} diff --git a/programs/cli/spec/fixtures/tailwind/tailwind.config.js b/programs/cli/spec/fixtures/tailwind/tailwind.config.js deleted file mode 100644 index fe8d881a..00000000 --- a/programs/cli/spec/fixtures/tailwind/tailwind.config.js +++ /dev/null @@ -1,8 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: ['**/*.html', '**/*.jsx'], - theme: { - extend: {} - }, - plugins: [] -} diff --git a/programs/cli/spec/fixtures/typescript/.gitignore b/programs/cli/spec/fixtures/typescript/.gitignore deleted file mode 100644 index ed0a520d..00000000 --- a/programs/cli/spec/fixtures/typescript/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -yarn.lock -package-lock.json diff --git a/programs/cli/spec/fixtures/typescript/README.md b/programs/cli/spec/fixtures/typescript/README.md deleted file mode 100644 index c61bb79e..00000000 --- a/programs/cli/spec/fixtures/typescript/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# typescript - -> This project was bootstrapped using the Extension.js TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### yarn dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -yarn dev -``` - -### yarn start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -yarn start -``` - -### yarn build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -yarn run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/cli/spec/fixtures/typescript/extension-env.d.ts b/programs/cli/spec/fixtures/typescript/extension-env.d.ts deleted file mode 100644 index 6908c3a9..00000000 --- a/programs/cli/spec/fixtures/typescript/extension-env.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Required Extension.js types for TypeScript projects. -// This file auto-generated and should not be excluded. -// If you need extra types, consider creating a new *.d.ts and -// referencing it in the "include" array in your tsconfig.json file. -// See https://www.typescriptlang.org/tsconfig#include for info. -/// - -// Polyfill types for browser.* APIs. -/// diff --git a/programs/cli/spec/fixtures/typescript/images/icons/icon_16.png b/programs/cli/spec/fixtures/typescript/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/cli/spec/fixtures/typescript/images/icons/icon_16.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/typescript/images/icons/icon_48.png b/programs/cli/spec/fixtures/typescript/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/cli/spec/fixtures/typescript/images/icons/icon_48.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/typescript/images/typescript.png b/programs/cli/spec/fixtures/typescript/images/typescript.png deleted file mode 100644 index 93614694..00000000 Binary files a/programs/cli/spec/fixtures/typescript/images/typescript.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/typescript/manifest.json b/programs/cli/spec/fixtures/typescript/manifest.json deleted file mode 100644 index 06ee1646..00000000 --- a/programs/cli/spec/fixtures/typescript/manifest.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "typescript", - "description": "An Extension.js template using TypeScript. This template includes a new tab override.", - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - }, - "chrome_url_overrides": { - "newtab": "newtab/index.html" - } -} diff --git a/programs/cli/spec/fixtures/typescript/newtab/index.html b/programs/cli/spec/fixtures/typescript/newtab/index.html deleted file mode 100644 index 88ca346a..00000000 --- a/programs/cli/spec/fixtures/typescript/newtab/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - TypeScript Extension - - - - - -
-

- The TypeScript logo -
- Welcome to your TypeScript Extension. -

-

- Learn more about creating browser extensions at - https://extension.js.org. -

-
- - - diff --git a/programs/cli/spec/fixtures/typescript/newtab/scripts.ts b/programs/cli/spec/fixtures/typescript/newtab/scripts.ts deleted file mode 100644 index 5c74d4cf..00000000 --- a/programs/cli/spec/fixtures/typescript/newtab/scripts.ts +++ /dev/null @@ -1,10 +0,0 @@ -function getManifest() { - return chrome.runtime.getManifest() -} -const manifest = getManifest() - -console.table({ - name: manifest.name, - version: manifest.version, - description: manifest.description -}) diff --git a/programs/cli/spec/fixtures/typescript/newtab/styles.css b/programs/cli/spec/fixtures/typescript/newtab/styles.css deleted file mode 100644 index da1dcbdb..00000000 --- a/programs/cli/spec/fixtures/typescript/newtab/styles.css +++ /dev/null @@ -1,18 +0,0 @@ -body { - display: flex; - justify-content: center; - align-items: center; - height: calc(100vh - 26px); -} - -h1 { - font-size: 3.7em; -} - -.typescript { - transition: all 400ms cubic-bezier(.47,1.64,.41,.8); -} - -.typescript:hover { - transform: scale(1.5); -} diff --git a/programs/cli/spec/fixtures/typescript/package.json b/programs/cli/spec/fixtures/typescript/package.json deleted file mode 100644 index 8f5e0775..00000000 --- a/programs/cli/spec/fixtures/typescript/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "devDependencies": { - "typescript": "5.3.3", - "extension": "latest" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "my-typescript", - "private": true, - "version": "0.0.0" -} diff --git a/programs/cli/spec/fixtures/vue-typescript/.gitignore b/programs/cli/spec/fixtures/vue-typescript/.gitignore deleted file mode 100644 index ed0a520d..00000000 --- a/programs/cli/spec/fixtures/vue-typescript/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -yarn.lock -package-lock.json diff --git a/programs/cli/spec/fixtures/vue-typescript/README.md b/programs/cli/spec/fixtures/vue-typescript/README.md deleted file mode 100644 index ec413527..00000000 --- a/programs/cli/spec/fixtures/vue-typescript/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# vue-typescript - -> This project was bootstrapped using the Extension Vue-TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### yarn dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -yarn dev -``` - -### yarn start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -yarn start -``` - -### yarn build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -yarn run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/cli/spec/fixtures/vue-typescript/background.ts b/programs/cli/spec/fixtures/vue-typescript/background.ts deleted file mode 100644 index 798d5018..00000000 --- a/programs/cli/spec/fixtures/vue-typescript/background.ts +++ /dev/null @@ -1 +0,0 @@ -console.log('Hello from the background script!') diff --git a/programs/cli/spec/fixtures/vue-typescript/content/ContentApp.vue b/programs/cli/spec/fixtures/vue-typescript/content/ContentApp.vue deleted file mode 100644 index a0752c8b..00000000 --- a/programs/cli/spec/fixtures/vue-typescript/content/ContentApp.vue +++ /dev/null @@ -1,90 +0,0 @@ - - diff --git a/programs/cli/spec/fixtures/vue-typescript/content/scripts.ts b/programs/cli/spec/fixtures/vue-typescript/content/scripts.ts deleted file mode 100644 index bbee32a8..00000000 --- a/programs/cli/spec/fixtures/vue-typescript/content/scripts.ts +++ /dev/null @@ -1,13 +0,0 @@ -import {createApp} from 'vue' -import ContentApp from './ContentApp.vue' -import './styles.css' - -function initial() { - const rootDiv = document.createElement('div') - rootDiv.id = 'extension-root' - document.body.appendChild(rootDiv) - - createApp(ContentApp).mount(rootDiv) -} - -setTimeout(initial, 1000) diff --git a/programs/cli/spec/fixtures/vue-typescript/content/shims-vue.d.ts b/programs/cli/spec/fixtures/vue-typescript/content/shims-vue.d.ts deleted file mode 100644 index 69226d04..00000000 --- a/programs/cli/spec/fixtures/vue-typescript/content/shims-vue.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* eslint-disable */ -declare module '*.vue' { - import type {DefineComponent} from 'vue' - const component: DefineComponent<{}, {}, any> - export default component -} diff --git a/programs/cli/spec/fixtures/vue-typescript/content/styles.css b/programs/cli/spec/fixtures/vue-typescript/content/styles.css deleted file mode 100644 index dc79ebb5..00000000 --- a/programs/cli/spec/fixtures/vue-typescript/content/styles.css +++ /dev/null @@ -1,10 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -#extension-root { - position: fixed; - bottom: 0; - right: 0; - z-index: 99999; -} diff --git a/programs/cli/spec/fixtures/vue-typescript/extension-env.d.ts b/programs/cli/spec/fixtures/vue-typescript/extension-env.d.ts deleted file mode 100644 index 6908c3a9..00000000 --- a/programs/cli/spec/fixtures/vue-typescript/extension-env.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Required Extension.js types for TypeScript projects. -// This file auto-generated and should not be excluded. -// If you need extra types, consider creating a new *.d.ts and -// referencing it in the "include" array in your tsconfig.json file. -// See https://www.typescriptlang.org/tsconfig#include for info. -/// - -// Polyfill types for browser.* APIs. -/// diff --git a/programs/cli/spec/fixtures/vue-typescript/images/chromeWindow.png b/programs/cli/spec/fixtures/vue-typescript/images/chromeWindow.png deleted file mode 100644 index da525dd8..00000000 Binary files a/programs/cli/spec/fixtures/vue-typescript/images/chromeWindow.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/vue-typescript/images/icons/icon_16.png b/programs/cli/spec/fixtures/vue-typescript/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/cli/spec/fixtures/vue-typescript/images/icons/icon_16.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/vue-typescript/images/icons/icon_48.png b/programs/cli/spec/fixtures/vue-typescript/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/cli/spec/fixtures/vue-typescript/images/icons/icon_48.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/vue-typescript/images/tailwind.png b/programs/cli/spec/fixtures/vue-typescript/images/tailwind.png deleted file mode 100644 index 83ed5e12..00000000 Binary files a/programs/cli/spec/fixtures/vue-typescript/images/tailwind.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/vue-typescript/images/tailwind_bg.png b/programs/cli/spec/fixtures/vue-typescript/images/tailwind_bg.png deleted file mode 100644 index edc40be8..00000000 Binary files a/programs/cli/spec/fixtures/vue-typescript/images/tailwind_bg.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/vue-typescript/images/typescript.png b/programs/cli/spec/fixtures/vue-typescript/images/typescript.png deleted file mode 100644 index 93614694..00000000 Binary files a/programs/cli/spec/fixtures/vue-typescript/images/typescript.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/vue-typescript/images/vue.svg b/programs/cli/spec/fixtures/vue-typescript/images/vue.svg deleted file mode 100644 index d4d5f0bd..00000000 --- a/programs/cli/spec/fixtures/vue-typescript/images/vue.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/programs/cli/spec/fixtures/vue-typescript/manifest.json b/programs/cli/spec/fixtures/vue-typescript/manifest.json deleted file mode 100644 index e7bf7e91..00000000 --- a/programs/cli/spec/fixtures/vue-typescript/manifest.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "vue-typescript", - "description": "An extension template using Vue and TypeScript. This template includes a content script using Tailwind.css. To see it in action, visit https://extension.js.org.", - "background": { - "service_worker": "./background.ts" - }, - "content_scripts": [ - { - "matches": ["https://extension.js.org/*"], - "js": ["./content/scripts.ts"] - } - ], - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - } -} diff --git a/programs/cli/spec/fixtures/vue-typescript/package.json b/programs/cli/spec/fixtures/vue-typescript/package.json deleted file mode 100644 index 56514c1d..00000000 --- a/programs/cli/spec/fixtures/vue-typescript/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "devDependencies": { - "vue": "^3.4.27", - "tailwindcss": "^3.4.1", - "typescript": "5.3.3", - "extension": "latest" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "my-vue-typescript", - "private": true, - "version": "0.0.0" -} diff --git a/programs/cli/spec/fixtures/vue-typescript/postcss.config.js b/programs/cli/spec/fixtures/vue-typescript/postcss.config.js deleted file mode 100644 index 85f717cc..00000000 --- a/programs/cli/spec/fixtures/vue-typescript/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {} - } -} diff --git a/programs/cli/spec/fixtures/vue-typescript/tailwind.config.js b/programs/cli/spec/fixtures/vue-typescript/tailwind.config.js deleted file mode 100644 index 0abdfe65..00000000 --- a/programs/cli/spec/fixtures/vue-typescript/tailwind.config.js +++ /dev/null @@ -1,8 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: ['**/*.html', '**/*.vue'], - theme: { - extend: {} - }, - plugins: [] -} diff --git a/programs/cli/spec/fixtures/vue-typescript/tsconfig.json b/programs/cli/spec/fixtures/vue-typescript/tsconfig.json deleted file mode 100644 index b17ae463..00000000 --- a/programs/cli/spec/fixtures/vue-typescript/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "types": ["webpack/module"], - "allowJs": true, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "isolatedModules": false, - "jsx": "preserve", - "lib": ["dom", "dom.iterable", "esnext"], - "moduleResolution": "node", - "module": "esnext", - "resolveJsonModule": true, - "strict": true, - "target": "esnext" - }, - "include": ["./"], - "exclude": ["node_modules", "dist"] -} diff --git a/programs/cli/spec/fixtures/vue/.gitignore b/programs/cli/spec/fixtures/vue/.gitignore deleted file mode 100644 index ed0a520d..00000000 --- a/programs/cli/spec/fixtures/vue/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -yarn.lock -package-lock.json diff --git a/programs/cli/spec/fixtures/vue/README.md b/programs/cli/spec/fixtures/vue/README.md deleted file mode 100644 index 48e8d8af..00000000 --- a/programs/cli/spec/fixtures/vue/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# vue - -> This project was bootstrapped using the Extension.js TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### yarn dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -yarn dev -``` - -### yarn start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -yarn start -``` - -### yarn build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -yarn run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/cli/spec/fixtures/vue/images/icons/icon_16.png b/programs/cli/spec/fixtures/vue/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/cli/spec/fixtures/vue/images/icons/icon_16.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/vue/images/icons/icon_48.png b/programs/cli/spec/fixtures/vue/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/cli/spec/fixtures/vue/images/icons/icon_48.png and /dev/null differ diff --git a/programs/cli/spec/fixtures/vue/images/vue.svg b/programs/cli/spec/fixtures/vue/images/vue.svg deleted file mode 100644 index d4d5f0bd..00000000 --- a/programs/cli/spec/fixtures/vue/images/vue.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/programs/cli/spec/fixtures/vue/manifest.json b/programs/cli/spec/fixtures/vue/manifest.json deleted file mode 100644 index c60475c8..00000000 --- a/programs/cli/spec/fixtures/vue/manifest.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "vue", - "description": "An Extension.js template using Vue. This template includes a new tab override.", - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - }, - "chrome_url_overrides": { - "newtab": "newtab/index.html" - } -} diff --git a/programs/cli/spec/fixtures/vue/newtab/NewTabApp.vue b/programs/cli/spec/fixtures/vue/newtab/NewTabApp.vue deleted file mode 100644 index 47fc2529..00000000 --- a/programs/cli/spec/fixtures/vue/newtab/NewTabApp.vue +++ /dev/null @@ -1,30 +0,0 @@ - - diff --git a/programs/cli/spec/fixtures/vue/newtab/index.html b/programs/cli/spec/fixtures/vue/newtab/index.html deleted file mode 100644 index 90a5ebca..00000000 --- a/programs/cli/spec/fixtures/vue/newtab/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - Vue Template - - - -
- - - diff --git a/programs/cli/spec/fixtures/vue/newtab/scripts.js b/programs/cli/spec/fixtures/vue/newtab/scripts.js deleted file mode 100644 index d4dd397f..00000000 --- a/programs/cli/spec/fixtures/vue/newtab/scripts.js +++ /dev/null @@ -1,7 +0,0 @@ -import 'sakura.css' -import './styles.css' - -import {createApp} from 'vue' -import NewTabApp from './NewTabApp.vue' - -createApp(NewTabApp).mount('#app') diff --git a/programs/cli/spec/fixtures/vue/newtab/styles.css b/programs/cli/spec/fixtures/vue/newtab/styles.css deleted file mode 100644 index 26ef4ee5..00000000 --- a/programs/cli/spec/fixtures/vue/newtab/styles.css +++ /dev/null @@ -1,36 +0,0 @@ -body { - display: flex; - justify-content: center; - align-items: center; - height: calc(100vh - 26px); -} - -h1 { - font-size: 4.7em; -} - -.vue { - animation: heartbeat 1s linear infinite; -} - -@keyframes heartbeat { - 0% { - transform: scale(0.9); - } - - 20% { - transform: scale(1); - } - - 30% { - transform: scale(0.9); - } - - 40% { - transform: scale(1); - } - - 100% { - transform: scale(0.9); - } -} diff --git a/programs/cli/spec/fixtures/vue/package.json b/programs/cli/spec/fixtures/vue/package.json deleted file mode 100644 index 544ad4db..00000000 --- a/programs/cli/spec/fixtures/vue/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "devDependencies": { - "vue": "^3.4.27", - "sakura.css": "^1.5.0", - "extension": "latest" - }, - "scripts": { - "dev": "extension dev", - "start": "extension start", - "build": "extension build" - }, - "dependencies": {}, - "name": "my-vue", - "private": true, - "version": "0.0.0" -} diff --git a/programs/cli/spec/create.spec.ts b/programs/create/__spec__/create.spec.ts similarity index 67% rename from programs/cli/spec/create.spec.ts rename to programs/create/__spec__/create.spec.ts index 9fc20f76..82ccf6f1 100644 --- a/programs/cli/spec/create.spec.ts +++ b/programs/create/__spec__/create.spec.ts @@ -6,43 +6,24 @@ // ╚═════╝╚══════╝╚═╝ import path from 'path' -import {ALL_TEMPLATES} from './fixtures/constants' -import { - extensionProgram, - localExtensionProgram, - fileExists, - removeAllTemplateFolders -} from './fixtures/helpers' +import {ALL_TEMPLATES, DEFAULT_TEMPLATE} from '../../../examples/data' +import {extensionCreate} from '../dist/module' +import {fileExists, removeAllTemplateFolders} from './helpers' describe('extension create', () => { beforeEach(async () => { await removeAllTemplateFolders() }) - it('throws an error if target directory has conflicting files', async () => { - const templatePath = path.join(__dirname, '..', 'dist', 'init-newest') - - expect.assertions(2) - - try { - // Create first extension. - await extensionProgram(`create ${templatePath}`) - - // Try recreating on top of existing directory. - await extensionProgram(`create ${templatePath}`) - } catch (error: any) { - expect(error).toBeTruthy() - expect(error.message).toContain('includes conflicting files') - } - }, 60000) - it('throws an error if no project name is provided', async () => { try { - await extensionProgram('create') + await extensionCreate(undefined, { + template: DEFAULT_TEMPLATE.name + }) } catch (error: any) { expect(error).toBeTruthy() expect(error.message).toContain( - "missing required argument 'project-name|project-path" + 'You need to provide an extension name to create one' ) } }, 30000) @@ -51,30 +32,33 @@ describe('extension create', () => { it.each(ALL_TEMPLATES)( `creates the "$name" extension template`, async (template) => { - const extensionPath = path.join(__dirname, '..', 'dist', template.name) - await localExtensionProgram( - `create ${extensionPath} --template="${template.name}"` + const templatePath = path.resolve( + __dirname, + '..', + 'dist', + template.name ) + await extensionCreate(templatePath, { + template: template.name, + noInstall: true + }) + // UI frameworks will use either tsx or jsx files. // Non-UI frameworks will use either ts or js files. // TODO: cezaraugusto this is not going to scale well // but better than nothing for now. const ext = template.uiFramework - ? template.configFiles?.includes('tsconfig.json') - ? template.uiFramework === 'vue' - ? 'ts' - : 'tsx' - : template.uiFramework === 'vue' - ? 'js' - : 'jsx' + ? template.uiFramework === 'vue' + ? 'ts' + : 'tsx' : template.configFiles?.includes('tsconfig.json') ? 'ts' : 'js' template.uiContext?.forEach((context: string) => { // Expect [context]/index.html for all contexts except 'content' - if (context !== 'content') { + if (!context.includes('content')) { expect( fileExists(template.name, `${context.toLowerCase()}/index.html`) ).toBeTruthy() @@ -85,10 +69,20 @@ describe('extension create', () => { fileExists(template.name, `${context.toLowerCase()}/scripts.${ext}`) ).toBeTruthy() - // Expect [uiContext]/styles.css for styles - expect( - fileExists(template.name, `${context.toLowerCase()}/styles.css`) - ).toBeTruthy() + // Expect [uiContext]/styles.sass|less|css for styles + if (template.name?.includes('sass')) { + expect( + fileExists(template.name, `${context.toLowerCase()}/styles.scss`) + ).toBeTruthy() + } else if (template.name?.includes('less')) { + expect( + fileExists(template.name, `${context.toLowerCase()}/styles.less`) + ).toBeTruthy() + } else { + expect( + fileExists(template.name, `${context.toLowerCase()}/styles.css`) + ).toBeTruthy() + } // Expect [ContextApp].[ext] for all contexts using frameworks if (template.uiFramework) { @@ -107,13 +101,16 @@ describe('extension create', () => { } }) - // Expect images/icons/icon_16.png and expect images/icons/icon_16.png + // Expect images/extension_16.png and expect images/extension_16.png if (template.name !== 'init') { expect( - fileExists(template.name, 'images/icons/icon_16.png') + fileExists(template.name, 'images/extension_16.png') + ).toBeTruthy() + expect( + fileExists(template.name, 'images/extension_48.png') ).toBeTruthy() expect( - fileExists(template.name, 'images/icons/icon_48.png') + fileExists(template.name, 'images/extension_128.png') ).toBeTruthy() } @@ -145,7 +142,7 @@ describe('extension create', () => { }) } }, - ALL_TEMPLATES.length * 50000 + 30000 ) }) }) diff --git a/programs/create/__spec__/helpers.ts b/programs/create/__spec__/helpers.ts new file mode 100644 index 00000000..87f7a900 --- /dev/null +++ b/programs/create/__spec__/helpers.ts @@ -0,0 +1,27 @@ +import path from 'path' +import fs from 'fs' +import {ALL_TEMPLATES} from '../../../examples/data' + +export function fileExists(templateName: string, filePath?: string): boolean { + const templatePath = path.resolve(__dirname, '..', 'dist', templateName) + return fs.existsSync(path.join(templatePath, filePath || '')) +} + +export async function removeDir(dirPath: string) { + if (fs.existsSync(dirPath)) { + await fs.promises.rm(dirPath, {recursive: true}) + } +} + +export async function removeAllTemplateFolders() { + await Promise.all( + ALL_TEMPLATES.map(async (template) => { + const templatePath = path.resolve(__dirname, '..', 'dist', template.name) + + console.log('Removing template:', templatePath) + + await removeDir(templatePath) + return true + }) + ) +} diff --git a/programs/create/copyTemplates.js b/programs/create/copyTemplates.js deleted file mode 100644 index aa879dbf..00000000 --- a/programs/create/copyTemplates.js +++ /dev/null @@ -1,53 +0,0 @@ -/* eslint-disable */ -const fs = require('fs').promises -const path = require('path') - -async function copyDirectory() { - const sourceDir = path.resolve(__dirname, './templates') - const destinationDir = path.resolve(__dirname, './dist/templates') - - try { - try { - await fs.access(sourceDir) - } catch (error) { - console.error(`Source directory '${sourceDir}' not found.`) - return - } - - // Create the destination directory if it doesn't exist - try { - await fs.mkdir(destinationDir, {recursive: true}) - } catch (err) { - // Ignore the error if the directory already exists - if (err.code !== 'EEXIST') throw err - } - - // Copy the contents of the source directory to the destination directory - await copyRecursive(sourceDir, destinationDir) - - console.log(`Copied '${sourceDir}' to '${destinationDir}'.`) - } catch (err) { - console.error('An error occurred:', err) - } -} - -async function copyRecursive(src, dest) { - const entries = await fs.readdir(src, {withFileTypes: true}) - await fs.mkdir(dest, {recursive: true}).catch((error) => { - // Ignore the error if the directory already exists - if (error.code !== 'EEXIST') throw error - }) - - for (const entry of entries) { - const srcPath = path.join(src, entry.name) - const destPath = path.join(dest, entry.name) - - if (entry.isDirectory()) { - await copyRecursive(srcPath, destPath) - } else { - await fs.copyFile(srcPath, destPath) - } - } -} - -copyDirectory() diff --git a/programs/create/create.spec.ts b/programs/create/create.spec.ts deleted file mode 100644 index 8b211aaf..00000000 --- a/programs/create/create.spec.ts +++ /dev/null @@ -1,7 +0,0 @@ -export default function moduleSpec() {} -/** - * can create a new extension - * can create a new extension from a template - * can create a new extension in a custom output directory - * can create a new extension from a template in a custom output directory - */ diff --git a/programs/create/helpers/getInstallInfo.ts b/programs/create/helpers/getInstallInfo.ts deleted file mode 100644 index eece4935..00000000 --- a/programs/create/helpers/getInstallInfo.ts +++ /dev/null @@ -1,16 +0,0 @@ -// ██████╗██████╗ ███████╗ █████╗ ████████╗███████╗ -// ██╔════╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔════╝ -// ██║ ██████╔╝█████╗ ███████║ ██║ █████╗ -// ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██╔══╝ -// ╚██████╗██║ ██║███████╗██║ ██║ ██║ ███████╗ -// ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ - -export function getInstallCommand() { - const userAgent = process.env.npm_config_user_agent - - if (!userAgent) return 'npm' - if (userAgent.startsWith('yarn')) return 'yarn' - if (userAgent.startsWith('pnpm')) return 'pnpm' - - return 'npm' -} diff --git a/programs/create/helpers/getTemplatePath.ts b/programs/create/helpers/getTemplatePath.ts deleted file mode 100644 index d1b6b5a5..00000000 --- a/programs/create/helpers/getTemplatePath.ts +++ /dev/null @@ -1,14 +0,0 @@ -// ██████╗██████╗ ███████╗ █████╗ ████████╗███████╗ -// ██╔════╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔════╝ -// ██║ ██████╔╝█████╗ ███████║ ██║ █████╗ -// ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██╔══╝ -// ╚██████╗██║ ██║███████╗██║ ██║ ██║ ███████╗ -// ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ - -import path from 'path' - -export default function getTemplatePath(workingDir: string, template: string) { - const templateName = path.basename(template) - const templatesDir = path.resolve(__dirname, 'templates', templateName) - return path.resolve(workingDir, templatesDir) -} diff --git a/programs/create/helpers/isDirectoryWriteable.ts b/programs/create/helpers/isDirectoryWriteable.ts deleted file mode 100644 index c5486f4d..00000000 --- a/programs/create/helpers/isDirectoryWriteable.ts +++ /dev/null @@ -1,25 +0,0 @@ -// ██████╗██████╗ ███████╗ █████╗ ████████╗███████╗ -// ██╔════╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔════╝ -// ██║ ██████╔╝█████╗ ███████║ ██║ █████╗ -// ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██╔══╝ -// ╚██████╗██║ ██║███████╗██║ ██║ ██║ ███████╗ -// ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ - -import fs from 'fs/promises' -import {brightGreen} from '@colors/colors/safe' - -export default async function isDirectoryWriteable( - directory: string, - projectName: string -): Promise { - try { - console.log(`🤝 - Ensuring ${brightGreen(projectName)} folder exists...`) - - await fs.mkdir(directory, {recursive: true}) - - return true - } catch (err) { - console.error('Error while checking directory writability:', err) - return false - } -} diff --git a/programs/create/helpers/isExternalTemplate.ts b/programs/create/helpers/isExternalTemplate.ts deleted file mode 100644 index 6add46f4..00000000 --- a/programs/create/helpers/isExternalTemplate.ts +++ /dev/null @@ -1,10 +0,0 @@ -// ██████╗██████╗ ███████╗ █████╗ ████████╗███████╗ -// ██╔════╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔════╝ -// ██║ ██████╔╝█████╗ ███████║ ██║ █████╗ -// ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██╔══╝ -// ╚██████╗██║ ██║███████╗██║ ██║ ██║ ███████╗ -// ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ - -export default function isExternalTemplate(template: string) { - return template.startsWith('https://') -} diff --git a/programs/create/helpers/isTypeScriptTemplate.ts b/programs/create/helpers/isTypeScriptTemplate.ts deleted file mode 100644 index 836935a6..00000000 --- a/programs/create/helpers/isTypeScriptTemplate.ts +++ /dev/null @@ -1,20 +0,0 @@ -// ██████╗██████╗ ███████╗ █████╗ ████████╗███████╗ -// ██╔════╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔════╝ -// ██║ ██████╔╝█████╗ ███████║ ██║ █████╗ -// ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██╔══╝ -// ╚██████╗██║ ██║███████╗██║ ██║ ██║ ███████╗ -// ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ - -import isExternalTemplate from './isExternalTemplate' - -export default function isTypeScriptTemplate(template: string) { - if (isExternalTemplate(template)) { - return false - } - - return ( - template === 'typescript' || - template.startsWith('typescript-') || - template.endsWith('-typescript') - ) -} diff --git a/programs/create/install_scripts.sh b/programs/create/install_scripts.sh new file mode 100644 index 00000000..ff35a773 --- /dev/null +++ b/programs/create/install_scripts.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +# Define source and destination paths +src_template="$(dirname "$0")/template" +dest_template="$(dirname "$0")/dist" + +# Ensure the destination directory exists +mkdir -p "$dest_template" + +# Copy the template directory to the dist folder +echo '►►► Copying template to distribution folder' +cp -r "$src_template" "$dest_template" + +echo '►►► Template copied successfully' diff --git a/programs/create/jest.config.js b/programs/create/jest.config.js new file mode 100644 index 00000000..0e6ffb72 --- /dev/null +++ b/programs/create/jest.config.js @@ -0,0 +1,5 @@ +module.exports = { + preset: 'ts-jest', + testEnvironment: 'node', + testMatch: ['**/__spec__/**/*.spec.ts'] +} diff --git a/programs/create/lib/messages.ts b/programs/create/lib/messages.ts new file mode 100644 index 00000000..ce30e1a0 --- /dev/null +++ b/programs/create/lib/messages.ts @@ -0,0 +1,277 @@ +// ██████╗██████╗ ███████╗ █████╗ ████████╗███████╗ +// ██╔════╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔════╝ +// ██║ ██████╔╝█████╗ ███████║ ██║ █████╗ +// ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██╔══╝ +// ╚██████╗██║ ██║███████╗██║ ██║ ██║ ███████╗ +// ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ + +import path from 'path' +import { + red, + gray, + cyan, + brightYellow, + brightBlue, + brightGreen, + underline +} from '@colors/colors/safe' +import fs from 'fs/promises' +import {detect} from 'detect-package-manager' + +export function destinationNotWriteable(workingDir: string) { + const workingDirFolder = path.basename(workingDir) + + return ( + `Failed to write in the destination directory. ` + + `Path for \`${workingDirFolder}\` is not writable.\n` + + `Ensure you have write permissions for this folder.\n` + + `Path: ${workingDirFolder}` + ) +} + +export async function directoryHasConflicts( + projectPath: string, + conflictingFiles: string[] +) { + const projectName = path.basename(projectPath) + + let message = + `\nConflict! Path to ` + + `${cyan(projectName)} includes conflicting files:\n\n` + + for (const file of conflictingFiles) { + const stats = await fs.lstat(path.join(projectPath, file)) + message += stats.isDirectory() + ? `${gray('-')} ${brightYellow(file)}\n` + : `${gray('-')} ${brightYellow(file)}\n` + } + + message += + '\nYou need to either rename/remove the files listed above, ' + + 'or choose a new directory name for your extension.\n' + + `\nPath to conflicting directory: ${underline(projectPath)}` + + return message +} + +export function noProjectName() { + return ( + 'You need to provide an extension name to create one. ' + + '\nSee `--help` for command info.' + ) +} + +export function noUrlAllowed() { + return ( + 'URLs are not allowed as a project path. Either write ' + + 'a name or a path to a local folder.' + ) +} + +export async function successfullInstall( + projectPath: string, + projectName: string +) { + const relativePath = path.relative(process.cwd(), projectPath) + const pm = await detect() + + let command = 'npm run' + + switch (pm) { + case 'yarn': + command = 'yarn dev' + break + case 'pnpm': + command = 'pnpm run dev' + break + default: + command = 'npm run dev' + } + return ( + `🧩 - ${brightGreen('Success!')} Extension ${cyan(projectName)} created.\n\n` + + `Now ${brightBlue(`cd ${underline(relativePath)}`)} and ` + + `${brightBlue(`${command}`)} to open a new browser instance\n` + + 'with your extension installed, loaded, and enabled for development.\n\n' + + `${brightGreen('You are ready')}. Time to hack on your extension!` + ) +} + +export function startingNewExtension(projectName: string) { + return `🐣 - Starting a new browser extension named ${cyan(projectName)}...` +} + +export function checkingIfPathIsWriteable() { + return `🤞 - Checking if destination path is writeable...` +} + +export function scanningPossiblyConflictingFiles() { + return '🔎 - Scanning for potential conflicting files...' +} + +export function createDirectoryError(projectName: string, error: any) { + return ( + `${red(`✖︎✖︎✖︎`)} ` + + `Can't create directory ${cyan(projectName)}. ${error}` + ) +} + +export function writingTypeDefinitions(projectName: string) { + return `🔷 - Writing ${cyan(projectName)} type definitions...` +} + +export function writingTypeDefinitionsError(error: any) { + return `${red( + `✖︎✖︎✖︎` + )} Failed to write the extension type definition. ${error}` +} + +export function installingFromTemplate( + projectName: string, + templateName: string +) { + if (templateName === 'init') { + return `🧰 - Installing ${cyan(projectName)}...` + } + + return ( + `🧰 - Installing ${cyan(projectName)} from ` + + `template ${brightBlue(templateName)}...` + ) +} + +export function installingFromTemplateError( + projectName: string, + template: string, + error: any +) { + return ( + `${red(`✖︎✖︎✖︎`)} Can't find template ` + + `${brightBlue(template)} for ${cyan(projectName)}. ${error}` + ) +} + +export function initializingGitForRepository(projectName: string) { + return `🌲 - Initializing git repository for ${cyan(projectName)}...` +} + +export function initializingGitForRepositoryFailed( + gitCommand: string, + gitArgs: string[], + code: number | null +) { + return ( + `Command ${gitCommand} ${gitArgs.join(' ')} ` + + `failed with exit code ${code}` + ) +} + +export function initializingGitForRepositoryProcessError( + projectName: string, + error: any +) { + return `${red( + `✖︎✖︎✖︎` + )} Child process error: Can't initialize ${brightYellow( + 'git' + )} for ${cyan(projectName)}. ${error.message}` +} + +export function initializingGitForRepositoryError( + projectName: string, + error: any +) { + return ( + `${red(`✖︎✖︎✖︎`)} Can't initialize ` + + `${brightYellow('git')} for ${cyan(projectName)}. ${ + error.message || error.toString() + }` + ) +} + +export function installingDependencies() { + return '🛠 - Installing dependencies...' +} + +export function installingDependenciesFailed( + gitCommand: string, + gitArgs: string[], + code: number | null +) { + return ( + `Command ${gitCommand} ${gitArgs.join(' ')} ` + + `failed with exit code ${code}` + ) +} + +export function installingDependenciesProcessError( + projectName: string, + error: any +) { + return ( + `${red(`✖︎✖︎✖︎`)} Child process error: Can't ` + + `install dependencies for ${cyan(projectName)}. ${error}` + ) +} + +export function cantInstallDependencies(projectName: string, error: any) { + return `${red( + `✖︎✖︎✖︎` + )} Can't install dependencies for ${cyan(projectName)}. ${ + error.message || error.toString() + }` +} + +export function symlinkCreated() { + return 'Symlink created successfully.' +} + +export function symlinkError(command: string, args: string[]) { + return `Failed to create symlink: ${command} ${args.join(' ')}` +} + +export function writingPackageJsonMetadata() { + return `📝 - Writing ${brightYellow(`package.json`)} metadata...` +} + +export function writingPackageJsonMetadataError( + projectName: string, + error: any +) { + return ( + `${red(`✖︎✖︎✖︎`)} Can't write ` + + `${brightYellow(`package.json`)} for ${cyan(projectName)}. ${error}` + ) +} + +export function writingManifestJsonMetadata() { + return `📜 - Writing ${brightYellow(`manifest.json`)} metadata...` +} + +export function writingManifestJsonMetadataError( + projectName: string, + error: any +) { + return ( + `${red(`✖︎✖︎✖︎`)} Can't write ` + + `${brightYellow(`manifest.json`)} for ${cyan(projectName)}. ${error}` + ) +} + +export function writingReadmeMetaData() { + return `📄 - Writing ${brightYellow(`README.md`)} metadata...` +} + +export function writingReadmeMetaDataEError(projectName: string, error: any) { + return ( + `${red(`✖︎✖︎✖︎`)} ` + + `Can't write the ${brightYellow('README.md')} file for ${cyan(projectName)}. ${error}` + ) +} + +export function folderExists(projectName: string) { + return `🤝 - Ensuring ${cyan(projectName)} folder exists...` +} + +export function writingDirectoryError(error: any) { + return 'Error while checking directory writability: ' + error +} diff --git a/programs/create/helpers/copyDirectory.ts b/programs/create/lib/utils.ts similarity index 50% rename from programs/create/helpers/copyDirectory.ts rename to programs/create/lib/utils.ts index 0453042a..cb8363c8 100644 --- a/programs/create/helpers/copyDirectory.ts +++ b/programs/create/lib/utils.ts @@ -7,11 +7,10 @@ import fs from 'fs/promises' import path from 'path' +import {detect} from 'detect-package-manager' +import * as messages from './messages' -export default async function copyDirectory( - source: string, - destination: string -) { +export async function copyDirectory(source: string, destination: string) { const directoryEntries = await fs.readdir(source, {withFileTypes: true}) await fs.mkdir(destination, {recursive: true}) @@ -28,3 +27,59 @@ export default async function copyDirectory( }) ) } + +export async function getInstallCommand() { + const pm = await detect() + + let command = 'npm run' + + switch (pm) { + case 'yarn': + command = 'yarn' + break + case 'pnpm': + command = 'pnpm run' + break + default: + command = 'npm run' + } + + return command +} + +export function getTemplatePath(workingDir: string) { + const templatesDir = path.resolve(__dirname, 'template') + return path.resolve(workingDir, templatesDir) +} + +export async function isDirectoryWriteable( + directory: string, + projectName: string +): Promise { + try { + console.log(messages.folderExists(projectName)) + + await fs.mkdir(directory, {recursive: true}) + + return true + } catch (err) { + console.log(messages.writingDirectoryError(err)) + return false + } +} + +export function isExternalTemplate(templateName: string) { + return templateName !== 'init' +} + +export function isTypeScriptTemplate(templateName: string) { + if (isExternalTemplate(templateName)) { + return false + } + + return ( + templateName === 'typescript' || + templateName.startsWith('typescript-') || + templateName.endsWith('-typescript') + ) +} diff --git a/programs/create/messages/index.ts b/programs/create/messages/index.ts deleted file mode 100644 index 668621a2..00000000 --- a/programs/create/messages/index.ts +++ /dev/null @@ -1,65 +0,0 @@ -// ██████╗██████╗ ███████╗ █████╗ ████████╗███████╗ -// ██╔════╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔════╝ -// ██║ ██████╔╝█████╗ ███████║ ██║ █████╗ -// ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██╔══╝ -// ╚██████╗██║ ██║███████╗██║ ██║ ██║ ███████╗ -// ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ - -import path from 'path' -import fs from 'fs/promises' -// @ts-ignore -import prefersYarn from 'prefers-yarn' -import {brightBlue, brightGreen, underline} from '@colors/colors/safe' - -export function destinationNotWriteable(workingDir: string) { - const workingDirFolder = path.basename(workingDir) - - return ( - `Failed to write in the destination directory. Path for \`${workingDirFolder}\` is not writable.\n` + - `Ensure you have write permissions for this folder.\nPath: ${workingDirFolder}` - ) -} - -export async function directoryHasConflicts( - projectPath: string, - conflictingFiles: string[] -) { - const projectName = path.basename(projectPath) - let message = `\nConflict! Path to ${underline( - projectName - )} includes conflicting files:\n` - - for (const file of conflictingFiles) { - const stats = await fs.lstat(path.join(projectPath, file)) - message += stats.isDirectory() ? `📁 - ${file}\n` : `📄 - ${file}\n` - } - - message += - '\nYou need to either rename/remove the files listed above, ' + - 'or choose a new directory name for your extension.\n' + - `\nPath to conflicting directory: \`${underline(projectPath)}\`` - - return message -} - -export function noProjectName() { - return 'You need to provide an extension name to create one. \nSee `--help` for command info.' -} - -export function noUrlAllowed() { - return 'URLs are not allowed as a project path. Either write a name or a path to a local folder.' -} - -export function successfullInstall(projectPath: string, projectName: string) { - const relativePath = path.relative(process.cwd(), projectPath) - - const packageManager = prefersYarn() ? 'yarn' : 'npm run' - return ( - `🧩 - ${brightGreen('Success!')} Extension ${projectName} created.\n` + - `Now ${brightBlue(`cd ${underline(relativePath)}`)} and ${brightBlue( - `${packageManager} dev` - )} to open a new browser instance\n` + - 'with your extension installed, loaded, and enabled for development.\n' + - '\nYou are ready. Time to hack on your extension!' - ) -} diff --git a/programs/create/module.ts b/programs/create/module.ts index c61265be..6397f966 100644 --- a/programs/create/module.ts +++ b/programs/create/module.ts @@ -1,46 +1,34 @@ -// ██████╗██████╗ ███████╗ █████╗ ████████╗███████╗ -// ██╔════╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔════╝ -// ██║ ██████╔╝█████╗ ███████║ ██║ █████╗ -// ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██╔══╝ -// ╚██████╗██║ ██║███████╗██║ ██║ ██║ ███████╗ -// ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ - import path from 'path' -import * as messages from './messages' -import createDirectory from './steps/createDirectory' -// import importExternalTemplate from './steps/importExternalTemplate' -import importLocalTemplate from './steps/importLocalTemplate' -import writePackageJson from './steps/writePackageJson' -import installDependencies from './steps/installDependencies' -import abortAndClean from './steps/abortProjectAndClean' -// import isExternalTemplate from './helpers/isExternalTemplate' -import writeReadmeFile from './steps/writeReadmeFile' -import writeManifestJson from './steps/writeManifestJson' -import generateExtensionTypes from './steps/generateExtensionTypes' -import isTypeScriptTemplate from './helpers/isTypeScriptTemplate' -import initializeGitRepository from './steps/initializeGitRepository' +import * as messages from './lib/messages' +import * as utils from './lib/utils' +import {createDirectory} from './steps/create-directory' +import {importLocalTemplate} from './steps/import-local-template' +import {importExternalTemplate} from './steps/import-external-template' +import {overridePackageJson} from './steps/write-package-json' +import {installDependencies} from './steps/install-dependencies' +import {writeReadmeFile} from './steps/write-readme-file' +import {writeManifestJson} from './steps/write-manifest-json' +import {generateExtensionTypes} from './steps/generate-extension-types' +import {initializeGitRepository} from './steps/initialize-git-repository' export interface CreateOptions { - template?: string - // TODO cezaraugusto deprecated - targetDir?: string + template: string + noInstall?: boolean } -export default async function createExtension( +export async function extensionCreate( projectNameInput: string | undefined, - {template = 'init'}: CreateOptions + {template = 'init', noInstall = false}: CreateOptions ) { if (!projectNameInput) { - messages.noProjectName() - process.exit(1) + throw new Error(messages.noProjectName()) } if (projectNameInput.startsWith('http')) { - messages.noUrlAllowed() - process.exit(1) + throw new Error(messages.noUrlAllowed()) } - // check if path is aboslute + // Check if path is absolute const projectPath = path.isAbsolute(projectNameInput) ? projectNameInput : path.join(process.cwd(), projectNameInput) @@ -50,25 +38,36 @@ export default async function createExtension( try { await createDirectory(projectPath, projectName) - // if (isExternalTemplate(template)) { - // await importExternalTemplate(targetDir, projectName, template) - // } else { - await importLocalTemplate(projectPath, projectName, template) - // } + if (template === 'init') { + await importLocalTemplate(projectPath, projectName, template) + } else { + await importExternalTemplate(projectPath, projectName, template) + } + + await overridePackageJson(projectPath, projectName, template) - await writePackageJson(projectPath, projectName, template) - await installDependencies(projectPath, projectName) - await writeReadmeFile(projectPath, projectName, template) + if (!noInstall) { + await installDependencies(projectPath, projectName) + } + + await writeReadmeFile(projectPath, projectName) await writeManifestJson(projectPath, projectName) await initializeGitRepository(projectPath, projectName) - if (isTypeScriptTemplate(template)) { + if (utils.isTypeScriptTemplate(template)) { await generateExtensionTypes(projectPath, projectName) } // All good! - messages.successfullInstall(projectPath, projectName) - } catch (error: any) { - await abortAndClean(error, projectPath, projectName) + const successfulInstall = await messages.successfullInstall( + projectPath, + projectName + ) + + console.log(successfulInstall) + } catch (error) { + console.error(error) + // Re-throw the error so it can be caught in tests + throw error } } diff --git a/programs/create/package.json b/programs/create/package.json index 34e9fed0..57ebd35b 100644 --- a/programs/create/package.json +++ b/programs/create/package.json @@ -24,17 +24,22 @@ "scripts": { "clean": "rm -rf dist", "watch": "yarn compile --watch", - "compile": "tsup-node ./module.ts --format cjs --dts --target=node18 --minify && node ./copyTemplates.js", - "test": "echo \"Note: no test specified\" && exit 0" + "compile": "tsup-node ./module.ts --format cjs --dts --target=node18 --minify && bash install_scripts.sh", + "test": "echo \"Note: no test specified\" && exit 0", + "test:create": "jest" }, "dependencies": { "@colors/colors": "^1.6.0", "cross-spawn": "^7.0.3", - "prefers-yarn": "^1.0.1" + "detect-package-manager": "^3.0.2", + "go-git-it": "^2.0.1" }, "devDependencies": { "@types/cross-spawn": "^6.0.6", "@types/react-dom": "^18.2.18", + "globals": "^15.9.0", + "jest": "^29.7.0", + "ts-jest": "^29.1.2", "tsconfig": "*", "tsup": "^8.0.1", "typescript": "5.3.3" diff --git a/programs/create/steps/abortProjectAndClean.ts b/programs/create/steps/abortProjectAndClean.ts deleted file mode 100644 index c89d52ca..00000000 --- a/programs/create/steps/abortProjectAndClean.ts +++ /dev/null @@ -1,42 +0,0 @@ -// ██████╗██████╗ ███████╗ █████╗ ████████╗███████╗ -// ██╔════╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔════╝ -// ██║ ██████╔╝█████╗ ███████║ ██║ █████╗ -// ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██╔══╝ -// ╚██████╗██║ ██║███████╗██║ ██║ ██║ ███████╗ -// ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ - -import fs from 'fs/promises' -import {underline, brightBlue, red} from '@colors/colors/safe' - -export default async function abortProjectAndClean( - error: any, - projectPath: string, - projectName: string -) { - console.log( - `🧩 ${`Extension.js`} ${red( - `✖︎✖︎✖︎` - )} Aborting installation of ${projectName}.` - ) - - if (error.command) { - console.log( - `🧩 ${`Extension.js`} ${red(`✖︎✖︎✖︎`)} ${error.command} has failed.` - ) - } else { - console.log( - `🧩 ${`Extension.js`} 🚨🚨🚨 Unexpected creation error. This is a bug. ` + - `Please report: "${error}"` - ) - console.log( - brightBlue(underline('https://github.com/cezaraugusto/extension/issues/')) - ) - } - - console.log('🧹 - Removing files generated from project in:') - console.log(`\`${projectPath}\``) - await fs.mkdir(projectPath, {recursive: true}) - await fs.rm(projectPath, {recursive: true, force: true}) - - process.exit(1) -} diff --git a/programs/create/steps/createDirectory.ts b/programs/create/steps/create-directory.ts similarity index 71% rename from programs/create/steps/createDirectory.ts rename to programs/create/steps/create-directory.ts index 133f6c57..2aab6b1c 100644 --- a/programs/create/steps/createDirectory.ts +++ b/programs/create/steps/create-directory.ts @@ -7,33 +7,34 @@ import path from 'path' import fs from 'fs/promises' -import {red} from '@colors/colors/safe' -import * as messages from '../messages' -import isDirectoryWriteable from '../helpers/isDirectoryWriteable' +import * as messages from '../lib/messages' +import * as utils from '../lib/utils' const allowlist = ['LICENSE', 'node_modules'] -export default async function createDirectory( +export async function createDirectory( projectPath: string, projectName: string ) { - console.log(`🐣 - Starting a new browser extension named ${projectName}...`) + console.log(messages.startingNewExtension(projectName)) try { - const isCurrentDirWriteable = await isDirectoryWriteable( + const isCurrentDirWriteable = await utils.isDirectoryWriteable( projectPath, projectName ) - console.log('🤞 - Checking if destination path is writeable...') + console.log(messages.checkingIfPathIsWriteable()) + if (!isCurrentDirWriteable) { - messages.destinationNotWriteable(projectPath) + console.error(messages.destinationNotWriteable(projectPath)) process.exit(1) } const currentDir = await fs.readdir(projectPath) - console.log('🔎 - Scanning for potential conflicting files...') + console.log(messages.scanningPossiblyConflictingFiles()) + const conflictingFiles = await Promise.all( currentDir // .gitignore, .DS_Store, etc @@ -54,15 +55,10 @@ export default async function createDirectory( projectPath, conflictingFiles ) - console.log(conflictMessage) - process.exit(1) + throw new Error(conflictMessage) } } catch (error: any) { - console.error( - `🧩 ${`Extension.js`} ${red( - `✖︎✖︎✖︎` - )} Can't create directory ${projectName}. ${error}` - ) + console.error(messages.createDirectoryError(projectName, error)) process.exit(1) } } diff --git a/programs/create/steps/generateExtensionTypes.ts b/programs/create/steps/generate-extension-types.ts similarity index 85% rename from programs/create/steps/generateExtensionTypes.ts rename to programs/create/steps/generate-extension-types.ts index e4b7406c..49fb80f3 100644 --- a/programs/create/steps/generateExtensionTypes.ts +++ b/programs/create/steps/generate-extension-types.ts @@ -7,9 +7,9 @@ import path from 'path' import fs from 'fs/promises' -import {red} from '@colors/colors/safe' +import * as messages from '../lib/messages' -export default async function generateExtensionTypes( +export async function generateExtensionTypes( projectPath: string, projectName: string ) { @@ -34,15 +34,11 @@ export default async function generateExtensionTypes( try { await fs.mkdir(projectPath, {recursive: true}) - console.log(`🔷 - Writing ${projectName} type definitions...`) + console.log(messages.writingTypeDefinitions(projectName)) await fs.writeFile(extensionEnvFile, fileContent) } catch (error: any) { - console.error( - `🧩 ${`Extension.js`} ${red( - `✖︎✖︎✖︎` - )} Failed to write the extension type definition. ${error}` - ) + console.error(messages.writingTypeDefinitionsError(error)) process.exit(1) } diff --git a/programs/create/steps/import-external-template.ts b/programs/create/steps/import-external-template.ts new file mode 100644 index 00000000..49f2f957 --- /dev/null +++ b/programs/create/steps/import-external-template.ts @@ -0,0 +1,49 @@ +// ██████╗██████╗ ███████╗ █████╗ ████████╗███████╗ +// ██╔════╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔════╝ +// ██║ ██████╔╝█████╗ ███████║ ██║ █████╗ +// ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██╔══╝ +// ╚██████╗██║ ██║███████╗██║ ██║ ██║ ███████╗ +// ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ + +import path from 'path' +import fs from 'fs/promises' +import goGitIt from 'go-git-it' +import * as messages from '../lib/messages' + +export async function importExternalTemplate( + projectPath: string, + projectName: string, + template: string +) { + const installationPath = path.dirname(projectPath) + const templateName = path.basename(template) + const examplesUrl = + 'https://github.com/extension-js/extension.js/tree/main/examples' + const templateUrl = `${examplesUrl}/${template}` + + try { + await fs.mkdir(projectPath, {recursive: true}) + + if (process.env.EXTENSION_ENV === 'development') { + await fs.copyFile( + path.join(__dirname, '..', '..', '..', 'examples', templateName), + path.join(installationPath, templateName) + ) + } else { + await goGitIt( + templateUrl, + installationPath, + messages.installingFromTemplate(projectName, templateName) + ) + } + + const templatePath = path.join(installationPath, templateName) + + await fs.rename(templatePath, projectPath) + } catch (error: any) { + console.error( + messages.installingFromTemplateError(projectName, templateName, error) + ) + process.exit(1) + } +} diff --git a/programs/create/steps/importExternalTemplate.ts b/programs/create/steps/import-local-template.ts similarity index 66% rename from programs/create/steps/importExternalTemplate.ts rename to programs/create/steps/import-local-template.ts index 6edec655..bf11fb8d 100644 --- a/programs/create/steps/importExternalTemplate.ts +++ b/programs/create/steps/import-local-template.ts @@ -6,26 +6,22 @@ // ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ import path from 'path' -import fs from 'fs/promises' -import {brightBlue} from '@colors/colors/safe' +import * as messages from '../lib/messages' +import * as utils from '../lib/utils' -export default async function importExternalTemplate( - workingDir: string, +export async function importLocalTemplate( + projectPath: string, projectName: string, template: string ) { - const projectPath = path.join(workingDir, projectName) - const templateName = path.basename(template) + const localTemplatePath = path.resolve(__dirname, 'template') try { - await fs.mkdir(projectPath, {recursive: true}) - - console.log( - `🧰 - Installing ${projectName} from template ${brightBlue(templateName)}` - ) + console.log(messages.installingFromTemplate(projectName, template)) + await utils.copyDirectory(localTemplatePath, projectPath) } catch (error: any) { console.error( - `😕❓ Can't find template ${brightBlue(templateName)}. ${error}` + messages.installingFromTemplateError(projectName, template, error) ) process.exit(1) } diff --git a/programs/create/steps/importLocalTemplate.ts b/programs/create/steps/importLocalTemplate.ts deleted file mode 100644 index fc17ea51..00000000 --- a/programs/create/steps/importLocalTemplate.ts +++ /dev/null @@ -1,36 +0,0 @@ -// ██████╗██████╗ ███████╗ █████╗ ████████╗███████╗ -// ██╔════╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔════╝ -// ██║ ██████╔╝█████╗ ███████║ ██║ █████╗ -// ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██╔══╝ -// ╚██████╗██║ ██║███████╗██║ ██║ ██║ ███████╗ -// ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ - -import path from 'path' -import {red, brightBlue} from '@colors/colors/safe' -import copyDirectory from '../helpers/copyDirectory' - -const templatesDir = path.resolve(__dirname, 'templates') - -export default async function importLocalTemplate( - projectPath: string, - projectName: string, - template: string -) { - const localTemplatePath = path.join(templatesDir, template, 'template') - - const isTemplate = template && template !== 'init' - const fromTemplate = isTemplate - ? ` from ${brightBlue(template)} template` - : '' - try { - console.log(`🧰 - Installing ${projectName}` + fromTemplate + '...') - await copyDirectory(localTemplatePath, projectPath) - } catch (error: any) { - console.error( - `🧩 ${`Extension.js`} ${red(`✖︎✖︎✖︎`)} Can't copy template ${brightBlue( - template - )} for ${projectName}. ${error}` - ) - process.exit(1) - } -} diff --git a/programs/create/steps/initializeGitRepository.ts b/programs/create/steps/initialize-git-repository.ts similarity index 72% rename from programs/create/steps/initializeGitRepository.ts rename to programs/create/steps/initialize-git-repository.ts index 72a4e8b8..4dc5f902 100644 --- a/programs/create/steps/initializeGitRepository.ts +++ b/programs/create/steps/initialize-git-repository.ts @@ -6,16 +6,16 @@ // ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ import {spawn} from 'cross-spawn' -import {brightYellow, red} from '@colors/colors/safe' +import * as messages from '../lib/messages' -export default async function initializeGitRepository( +export async function initializeGitRepository( projectPath: string, projectName: string ) { const gitCommand = 'git' const gitArgs = ['init'] - console.log(`🌲 - Initializing git repository for ${projectName}...`) + console.log(messages.initializingGitForRepository(projectName)) try { const originalDirectory = process.cwd() @@ -35,9 +35,11 @@ export default async function initializeGitRepository( if (code !== 0) { reject( new Error( - `Command ${gitCommand} ${gitArgs.join( - ' ' - )} failed with exit code ${code}` + messages.initializingGitForRepositoryFailed( + gitCommand, + gitArgs, + code + ) ) ) } else { @@ -50,20 +52,14 @@ export default async function initializeGitRepository( process.chdir(originalDirectory) console.error( - `🧩 ${`Extension.js`} ${red( - `✖︎✖︎✖︎` - )} Child process error: Can't initialize ${brightYellow( - 'git' - )} for ${projectName}. ${error.message}` + messages.initializingGitForRepositoryProcessError(projectName, error) ) reject(error) }) }) } catch (error: any) { console.error( - `🧩 ${`Extension.js`} ${red(`✖︎✖︎✖︎`)} Can't initialize ${brightYellow( - 'git' - )} for ${projectName}. ${error.message || error.toString()}` + messages.initializingGitForRepositoryError(projectName, error) ) process.exit(1) diff --git a/programs/create/steps/installDependencies.ts b/programs/create/steps/install-dependencies.ts similarity index 73% rename from programs/create/steps/installDependencies.ts rename to programs/create/steps/install-dependencies.ts index 7e32d277..78688074 100644 --- a/programs/create/steps/installDependencies.ts +++ b/programs/create/steps/install-dependencies.ts @@ -8,25 +8,25 @@ import path from 'path' import {spawn} from 'cross-spawn' import fs from 'fs' -import {red} from '@colors/colors/safe' +import * as messages from '../lib/messages' -import {getInstallCommand} from '../helpers/getInstallInfo' -import createSymlink from './symlinkExtensionJs' +import * as utils from '../lib/utils' +import {createSymlink} from './symlink-extension-js' function getInstallArgs() { return ['install', '--silent'] } -export default async function installDependencies( +export async function installDependencies( projectPath: string, projectName: string ) { const nodeModulesPath = path.join(projectPath, 'node_modules') - const command = getInstallCommand() + const command = await utils.getInstallCommand() const dependenciesArgs = getInstallArgs() - console.log('🛠 - Installing dependencies...') + console.log(messages.installingDependencies()) // Symlink Extension for development if (process.env.EXTENSION_ENV === 'development') { @@ -54,9 +54,11 @@ export default async function installDependencies( if (code !== 0) { reject( new Error( - `Command ${command} ${dependenciesArgs.join( - ' ' - )} failed with exit code ${code}` + messages.installingDependenciesFailed( + command, + dependenciesArgs, + code + ) ) ) } else { @@ -69,23 +71,13 @@ export default async function installDependencies( process.chdir(originalDirectory) console.error( - `🧩 ${`Extension.js`} ${red( - `✖︎✖︎✖︎` - )} Child process error: Can't install dependencies for ${projectName}. ${ - error.message - }` + messages.installingDependenciesProcessError(projectName, error) ) reject(error) }) }) } catch (error: any) { - console.error( - `🧩 ${`Extension.js`} ${red( - `✖︎✖︎✖︎` - )} Can't install dependencies for ${projectName}. ${ - error.message || error.toString() - }` - ) + console.error(messages.cantInstallDependencies(projectName, error)) process.exit(1) } diff --git a/programs/create/steps/symlinkExtensionJs.ts b/programs/create/steps/symlink-extension-js.ts similarity index 81% rename from programs/create/steps/symlinkExtensionJs.ts rename to programs/create/steps/symlink-extension-js.ts index ed38b912..11733b23 100644 --- a/programs/create/steps/symlinkExtensionJs.ts +++ b/programs/create/steps/symlink-extension-js.ts @@ -7,11 +7,12 @@ import path from 'path' import {spawn} from 'cross-spawn' -import {getInstallCommand} from '../helpers/getInstallInfo' +import * as messages from '../lib/messages' +import * as utils from '../lib/utils' -export default async function createSymlink(projectPath: string) { +export async function createSymlink(projectPath: string) { const extensionJsCliDir = path.join(__dirname, '../../cli') - const command = getInstallCommand() + const command = await utils.getInstallCommand() const args = ['link'] await new Promise((resolve, reject) => { @@ -28,12 +29,10 @@ export default async function createSymlink(projectPath: string) { linkProcess.on('close', (code) => { if (code === 0) { - console.log('Symlink created successfully.') + console.log(messages.symlinkCreated()) resolve() } else { - reject( - new Error(`Failed to create symlink: ${command} ${args.join(' ')}`) - ) + reject(new Error(messages.symlinkError(command, args))) } }) }) diff --git a/programs/create/steps/writeManifestJson.ts b/programs/create/steps/write-manifest-json.ts similarity index 77% rename from programs/create/steps/writeManifestJson.ts rename to programs/create/steps/write-manifest-json.ts index d554da78..0d5e03fc 100644 --- a/programs/create/steps/writeManifestJson.ts +++ b/programs/create/steps/write-manifest-json.ts @@ -7,9 +7,9 @@ import path from 'path' import fs from 'fs/promises' -import {red, brightYellow} from '@colors/colors/safe' +import * as messages from '../lib/messages' -export default async function writeManifestJson( +export async function writeManifestJson( projectPath: string, projectName: string ) { @@ -20,21 +20,18 @@ export default async function writeManifestJson( const manifestMetadata = { ...manifestJson, - name: path.basename(projectPath) + name: path.basename(projectPath), + author: 'Your Name' } try { - console.log(`📜 - Writing ${brightYellow(`manifest.json`)} metadata...`) + console.log(messages.writingManifestJsonMetadata()) await fs.writeFile( path.join(projectPath, 'manifest.json'), JSON.stringify(manifestMetadata, null, 2) ) } catch (error: any) { - console.error( - `🧩 ${`Extension.js`} ${red(`✖︎✖︎✖︎`)} Can't write ${brightYellow( - `manifest.json` - )} for ${projectName}. ${error}` - ) + console.error(messages.writingManifestJsonMetadataError(projectName, error)) process.exit(1) } diff --git a/programs/create/steps/writePackageJson.ts b/programs/create/steps/write-package-json.ts similarity index 76% rename from programs/create/steps/writePackageJson.ts rename to programs/create/steps/write-package-json.ts index e0219e38..cc452e08 100644 --- a/programs/create/steps/writePackageJson.ts +++ b/programs/create/steps/write-package-json.ts @@ -7,10 +7,8 @@ import path from 'path' import fs from 'fs/promises' -import {red, brightYellow} from '@colors/colors/safe' - -import getTemplatePath from '../helpers/getTemplatePath' -import isExternalTemplate from '../helpers/isExternalTemplate' +import * as utils from '../lib/utils' +import * as messages from '../lib/messages' const extensionJsPackageJsonScripts = { dev: @@ -27,16 +25,16 @@ const extensionJsPackageJsonScripts = { : 'extension build' } -export default async function writePackageJson( +export async function overridePackageJson( projectPath: string, projectName: string, template: string ) { - const templatePath = getTemplatePath(process.cwd(), template) + const templatePath = utils.getTemplatePath(process.cwd()) - const packageJsonPath = isExternalTemplate(template) + const packageJsonPath = utils.isExternalTemplate(template) ? path.join(projectPath, 'package.json') - : path.join(templatePath, 'template.json') + : path.join(templatePath, 'package.json') const packageJsonContent = await fs.readFile(packageJsonPath) const packageJson = JSON.parse(packageJsonContent.toString()) @@ -53,27 +51,27 @@ export default async function writePackageJson( ...packageJson, name: path.basename(projectPath), private: true, - version: '0.0.0', scripts: { ...packageJson.scripts, ...extensionJsPackageJsonScripts }, dependencies: packageJson.dependencies, - devDependencies: packageJson.devDependencies + devDependencies: packageJson.devDependencies, + author: { + name: 'Your Name', + email: 'your@email.com', + url: 'https://yourwebsite.com' + } } try { - console.log(`📝 - Writing ${brightYellow(`package.json`)} metadata...`) + console.log(messages.writingPackageJsonMetadata()) await fs.writeFile( path.join(projectPath, 'package.json'), JSON.stringify(packageMetadata, null, 2) ) } catch (error: any) { - console.error( - `🧩 ${`Extension.js`} ${red(`✖︎✖︎✖︎`)} Can't write ${brightYellow( - `package.json` - )} for ${projectName}. ${error}` - ) + console.error(messages.writingPackageJsonMetadataError(projectName, error)) process.exit(1) } diff --git a/programs/create/steps/writeReadmeFile.ts b/programs/create/steps/write-readme-file.ts similarity index 53% rename from programs/create/steps/writeReadmeFile.ts rename to programs/create/steps/write-readme-file.ts index a1f61607..1bde12e2 100644 --- a/programs/create/steps/writeReadmeFile.ts +++ b/programs/create/steps/write-readme-file.ts @@ -7,40 +7,34 @@ import path from 'path' import fs from 'fs/promises' -import {red, brightYellow} from '@colors/colors/safe' +import * as messages from '../lib/messages' +import * as utils from '../lib/utils' -import {getInstallCommand} from '../helpers/getInstallInfo' -import isExternalTemplate from '../helpers/isExternalTemplate' - -export default async function writeReadmeFile( +export async function writeReadmeFile( projectPath: string, - projectName: string, - template: string + projectName: string ) { - const readmePath = path.join(projectPath, 'README.md') - const stats = await fs.lstat(readmePath) - - // If the file doesn't exist or comes from external source, - // we don't need to do anything - if (!stats.isFile() || isExternalTemplate(template)) { - return - } + const initTemplateReadme = await fs.readFile( + path.join(__dirname, 'template', 'README.md'), + 'utf-8' + ) - const readmeFile = await fs.readFile(readmePath, 'utf-8') + const installCommand = await utils.getInstallCommand() + const manifestJson = require(path.join(projectPath, 'manifest.json')) - const readmeFileEdited = readmeFile + const readmeFileEdited = initTemplateReadme .replaceAll('[projectName]', projectName) - .replaceAll('[projectPackageManager]', getInstallCommand()) + .replaceAll('[templateDescription]', manifestJson.description) + .replaceAll('[runCommand]', installCommand) try { - console.log(`📝 - Writing ${brightYellow(`README.md`)} metadata...`) + console.log(messages.writingReadmeMetaData()) + + // Ensure path to project exists + await fs.mkdir(projectPath, {recursive: true}) await fs.writeFile(path.join(projectPath, 'README.md'), readmeFileEdited) } catch (error: any) { - console.error( - `🧩 ${`Extension.js`} ${red( - `✖︎✖︎✖︎` - )} Can't write the README.md file for ${projectName}. ${error}` - ) + console.error(messages.writingReadmeMetaDataEError(projectName, error)) process.exit(1) } diff --git a/programs/create/templates/chatgpt/.gitignore b/programs/create/template/.gitignore similarity index 100% rename from programs/create/templates/chatgpt/.gitignore rename to programs/create/template/.gitignore diff --git a/programs/cli/spec/fixtures/preact-typescript/README.md b/programs/create/template/README.md similarity index 66% rename from programs/cli/spec/fixtures/preact-typescript/README.md rename to programs/create/template/README.md index 4e3fed08..4d0a8316 100644 --- a/programs/cli/spec/fixtures/preact-typescript/README.md +++ b/programs/create/template/README.md @@ -1,37 +1,37 @@ -# preact-typescript +# [projectName] -> This project was bootstrapped using the Extension.js Preact-TypeScript template. +> [templateDescription] ## Scripts Available In the project directory, you can run: -### yarn dev +### [runCommand] dev ``` // Runs the app in the development mode. // Will open a new browser instance with your extension loaded. // The page will reload when you make changes. -yarn dev +[runCommand] dev ``` -### yarn start +### [runCommand] start ``` // Runs the app in the production mode. // Will open a new browser instance with your extension loaded. // This is how your browser extension will work once published. -yarn start +[runCommand] start ``` -### yarn build +### [runCommand] build ``` // Builds the app for production. // Bundles your browser extension in production mode for the target browser. -yarn run build +[runCommand] build ``` ## Learn More -You can learn more in the [Extension.js](https://extension.js.org) documentation. +Learn more about creating cross-browser extensions in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/create/templates/init/template/manifest.json b/programs/create/template/manifest.json similarity index 100% rename from programs/create/templates/init/template/manifest.json rename to programs/create/template/manifest.json diff --git a/examples/init/icons/package.json b/programs/create/template/package.json similarity index 62% rename from examples/init/icons/package.json rename to programs/create/template/package.json index efe486ce..4b37409c 100644 --- a/examples/init/icons/package.json +++ b/programs/create/template/package.json @@ -3,16 +3,11 @@ "repository": { "type": "git", "url": "https://github.com/extension-js/extension.git", - "directory": "examples/icons" + "directory": "examples/init" }, - "name": "icons", + "name": "init", "description": "An Extension.js example.", "version": "0.0.1", - "author": { - "name": "Cezar Augusto", - "email": "boss@cezaraugusto.net", - "url": "https://cezaraugusto.com" - }, "keywords": [ "extension", "browser-extension", diff --git a/programs/create/templates/chatgpt/README.md b/programs/create/templates/chatgpt/README.md deleted file mode 100644 index 2d54f7bc..00000000 --- a/programs/create/templates/chatgpt/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Extension.js ChatGPT Template - -> ChatGPT template for [Extension.js](https://github.com/cezaraugusto/extension). diff --git a/programs/create/templates/chatgpt/package.json b/programs/create/templates/chatgpt/package.json deleted file mode 100644 index 31ad35c3..00000000 --- a/programs/create/templates/chatgpt/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/chatgpt" - }, - "name": "chatgpt-template", - "description": "The Extension.js ChatGPT template.", - "version": "0.0.0", - "author": { - "name": "Cezar Augusto", - "email": "boss@cezaraugusto.net", - "url": "https://cezaraugusto.com" - }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] -} diff --git a/programs/create/templates/chatgpt/template.json b/programs/create/templates/chatgpt/template.json deleted file mode 100644 index 27012f92..00000000 --- a/programs/create/templates/chatgpt/template.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "devDependencies": { - "@types/react": "^18.0.9", - "@types/react-dom": "^18.0.5", - "daisyui": "^4.7.3", - "openai": "^4.28.4", - "react": "^18.1.0", - "react-dom": "^18.1.0", - "tailwindcss": "^3.4.1" - } -} diff --git a/programs/create/templates/chatgpt/template/.env.example b/programs/create/templates/chatgpt/template/.env.example deleted file mode 100644 index 37a04ea5..00000000 --- a/programs/create/templates/chatgpt/template/.env.example +++ /dev/null @@ -1 +0,0 @@ -EXTENSION_OPENAI_API_KEY='My API Key' diff --git a/programs/create/templates/chatgpt/template/.gitignore b/programs/create/templates/chatgpt/template/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/chatgpt/template/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/chatgpt/template/README.md b/programs/create/templates/chatgpt/template/README.md deleted file mode 100644 index d5aceb2c..00000000 --- a/programs/create/templates/chatgpt/template/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# [projectName] - -> This project was bootstrapped using the Extension.js React-TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### [projectPackageManager] dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -[projectPackageManager] dev -``` - -### [projectPackageManager] start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -[projectPackageManager] start -``` - -### [projectPackageManager] build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -[projectPackageManager] run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/create/templates/chatgpt/template/images/chatgpt.png b/programs/create/templates/chatgpt/template/images/chatgpt.png deleted file mode 100644 index 37b27118..00000000 Binary files a/programs/create/templates/chatgpt/template/images/chatgpt.png and /dev/null differ diff --git a/programs/create/templates/chatgpt/template/images/extension.png b/programs/create/templates/chatgpt/template/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/programs/create/templates/chatgpt/template/images/extension.png and /dev/null differ diff --git a/programs/create/templates/chatgpt/template/images/icons/icon_16.png b/programs/create/templates/chatgpt/template/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/create/templates/chatgpt/template/images/icons/icon_16.png and /dev/null differ diff --git a/programs/create/templates/chatgpt/template/images/icons/icon_48.png b/programs/create/templates/chatgpt/template/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/create/templates/chatgpt/template/images/icons/icon_48.png and /dev/null differ diff --git a/programs/create/templates/chatgpt/template/manifest.json b/programs/create/templates/chatgpt/template/manifest.json deleted file mode 100644 index 20c88929..00000000 --- a/programs/create/templates/chatgpt/template/manifest.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "ChatGPT Template", - "description": "An Extension.js template integrated with ChatGPT. This template includes a sidebar panel.", - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - }, - "side_panel": { - "default_path": "sidebar/index.html" - }, - "permissions": ["sidePanel"] -} diff --git a/programs/create/templates/chatgpt/template/postcss.config.js b/programs/create/templates/chatgpt/template/postcss.config.js deleted file mode 100644 index 85f717cc..00000000 --- a/programs/create/templates/chatgpt/template/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {} - } -} diff --git a/programs/create/templates/chatgpt/template/sidebar/SidebarApp.jsx b/programs/create/templates/chatgpt/template/sidebar/SidebarApp.jsx deleted file mode 100644 index 7a208a7f..00000000 --- a/programs/create/templates/chatgpt/template/sidebar/SidebarApp.jsx +++ /dev/null @@ -1,91 +0,0 @@ -import { useState } from 'react'; -import OpenAI from "openai"; -import chatgptLogo from '../images/chatgpt.png' -import extensionJsLogo from '../images/extension.png' - -const openai = new OpenAI({ - apiKey: process.env.EXTENSION_OPENAI_API_KEY, - dangerouslyAllowBrowser: true, -}); - -function SidebarApp() { - const [messages, setMessages] = useState([ - { - content: ( - "Hello there! This is your ChatGPT extension sample, " + - "built with React, Tailwind.css, and DaisyUI. " + - "For it to work, create a .env file with your EXTENSION_OPENAI_API_KEY. " + - "You can get an API key from OpenAI's website." - ), - role: "assistant" - }, - { - content: "https://platform.openai.com/api-keys", - role: "assistant" - }, - ]); - - const [isTyping, setIsTyping] = useState(false); - - - const handleSubmit = async (e) => { - e.preventDefault(); - - const newMessage = { - content: e.target[0].value, - role: "user" - } - - const newMessages = [...messages, newMessage]; - - setMessages(newMessages); - setIsTyping(true); - e.target.reset(); - - const completion = await openai.chat.completions.create({ - model: "gpt-3.5-turbo", - messages: [...newMessages], - }); - - setMessages([...newMessages, completion.choices[0].message]); - setIsTyping(false); - } - - return ( -
-
-
- { - messages.length && messages.map((msg, i) => { - return ( -
-
-
- -
-
-
{msg.content}
-
- ) - }) - } -
- -
handleSubmit(e)}> -
- {isTyping && ChatGPT Extension is typing...} - - - -
-
-
-
- ); -} - -export default SidebarApp; \ No newline at end of file diff --git a/programs/create/templates/chatgpt/template/sidebar/index.html b/programs/create/templates/chatgpt/template/sidebar/index.html deleted file mode 100644 index 12494f55..00000000 --- a/programs/create/templates/chatgpt/template/sidebar/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - ChatGPT Template - - - -
- - - diff --git a/programs/create/templates/chatgpt/template/sidebar/scripts.jsx b/programs/create/templates/chatgpt/template/sidebar/scripts.jsx deleted file mode 100644 index 2d965775..00000000 --- a/programs/create/templates/chatgpt/template/sidebar/scripts.jsx +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import SidebarApp from './SidebarApp' -import './styles.css' - -const root = ReactDOM.createRoot(document.getElementById('root')) - -root.render( - - - -) diff --git a/programs/create/templates/chatgpt/template/sidebar/styles.css b/programs/create/templates/chatgpt/template/sidebar/styles.css deleted file mode 100644 index b5c61c95..00000000 --- a/programs/create/templates/chatgpt/template/sidebar/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; diff --git a/programs/create/templates/chatgpt/template/tailwind.config.js b/programs/create/templates/chatgpt/template/tailwind.config.js deleted file mode 100644 index c92094be..00000000 --- a/programs/create/templates/chatgpt/template/tailwind.config.js +++ /dev/null @@ -1,8 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: ['**/*.html', '**/*.jsx'], - theme: { - extend: {} - }, - plugins: [require('daisyui')] -} diff --git a/programs/create/templates/content/.gitignore b/programs/create/templates/content/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/content/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/content/README.md b/programs/create/templates/content/README.md deleted file mode 100644 index 076b5b99..00000000 --- a/programs/create/templates/content/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Extension.js Content Scripts Template - -> content_scripts template for [Extension.js](https://github.com/cezaraugusto/extension). diff --git a/programs/create/templates/content/package.json b/programs/create/templates/content/package.json deleted file mode 100644 index 73f55cb5..00000000 --- a/programs/create/templates/content/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "packages/create/templates/content" - }, - "name": "content-template", - "description": "The Extension.js content_scripts template.", - "version": "0.0.0", - "author": { - "name": "Cezar Augusto", - "email": "boss@cezaraugusto.net", - "url": "https://cezaraugusto.com" - }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] -} diff --git a/programs/create/templates/content/template.json b/programs/create/templates/content/template.json deleted file mode 100644 index 6ae64c05..00000000 --- a/programs/create/templates/content/template.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "devDependencies": {} -} diff --git a/programs/create/templates/content/template/.gitignore b/programs/create/templates/content/template/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/content/template/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/content/template/README.md b/programs/create/templates/content/template/README.md deleted file mode 100644 index 2f65bc5b..00000000 --- a/programs/create/templates/content/template/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# [projectName] - -> This project was bootstrapped using the Extension.js TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### [projectPackageManager] dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -[projectPackageManager] dev -``` - -### [projectPackageManager] start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -[projectPackageManager] start -``` - -### [projectPackageManager] build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -[projectPackageManager] run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/create/templates/content/template/background.js b/programs/create/templates/content/template/background.js deleted file mode 100644 index 8c694999..00000000 --- a/programs/create/templates/content/template/background.js +++ /dev/null @@ -1,19 +0,0 @@ -chrome.runtime.onMessage.addListener((request, sender) => { - if (request.action === 'changeBackgroundColor') { - changeBackgroundColor(request.color, sender.tab.id) - } -}) - -function changeBackgroundColor(color, tabId) { - chrome.scripting - .executeScript({ - target: {tabId}, - function: setPageBackgroundColor, - args: [color] - }) - .catch(console.error) -} - -function setPageBackgroundColor(color) { - document.body.style.backgroundColor = color -} diff --git a/programs/create/templates/content/template/content/scripts.js b/programs/create/templates/content/template/content/scripts.js deleted file mode 100644 index d49a238a..00000000 --- a/programs/create/templates/content/template/content/scripts.js +++ /dev/null @@ -1,30 +0,0 @@ -import extensionJsLogo from '../images/extension.png' -import './styles.css' - -document.body.innerHTML += ` -
- -

- Change the background-color ⬇ -

- -

- Learn more about creating browser extensions at - https://extension.js.org - -

-
-` - -document.getElementById('colorPicker').addEventListener('input', (event) => { - chrome.runtime - .sendMessage({ - action: 'changeBackgroundColor', - color: event.target.value - }) - .catch(console.error) -}) diff --git a/programs/create/templates/content/template/content/styles.css b/programs/create/templates/content/template/content/styles.css deleted file mode 100644 index 01c6bc63..00000000 --- a/programs/create/templates/content/template/content/styles.css +++ /dev/null @@ -1,56 +0,0 @@ - -.content_script-box { - background: white; - position: fixed; - right: 0; - bottom: 0; - z-index: 9; - width: 315px; - height: 345px; - margin: 1em; - padding: 1em; - display: flex; - align-items: center; - justify-content: center; - flex-direction: column; - gap: 1em; - box-shadow: 0px 0px 4px 1px #ccc; -} - -.content_script-logo { - background: white; - width: 90px; - align-self: flex-start; - border: 4px solid; - border-color: #ccc; - border-radius: 24px; - filter: grayscale(1); - transition: filter 2s, border-color 2s; -} - -.content_script-logo:hover { - filter: grayscale(0); - border-color: aquamarine; -} - -.content_script-title { - font-size: 1.85em; - color: #333; - line-height: 1.1; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; - font-weight: 700; - overflow-wrap: break-word; - word-wrap: break-word; - -ms-word-break: break-all; - word-break: break-word; -} - -.content_script-description { - color: #999; -} - -.content_script-colorPicker { - display: block; - width: 100%; - height: 50px; -} diff --git a/programs/create/templates/content/template/images/extension.png b/programs/create/templates/content/template/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/programs/create/templates/content/template/images/extension.png and /dev/null differ diff --git a/programs/create/templates/content/template/images/icons/icon_16.png b/programs/create/templates/content/template/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/create/templates/content/template/images/icons/icon_16.png and /dev/null differ diff --git a/programs/create/templates/content/template/images/icons/icon_48.png b/programs/create/templates/content/template/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/create/templates/content/template/images/icons/icon_48.png and /dev/null differ diff --git a/programs/create/templates/content/template/manifest.json b/programs/create/templates/content/template/manifest.json deleted file mode 100644 index 82365b80..00000000 --- a/programs/create/templates/content/template/manifest.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "Content Template", - "description": "An Extension.js template using web technologies. This template includes a content script.", - "permissions": ["activeTab", "scripting"], - "host_permissions": [""], - "background": { - "chromium:service_worker": "background.js", - "firefox:scripts": ["background.js"] - }, - "content_scripts": [ - { - "matches": [""], - "js": ["content/scripts.js"] - } - ], - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - } -} diff --git a/programs/create/templates/init/.gitignore b/programs/create/templates/init/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/init/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/init/README.md b/programs/create/templates/init/README.md deleted file mode 100644 index 8855d0ee..00000000 --- a/programs/create/templates/init/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Extension.js Default Template - -> Default template for [Extension.js](https://github.com/cezaraugusto/extension). diff --git a/programs/create/templates/init/package.json b/programs/create/templates/init/package.json deleted file mode 100644 index 2518f96f..00000000 --- a/programs/create/templates/init/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/new" - }, - "name": "init-template", - "description": "The Extension.js init template.", - "version": "0.0.0", - "author": { - "name": "Cezar Augusto", - "email": "boss@cezaraugusto.net", - "url": "https://cezaraugusto.com" - }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "default-extension", - "template" - ] -} diff --git a/programs/create/templates/init/template.json b/programs/create/templates/init/template.json deleted file mode 100644 index 6ae64c05..00000000 --- a/programs/create/templates/init/template.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "devDependencies": {} -} diff --git a/programs/create/templates/init/template/.gitignore b/programs/create/templates/init/template/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/init/template/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/init/template/README.md b/programs/create/templates/init/template/README.md deleted file mode 100644 index 45ba120f..00000000 --- a/programs/create/templates/init/template/README.md +++ /dev/null @@ -1,60 +0,0 @@ -# [projectName] - -> This project was bootstrapped using the Extension.js web template. - -## Directory Structure: - -``` -./[projectName] -├── manifest.json -├── newtab -│ ├── newtab.html -│ ├── newtab.js -│ └── styles.css -├── popup -│ ├── popup.html -│ ├── popup.js -│ └── popup.css -├── public -│ ├── icon -│ │ ├── icon_16.png -│ │ ├── icon_32.png -│ │ └── icon_64.png -│ └── puzzle.png -├── .gitignore -├── README.md -``` - -## Scripts Available - -In the project directory, you can run: - -### [projectPackageManager] dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -[projectPackageManager] dev -``` - -### [projectPackageManager] start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -[projectPackageManager] start -``` - -### [projectPackageManager] build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -[projectPackageManager] run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/create/templates/new/.gitignore b/programs/create/templates/new/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/new/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/new/README.md b/programs/create/templates/new/README.md deleted file mode 100644 index 8d6c1323..00000000 --- a/programs/create/templates/new/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Extension.js Web Template - -> Web template for [Extension.js](https://github.com/cezaraugusto/extension). diff --git a/programs/create/templates/new/package.json b/programs/create/templates/new/package.json deleted file mode 100644 index fd138521..00000000 --- a/programs/create/templates/new/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/new" - }, - "name": "new-template", - "description": "The Extension.js new template.", - "version": "0.0.0", - "author": { - "name": "Cezar Augusto", - "email": "boss@cezaraugusto.net", - "url": "https://cezaraugusto.com" - }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] -} diff --git a/programs/create/templates/new/template.json b/programs/create/templates/new/template.json deleted file mode 100644 index 6ae64c05..00000000 --- a/programs/create/templates/new/template.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "devDependencies": {} -} diff --git a/programs/create/templates/new/template/.gitignore b/programs/create/templates/new/template/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/new/template/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/new/template/README.md b/programs/create/templates/new/template/README.md deleted file mode 100644 index 2f65bc5b..00000000 --- a/programs/create/templates/new/template/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# [projectName] - -> This project was bootstrapped using the Extension.js TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### [projectPackageManager] dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -[projectPackageManager] dev -``` - -### [projectPackageManager] start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -[projectPackageManager] start -``` - -### [projectPackageManager] build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -[projectPackageManager] run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/create/templates/new/template/images/extension.png b/programs/create/templates/new/template/images/extension.png deleted file mode 100644 index 66a7b933..00000000 Binary files a/programs/create/templates/new/template/images/extension.png and /dev/null differ diff --git a/programs/create/templates/new/template/images/icons/icon_16.png b/programs/create/templates/new/template/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/create/templates/new/template/images/icons/icon_16.png and /dev/null differ diff --git a/programs/create/templates/new/template/images/icons/icon_48.png b/programs/create/templates/new/template/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/create/templates/new/template/images/icons/icon_48.png and /dev/null differ diff --git a/programs/create/templates/new/template/manifest.json b/programs/create/templates/new/template/manifest.json deleted file mode 100644 index de0e94a4..00000000 --- a/programs/create/templates/new/template/manifest.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "New Template", - "description": "An Extension.js template using web technologies. This template includes a new tab override.", - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - }, - "chrome_url_overrides": { - "newtab": "newtab/index.html" - } -} diff --git a/programs/create/templates/new/template/newtab/index.html b/programs/create/templates/new/template/newtab/index.html deleted file mode 100644 index 58a5e51a..00000000 --- a/programs/create/templates/new/template/newtab/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - New Extension - - - - - -
-

- The Extension logo -
- Welcome to your New Extension. -

-

- Learn more about creating browser extensions at - https://extension.js.org. -

-
- - - diff --git a/programs/create/templates/new/template/newtab/scripts.js b/programs/create/templates/new/template/newtab/scripts.js deleted file mode 100644 index 5c74d4cf..00000000 --- a/programs/create/templates/new/template/newtab/scripts.js +++ /dev/null @@ -1,10 +0,0 @@ -function getManifest() { - return chrome.runtime.getManifest() -} -const manifest = getManifest() - -console.table({ - name: manifest.name, - version: manifest.version, - description: manifest.description -}) diff --git a/programs/create/templates/new/template/newtab/styles.css b/programs/create/templates/new/template/newtab/styles.css deleted file mode 100644 index 17313d18..00000000 --- a/programs/create/templates/new/template/newtab/styles.css +++ /dev/null @@ -1,25 +0,0 @@ -body { - display: flex; - justify-content: center; - align-items: center; - height: calc(100vh - 26px); -} - -h1 { - font-size: 4.7em; -} - -.new { - border-radius: 24px; - border: 4px solid; - background: white; - border-color: #ccc; - border-radius: 24px; - filter: grayscale(1); - transition: filter 2s, border-color 2s; -} - -.new:hover { - filter: grayscale(0); - border-color: aquamarine; -} diff --git a/programs/create/templates/preact-typescript/.gitignore b/programs/create/templates/preact-typescript/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/preact-typescript/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/preact-typescript/README.md b/programs/create/templates/preact-typescript/README.md deleted file mode 100644 index d9f08ed5..00000000 --- a/programs/create/templates/preact-typescript/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Extension.js Preact TypeScript Template - -> Preact + TypeScript template for [Extension.js](https://github.com/cezaraugusto/extension). diff --git a/programs/create/templates/preact-typescript/package.json b/programs/create/templates/preact-typescript/package.json deleted file mode 100644 index e49003a2..00000000 --- a/programs/create/templates/preact-typescript/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/preact-typescript" - }, - "name": "preact-typescript-template", - "description": "The Extension.js Preact + TypeScript template.", - "version": "0.0.0", - "author": { - "name": "OSpoon", - "email": "zxin088@gmail.com", - "url": "https://hw404.cn" - }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] -} diff --git a/programs/create/templates/preact-typescript/template.json b/programs/create/templates/preact-typescript/template.json deleted file mode 100644 index a5a4d55d..00000000 --- a/programs/create/templates/preact-typescript/template.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "devDependencies": { - "@preact/signals": "^1.2.3", - "preact": "^10.22.0", - "tailwindcss": "^3.4.1", - "typescript": "5.3.3" - } -} diff --git a/programs/create/templates/preact-typescript/template/.gitignore b/programs/create/templates/preact-typescript/template/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/preact-typescript/template/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/preact-typescript/template/README.md b/programs/create/templates/preact-typescript/template/README.md deleted file mode 100644 index 4f77fa05..00000000 --- a/programs/create/templates/preact-typescript/template/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# [projectName] - -> This project was bootstrapped using the Extension.js Preact-TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### [projectPackageManager] dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -[projectPackageManager] dev -``` - -### [projectPackageManager] start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -[projectPackageManager] start -``` - -### [projectPackageManager] build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -[projectPackageManager] run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/create/templates/preact-typescript/template/background.ts b/programs/create/templates/preact-typescript/template/background.ts deleted file mode 100644 index 798d5018..00000000 --- a/programs/create/templates/preact-typescript/template/background.ts +++ /dev/null @@ -1 +0,0 @@ -console.log('Hello from the background script!') diff --git a/programs/create/templates/preact-typescript/template/content/ContentApp.tsx b/programs/create/templates/preact-typescript/template/content/ContentApp.tsx deleted file mode 100644 index b69c8202..00000000 --- a/programs/create/templates/preact-typescript/template/content/ContentApp.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import {Component} from 'preact' -import {signal} from '@preact/signals' - -import preactLogo from '../images/preact.png' -import tailwindBg from '../images/tailwind_bg.png' -import typescriptLogo from '../images/typescript.png' -import tailwindLogo from '../images/tailwind.png' -import chromeWindowBg from '../images/chromeWindow.png' - -export default function ContentApp() { - const isdialogOpen = signal(true) - - const setIsDialogOpen = (bool: boolean) => { - isdialogOpen.value = bool - } - - if (!isdialogOpen) { - return ( -
- -
- ) - } - - return ( -
-
-
-
- - - -
-
-
-
- Preact logo -
+
- TypeScript logo -
+
- Tailwind logo -
-

- This is a content script running Preact, TypeScript, and - Tailwind.css. -

-

- Learn more about creating cross-browser extensions by{' '} - - . -

-
-
- Chrome window screenshot -
-
-
- ) -} diff --git a/programs/create/templates/preact-typescript/template/content/scripts.tsx b/programs/create/templates/preact-typescript/template/content/scripts.tsx deleted file mode 100644 index bed0b743..00000000 --- a/programs/create/templates/preact-typescript/template/content/scripts.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import {render} from 'preact' -import ContentApp from './ContentApp' -import './styles.css' - -setTimeout(initial, 1000) - -function initial() { - // Create a new div element and append it to the document's body - const rootDiv = document.createElement('div') - rootDiv.id = 'extension-root' - document.body.appendChild(rootDiv) - - render(, rootDiv) -} diff --git a/programs/create/templates/preact-typescript/template/content/styles.css b/programs/create/templates/preact-typescript/template/content/styles.css deleted file mode 100644 index dc79ebb5..00000000 --- a/programs/create/templates/preact-typescript/template/content/styles.css +++ /dev/null @@ -1,10 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -#extension-root { - position: fixed; - bottom: 0; - right: 0; - z-index: 99999; -} diff --git a/programs/create/templates/preact-typescript/template/images/chromeWindow.png b/programs/create/templates/preact-typescript/template/images/chromeWindow.png deleted file mode 100644 index da525dd8..00000000 Binary files a/programs/create/templates/preact-typescript/template/images/chromeWindow.png and /dev/null differ diff --git a/programs/create/templates/preact-typescript/template/images/icons/icon_16.png b/programs/create/templates/preact-typescript/template/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/create/templates/preact-typescript/template/images/icons/icon_16.png and /dev/null differ diff --git a/programs/create/templates/preact-typescript/template/images/icons/icon_48.png b/programs/create/templates/preact-typescript/template/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/create/templates/preact-typescript/template/images/icons/icon_48.png and /dev/null differ diff --git a/programs/create/templates/preact-typescript/template/images/preact.png b/programs/create/templates/preact-typescript/template/images/preact.png deleted file mode 100644 index 9bd16ecc..00000000 Binary files a/programs/create/templates/preact-typescript/template/images/preact.png and /dev/null differ diff --git a/programs/create/templates/preact-typescript/template/images/tailwind.png b/programs/create/templates/preact-typescript/template/images/tailwind.png deleted file mode 100644 index 83ed5e12..00000000 Binary files a/programs/create/templates/preact-typescript/template/images/tailwind.png and /dev/null differ diff --git a/programs/create/templates/preact-typescript/template/images/tailwind_bg.png b/programs/create/templates/preact-typescript/template/images/tailwind_bg.png deleted file mode 100644 index edc40be8..00000000 Binary files a/programs/create/templates/preact-typescript/template/images/tailwind_bg.png and /dev/null differ diff --git a/programs/create/templates/preact-typescript/template/images/typescript.png b/programs/create/templates/preact-typescript/template/images/typescript.png deleted file mode 100644 index 93614694..00000000 Binary files a/programs/create/templates/preact-typescript/template/images/typescript.png and /dev/null differ diff --git a/programs/create/templates/preact-typescript/template/manifest.json b/programs/create/templates/preact-typescript/template/manifest.json deleted file mode 100644 index bc661fea..00000000 --- a/programs/create/templates/preact-typescript/template/manifest.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "Preact+TypeScript Template", - "description": "An extension template using Preact and TypeScript. This template includes a content script using Tailwind.css. To see it in action, visit https://extension.js.org.", - "background": { - "chromium:service_worker": "background.ts", - "firefox:scripts": ["background.ts"] - }, - "content_scripts": [ - { - "matches": ["https://extension.js.org/*"], - "js": ["./content/scripts.tsx"] - } - ], - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - } -} diff --git a/programs/create/templates/preact-typescript/template/postcss.config.js b/programs/create/templates/preact-typescript/template/postcss.config.js deleted file mode 100644 index 85f717cc..00000000 --- a/programs/create/templates/preact-typescript/template/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {} - } -} diff --git a/programs/create/templates/preact-typescript/template/tsconfig.json b/programs/create/templates/preact-typescript/template/tsconfig.json deleted file mode 100644 index 1d045996..00000000 --- a/programs/create/templates/preact-typescript/template/tsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compilerOptions": { - "allowJs": true, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "isolatedModules": false, - "jsx": "react-jsx", - "lib": ["dom", "dom.iterable", "esnext"], - "moduleResolution": "node", - "module": "esnext", - "resolveJsonModule": true, - "strict": true, - "target": "esnext", - "skipLibCheck": true, - "baseUrl": "./", - "paths": { - "react": ["./node_modules/preact/compat/"], - "react/jsx-runtime": ["./node_modules/preact/jsx-runtime"], - "react-dom": ["./node_modules/preact/compat/"], - "react-dom/*": ["./node_modules/preact/compat/*"] - } - }, - "include": ["./"], - "exclude": ["node_modules", "dist"] -} diff --git a/programs/create/templates/preact/.gitignore b/programs/create/templates/preact/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/preact/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/preact/README.md b/programs/create/templates/preact/README.md deleted file mode 100644 index cabae221..00000000 --- a/programs/create/templates/preact/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Extension.js Preact Template - -> Preact template for [Extension.js](https://github.com/cezaraugusto/extension). diff --git a/programs/create/templates/preact/package.json b/programs/create/templates/preact/package.json deleted file mode 100644 index b0370c6f..00000000 --- a/programs/create/templates/preact/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/preact" - }, - "name": "preact-template", - "description": "The Extension.js Preact template.", - "version": "0.0.0", - "author": { - "name": "OSpoon", - "email": "zxin088@gmail.com", - "url": "https://hw404.cn" - }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] -} diff --git a/programs/create/templates/preact/template.json b/programs/create/templates/preact/template.json deleted file mode 100644 index 68cb6eee..00000000 --- a/programs/create/templates/preact/template.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "devDependencies": { - "preact": "^10.22.0", - "sakura.css": "^1.5.0" - } -} diff --git a/programs/create/templates/preact/template/.gitignore b/programs/create/templates/preact/template/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/preact/template/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/preact/template/README.md b/programs/create/templates/preact/template/README.md deleted file mode 100644 index 4f77fa05..00000000 --- a/programs/create/templates/preact/template/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# [projectName] - -> This project was bootstrapped using the Extension.js Preact-TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### [projectPackageManager] dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -[projectPackageManager] dev -``` - -### [projectPackageManager] start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -[projectPackageManager] start -``` - -### [projectPackageManager] build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -[projectPackageManager] run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/create/templates/preact/template/babel.config.json b/programs/create/templates/preact/template/babel.config.json deleted file mode 100644 index 1a720f1c..00000000 --- a/programs/create/templates/preact/template/babel.config.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "plugins": [ - [ - "@babel/plugin-transform-react-jsx", - { - "runtime": "automatic", - "importSource": "preact" - } - ] - ] -} diff --git a/programs/create/templates/preact/template/images/icons/icon_16.png b/programs/create/templates/preact/template/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/create/templates/preact/template/images/icons/icon_16.png and /dev/null differ diff --git a/programs/create/templates/preact/template/images/icons/icon_48.png b/programs/create/templates/preact/template/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/create/templates/preact/template/images/icons/icon_48.png and /dev/null differ diff --git a/programs/create/templates/preact/template/manifest.json b/programs/create/templates/preact/template/manifest.json deleted file mode 100644 index 3af892f7..00000000 --- a/programs/create/templates/preact/template/manifest.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "Preact Template", - "description": "An Extension.js template using Preact. This template includes a new tab override.", - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - }, - "chrome_url_overrides": { - "newtab": "newtab/index.html" - } -} diff --git a/programs/create/templates/preact/template/newtab/NewTabApp.jsx b/programs/create/templates/preact/template/newtab/NewTabApp.jsx deleted file mode 100644 index 78fb3d69..00000000 --- a/programs/create/templates/preact/template/newtab/NewTabApp.jsx +++ /dev/null @@ -1,25 +0,0 @@ -import {Component} from 'preact' -import 'sakura.css' -import './styles.css' -import Logo from './logo' - -export default class NewTabApp extends Component { - render() { - return ( -
-

- -
- Welcome to your Preact Extension. -

-

- Learn more about creating browser extensions at{' '} - - https://extension.js.org - - . -

-
- ) - } -} diff --git a/programs/create/templates/preact/template/newtab/index.html b/programs/create/templates/preact/template/newtab/index.html deleted file mode 100644 index 56192396..00000000 --- a/programs/create/templates/preact/template/newtab/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - Preact Template - - - -
- - - diff --git a/programs/create/templates/preact/template/newtab/logo.jsx b/programs/create/templates/preact/template/newtab/logo.jsx deleted file mode 100644 index 93018894..00000000 --- a/programs/create/templates/preact/template/newtab/logo.jsx +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Logo Component from Preact Website Logo - * https://github.dev/preactjs/preact-www/blob/master/src/index.jsx - */ -import {Component} from 'preact' - -export default class Logo extends Component { - state = {i: 0, hover: false} - - hover = () => { - this.setState({hover: true}) - } - - hoverOut = () => { - this.setState({hover: false}) - } - - frame = () => { - this.timer = null - if (!this.mounted) return - this.setState({i: this.state.i + 1}, this.next) - } - - next = () => { - let {hover} = this.state - if (!this.mounted || !hover || this.timer) return - this.timer = (requestAnimationFrame || setTimeout)(this.frame, 15) - } - - componentDidMount() { - this.mounted = true - this.startTimer = setTimeout(this.next, 5000) - } - - componentWillUnmount() { - clearTimeout(this.startTimer) - ;(cancelAnimationFrame || clearTimeout)(this.timer) - this.mounted = this.timer = false - } - - componentDidUpdate() { - this.next() - } - - renderEllipse(fg, deg, offset) { - let gapLength = Math.sin((offset / 500) * Math.PI) * 30 + 60 - let lineLength = 894 / 2 - gapLength - return ( - - ) - } - - render( - { - inverted = false, - fg = '#673ab8', - bg = 'white', - component, - title, - ...props - }, - {i} - ) { - if (inverted) [bg, fg] = [fg, bg] - - return ( - - - {this.renderEllipse(fg, 52, i)} - {this.renderEllipse(fg, -52, -0.7 * i)} - - - ) - } -} diff --git a/programs/create/templates/preact/template/newtab/scripts.jsx b/programs/create/templates/preact/template/newtab/scripts.jsx deleted file mode 100644 index 20684ed2..00000000 --- a/programs/create/templates/preact/template/newtab/scripts.jsx +++ /dev/null @@ -1,5 +0,0 @@ -import {render} from 'preact' -import NewTabApp from './NewTabApp' -import './styles.css' - -render(, document.getElementById('root')) diff --git a/programs/create/templates/preact/template/newtab/styles.css b/programs/create/templates/preact/template/newtab/styles.css deleted file mode 100644 index 1a72e896..00000000 --- a/programs/create/templates/preact/template/newtab/styles.css +++ /dev/null @@ -1,10 +0,0 @@ -body { - display: flex; - justify-content: center; - align-items: center; - height: calc(100vh - 26px); -} - -h1 { - font-size: 4.7em; -} diff --git a/programs/create/templates/react-typescript/.gitignore b/programs/create/templates/react-typescript/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/react-typescript/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/react-typescript/README.md b/programs/create/templates/react-typescript/README.md deleted file mode 100644 index 8ac4c8e8..00000000 --- a/programs/create/templates/react-typescript/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Extension.js React TypeScript Template - -> React + TypeScript template for [Extension.js](https://github.com/cezaraugusto/extension). diff --git a/programs/create/templates/react-typescript/package.json b/programs/create/templates/react-typescript/package.json deleted file mode 100644 index 51cd480b..00000000 --- a/programs/create/templates/react-typescript/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/react-typescript" - }, - "name": "react-typescript-template", - "description": "The Extension.js React + TypeScript template.", - "version": "0.0.0", - "author": { - "name": "Cezar Augusto", - "email": "boss@cezaraugusto.net", - "url": "https://cezaraugusto.com" - }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] -} diff --git a/programs/create/templates/react-typescript/template.json b/programs/create/templates/react-typescript/template.json deleted file mode 100644 index f7d170cb..00000000 --- a/programs/create/templates/react-typescript/template.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "devDependencies": { - "@types/react": "^18.0.9", - "@types/react-dom": "^18.0.5", - "react": "^18.1.0", - "react-dom": "^18.1.0", - "tailwindcss": "^3.4.1", - "typescript": "5.3.3" - } -} diff --git a/programs/create/templates/react-typescript/template/.gitignore b/programs/create/templates/react-typescript/template/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/react-typescript/template/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/react-typescript/template/README.md b/programs/create/templates/react-typescript/template/README.md deleted file mode 100644 index d5aceb2c..00000000 --- a/programs/create/templates/react-typescript/template/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# [projectName] - -> This project was bootstrapped using the Extension.js React-TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### [projectPackageManager] dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -[projectPackageManager] dev -``` - -### [projectPackageManager] start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -[projectPackageManager] start -``` - -### [projectPackageManager] build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -[projectPackageManager] run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/create/templates/react-typescript/template/background.ts b/programs/create/templates/react-typescript/template/background.ts deleted file mode 100644 index 798d5018..00000000 --- a/programs/create/templates/react-typescript/template/background.ts +++ /dev/null @@ -1 +0,0 @@ -console.log('Hello from the background script!') diff --git a/programs/create/templates/react-typescript/template/content/ContentApp.tsx b/programs/create/templates/react-typescript/template/content/ContentApp.tsx deleted file mode 100644 index 446e3add..00000000 --- a/programs/create/templates/react-typescript/template/content/ContentApp.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import React from 'react' -import reactLogo from '../images/react.png' -import tailwindBg from '../images/tailwind_bg.png' -import typescriptLogo from '../images/typescript.png' -import tailwindLogo from '../images/tailwind.png' -import chromeWindowBg from '../images/chromeWindow.png' - -export default function ContentApp() { - const [isdialogOpen, setIsDialogOpen] = React.useState(true) - - if (!isdialogOpen) { - return ( -
- -
- ) - } - - return ( -
-
-
-
- - - -
-
-
-
- React logo -
+
- TypeScript logo -
+
- Tailwind logo -
-

- This is a content script running React, TypeScript, and - Tailwind.css. -

-

- Learn more about creating cross-browser extensions by{' '} - - . -

-
-
- Chrome window screenshot -
-
-
- ) -} diff --git a/programs/create/templates/react-typescript/template/content/scripts.tsx b/programs/create/templates/react-typescript/template/content/scripts.tsx deleted file mode 100644 index 89050dc3..00000000 --- a/programs/create/templates/react-typescript/template/content/scripts.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import ReactDOM from 'react-dom/client' -import ContentApp from './ContentApp' -import './styles.css' - -setTimeout(initial, 1000) - -function initial() { - // Create a new div element and append it to the document's body - const rootDiv = document.createElement('div') - rootDiv.id = 'extension-root' - document.body.appendChild(rootDiv) - - // Use `createRoot` to create a root, then render the component - // Note that `createRoot` takes the container DOM node, not the React element - const root = ReactDOM.createRoot(rootDiv) - root.render() -} diff --git a/programs/create/templates/react-typescript/template/content/styles.css b/programs/create/templates/react-typescript/template/content/styles.css deleted file mode 100644 index dc79ebb5..00000000 --- a/programs/create/templates/react-typescript/template/content/styles.css +++ /dev/null @@ -1,10 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -#extension-root { - position: fixed; - bottom: 0; - right: 0; - z-index: 99999; -} diff --git a/programs/create/templates/react-typescript/template/images/chromeWindow.png b/programs/create/templates/react-typescript/template/images/chromeWindow.png deleted file mode 100644 index da525dd8..00000000 Binary files a/programs/create/templates/react-typescript/template/images/chromeWindow.png and /dev/null differ diff --git a/programs/create/templates/react-typescript/template/images/icons/icon_16.png b/programs/create/templates/react-typescript/template/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/create/templates/react-typescript/template/images/icons/icon_16.png and /dev/null differ diff --git a/programs/create/templates/react-typescript/template/images/icons/icon_48.png b/programs/create/templates/react-typescript/template/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/create/templates/react-typescript/template/images/icons/icon_48.png and /dev/null differ diff --git a/programs/create/templates/react-typescript/template/images/react.png b/programs/create/templates/react-typescript/template/images/react.png deleted file mode 100644 index 9080fddd..00000000 Binary files a/programs/create/templates/react-typescript/template/images/react.png and /dev/null differ diff --git a/programs/create/templates/react-typescript/template/images/tailwind.png b/programs/create/templates/react-typescript/template/images/tailwind.png deleted file mode 100644 index 83ed5e12..00000000 Binary files a/programs/create/templates/react-typescript/template/images/tailwind.png and /dev/null differ diff --git a/programs/create/templates/react-typescript/template/images/tailwind_bg.png b/programs/create/templates/react-typescript/template/images/tailwind_bg.png deleted file mode 100644 index edc40be8..00000000 Binary files a/programs/create/templates/react-typescript/template/images/tailwind_bg.png and /dev/null differ diff --git a/programs/create/templates/react-typescript/template/images/typescript.png b/programs/create/templates/react-typescript/template/images/typescript.png deleted file mode 100644 index 93614694..00000000 Binary files a/programs/create/templates/react-typescript/template/images/typescript.png and /dev/null differ diff --git a/programs/create/templates/react-typescript/template/manifest.json b/programs/create/templates/react-typescript/template/manifest.json deleted file mode 100644 index 25417f78..00000000 --- a/programs/create/templates/react-typescript/template/manifest.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "React+TypeScript Template", - "description": "An extension template using React and TypeScript. This template includes a content script using Tailwind.css. To see it in action, visit https://extension.js.org.", - "background": { - "chromium:service_worker": "background.ts", - "firefox:scripts": ["background.ts"] - }, - "content_scripts": [ - { - "matches": ["https://extension.js.org/*"], - "js": ["./content/scripts.tsx"] - } - ], - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - } -} diff --git a/programs/create/templates/react-typescript/template/postcss.config.js b/programs/create/templates/react-typescript/template/postcss.config.js deleted file mode 100644 index 85f717cc..00000000 --- a/programs/create/templates/react-typescript/template/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {} - } -} diff --git a/programs/create/templates/react-typescript/template/tailwind.config.js b/programs/create/templates/react-typescript/template/tailwind.config.js deleted file mode 100644 index 069e1bc3..00000000 --- a/programs/create/templates/react-typescript/template/tailwind.config.js +++ /dev/null @@ -1,8 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: ['**/*.html', '**/*.tsx'], - theme: { - extend: {} - }, - plugins: [] -} diff --git a/programs/create/templates/react/.gitignore b/programs/create/templates/react/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/react/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/react/README.md b/programs/create/templates/react/README.md deleted file mode 100644 index 5e6ed807..00000000 --- a/programs/create/templates/react/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Extension.js React Template - -> React template for [Extension.js](https://github.com/cezaraugusto/extension). diff --git a/programs/create/templates/react/package.json b/programs/create/templates/react/package.json deleted file mode 100644 index fd380b5a..00000000 --- a/programs/create/templates/react/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/react" - }, - "name": "react-template", - "description": "The Extension.js React template.", - "version": "0.0.0", - "author": { - "name": "Cezar Augusto", - "email": "boss@cezaraugusto.net", - "url": "https://cezaraugusto.com" - }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] -} diff --git a/programs/create/templates/react/template.json b/programs/create/templates/react/template.json deleted file mode 100644 index 6ff59a96..00000000 --- a/programs/create/templates/react/template.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "devDependencies": { - "@types/react": "^18.2.64", - "@types/react-dom": "^18.2.21", - "react": "^18.1.0", - "react-dom": "^18.1.0", - "sakura.css": "^1.5.0" - } -} diff --git a/programs/create/templates/react/template/.gitignore b/programs/create/templates/react/template/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/react/template/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/react/template/README.md b/programs/create/templates/react/template/README.md deleted file mode 100644 index 2f65bc5b..00000000 --- a/programs/create/templates/react/template/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# [projectName] - -> This project was bootstrapped using the Extension.js TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### [projectPackageManager] dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -[projectPackageManager] dev -``` - -### [projectPackageManager] start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -[projectPackageManager] start -``` - -### [projectPackageManager] build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -[projectPackageManager] run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/create/templates/react/template/images/icons/icon_16.png b/programs/create/templates/react/template/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/create/templates/react/template/images/icons/icon_16.png and /dev/null differ diff --git a/programs/create/templates/react/template/images/icons/icon_48.png b/programs/create/templates/react/template/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/create/templates/react/template/images/icons/icon_48.png and /dev/null differ diff --git a/programs/create/templates/react/template/images/react.png b/programs/create/templates/react/template/images/react.png deleted file mode 100644 index 9080fddd..00000000 Binary files a/programs/create/templates/react/template/images/react.png and /dev/null differ diff --git a/programs/create/templates/react/template/manifest.json b/programs/create/templates/react/template/manifest.json deleted file mode 100644 index 8baccd54..00000000 --- a/programs/create/templates/react/template/manifest.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "React Template", - "description": "An Extension.js template using React. This template includes a new tab override.", - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - }, - "chrome_url_overrides": { - "newtab": "newtab/index.html" - } -} diff --git a/programs/create/templates/react/template/newtab/NewTabApp.jsx b/programs/create/templates/react/template/newtab/NewTabApp.jsx deleted file mode 100644 index b57a8923..00000000 --- a/programs/create/templates/react/template/newtab/NewTabApp.jsx +++ /dev/null @@ -1,23 +0,0 @@ -import React from 'react' -import 'sakura.css' -import './styles.css' -import reactLogo from '../images/react.png' - -export default function NewTabApp() { - return ( -
-

- The React logo -
- Welcome to your React Extension. -

-

- Learn more about creating browser extensions at{' '} - - https://extension.js.org - - . -

-
- ) -} diff --git a/programs/create/templates/react/template/newtab/index.html b/programs/create/templates/react/template/newtab/index.html deleted file mode 100644 index 75582e5f..00000000 --- a/programs/create/templates/react/template/newtab/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - React Template - - - -
- - - diff --git a/programs/create/templates/react/template/newtab/styles.css b/programs/create/templates/react/template/newtab/styles.css deleted file mode 100644 index 11e3a190..00000000 --- a/programs/create/templates/react/template/newtab/styles.css +++ /dev/null @@ -1,23 +0,0 @@ -body { - display: flex; - justify-content: center; - align-items: center; - height: calc(100vh - 26px); -} - -h1 { - font-size: 4.7em; -} - -.react { - animation: spin 5s linear infinite; -} - -@keyframes spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} \ No newline at end of file diff --git a/programs/create/templates/tailwind/.gitignore b/programs/create/templates/tailwind/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/tailwind/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/tailwind/README.md b/programs/create/templates/tailwind/README.md deleted file mode 100644 index 6c81c037..00000000 --- a/programs/create/templates/tailwind/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Extension.js Tailwind Template - -> Tailwind template for [Extension.js](https://github.com/cezaraugusto/extension). diff --git a/programs/create/templates/tailwind/package.json b/programs/create/templates/tailwind/package.json deleted file mode 100644 index df755e2d..00000000 --- a/programs/create/templates/tailwind/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/tailwind" - }, - "name": "tailwind-template", - "description": "The Tailwind template for Extension.js.", - "version": "0.0.0", - "author": { - "name": "Cezar Augusto", - "email": "boss@cezaraugusto.net", - "url": "https://cezaraugusto.com" - }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] -} diff --git a/programs/create/templates/tailwind/template.json b/programs/create/templates/tailwind/template.json deleted file mode 100644 index cff6d5f9..00000000 --- a/programs/create/templates/tailwind/template.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "devDependencies": { - "@types/react": "^18.2.64", - "@types/react-dom": "^18.2.21", - "react": "^18.1.0", - "react-dom": "^18.1.0", - "tailwindcss": "^3.4.1" - } -} diff --git a/programs/create/templates/tailwind/template/.gitignore b/programs/create/templates/tailwind/template/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/tailwind/template/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/tailwind/template/README.md b/programs/create/templates/tailwind/template/README.md deleted file mode 100644 index c926cb81..00000000 --- a/programs/create/templates/tailwind/template/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# [projectName] - -> This project was bootstrapped using the Extension.js Tailwind template. - -## Scripts Available - -In the project directory, you can run: - -### [projectPackageManager] dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -[projectPackageManager] dev -``` - -### [projectPackageManager] start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -[projectPackageManager] start -``` - -### [projectPackageManager] build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -[projectPackageManager] run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/create/templates/tailwind/template/images/chromeWindow.png b/programs/create/templates/tailwind/template/images/chromeWindow.png deleted file mode 100644 index d70571be..00000000 Binary files a/programs/create/templates/tailwind/template/images/chromeWindow.png and /dev/null differ diff --git a/programs/create/templates/tailwind/template/images/icons/icon_16.png b/programs/create/templates/tailwind/template/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/create/templates/tailwind/template/images/icons/icon_16.png and /dev/null differ diff --git a/programs/create/templates/tailwind/template/images/icons/icon_48.png b/programs/create/templates/tailwind/template/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/create/templates/tailwind/template/images/icons/icon_48.png and /dev/null differ diff --git a/programs/create/templates/tailwind/template/images/react.png b/programs/create/templates/tailwind/template/images/react.png deleted file mode 100644 index 9080fddd..00000000 Binary files a/programs/create/templates/tailwind/template/images/react.png and /dev/null differ diff --git a/programs/create/templates/tailwind/template/images/tailwind.png b/programs/create/templates/tailwind/template/images/tailwind.png deleted file mode 100644 index 83ed5e12..00000000 Binary files a/programs/create/templates/tailwind/template/images/tailwind.png and /dev/null differ diff --git a/programs/create/templates/tailwind/template/images/tailwind_bg.png b/programs/create/templates/tailwind/template/images/tailwind_bg.png deleted file mode 100644 index edc40be8..00000000 Binary files a/programs/create/templates/tailwind/template/images/tailwind_bg.png and /dev/null differ diff --git a/programs/create/templates/tailwind/template/manifest.json b/programs/create/templates/tailwind/template/manifest.json deleted file mode 100644 index 760e4783..00000000 --- a/programs/create/templates/tailwind/template/manifest.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "Tailwind Template", - "description": "An extension template using Tailwind. This template includes a new tab override.", - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - }, - "chrome_url_overrides": { - "newtab": "newtab/index.html" - } -} diff --git a/programs/create/templates/tailwind/template/newtab/index.html b/programs/create/templates/tailwind/template/newtab/index.html deleted file mode 100644 index c6dff892..00000000 --- a/programs/create/templates/tailwind/template/newtab/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - Tailwind Template - - - -
- - - diff --git a/programs/create/templates/tailwind/template/newtab/scripts.jsx b/programs/create/templates/tailwind/template/newtab/scripts.jsx deleted file mode 100644 index a6755c29..00000000 --- a/programs/create/templates/tailwind/template/newtab/scripts.jsx +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import NewTabApp from './NewTabApp' -import './styles.css' - -const root = ReactDOM.createRoot(document.getElementById('root')) - -root.render( - - - -) diff --git a/programs/create/templates/tailwind/template/newtab/styles.css b/programs/create/templates/tailwind/template/newtab/styles.css deleted file mode 100644 index b5c61c95..00000000 --- a/programs/create/templates/tailwind/template/newtab/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; diff --git a/programs/create/templates/tailwind/template/postcss.config.js b/programs/create/templates/tailwind/template/postcss.config.js deleted file mode 100644 index 85f717cc..00000000 --- a/programs/create/templates/tailwind/template/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {} - } -} diff --git a/programs/create/templates/tailwind/template/tailwind.config.js b/programs/create/templates/tailwind/template/tailwind.config.js deleted file mode 100644 index fe8d881a..00000000 --- a/programs/create/templates/tailwind/template/tailwind.config.js +++ /dev/null @@ -1,8 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: ['**/*.html', '**/*.jsx'], - theme: { - extend: {} - }, - plugins: [] -} diff --git a/programs/create/templates/typescript/.gitignore b/programs/create/templates/typescript/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/typescript/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/typescript/README.md b/programs/create/templates/typescript/README.md deleted file mode 100644 index 409e6db8..00000000 --- a/programs/create/templates/typescript/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Extension.js TypeScript Template - -> TypeScript template for [Extension.js](https://github.com/cezaraugusto/extension). diff --git a/programs/create/templates/typescript/package.json b/programs/create/templates/typescript/package.json deleted file mode 100644 index 5a1a5cc5..00000000 --- a/programs/create/templates/typescript/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/typescript" - }, - "name": "typescript-template", - "description": "The Extension.js Typescript template.", - "version": "0.0.0", - "author": { - "name": "Cezar Augusto", - "email": "boss@cezaraugusto.net", - "url": "https://cezaraugusto.com" - }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] -} diff --git a/programs/create/templates/typescript/template.json b/programs/create/templates/typescript/template.json deleted file mode 100644 index 5b285e93..00000000 --- a/programs/create/templates/typescript/template.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "devDependencies": { - "typescript": "5.3.3" - } -} diff --git a/programs/create/templates/typescript/template/.gitignore b/programs/create/templates/typescript/template/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/typescript/template/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/typescript/template/README.md b/programs/create/templates/typescript/template/README.md deleted file mode 100644 index 2f65bc5b..00000000 --- a/programs/create/templates/typescript/template/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# [projectName] - -> This project was bootstrapped using the Extension.js TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### [projectPackageManager] dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -[projectPackageManager] dev -``` - -### [projectPackageManager] start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -[projectPackageManager] start -``` - -### [projectPackageManager] build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -[projectPackageManager] run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/create/templates/typescript/template/images/icons/icon_16.png b/programs/create/templates/typescript/template/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/create/templates/typescript/template/images/icons/icon_16.png and /dev/null differ diff --git a/programs/create/templates/typescript/template/images/icons/icon_48.png b/programs/create/templates/typescript/template/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/create/templates/typescript/template/images/icons/icon_48.png and /dev/null differ diff --git a/programs/create/templates/typescript/template/images/typescript.png b/programs/create/templates/typescript/template/images/typescript.png deleted file mode 100644 index 93614694..00000000 Binary files a/programs/create/templates/typescript/template/images/typescript.png and /dev/null differ diff --git a/programs/create/templates/typescript/template/manifest.json b/programs/create/templates/typescript/template/manifest.json deleted file mode 100644 index 52fa92d6..00000000 --- a/programs/create/templates/typescript/template/manifest.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "TypeScript Template", - "description": "An Extension.js template using TypeScript. This template includes a new tab override.", - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - }, - "chrome_url_overrides": { - "newtab": "newtab/index.html" - } -} diff --git a/programs/create/templates/typescript/template/newtab/index.html b/programs/create/templates/typescript/template/newtab/index.html deleted file mode 100644 index 88ca346a..00000000 --- a/programs/create/templates/typescript/template/newtab/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - TypeScript Extension - - - - - -
-

- The TypeScript logo -
- Welcome to your TypeScript Extension. -

-

- Learn more about creating browser extensions at - https://extension.js.org. -

-
- - - diff --git a/programs/create/templates/typescript/template/newtab/scripts.ts b/programs/create/templates/typescript/template/newtab/scripts.ts deleted file mode 100644 index 5c74d4cf..00000000 --- a/programs/create/templates/typescript/template/newtab/scripts.ts +++ /dev/null @@ -1,10 +0,0 @@ -function getManifest() { - return chrome.runtime.getManifest() -} -const manifest = getManifest() - -console.table({ - name: manifest.name, - version: manifest.version, - description: manifest.description -}) diff --git a/programs/create/templates/typescript/template/newtab/styles.css b/programs/create/templates/typescript/template/newtab/styles.css deleted file mode 100644 index da1dcbdb..00000000 --- a/programs/create/templates/typescript/template/newtab/styles.css +++ /dev/null @@ -1,18 +0,0 @@ -body { - display: flex; - justify-content: center; - align-items: center; - height: calc(100vh - 26px); -} - -h1 { - font-size: 3.7em; -} - -.typescript { - transition: all 400ms cubic-bezier(.47,1.64,.41,.8); -} - -.typescript:hover { - transform: scale(1.5); -} diff --git a/programs/create/templates/vue-typescript/.gitignore b/programs/create/templates/vue-typescript/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/vue-typescript/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/vue-typescript/README.md b/programs/create/templates/vue-typescript/README.md deleted file mode 100644 index 82ed19c6..00000000 --- a/programs/create/templates/vue-typescript/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Extension Vue TypeScript Template - -> Vue + TypeScript template for [Extension.js](https://github.com/cezaraugusto/extension). diff --git a/programs/create/templates/vue-typescript/package.json b/programs/create/templates/vue-typescript/package.json deleted file mode 100644 index df416929..00000000 --- a/programs/create/templates/vue-typescript/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/vue-typescript" - }, - "name": "vue-typescript-template", - "description": "The Extension.js Vue + TypeScript template.", - "version": "0.0.0", - "author": { - "name": "OSpoon", - "email": "zxin088@gmail.com", - "url": "https://hw404.cn" - }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] -} diff --git a/programs/create/templates/vue-typescript/template.json b/programs/create/templates/vue-typescript/template.json deleted file mode 100644 index 8abc85b0..00000000 --- a/programs/create/templates/vue-typescript/template.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "devDependencies": { - "vue": "^3.4.27", - "tailwindcss": "^3.4.1", - "typescript": "5.3.3" - } -} diff --git a/programs/create/templates/vue-typescript/template/.gitignore b/programs/create/templates/vue-typescript/template/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/vue-typescript/template/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/vue-typescript/template/README.md b/programs/create/templates/vue-typescript/template/README.md deleted file mode 100644 index 11e148a5..00000000 --- a/programs/create/templates/vue-typescript/template/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# [projectName] - -> This project was bootstrapped using the Extension Vue-TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### [projectPackageManager] dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -[projectPackageManager] dev -``` - -### [projectPackageManager] start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -[projectPackageManager] start -``` - -### [projectPackageManager] build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -[projectPackageManager] run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/create/templates/vue-typescript/template/background.ts b/programs/create/templates/vue-typescript/template/background.ts deleted file mode 100644 index 798d5018..00000000 --- a/programs/create/templates/vue-typescript/template/background.ts +++ /dev/null @@ -1 +0,0 @@ -console.log('Hello from the background script!') diff --git a/programs/create/templates/vue-typescript/template/content/ContentApp.vue b/programs/create/templates/vue-typescript/template/content/ContentApp.vue deleted file mode 100644 index a0752c8b..00000000 --- a/programs/create/templates/vue-typescript/template/content/ContentApp.vue +++ /dev/null @@ -1,90 +0,0 @@ - - diff --git a/programs/create/templates/vue-typescript/template/content/scripts.ts b/programs/create/templates/vue-typescript/template/content/scripts.ts deleted file mode 100644 index bbee32a8..00000000 --- a/programs/create/templates/vue-typescript/template/content/scripts.ts +++ /dev/null @@ -1,13 +0,0 @@ -import {createApp} from 'vue' -import ContentApp from './ContentApp.vue' -import './styles.css' - -function initial() { - const rootDiv = document.createElement('div') - rootDiv.id = 'extension-root' - document.body.appendChild(rootDiv) - - createApp(ContentApp).mount(rootDiv) -} - -setTimeout(initial, 1000) diff --git a/programs/create/templates/vue-typescript/template/content/shims-vue.d.ts b/programs/create/templates/vue-typescript/template/content/shims-vue.d.ts deleted file mode 100644 index 69226d04..00000000 --- a/programs/create/templates/vue-typescript/template/content/shims-vue.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* eslint-disable */ -declare module '*.vue' { - import type {DefineComponent} from 'vue' - const component: DefineComponent<{}, {}, any> - export default component -} diff --git a/programs/create/templates/vue-typescript/template/content/styles.css b/programs/create/templates/vue-typescript/template/content/styles.css deleted file mode 100644 index dc79ebb5..00000000 --- a/programs/create/templates/vue-typescript/template/content/styles.css +++ /dev/null @@ -1,10 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -#extension-root { - position: fixed; - bottom: 0; - right: 0; - z-index: 99999; -} diff --git a/programs/create/templates/vue-typescript/template/images/chromeWindow.png b/programs/create/templates/vue-typescript/template/images/chromeWindow.png deleted file mode 100644 index da525dd8..00000000 Binary files a/programs/create/templates/vue-typescript/template/images/chromeWindow.png and /dev/null differ diff --git a/programs/create/templates/vue-typescript/template/images/icons/icon_16.png b/programs/create/templates/vue-typescript/template/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/create/templates/vue-typescript/template/images/icons/icon_16.png and /dev/null differ diff --git a/programs/create/templates/vue-typescript/template/images/icons/icon_48.png b/programs/create/templates/vue-typescript/template/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/create/templates/vue-typescript/template/images/icons/icon_48.png and /dev/null differ diff --git a/programs/create/templates/vue-typescript/template/images/tailwind.png b/programs/create/templates/vue-typescript/template/images/tailwind.png deleted file mode 100644 index 83ed5e12..00000000 Binary files a/programs/create/templates/vue-typescript/template/images/tailwind.png and /dev/null differ diff --git a/programs/create/templates/vue-typescript/template/images/tailwind_bg.png b/programs/create/templates/vue-typescript/template/images/tailwind_bg.png deleted file mode 100644 index edc40be8..00000000 Binary files a/programs/create/templates/vue-typescript/template/images/tailwind_bg.png and /dev/null differ diff --git a/programs/create/templates/vue-typescript/template/images/typescript.png b/programs/create/templates/vue-typescript/template/images/typescript.png deleted file mode 100644 index 93614694..00000000 Binary files a/programs/create/templates/vue-typescript/template/images/typescript.png and /dev/null differ diff --git a/programs/create/templates/vue-typescript/template/images/vue.svg b/programs/create/templates/vue-typescript/template/images/vue.svg deleted file mode 100644 index d4d5f0bd..00000000 --- a/programs/create/templates/vue-typescript/template/images/vue.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/programs/create/templates/vue-typescript/template/manifest.json b/programs/create/templates/vue-typescript/template/manifest.json deleted file mode 100644 index d6a9e970..00000000 --- a/programs/create/templates/vue-typescript/template/manifest.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "Vue+TypeScript Template", - "description": "An extension template using Vue and TypeScript. This template includes a content script using Tailwind.css. To see it in action, visit https://extension.js.org.", - "background": { - "chromium:service_worker": "background.ts", - "firefox:scripts": ["background.ts"] - }, - "content_scripts": [ - { - "matches": ["https://extension.js.org/*"], - "js": ["./content/scripts.ts"] - } - ], - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - } -} diff --git a/programs/create/templates/vue-typescript/template/postcss.config.js b/programs/create/templates/vue-typescript/template/postcss.config.js deleted file mode 100644 index 85f717cc..00000000 --- a/programs/create/templates/vue-typescript/template/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {} - } -} diff --git a/programs/create/templates/vue-typescript/template/tailwind.config.js b/programs/create/templates/vue-typescript/template/tailwind.config.js deleted file mode 100644 index 0abdfe65..00000000 --- a/programs/create/templates/vue-typescript/template/tailwind.config.js +++ /dev/null @@ -1,8 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: ['**/*.html', '**/*.vue'], - theme: { - extend: {} - }, - plugins: [] -} diff --git a/programs/create/templates/vue-typescript/template/tsconfig.json b/programs/create/templates/vue-typescript/template/tsconfig.json deleted file mode 100644 index b17ae463..00000000 --- a/programs/create/templates/vue-typescript/template/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "types": ["webpack/module"], - "allowJs": true, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "isolatedModules": false, - "jsx": "preserve", - "lib": ["dom", "dom.iterable", "esnext"], - "moduleResolution": "node", - "module": "esnext", - "resolveJsonModule": true, - "strict": true, - "target": "esnext" - }, - "include": ["./"], - "exclude": ["node_modules", "dist"] -} diff --git a/programs/create/templates/vue/.gitignore b/programs/create/templates/vue/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/vue/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/vue/README.md b/programs/create/templates/vue/README.md deleted file mode 100644 index b6884795..00000000 --- a/programs/create/templates/vue/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Extension.js Vue Template - -> Vue template for [Extension.js](https://github.com/cezaraugusto/extension). diff --git a/programs/create/templates/vue/package.json b/programs/create/templates/vue/package.json deleted file mode 100644 index 55db5a02..00000000 --- a/programs/create/templates/vue/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/cezaraugusto/extension.git", - "directory": "programs/create/templates/vue" - }, - "name": "vue-template", - "description": "The Extension.js Vue template.", - "version": "0.0.0", - "author": { - "name": "OSpoon", - "email": "zxin088@gmail.com", - "url": "https://hw404.cn" - }, - "files": [ - "template", - "template.json" - ], - "keywords": [ - "extension", - "browser-extension", - "web-extension", - "template" - ] -} diff --git a/programs/create/templates/vue/template.json b/programs/create/templates/vue/template.json deleted file mode 100644 index cba4f09a..00000000 --- a/programs/create/templates/vue/template.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "devDependencies": { - "vue": "^3.4.27", - "sakura.css": "^1.5.0" - } -} diff --git a/programs/create/templates/vue/template/.gitignore b/programs/create/templates/vue/template/.gitignore deleted file mode 100644 index aab4db30..00000000 --- a/programs/create/templates/vue/template/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules - -# testing -/coverage - -# production -/dist - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/programs/create/templates/vue/template/README.md b/programs/create/templates/vue/template/README.md deleted file mode 100644 index 2f65bc5b..00000000 --- a/programs/create/templates/vue/template/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# [projectName] - -> This project was bootstrapped using the Extension.js TypeScript template. - -## Scripts Available - -In the project directory, you can run: - -### [projectPackageManager] dev - -``` -// Runs the app in the development mode. -// Will open a new browser instance with your extension loaded. -// The page will reload when you make changes. -[projectPackageManager] dev -``` - -### [projectPackageManager] start - -``` -// Runs the app in the production mode. -// Will open a new browser instance with your extension loaded. -// This is how your browser extension will work once published. -[projectPackageManager] start -``` - -### [projectPackageManager] build - -``` -// Builds the app for production. -// Bundles your browser extension in production mode for the target browser. -[projectPackageManager] run build -``` - -## Learn More - -You can learn more in the [Extension.js](https://extension.js.org) documentation. diff --git a/programs/create/templates/vue/template/images/icons/icon_16.png b/programs/create/templates/vue/template/images/icons/icon_16.png deleted file mode 100644 index 651139b5..00000000 Binary files a/programs/create/templates/vue/template/images/icons/icon_16.png and /dev/null differ diff --git a/programs/create/templates/vue/template/images/icons/icon_48.png b/programs/create/templates/vue/template/images/icons/icon_48.png deleted file mode 100644 index 73b36f0f..00000000 Binary files a/programs/create/templates/vue/template/images/icons/icon_48.png and /dev/null differ diff --git a/programs/create/templates/vue/template/images/vue.svg b/programs/create/templates/vue/template/images/vue.svg deleted file mode 100644 index d4d5f0bd..00000000 --- a/programs/create/templates/vue/template/images/vue.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/programs/create/templates/vue/template/manifest.json b/programs/create/templates/vue/template/manifest.json deleted file mode 100644 index ef0904b8..00000000 --- a/programs/create/templates/vue/template/manifest.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "manifest_version": 3, - "version": "1.0", - "name": "Vue Template", - "description": "An Extension.js template using Vue. This template includes a new tab override.", - "icons": { - "16": "images/icons/icon_16.png", - "48": "images/icons/icon_48.png" - }, - "chrome_url_overrides": { - "newtab": "newtab/index.html" - } -} diff --git a/programs/create/templates/vue/template/newtab/NewTabApp.vue b/programs/create/templates/vue/template/newtab/NewTabApp.vue deleted file mode 100644 index 47fc2529..00000000 --- a/programs/create/templates/vue/template/newtab/NewTabApp.vue +++ /dev/null @@ -1,30 +0,0 @@ - - diff --git a/programs/create/templates/vue/template/newtab/index.html b/programs/create/templates/vue/template/newtab/index.html deleted file mode 100644 index 90a5ebca..00000000 --- a/programs/create/templates/vue/template/newtab/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - Vue Template - - - -
- - - diff --git a/programs/create/templates/vue/template/newtab/scripts.js b/programs/create/templates/vue/template/newtab/scripts.js deleted file mode 100644 index d4dd397f..00000000 --- a/programs/create/templates/vue/template/newtab/scripts.js +++ /dev/null @@ -1,7 +0,0 @@ -import 'sakura.css' -import './styles.css' - -import {createApp} from 'vue' -import NewTabApp from './NewTabApp.vue' - -createApp(NewTabApp).mount('#app') diff --git a/programs/create/templates/vue/template/newtab/styles.css b/programs/create/templates/vue/template/newtab/styles.css deleted file mode 100644 index 26ef4ee5..00000000 --- a/programs/create/templates/vue/template/newtab/styles.css +++ /dev/null @@ -1,36 +0,0 @@ -body { - display: flex; - justify-content: center; - align-items: center; - height: calc(100vh - 26px); -} - -h1 { - font-size: 4.7em; -} - -.vue { - animation: heartbeat 1s linear infinite; -} - -@keyframes heartbeat { - 0% { - transform: scale(0.9); - } - - 20% { - transform: scale(1); - } - - 30% { - transform: scale(0.9); - } - - 40% { - transform: scale(1); - } - - 100% { - transform: scale(0.9); - } -} diff --git a/programs/develop/__spec__/build.spec.ts b/programs/develop/__spec__/build.spec.ts index 67a41a61..01a28894 100644 --- a/programs/develop/__spec__/build.spec.ts +++ b/programs/develop/__spec__/build.spec.ts @@ -15,7 +15,7 @@ describe('extension build', () => { describe('running built-in templates', () => { it.each(ALL_TEMPLATES)( - `builds an extension created viaaaaa "$name" template`, + `builds an extension created via "$name" template`, async (template) => { const templatePath = path.resolve( __dirname, @@ -26,8 +26,6 @@ describe('extension build', () => { template.name ) - console.log('templatePath', templatePath) - await extensionBuild(templatePath) expect( diff --git a/programs/develop/commands/commands-lib/messages.ts b/programs/develop/commands/commands-lib/messages.ts index 75a74fe4..676b5d75 100644 --- a/programs/develop/commands/commands-lib/messages.ts +++ b/programs/develop/commands/commands-lib/messages.ts @@ -8,7 +8,7 @@ import { brightGreen, underline, magenta, - brightBlue + cyan } from '@colors/colors/safe' import {Manifest} from '../../types' import {StartOptions} from '../start' @@ -19,7 +19,7 @@ function getLoggingPrefix(type: 'warn' | 'info' | 'error' | 'success'): string { type === 'warn' ? brightYellow('►►►') : type === 'info' - ? brightBlue('►►►') + ? gray('►►►') : type === 'error' ? red('✖︎✖︎✖︎') : brightGreen('►►►') @@ -66,8 +66,12 @@ export function runningInProduction( ${` Extension Name `} ${gray(name)} ${` Extension Version `} ${gray(version)} ${` Locales `} ${gray(locales)} -${` Host Permissions `} ${gray(hasHost ? hostPermissions.join(', ') : 'Browser defaults')} -${` Permissions `} ${gray(hasPermissions ? permissions.join(', ') : 'Browser defaults')} +${` Host Permissions `} ${gray( + hasHost ? hostPermissions.join(', ') : 'Browser defaults' + )} +${` Permissions `} ${gray( + hasPermissions ? permissions.join(', ') : 'Browser defaults' + )} ` } @@ -106,7 +110,7 @@ export function buildWebpack( fs.readFileSync(manifestPath, 'utf8') ) const assets: any[] = statsJson?.assets - const heading = `${getLoggingPrefix('info')} Building ${brightGreen( + const heading = `${getLoggingPrefix('info')} Building ${cyan( manifest.name )} extension using ${capitalizedBrowserName(browser)} defaults...\n\n` const buildTime = `\nBuild completed in ${( @@ -134,7 +138,9 @@ export function buildWebpack( export function buildSuccess() { return `${getLoggingPrefix( 'success' - )} No errors or warnings found. Your extension is ${brightGreen('ready for deployment')}.` + )} No errors or warnings found. Your extension is ${brightGreen( + 'ready for deployment' + )}.` } export function fetchingProjectPath(owner: string, project: string) { @@ -145,9 +151,7 @@ export function fetchingProjectPath(owner: string, project: string) { } export function downloadingProjectPath(projectName: string) { - return `${getLoggingPrefix('success')} Downloading ${brightGreen( - projectName - )}...` + return `${getLoggingPrefix('success')} Downloading ${cyan(projectName)}...` } export function creatingProjectPath(projectName: string) { @@ -348,7 +352,7 @@ function printTree(node: Record, prefix = ''): string { : '' output += `${gray(prefix)}${gray(connector)} ${key}${gray(sizeInKB)}\n` if (typeof node[key] === 'object' && !node[key].size) { - output += printTree(node[key], `${prefix}${isLast ? ' ' : '| '}`) + output += printTree(node[key], `${prefix}${isLast ? ' ' : gray('| ')}`) } }) diff --git a/programs/develop/commands/dev.ts b/programs/develop/commands/dev.ts index 6948c81f..f9191780 100644 --- a/programs/develop/commands/dev.ts +++ b/programs/develop/commands/dev.ts @@ -28,7 +28,7 @@ export interface DevOptions { export async function extensionDev( pathOrRemoteUrl: string | undefined, - {...devOptions}: DevOptions = { + devOptions: DevOptions = { browser: 'chrome', mode: 'development' } diff --git a/programs/develop/install_scripts.sh b/programs/develop/install_scripts.sh index 8a15e9bc..2cee940a 100644 --- a/programs/develop/install_scripts.sh +++ b/programs/develop/install_scripts.sh @@ -15,7 +15,6 @@ resolve_plugin_files=( scripts_plugin_files=( "$(dirname "$0")/webpack/plugin-extension/feature-scripts/steps/inject-content-css-during-dev.ts" "$(dirname "$0")/webpack/plugin-extension/feature-scripts/steps/add-hmr-accept-code.ts" - "$(dirname "$0")/webpack/plugin-extension/feature-scripts/steps/add-dynamic-public-path.ts" "$(dirname "$0")/webpack/plugin-extension/feature-scripts/steps/add-query-param-to-imported-css.ts" ) @@ -90,7 +89,7 @@ done echo '►►► Setting up client helper files' static_files=( "$(dirname "$0")/tailwind.config.js" - "$(dirname "$0")/stylelint.config.js" + "$(dirname "$0")/stylelint.config.json" "$(dirname "$0")/types" "$(dirname "$0")/webpack/plugin-reload/extensions" ) diff --git a/programs/develop/package.json b/programs/develop/package.json index fe7884df..b7c60e74 100644 --- a/programs/develop/package.json +++ b/programs/develop/package.json @@ -50,7 +50,7 @@ "edge-location": "^1.0.0", "firefox-profile": "^4.6.0", "fx-runner": "^1.4.0", - "go-git-it": "^2.0.0", + "go-git-it": "^2.0.1", "ignore": "^5.3.1", "loader-utils": "^3.3.1", "mini-css-extract-plugin": "^2.8.1", diff --git a/programs/develop/plugin-browsers/browsers-lib/messages.ts b/programs/develop/plugin-browsers/browsers-lib/messages.ts index 16cd94cb..8d6409ce 100644 --- a/programs/develop/plugin-browsers/browsers-lib/messages.ts +++ b/programs/develop/plugin-browsers/browsers-lib/messages.ts @@ -4,8 +4,7 @@ import { brightYellow, brightGreen, red, - cyan, - magenta + brightBlue } from '@colors/colors/safe' import {DevOptions} from '../../commands/dev' @@ -19,7 +18,7 @@ function getLoggingPrefix( type === 'warn' ? brightYellow('►►►') : type === 'info' - ? gray('►►►') + ? brightBlue('►►►') : type === 'error' ? red('✖︎✖︎✖︎') : brightGreen('►►►') @@ -36,12 +35,11 @@ export function stdoutData( mode: DevOptions['mode'] ) { const extensionOutput = browser === 'firefox' ? 'Add-on' : 'Extension' - const modeColor = mode === 'development' ? cyan : magenta return ( `${getLoggingPrefix(browser, 'info')} ` + `${capitalizedBrowserName(browser)} ${extensionOutput} ` + - // `${name} ` + - `running in ${modeColor(mode || 'unknown')} mode.` + // `${cyan(name)} ` + + `running in ${brightBlue(mode || 'unknown')} mode.` ) } diff --git a/programs/develop/plugin-browsers/run-chromium/browser-config.ts b/programs/develop/plugin-browsers/run-chromium/browser-config.ts index 5cadd56a..b8e74f9a 100644 --- a/programs/develop/plugin-browsers/run-chromium/browser-config.ts +++ b/programs/develop/plugin-browsers/run-chromium/browser-config.ts @@ -13,7 +13,8 @@ export function browserConfig(configOptions: PluginInterface) { `--load-extension=${extensionsToLoad.join()}`, `--user-data-dir=${createProfile( configOptions.browser, - configOptions.userDataDir || configOptions.profile + configOptions.profile, + false )}`, // Disable Chrome's native first run experience. '--no-first-run', diff --git a/programs/develop/plugin-browsers/run-chromium/index.ts b/programs/develop/plugin-browsers/run-chromium/index.ts index 4e92db85..28aa0f9a 100644 --- a/programs/develop/plugin-browsers/run-chromium/index.ts +++ b/programs/develop/plugin-browsers/run-chromium/index.ts @@ -30,7 +30,7 @@ export class RunChromiumPlugin { this.browser = options.browser this.browserFlags = options.browserFlags || [] this.userDataDir = options.userDataDir - this.profile = options.profile + this.profile = options.profile || options.userDataDir this.preferences = options.preferences this.startingUrl = options.startingUrl } @@ -90,10 +90,7 @@ export class RunChromiumPlugin { this.launchChromium(this.browser) console.log( - messages.stdoutData( - this.browser, - compilation.compilation.options.mode - ) + messages.stdoutData(this.browser, compilation.compilation.options.mode) ) chromiumDidLaunch = true diff --git a/programs/develop/webpack/dev-server.ts b/programs/develop/webpack/dev-server.ts index 82411583..32956cf9 100644 --- a/programs/develop/webpack/dev-server.ts +++ b/programs/develop/webpack/dev-server.ts @@ -39,7 +39,7 @@ export async function devServer( host: '127.0.0.1', allowedHosts: 'all', static: path.join(projectPath, 'public'), - compress: true, + compress: false, devMiddleware: { writeToDisk: true }, @@ -60,10 +60,7 @@ export async function devServer( progress: false, // Shows a full-screen overlay in the browser // when there are compiler errors or warnings. - overlay: { - errors: false, - warnings: false - } + overlay: false }, headers: { 'Access-Control-Allow-Origin': '*' diff --git a/programs/develop/webpack/lib/messages.ts b/programs/develop/webpack/lib/messages.ts index 2477a01f..4f7ce072 100644 --- a/programs/develop/webpack/lib/messages.ts +++ b/programs/develop/webpack/lib/messages.ts @@ -8,7 +8,8 @@ import { cyan, bold, gray, - brightYellow + brightYellow, + magenta } from '@colors/colors/safe' import {Manifest} from '../webpack-types' import {DevOptions} from '../../commands/dev' @@ -17,10 +18,10 @@ import {Stats} from 'webpack' type PrefixType = 'warn' | 'info' | 'error' | 'success' -function getLoggingPrefix(filename: string, type: PrefixType): string { +function getLoggingPrefix(manifestName: string, type: PrefixType): string { // For errors we invert the order if (type === 'error') { - return `${filename} ${red('✖︎✖︎✖︎')}` + return `${manifestName} ${red('✖︎✖︎✖︎')}` } const arrow = @@ -30,20 +31,25 @@ function getLoggingPrefix(filename: string, type: PrefixType): string { ? gray('►►►') : brightGreen('►►►') - return `${arrow} ${filename}` + return `${arrow} ${cyan(manifestName)}` } export function capitalizedBrowserName(browser: DevOptions['browser']) { return browser!.charAt(0).toUpperCase() + browser!.slice(1) } -export function boring(manifestName: string, duration: number, stats: Stats) { +export function boring(duration: number, stats: Stats) { let didShow = false if (!didShow) { - return `${getLoggingPrefix(manifestName, stats.hasErrors() ? 'error' : 'info')} compiled ${brightGreen( - 'successfully' - )} in ${duration} ms` + const arrow = stats.hasErrors() ? red('✖︎✖︎✖︎') : brightGreen('►►►') + + return ( + // `${getLoggingPrefix(manifestName, stats.hasErrors() ? 'error' : 'success')} ` + + `${arrow} ${'Extension.js'} ` + + // `${getLoggingPrefix('manifestName', stats.hasErrors() ? 'error' : 'success')} ` + + `compiled ${stats.hasErrors() ? red('with errors') : brightGreen('successfully')} in ${duration} ms.` + ) } return undefined @@ -55,7 +61,7 @@ export function integrationNotInstalled( packageManager: string ) { return ( - `${getLoggingPrefix(manifestName, 'info')} ${cyan( + `${getLoggingPrefix(manifestName, 'info')} ${magenta( integration )} Integration Found\n\n` + `Installing required setup dependencies via ${brightYellow( @@ -75,14 +81,14 @@ export function envFileLoaded(manifestName: string) { export function isUsingIntegration(manifestName: string, integration: any) { return ( `${getLoggingPrefix(manifestName, 'info')} ` + - `is using ${cyan(integration)}.` + `is using ${magenta(integration)}.` ) } export function youAreAllSet(manifestName: string, integration: string) { return ( `${getLoggingPrefix(manifestName, 'success')} You Are All Set\n\n` + - `Run the program again to start hacking with ${cyan(integration)} support.` + `Run the program again to start hacking with ${magenta(integration)} support.` ) } @@ -95,7 +101,7 @@ export function installingRootDependencies( manifestName, 'info' )} Installing Root Dependencies\n\n` + - `Installing ${cyan(integration)} Dependencies in Extension.js root. ` + + `Installing ${magenta(integration)} dependencies in Extension.js root. ` + `This only happens for authors and contributors.` ) } @@ -116,11 +122,11 @@ export function failedToInstallIntegration( error: unknown ) { return ( - `${getLoggingPrefix(manifestName, 'error')} ${cyan( + `${getLoggingPrefix(manifestName, 'error')} ${magenta( integration )} Installation Error\n\n` + `Failed to detect package ` + - `manager or install ${cyan(integration)} dependencies: ${red( + `manager or install ${magenta(integration)} dependencies: ${red( error?.toString() || '' )}` ) @@ -226,7 +232,7 @@ export function invalidFieldType( return ( `${getLoggingPrefix(manifestName, 'error')} Invalid Manifest Field\n\n` + - `Field ${brightYellow(field)} must be of type ${cyan(type)}.\n\n` + + `Field ${brightYellow(field)} must be of type ${brightBlue(type)}.\n\n` + `Read more: ${getManifestDocumentationURL(browser)}` ) } @@ -386,6 +392,12 @@ export function serverRestartRequiredFromManifest( fileAdded: string, fileRemoved: string ) { + const fileRemovedText = + fileRemoved && + `${gray('PATH')} ${red('REMOVED')} ${underline(fileRemoved)}\n` + const fileAddedText = + fileAdded && + `${gray('PATH')} ${brightGreen('ADDED')} ${underline(fileAdded)}` return ( `${getLoggingPrefix( manifestName, @@ -395,8 +407,8 @@ export function serverRestartRequiredFromManifest( '' )} ` + `files after compilation requires a server restart.\n\n` + - `${gray('PATH')} ${red('REMOVED')} ${underline(fileRemoved)}\n` + - `${gray('PATH')} ${brightGreen('ADDED')} ${underline(fileAdded)}` + fileRemovedText + + fileAddedText ) } @@ -487,7 +499,7 @@ export function runningInDevelopment( `No data received from the extension client.\n\n` + `This error happens when the program can\'t get the data from your extension.\n` + `Ensure your extension is enabled in your browser and that no hanging browser\n` + - `instance is open. If that is not the case, restart the extension package in\n` + + `instance is open.\n\nIf that is not the case, restart the extension package in\n` + `the browser and try again.\n\n` + `If nothing helps and the issue persists, please report a bug:\n\n` + underline(`https://github.com/extension-js/extension.js/issues`) @@ -631,3 +643,12 @@ export function defaultPortInUse(manifestName: string, port: number) { `Default port ${port} in use, choose a new port. ` ) } + +export function noExtensionIdError(manifestName: string) { + return ( + `${getLoggingPrefix(manifestName, 'error')} No Extension Id Specified\n\n` + + `For MAIN world content scripts, you must specify an extension ID.\n` + + `Otherwise, the content script won't reload on changes.\n` + + `Add an ${brightYellow('id')} field to your manifest.json file and try again.` + ) +} diff --git a/programs/develop/webpack/plugin-compilation/index.ts b/programs/develop/webpack/plugin-compilation/index.ts index ced22856..8a0d7484 100644 --- a/programs/develop/webpack/plugin-compilation/index.ts +++ b/programs/develop/webpack/plugin-compilation/index.ts @@ -4,7 +4,7 @@ import {EnvPlugin} from './env' import {CleanHotUpdatesPlugin} from './clean-hot-updates' import * as messages from '../lib/messages' -import {type PluginInterface, type Manifest} from '../webpack-types' +import {type PluginInterface} from '../webpack-types' export class CompilationPlugin { public static readonly name: string = 'plugin-compilation' @@ -25,13 +25,10 @@ export class CompilationPlugin { compiler.hooks.done.tap('develop:brand', (stats) => { stats.compilation.name = undefined - const manifest: Manifest = require(this.manifestPath) - const manifestName = manifest.name || 'Extension.js' - // const manifestVersion = manifest.version || 'Unknown' // Calculate compilation time const duration = stats.endTime - stats.startTime - console.log(messages.boring(`${manifestName}`, duration, stats)) + console.log(messages.boring(duration, stats)) }) } } diff --git a/programs/develop/webpack/plugin-css/css-tools/stylelint.ts b/programs/develop/webpack/plugin-css/css-tools/stylelint.ts index b6ae467a..00b1fae4 100644 --- a/programs/develop/webpack/plugin-css/css-tools/stylelint.ts +++ b/programs/develop/webpack/plugin-css/css-tools/stylelint.ts @@ -12,7 +12,7 @@ import * as messages from '../../lib/messages' import {installOptionalDependencies} from '../../lib/utils' export function getStylelintConfigFile(projectPath: string) { - const stylelintConfigJs = path.join(projectPath, 'stylelint.config.js') + const stylelintConfigJs = path.join(projectPath, 'stylelint.config.json') const stylelintConfigDotJs = path.join(projectPath, '.stylelintrc.js file') const stylelintConfigMjs = path.join(projectPath, 'stylelint.config.mjs') const stylelintConfigDotMjs = path.join(projectPath, '.stylelintrc.mjs') @@ -97,7 +97,7 @@ export async function maybeUseStylelint( context: projectPath, configFile: isUsingStylelint(projectPath) ? getStylelintConfigFile(projectPath) - : path.join(__dirname, 'stylelint.config.js'), + : path.join(__dirname, 'stylelint.config.json'), files: '**/*.{css,scss,sass,less}', exclude: ['node_modules', path.join(projectPath, 'node_modules')] }) diff --git a/programs/develop/webpack/plugin-css/index.ts b/programs/develop/webpack/plugin-css/index.ts index 634f8af4..b032f1b9 100644 --- a/programs/develop/webpack/plugin-css/index.ts +++ b/programs/develop/webpack/plugin-css/index.ts @@ -12,7 +12,6 @@ import {type DevOptions} from '../../commands/dev' import {maybeUseSass} from './css-tools/sass' import {maybeUseLess} from './css-tools/less' import {maybeUseStylelint} from './css-tools/stylelint' -import {getAssetFilename} from '../webpack-config' export class CssPlugin { public static readonly name: string = 'plugin-css' @@ -28,15 +27,7 @@ export class CssPlugin { private async configureOptions(compiler: Compiler) { const projectPath = path.dirname(this.manifestPath) - const plugins: WebpackPluginInstance[] = [ - new MiniCssExtractPlugin({ - chunkFilename: (pathData: PathData) => { - const runtime = (pathData.chunk as any)?.runtime - - return getAssetFilename(runtime) - } - }) - ] + const plugins: WebpackPluginInstance[] = [new MiniCssExtractPlugin()] plugins.forEach((plugin) => plugin.apply(compiler)) diff --git a/programs/develop/webpack/plugin-errors/webpack-common-errors/index.ts b/programs/develop/webpack/plugin-errors/webpack-common-errors/index.ts index 1386185c..8e7039d2 100644 --- a/programs/develop/webpack/plugin-errors/webpack-common-errors/index.ts +++ b/programs/develop/webpack/plugin-errors/webpack-common-errors/index.ts @@ -3,7 +3,7 @@ import path from 'path' import type webpack from 'webpack' import { handleMultipleAssetsError, - handleTopLevelAwaitError, + handleTopLevelAwaitError // handleCantResolveError } from './compilation-error-handlers' import {type PluginInterface} from '../../webpack-types' diff --git a/programs/develop/webpack/plugin-extension/feature-html/steps/throw-if-recompile-is-needed.ts b/programs/develop/webpack/plugin-extension/feature-html/steps/throw-if-recompile-is-needed.ts index 8fd79345..6ad7318c 100644 --- a/programs/develop/webpack/plugin-extension/feature-html/steps/throw-if-recompile-is-needed.ts +++ b/programs/develop/webpack/plugin-extension/feature-html/steps/throw-if-recompile-is-needed.ts @@ -1,5 +1,4 @@ import fs from 'fs' -import path from 'path' import {type Compiler} from 'webpack' import {type FilepathList, type PluginInterface} from '../../../webpack-types' import {getAssetsFromHtml} from '../html-lib/utils' diff --git a/programs/develop/webpack/plugin-extension/feature-manifest/steps/throw-if-recompile.ts b/programs/develop/webpack/plugin-extension/feature-manifest/steps/throw-if-recompile.ts index f53bf2f1..521ec98f 100644 --- a/programs/develop/webpack/plugin-extension/feature-manifest/steps/throw-if-recompile.ts +++ b/programs/develop/webpack/plugin-extension/feature-manifest/steps/throw-if-recompile.ts @@ -32,7 +32,6 @@ export class ThrowIfRecompileIsNeeded { return } - const projectName = require(packageJsonPath).name const manifest: Manifest = require(this.manifestPath) const initialHtml = this.flattenAndSort( Object.values(htmlFields(context, manifest)) diff --git a/programs/develop/webpack/plugin-extension/feature-resolve/steps/resolver-loader.ts b/programs/develop/webpack/plugin-extension/feature-resolve/steps/resolver-loader.ts index 96def825..7f5a755a 100644 --- a/programs/develop/webpack/plugin-extension/feature-resolve/steps/resolver-loader.ts +++ b/programs/develop/webpack/plugin-extension/feature-resolve/steps/resolver-loader.ts @@ -4,6 +4,7 @@ import {Schema} from 'schema-utils/declarations/validate' import {transformSource} from './transform-source' import {emitResolverModule} from './emit-resolver-module' import {ResolvePluginContext} from './loader-types' +import {type Manifest} from '../../../../types' const schema: Schema = { type: 'object', @@ -16,6 +17,25 @@ const schema: Schema = { } } +function getContentScripts(manifest: Manifest, manifestDir: string): string[] { + if (!manifest.content_scripts) { + return [] + } + + const scripts: string[] = [] + + manifest.content_scripts.forEach((contentScript) => { + if (contentScript.js) { + contentScript.js.forEach((script) => { + // Resolve each script path relative to the manifest directory + scripts.push(path.resolve(manifestDir, script)) + }) + } + }) + + return scripts +} + export default function resolveLoader( this: ResolvePluginContext, source: string @@ -36,6 +56,19 @@ export default function resolveLoader( ) { return source } + + // Get the directory of the manifest file + const manifestDir = path.dirname(options.manifestPath) + // Get the content scripts, resolved relative to the manifest directory + const contentScripts = getContentScripts( + require(options.manifestPath) as Manifest, + manifestDir + ) + + if (contentScripts.some((script) => script === this.resourcePath)) { + return source + } + const transformedSource = transformSource(source, options) const resolverAbsolutePath = path.join(__dirname, resolverName) diff --git a/programs/develop/webpack/plugin-extension/feature-scripts/index.ts b/programs/develop/webpack/plugin-extension/feature-scripts/index.ts index 58e39edb..eee9cb69 100644 --- a/programs/develop/webpack/plugin-extension/feature-scripts/index.ts +++ b/programs/develop/webpack/plugin-extension/feature-scripts/index.ts @@ -1,8 +1,14 @@ import path from 'path' import type webpack from 'webpack' -import {type FilepathList, type PluginInterface} from '../../webpack-types' +import { + type Manifest, + type FilepathList, + type PluginInterface +} from '../../webpack-types' import {AddScripts} from './steps/add-scripts' import {AddPublicPathRuntimeModule} from './steps/add-public-path-runtime-module' +import {AddPublicPathForMainWorld} from './steps/add-public-path-for-main-world' +import {DevOptions} from '../../../module' /** * ScriptsPlugin is responsible for handiling all possible JavaScript @@ -22,11 +28,13 @@ import {AddPublicPathRuntimeModule} from './steps/add-public-path-runtime-module */ export class ScriptsPlugin { public readonly manifestPath: string + public readonly browser?: DevOptions['browser'] public readonly includeList?: FilepathList public readonly excludeList?: FilepathList constructor(options: PluginInterface) { this.manifestPath = options.manifestPath + this.browser = options.browser || 'chrome' this.includeList = options.includeList this.excludeList = options.excludeList } @@ -97,21 +105,12 @@ export class ScriptsPlugin { // 4 - Fix the issue where assets imported via content_scripts // running in the MAIN world could not find the correct public path. - // compiler.options.module.rules.push({ - // test: /\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/, - // include: [path.dirname(this.manifestPath)], - // exclude: [path.join(path.dirname(this.manifestPath), 'node_modules')], - // use: [ - // { - // loader: path.resolve(__dirname, './add-dynamic-public-path.js'), - // options: { - // manifestPath: this.manifestPath, - // includeList: this.includeList || {}, - // excludeList: this.excludeList || {} - // } - // } - // ] - // }) + new AddPublicPathForMainWorld({ + manifestPath: this.manifestPath, + browser: this.browser || 'chrome', + includeList: this.includeList || {}, + excludeList: this.excludeList || {} + }).apply(compiler) // 5 - Fix the issue of content_scripts not being able to import // CSS files via import statements. This loader adds the diff --git a/programs/develop/webpack/plugin-extension/feature-scripts/steps/add-dynamic-public-path.ts b/programs/develop/webpack/plugin-extension/feature-scripts/steps/add-dynamic-public-path.ts deleted file mode 100644 index 0087f622..00000000 --- a/programs/develop/webpack/plugin-extension/feature-scripts/steps/add-dynamic-public-path.ts +++ /dev/null @@ -1,63 +0,0 @@ -import path from 'path' -import {urlToRequest} from 'loader-utils' -import {validate} from 'schema-utils' -import {type Schema} from 'schema-utils/declarations/validate' -import {type LoaderContext} from '../../../webpack-types' - -const schema: Schema = { - type: 'object', - properties: { - test: { - type: 'string' - }, - manifestPath: { - type: 'string' - } - } -} - -export default function addDynamicPublicPathLoader( - this: LoaderContext, - source: string -) { - const options = this.getOptions() - const manifestPath = options.manifestPath - const projectPath = path.dirname(manifestPath) - const manifest = require(manifestPath) - - validate(schema, options, { - name: 'scripts:add-dynamic-public-path', - baseDataPath: 'options' - }) - - // @ts-expect-error this is not typed - if (this._compilation?.options.mode === 'production') return source - - const url = urlToRequest(this.resourcePath) - const reloadCode = ` -;__webpack_public_path__ = chrome.extension.getURL('/'); - ` - - if (manifest.background) { - if (manifest.background.scripts) { - for (const bgScript of manifest.background.scripts) { - const absoluteUrl = path.resolve(projectPath, bgScript as string) - if (url.includes(absoluteUrl)) { - return `${reloadCode}${source}` - } - } - } - - if (manifest.background.service_worker) { - const absoluteUrl = path.resolve( - projectPath, - manifest.background.service_worker as string - ) - if (url.includes(absoluteUrl)) { - return `${reloadCode}${source}` - } - } - } - - return source -} diff --git a/programs/develop/webpack/plugin-extension/feature-scripts/steps/add-public-path-for-main-world.ts b/programs/develop/webpack/plugin-extension/feature-scripts/steps/add-public-path-for-main-world.ts new file mode 100644 index 00000000..cc588d85 --- /dev/null +++ b/programs/develop/webpack/plugin-extension/feature-scripts/steps/add-public-path-for-main-world.ts @@ -0,0 +1,44 @@ +import type webpack from 'webpack' +import { + type FilepathList, + type PluginInterface, + type Manifest +} from '../../../webpack-types' +import * as messages from '../../../lib/messages' +import {DevOptions} from '../../../../module' + +export class AddPublicPathForMainWorld { + public readonly manifestPath: string + public readonly browser: DevOptions['browser'] + public readonly includeList: FilepathList + public readonly excludeList: FilepathList + + constructor(options: PluginInterface) { + this.manifestPath = options.manifestPath + this.browser = options.browser || 'chrome' + this.includeList = options.includeList || {} + this.excludeList = options.excludeList || {} + } + + public apply(compiler: webpack.Compiler): void { + const manifest: Manifest = require(this.manifestPath) + if ( + manifest.content_scripts?.some( + // @ts-expect-error - TS doesn't know about content_scripts + (cs) => cs.world && cs.world.toLowerCase() === 'main' + ) + ) { + if (!manifest.id) { + console.error(messages.noExtensionIdError(manifest.name || '')) + process.exit(1) + } + + if (this.browser === 'firefox') { + compiler.options.output.publicPath = `moz-extension://${manifest.id}/` + return + } + + compiler.options.output.publicPath = `${this.browser}-extension://${manifest.id}/` + } + } +} diff --git a/programs/develop/webpack/plugin-extension/index.ts b/programs/develop/webpack/plugin-extension/index.ts index b2f0363a..da69aaf3 100644 --- a/programs/develop/webpack/plugin-extension/index.ts +++ b/programs/develop/webpack/plugin-extension/index.ts @@ -93,6 +93,7 @@ export class ExtensionPlugin { // Get all scripts (bg, content, sw) declared in manifest new ScriptsPlugin({ manifestPath, + browser: this.browser, includeList: { ...manifestFieldsData.scripts, ...specialFoldersData.scripts diff --git a/programs/develop/webpack/plugin-js-frameworks/index.ts b/programs/develop/webpack/plugin-js-frameworks/index.ts index 8239c9fb..7347a1d7 100644 --- a/programs/develop/webpack/plugin-js-frameworks/index.ts +++ b/programs/develop/webpack/plugin-js-frameworks/index.ts @@ -68,6 +68,8 @@ export class JsFrameworksPlugin { }, transform: { react: { + development: this.mode === 'development', + refresh: this.mode === 'development', runtime: 'automatic', importSource: 'react' } diff --git a/programs/develop/webpack/plugin-js-frameworks/js-tools/preact.ts b/programs/develop/webpack/plugin-js-frameworks/js-tools/preact.ts index 89e006d9..d742b97e 100644 --- a/programs/develop/webpack/plugin-js-frameworks/js-tools/preact.ts +++ b/programs/develop/webpack/plugin-js-frameworks/js-tools/preact.ts @@ -52,13 +52,15 @@ export async function maybeUsePreact( // https://github.com/preactjs/prefresh require.resolve('@prefresh/webpack') } catch (e) { - const preactDependencies = [ - '@prefresh/webpack' - ] + const preactDependencies = ['@prefresh/webpack'] const manifest = require(path.join(projectPath, 'manifest.json')) const manifestName = manifest.name || 'Extension.js' - await installOptionalDependencies(manifestName, 'Preact', preactDependencies) + await installOptionalDependencies( + manifestName, + 'Preact', + preactDependencies + ) // The compiler will exit after installing the dependencies // as it can't read the new dependencies without a restart. diff --git a/programs/develop/webpack/plugin-js-frameworks/js-tools/react.ts b/programs/develop/webpack/plugin-js-frameworks/js-tools/react.ts index d70ec8a5..09192aa8 100644 --- a/programs/develop/webpack/plugin-js-frameworks/js-tools/react.ts +++ b/programs/develop/webpack/plugin-js-frameworks/js-tools/react.ts @@ -67,7 +67,9 @@ export async function maybeUseReact( } const reactPlugins: WebpackPluginInstance[] = [ - new (require('@pmmmwh/react-refresh-webpack-plugin'))() + new (require('@pmmmwh/react-refresh-webpack-plugin'))({ + overlay: false + }) ] return { diff --git a/programs/develop/webpack/plugin-static-assets/index.ts b/programs/develop/webpack/plugin-static-assets/index.ts index cde9d77b..4d7c6853 100644 --- a/programs/develop/webpack/plugin-static-assets/index.ts +++ b/programs/develop/webpack/plugin-static-assets/index.ts @@ -14,17 +14,10 @@ export class StaticAssetsPlugin { } public async apply(compiler: Compiler) { - const getAssetFilename = (folderPath: string) => { - return `${folderPath}/[name][ext]` - } - // Define the default SVG rule const defaultSvgRule: RuleSetRule = { test: /\.svg$/i, type: 'asset/resource', - generator: { - filename: () => getAssetFilename('assets') - }, parser: { dataUrlCondition: { // inline images < 2 KB @@ -49,9 +42,6 @@ export class StaticAssetsPlugin { { test: /\.(png|jpg|jpeg|gif|webp|avif|ico|bmp)$/i, type: 'asset/resource', - generator: { - filename: () => getAssetFilename('assets') - }, parser: { dataUrlCondition: { // inline images < 2 KB @@ -61,17 +51,11 @@ export class StaticAssetsPlugin { }, { test: /\.(woff|woff2|eot|ttf|otf)$/i, - type: 'asset/resource', - generator: { - filename: () => getAssetFilename('assets') - } + type: 'asset/resource' }, { test: /\.(txt|md|csv|tsv|xml|pdf|docx|doc|xls|xlsx|ppt|pptx|zip|gz|gzip|tgz)$/i, type: 'asset/resource', - generator: { - filename: () => getAssetFilename('assets') - }, parser: { dataUrlCondition: { // inline images < 2 KB @@ -81,10 +65,7 @@ export class StaticAssetsPlugin { }, { test: /\.(csv|tsv)$/i, - use: [require.resolve('csv-loader')], - generator: { - filename: () => getAssetFilename('assets') - } + use: [require.resolve('csv-loader')] } ] diff --git a/programs/develop/webpack/webpack-config.ts b/programs/develop/webpack/webpack-config.ts index eb84b4c7..ee3f91e1 100644 --- a/programs/develop/webpack/webpack-config.ts +++ b/programs/develop/webpack/webpack-config.ts @@ -20,10 +20,6 @@ import {CompatibilityPlugin} from './plugin-compatibility' import {ErrorsPlugin} from './plugin-errors' import {BrowsersPlugin} from '../plugin-browsers' -export const getAssetFilename = (folderPath: string) => { - return `${folderPath}/[name][ext]` -} - export default function webpackConfig( projectPath: string, devOptions: DevOptions @@ -61,16 +57,6 @@ export default function webpackConfig( environment: { bigIntLiteral: true, dynamicImport: true - }, - chunkFilename: (pathData) => { - const runtime = (pathData.chunk as any)?.runtime - - // Chunks are stored within their caller's directory, - // So a dynamic import of a CSS action page will be stored - // as action/[filename].css. - // The JS counterpart of this is defined in MiniCssExtractPlugin - // options.chunkFilename function. - return getAssetFilename(runtime) } }, resolve: { diff --git a/programs/develop/webpack/webpack-types.ts b/programs/develop/webpack/webpack-types.ts index 26391056..16e8f780 100644 --- a/programs/develop/webpack/webpack-types.ts +++ b/programs/develop/webpack/webpack-types.ts @@ -58,6 +58,7 @@ export interface LoaderContext { getOptions: () => { test: string manifestPath: string + browser?: DevOptions['browser'] includeList?: FilepathList excludeList?: FilepathList } diff --git a/yarn.lock b/yarn.lock index 7ae60823..deaaff2a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -306,7 +306,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-class-properties@^7.12.13", "@babel/plugin-syntax-class-properties@^7.8.3": +"@babel/plugin-syntax-class-properties@^7.12.13": version "7.12.13" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== @@ -355,7 +355,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-syntax-import-meta@^7.10.4", "@babel/plugin-syntax-import-meta@^7.8.3": +"@babel/plugin-syntax-import-meta@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== @@ -376,7 +376,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.24.7" -"@babel/plugin-syntax-logical-assignment-operators@^7.10.4", "@babel/plugin-syntax-logical-assignment-operators@^7.8.3": +"@babel/plugin-syntax-logical-assignment-operators@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== @@ -390,7 +390,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-numeric-separator@^7.10.4", "@babel/plugin-syntax-numeric-separator@^7.8.3": +"@babel/plugin-syntax-numeric-separator@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== @@ -425,7 +425,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" -"@babel/plugin-syntax-top-level-await@^7.14.5", "@babel/plugin-syntax-top-level-await@^7.8.3": +"@babel/plugin-syntax-top-level-await@^7.14.5": version "7.14.5" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== @@ -1745,10 +1745,10 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@9.8.0", "@eslint/js@^9.6.0": - version "9.8.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.8.0.tgz#ae9bc14bb839713c5056f5018bcefa955556d3a4" - integrity sha512-MfluB7EUfxXtv3i/++oh89uzAr4PDI4nn201hsp+qaXqsjAWzinlZEHEfPgAX4doIlKvPG/i0A9dpKxOLII8yA== +"@eslint/js@9.9.0", "@eslint/js@^9.6.0": + version "9.9.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.9.0.tgz#d8437adda50b3ed4401964517b64b4f59b0e2638" + integrity sha512-hhetes6ZHP3BlXLxmd8K2SNgkhNSi+UcecbnwWKwpP7kyi/uC75DJ1lOOBO3xrC4jyojtGE3YxKZPHfk4yrgug== "@eslint/object-schema@^2.1.4": version "2.1.4" @@ -2236,74 +2236,74 @@ dependencies: "@sinonjs/commons" "^3.0.0" -"@swc/core-darwin-arm64@1.7.6": - version "1.7.6" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.7.6.tgz#16deedb286caf7b4519d3e39f121e276bc573e72" - integrity sha512-6lYHey84ZzsdtC7UuPheM4Rm0Inzxm6Sb8U6dmKc4eCx8JL0LfWG4LC5RsdsrTxnjTsbriWlnhZBffh8ijUHIQ== - -"@swc/core-darwin-x64@1.7.6": - version "1.7.6" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.7.6.tgz#d54cfa083d5bef0eb2a852568bbc6f6c5e5bae97" - integrity sha512-Fyl+8aH9O5rpx4O7r2KnsPpoi32iWoKOYKiipeTbGjQ/E95tNPxbmsz4yqE8Ovldcga60IPJ5OKQA3HWRiuzdw== - -"@swc/core-linux-arm-gnueabihf@1.7.6": - version "1.7.6" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.7.6.tgz#d92b5022f872c9da6b246a16b01ec074288b94b0" - integrity sha512-2WxYTqFaOx48GKC2cbO1/IntA+w+kfCFy436Ij7qRqqtV/WAvTM9TC1OmiFbqq436rSot52qYmX8fkwdB5UcLQ== - -"@swc/core-linux-arm64-gnu@1.7.6": - version "1.7.6" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.7.6.tgz#3e14000de714cefe097ee244498758f993bb0c81" - integrity sha512-TBEGMSe0LhvPe4S7E68c7VzgT3OMu4VTmBLS7B2aHv4v8uZO92Khpp7L0WqgYU1y5eMjk+XLDLi4kokiNHv/Hg== - -"@swc/core-linux-arm64-musl@1.7.6": - version "1.7.6" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.7.6.tgz#69edbe4b1f62e7d35fde180bd714ad23a6749c25" - integrity sha512-QI8QGL0HGT42tj7F1A+YAzhGkJjUcvvTfI1e2m704W0Enl2/UIK9v5D1zvQzYwusRyKuaQfbeBRYDh0NcLOGLg== - -"@swc/core-linux-x64-gnu@1.7.6": - version "1.7.6" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.7.6.tgz#b766e32e5e3549f7c0b83d7a798886810290fa5a" - integrity sha512-61AYVzhjuNQAVIKKWOJu3H0/pFD28RYJGxnGg3YMhvRLRyuWNyY5Nyyj2WkKcz/ON+g38Arlz00NT1LDIViRLg== - -"@swc/core-linux-x64-musl@1.7.6": - version "1.7.6" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.7.6.tgz#833b77654b48bf04b27263a798cc306d7c378192" - integrity sha512-hQFznpfLK8XajfAAN9Cjs0w/aVmO7iu9VZvInyrTCRcPqxV5O+rvrhRxKvC1LRMZXr5M6JRSRtepp5w+TK4kAw== - -"@swc/core-win32-arm64-msvc@1.7.6": - version "1.7.6" - resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.7.6.tgz#0cc81edb4478863d1b64942329fadbc90321ffdf" - integrity sha512-Aqsd9afykVMuekzjm4X4TDqwxmG4CrzoOSFe0hZrn9SMio72l5eAPnMtYoe5LsIqtjV8MNprLfXaNbjHjTegmA== - -"@swc/core-win32-ia32-msvc@1.7.6": - version "1.7.6" - resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.7.6.tgz#47965dbf55f06d87f0bcd3198fca0b3515a7daf9" - integrity sha512-9h0hYnOeRVNeQgHQTvD1Im67faNSSzBZ7Adtxyu9urNLfBTJilMllFd2QuGHlKW5+uaT6ZH7ZWDb+c/enx7Lcg== - -"@swc/core-win32-x64-msvc@1.7.6": - version "1.7.6" - resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.7.6.tgz#89f0b151d3e8a9539f7915631759a406ebc14ed2" - integrity sha512-izeoB8glCSe6IIDQmrVm6bvR9muk9TeKgmtY7b6l1BwL4BFnTUk4dMmpbntT90bEVQn3JPCaPtUG4HfL8VuyuA== +"@swc/core-darwin-arm64@1.7.10": + version "1.7.10" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.7.10.tgz#3ee53edb501b23b10446a98d1f6d6d487d88a1d9" + integrity sha512-TYp4x/9w/C/yMU1olK5hTKq/Hi7BjG71UJ4V1U1WxI1JA3uokjQ/GoktDfmH5V5pX4dgGSOJwUe2RjoN8Z/XnA== + +"@swc/core-darwin-x64@1.7.10": + version "1.7.10" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.7.10.tgz#71d3541580e36ebef76d37f0081c49a7f1afead6" + integrity sha512-P3LJjAWh5yLc6p5IUwV5LgRfA3R1oDCZDMabYyb2BVQuJTD4MfegW9DhBcUUF5dhBLwq3191KpLVzE+dLTbiXw== + +"@swc/core-linux-arm-gnueabihf@1.7.10": + version "1.7.10" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.7.10.tgz#7b3f3a829d91f859a500fe607e6814898ee819d9" + integrity sha512-yGOFjE7w/akRTmqGY3FvWYrqbxO7OB2N2FHj2LO5HtzXflfoABb5RyRvdEquX+17J6mEpu4EwjYNraTD/WHIEQ== + +"@swc/core-linux-arm64-gnu@1.7.10": + version "1.7.10" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.7.10.tgz#bdd0d0f64c2b2c09dea976be9dc248fd359de551" + integrity sha512-SPWsgWHfdWKKjLrYlvhxcdBJ7Ruy6crJbPoE9NfD95eJEjMnS2yZTqj2ChFsY737WeyhWYlHzgYhYOVCp83YwQ== + +"@swc/core-linux-arm64-musl@1.7.10": + version "1.7.10" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.7.10.tgz#bc9808bb24ba124fbe97729019a745bd5e8859ab" + integrity sha512-PUi50bkNqnBL3Z/Zq6jSfwgN9A/taA6u2Zou0tjDJi7oVdpjdr7SxNgCGzMJ/nNg5D/IQn1opM1jktMvpsPAuQ== + +"@swc/core-linux-x64-gnu@1.7.10": + version "1.7.10" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.7.10.tgz#101a71dcf9224eb2ceec781a254a93774c65ff31" + integrity sha512-Sc+pY55gknCAmBQBR6DhlA7jZSxHaLSDb5Sevzi6DOFMXR79NpA6zWTNKwp1GK2AnRIkbAfvYLgOxS5uWTFVpg== + +"@swc/core-linux-x64-musl@1.7.10": + version "1.7.10" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.7.10.tgz#6fc1abbf7d8183343be94afae0bf596ae98d4048" + integrity sha512-g5NKx2LXaGd0K26hmEts1Cvb7ptIvq3MHSgr6/D1tRPcDZw1Sp0dYsmyOv0ho4F5GOJyiCooG3oE9FXdb7jIpQ== + +"@swc/core-win32-arm64-msvc@1.7.10": + version "1.7.10" + resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.7.10.tgz#5d6ecfda4cc5e83ec8659119f1607b1663f70a6d" + integrity sha512-plRIsOcfy9t9Q/ivm5DA7I0HaIvfAWPbI+bvVRrr3C/1K2CSqnqZJjEWOAmx2LiyipijNnEaFYuLBp0IkGuJpg== + +"@swc/core-win32-ia32-msvc@1.7.10": + version "1.7.10" + resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.7.10.tgz#37f3177da53b28b2dc8c83aefefc20205064ebcf" + integrity sha512-GntrVNT23viHtbfzmlK8lfBiKeajH24GzbDT7qXhnoO20suUPcyYZxyvCb4gWM2zu8ZBTPHNlqfrNsriQCZ+lQ== + +"@swc/core-win32-x64-msvc@1.7.10": + version "1.7.10" + resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.7.10.tgz#2814335c003295c4a808ec1b9cf19ea54f9ad6e5" + integrity sha512-uXIF8GuSappe1imm6Lf7pHGepfCBjDQlS+qTqvEGE0wZAsL1IVATK9P/cH/OCLfJXeQDTLeSYmrpwjtXNt46tQ== "@swc/core@^1.7.3": - version "1.7.6" - resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.7.6.tgz#04fbe99660ac83d341c6447ff52e04706bea6f36" - integrity sha512-FZxyao9eQks1MRmUshgsZTmlg/HB2oXK5fghkoWJm/1CU2q2kaJlVDll2as5j+rmWiwkp0Gidlq8wlXcEEAO+g== + version "1.7.10" + resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.7.10.tgz#4a6318c411a9f9561ee7e8f63d4f8231ff4d84b8" + integrity sha512-l0xrFwBQ9atizhmV94yC2nwcecTk/oftofwMNPiFMGe56dqdmi2ArHaTV3PCtMlgaUH6rGCehoRMt5OrCI1ktg== dependencies: "@swc/counter" "^0.1.3" "@swc/types" "^0.1.12" optionalDependencies: - "@swc/core-darwin-arm64" "1.7.6" - "@swc/core-darwin-x64" "1.7.6" - "@swc/core-linux-arm-gnueabihf" "1.7.6" - "@swc/core-linux-arm64-gnu" "1.7.6" - "@swc/core-linux-arm64-musl" "1.7.6" - "@swc/core-linux-x64-gnu" "1.7.6" - "@swc/core-linux-x64-musl" "1.7.6" - "@swc/core-win32-arm64-msvc" "1.7.6" - "@swc/core-win32-ia32-msvc" "1.7.6" - "@swc/core-win32-x64-msvc" "1.7.6" + "@swc/core-darwin-arm64" "1.7.10" + "@swc/core-darwin-x64" "1.7.10" + "@swc/core-linux-arm-gnueabihf" "1.7.10" + "@swc/core-linux-arm64-gnu" "1.7.10" + "@swc/core-linux-arm64-musl" "1.7.10" + "@swc/core-linux-x64-gnu" "1.7.10" + "@swc/core-linux-x64-musl" "1.7.10" + "@swc/core-win32-arm64-msvc" "1.7.10" + "@swc/core-win32-ia32-msvc" "1.7.10" + "@swc/core-win32-x64-msvc" "1.7.10" "@swc/counter@^0.1.3": version "0.1.3" @@ -2580,9 +2580,9 @@ "@types/node" "*" "@types/node@*": - version "22.1.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-22.1.0.tgz#6d6adc648b5e03f0e83c78dc788c2b037d0ad94b" - integrity sha512-AOmuRF0R2/5j1knA3c6G3HOk523Ga+l+ZXltX8SF1+5oqcXijjfTd8fY3XRZqSihEu9XhtQnKYLmkFaoxgsJHw== + version "22.2.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.2.0.tgz#7cf046a99f0ba4d628ad3088cb21f790df9b0c5b" + integrity sha512-bm6EG6/pCpkxDf/0gDNDdtDILMOHgaQBVOJGdwsqClnxA3xL6jtMv76rLBc006RVMWbmaf0xbmom4Z/5o2nRkQ== dependencies: undici-types "~6.13.0" @@ -2592,9 +2592,9 @@ integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== "@types/node@^20.11.5", "@types/node@^20.14.12": - version "20.14.14" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.14.tgz#6b655d4a88623b0edb98300bb9dd2107225f885e" - integrity sha512-d64f00982fS9YoOgJkAMolK7MN8Iq3TDdVjchbYHdEmjth/DHowx82GnoA+tVUAN+7vxfYUgAzi+JXbKNd2SDQ== + version "20.14.15" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.15.tgz#e59477ab7bc7db1f80c85540bfd192a0becc588b" + integrity sha512-Fz1xDMCF/B00/tYSVMlmK7hVeLh7jE5f3B7X1/hmV0MJBwE27KlS7EvD/Yp+z1lm8mVhwV5w+n8jOZG8AfTlKw== dependencies: undici-types "~5.26.4" @@ -3305,22 +3305,25 @@ babel-plugin-transform-react-remove-prop-types@^0.4.24: integrity sha512-eqj0hVcJUR57/Ug2zE1Yswsw4LhuqqHhD+8v120T1cl3kjg76QwtyBrdIk4WVwK+lAhBJVYCd/v+4nc4y+8JsA== babel-preset-current-node-syntax@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz#b4399239b89b2a011f9ddbe3e4f401fc40cff73b" - integrity sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ== + version "1.1.0" + resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz#9a929eafece419612ef4ae4f60b1862ebad8ef30" + integrity sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw== dependencies: "@babel/plugin-syntax-async-generators" "^7.8.4" "@babel/plugin-syntax-bigint" "^7.8.3" - "@babel/plugin-syntax-class-properties" "^7.8.3" - "@babel/plugin-syntax-import-meta" "^7.8.3" + "@babel/plugin-syntax-class-properties" "^7.12.13" + "@babel/plugin-syntax-class-static-block" "^7.14.5" + "@babel/plugin-syntax-import-attributes" "^7.24.7" + "@babel/plugin-syntax-import-meta" "^7.10.4" "@babel/plugin-syntax-json-strings" "^7.8.3" - "@babel/plugin-syntax-logical-assignment-operators" "^7.8.3" + "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" - "@babel/plugin-syntax-numeric-separator" "^7.8.3" + "@babel/plugin-syntax-numeric-separator" "^7.10.4" "@babel/plugin-syntax-object-rest-spread" "^7.8.3" "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" "@babel/plugin-syntax-optional-chaining" "^7.8.3" - "@babel/plugin-syntax-top-level-await" "^7.8.3" + "@babel/plugin-syntax-private-property-in-object" "^7.14.5" + "@babel/plugin-syntax-top-level-await" "^7.14.5" babel-preset-jest@^29.6.3: version "29.6.3" @@ -4129,9 +4132,9 @@ ejs@^3.1.10: jake "^10.8.5" electron-to-chromium@^1.5.4: - version "1.5.5" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.5.tgz#03bfdf422bdd2c05ee2657efedde21264a1a566b" - integrity sha512-QR7/A7ZkMS8tZuoftC/jfqNkZLQO779SSW3YuZHP4eXpj3EffGLFcB/Xu9AAZQzLccTiCV+EmUo3ha4mQ9wnlA== + version "1.5.6" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.6.tgz#c81d9938b5a877314ad370feb73b4e5409b36abd" + integrity sha512-jwXWsM5RPf6j9dPYzaorcBSUg6AiqocPEyMpkchkvntaH9HGfOOMZwxMJjDY/XEs3T5dM7uyH1VhRMkqUU9qVw== emittery@^0.13.1: version "0.13.1" @@ -4309,15 +4312,15 @@ eslint-visitor-keys@^4.0.0: integrity sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw== eslint@^9.6.0: - version "9.8.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.8.0.tgz#a4f4a090c8ea2d10864d89a6603e02ce9f649f0f" - integrity sha512-K8qnZ/QJzT2dLKdZJVX6W4XOwBzutMYmt0lqUS+JdXgd+HTYFlonFgkJ8s44d/zMPPCnOOk0kMWCApCPhiOy9A== + version "9.9.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.9.0.tgz#8d214e69ae4debeca7ae97daebbefe462072d975" + integrity sha512-JfiKJrbx0506OEerjK2Y1QlldtBxkAlLxT5OEcRF8uaQ86noDe2k31Vw9rnSWv+MXZHj7OOUV/dA0AhdLFcyvA== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.11.0" "@eslint/config-array" "^0.17.1" "@eslint/eslintrc" "^3.1.0" - "@eslint/js" "9.8.0" + "@eslint/js" "9.9.0" "@humanwhocodes/module-importer" "^1.0.1" "@humanwhocodes/retry" "^0.3.0" "@nodelib/fs.walk" "^1.2.8" @@ -4892,10 +4895,10 @@ globrex@^0.1.2: resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098" integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg== -go-git-it@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/go-git-it/-/go-git-it-2.0.0.tgz#552acd469fd80897d9d5a252bfb3b07dd2b4b193" - integrity sha512-htrZHZUoHiAW1zGb5flb+3EYj95vcRcw46Xhyz6MeQL8TbJFrarlbNjRypS0LyU8GmEtysMke0iVaSXsARnHxQ== +go-git-it@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/go-git-it/-/go-git-it-2.0.1.tgz#8e73d9257825eb1a923b011f4aa5f061913b87c5" + integrity sha512-LRHbbhN7tieIowfgO/gtTZrKK79d9linv2uJLLnmTidnT2vn44QTG+WCfbi1W0zkH4ENVXefkMcrW9xYSQ5LoQ== dependencies: "@colors/colors" "^1.6.0" progress "^2.0.3" @@ -5087,9 +5090,9 @@ icss-utils@^5.0.0, icss-utils@^5.1.0: integrity sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA== ignore@^5.2.0, ignore@^5.2.4, ignore@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef" - integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw== + version "5.3.2" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" + integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== image-size@~0.5.0: version "0.5.5" @@ -6943,9 +6946,9 @@ postcss-replace-overflow-wrap@^4.0.0: integrity sha512-KmF7SBPphT4gPPcKZc7aDkweHiKEEO8cla/GjcBK+ckKxiZslIu3C4GCRW3DNfL0o7yW7kMQu9xlZ1kXRXLXtw== postcss-resolve-nested-selector@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/postcss-resolve-nested-selector/-/postcss-resolve-nested-selector-0.1.5.tgz#799bce8b8cfc46958020dc1335a146abf951cbf6" - integrity sha512-tum2m18S22ZSNjXatMG0FSk5ZL83pTttymeJx5Gzxg7RU0s1jNDU9rXltro4osQrukjyNormcb07IEjqEyPNaA== + version "0.1.6" + resolved "https://registry.yarnpkg.com/postcss-resolve-nested-selector/-/postcss-resolve-nested-selector-0.1.6.tgz#3d84dec809f34de020372c41b039956966896686" + integrity sha512-0sglIs9Wmkzbr8lQwEyIzlDOOC9bGmfVKcJTaxv3vMmd3uo4o4DerC3En0bnmgceeql9BfC8hRkp7cg0fjdVqw== postcss-safe-parser@^7.0.0: version "7.0.0" @@ -6965,9 +6968,9 @@ postcss-selector-not@^7.0.2: postcss-selector-parser "^6.0.13" postcss-selector-parser@^6.0.11, postcss-selector-parser@^6.0.13, postcss-selector-parser@^6.0.2, postcss-selector-parser@^6.0.4, postcss-selector-parser@^6.1.0, postcss-selector-parser@^6.1.1: - version "6.1.1" - resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.1.1.tgz#5be94b277b8955904476a2400260002ce6c56e38" - integrity sha512-b4dlw/9V8A71rLIDsSwVmak9z2DuBUB7CA1/wSdelNEzqsjoSPeADTWNO09lpH49Diy3/JIZ2bSPB1dI3LJCHg== + version "6.1.2" + resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz#27ecb41fb0e3b6ba7a1ec84fff347f734c7929de" + integrity sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg== dependencies: cssesc "^3.0.0" util-deprecate "^1.0.2" @@ -6996,11 +6999,6 @@ preferred-pm@^3.0.0: path-exists "^4.0.0" which-pm "^2.2.0" -prefers-yarn@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/prefers-yarn/-/prefers-yarn-1.0.1.tgz#6229a00fb479ee9d57c6081226197a2619a05480" - integrity sha512-Uw4uhM+IitLWmbH/zzrglkQ1AbxOab09b+UGzt8m6eAjh13OX5vXxdIrVMkkraYPAO6rqW84lVPmnkVU2Pz0ZA== - prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -8030,9 +8028,9 @@ terser-webpack-plugin@^5.3.10: terser "^5.26.0" terser@^5.26.0: - version "5.31.5" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.31.5.tgz#e48b7c65f32d2808e7dad803e4586a0bc3829b87" - integrity sha512-YPmas0L0rE1UyLL/llTWA0SiDOqIcAQYLeUj7cJYzXHlRTAnMSg9pPe4VJ5PlKvTrPQsdVFuiRiwyeNlYgwh2Q== + version "5.31.6" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.31.6.tgz#c63858a0f0703988d0266a82fcbf2d7ba76422b1" + integrity sha512-PQ4DAriWzKj+qgehQ7LK5bQqCFNMmlhjR2PFFLuqGCpuCAauxemVBWwWOxo3UIwWQx8+Pr61Df++r76wDmkQBg== dependencies: "@jridgewell/source-map" "^0.3.3" acorn "^8.8.2" @@ -8437,9 +8435,9 @@ walker@^1.0.8: makeerror "1.0.12" watchpack@^2.4.0, watchpack@^2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.1.tgz#29308f2cac150fa8e4c92f90e0ec954a9fed7fff" - integrity sha512-8wrBCMtVhqcXP2Sup1ctSkga6uc2Bx0IIvKyT7yTFier5AXHooSI+QyQQAtTb7+E0IUCCKyTFmXqdqgum2XWGg== + version "2.4.2" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.2.tgz#2feeaed67412e7c33184e5a79ca738fbd38564da" + integrity sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw== dependencies: glob-to-regexp "^0.4.1" graceful-fs "^4.1.2"