extension-create 2.0.0-alpha.5 → 2.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.js +13 -12
- package/package.json +2 -2
- package/dist/action/README.md +0 -37
- package/dist/action/action/index.html +0 -40
- package/dist/action/action/scripts.js +0 -11
- package/dist/action/action/styles.css +0 -23
- package/dist/action/images/extension_128.png +0 -0
- package/dist/action/images/extension_16.png +0 -0
- package/dist/action/images/extension_48.png +0 -0
- package/dist/action/manifest.json +0 -21
- package/dist/action/package.json +0 -21
- package/dist/action-chatgpt/.env.example +0 -1
- package/dist/action-chatgpt/README.md +0 -37
- package/dist/action-chatgpt/action/ActionApp.tsx +0 -118
- package/dist/action-chatgpt/action/index.html +0 -13
- package/dist/action-chatgpt/action/scripts.tsx +0 -12
- package/dist/action-chatgpt/action/styles.css +0 -8
- package/dist/action-chatgpt/extension-env.d.ts +0 -9
- package/dist/action-chatgpt/images/chatgpt.png +0 -0
- package/dist/action-chatgpt/images/extension.png +0 -0
- package/dist/action-chatgpt/images/extension_128.png +0 -0
- package/dist/action-chatgpt/images/extension_16.png +0 -0
- package/dist/action-chatgpt/images/extension_48.png +0 -0
- package/dist/action-chatgpt/manifest.json +0 -21
- package/dist/action-chatgpt/package.json +0 -30
- package/dist/action-chatgpt/postcss.config.js +0 -6
- package/dist/action-chatgpt/tailwind.config.js +0 -8
- package/dist/action-chatgpt/tsconfig.json +0 -21
- package/dist/config-stylelint/README.md +0 -37
- package/dist/config-stylelint/images/extension_128.png +0 -0
- package/dist/config-stylelint/images/extension_16.png +0 -0
- package/dist/config-stylelint/images/extension_48.png +0 -0
- package/dist/config-stylelint/images/stylelint.svg +0 -1
- package/dist/config-stylelint/manifest.json +0 -15
- package/dist/config-stylelint/newtab/index.html +0 -40
- package/dist/config-stylelint/newtab/scripts.js +0 -11
- package/dist/config-stylelint/newtab/styles.css +0 -20
- package/dist/config-stylelint/package.json +0 -23
- package/dist/config-stylelint/stylelint.config.json +0 -1
- package/dist/content/README.md +0 -37
- package/dist/content/background.js +0 -21
- package/dist/content/content/scripts.js +0 -32
- package/dist/content/content/styles.css +0 -54
- package/dist/content/images/extension_128.png +0 -0
- package/dist/content/images/extension_16.png +0 -0
- package/dist/content/images/extension_48.png +0 -0
- package/dist/content/manifest.json +0 -35
- package/dist/content/package.json +0 -20
- package/dist/content-css-module/README.md +0 -37
- package/dist/content-css-module/background.js +0 -21
- package/dist/content-css-module/content/Logo.module.css +0 -11
- package/dist/content-css-module/content/scripts.js +0 -33
- package/dist/content-css-module/content/styles.css +0 -40
- package/dist/content-css-module/images/extension_128.png +0 -0
- package/dist/content-css-module/images/extension_16.png +0 -0
- package/dist/content-css-module/images/extension_48.png +0 -0
- package/dist/content-css-module/manifest.json +0 -35
- package/dist/content-css-module/package.json +0 -20
- package/dist/content-less/README.md +0 -37
- package/dist/content-less/background.js +0 -21
- package/dist/content-less/content/scripts.js +0 -32
- package/dist/content-less/content/styles.less +0 -51
- package/dist/content-less/images/extension_128.png +0 -0
- package/dist/content-less/images/extension_16.png +0 -0
- package/dist/content-less/images/extension_48.png +0 -0
- package/dist/content-less/manifest.json +0 -35
- package/dist/content-less/package.json +0 -21
- package/dist/content-main-world/README.md +0 -37
- package/dist/content-main-world/background.js +0 -19
- package/dist/content-main-world/content/scripts.js +0 -32
- package/dist/content-main-world/content/styles.css +0 -51
- package/dist/content-main-world/images/extension_128.png +0 -0
- package/dist/content-main-world/images/extension_16.png +0 -0
- package/dist/content-main-world/images/extension_48.png +0 -0
- package/dist/content-main-world/manifest.json +0 -37
- package/dist/content-main-world/package.json +0 -20
- package/dist/content-preact/README.md +0 -37
- package/dist/content-preact/background.ts +0 -1
- package/dist/content-preact/content/ContentApp.tsx +0 -92
- package/dist/content-preact/content/scripts.tsx +0 -14
- package/dist/content-preact/content/styles.css +0 -10
- package/dist/content-preact/extension-env.d.ts +0 -9
- package/dist/content-preact/images/chromeWindow.png +0 -0
- package/dist/content-preact/images/extension_128.png +0 -0
- package/dist/content-preact/images/extension_16.png +0 -0
- package/dist/content-preact/images/extension_48.png +0 -0
- package/dist/content-preact/images/preact.png +0 -0
- package/dist/content-preact/images/tailwind.png +0 -0
- package/dist/content-preact/images/tailwind_bg.png +0 -0
- package/dist/content-preact/images/typescript.png +0 -0
- package/dist/content-preact/manifest.json +0 -31
- package/dist/content-preact/package.json +0 -27
- package/dist/content-preact/postcss.config.js +0 -6
- package/dist/content-preact/tailwind.config.js +0 -8
- package/dist/content-preact/tsconfig.json +0 -26
- package/dist/content-react/README.md +0 -37
- package/dist/content-react/background.ts +0 -1
- package/dist/content-react/content/ContentApp.tsx +0 -86
- package/dist/content-react/content/scripts.tsx +0 -17
- package/dist/content-react/content/styles.css +0 -10
- package/dist/content-react/extension-env.d.ts +0 -9
- package/dist/content-react/images/chromeWindow.png +0 -0
- package/dist/content-react/images/extension_128.png +0 -0
- package/dist/content-react/images/extension_16.png +0 -0
- package/dist/content-react/images/extension_48.png +0 -0
- package/dist/content-react/images/react.png +0 -0
- package/dist/content-react/images/tailwind.png +0 -0
- package/dist/content-react/images/tailwind_bg.png +0 -0
- package/dist/content-react/images/typescript.png +0 -0
- package/dist/content-react/manifest.json +0 -28
- package/dist/content-react/package.json +0 -28
- package/dist/content-react/postcss.config.js +0 -6
- package/dist/content-react/tailwind.config.js +0 -8
- package/dist/content-react/tsconfig.json +0 -21
- package/dist/content-sass/README.md +0 -37
- package/dist/content-sass/background.js +0 -21
- package/dist/content-sass/content/scripts.js +0 -32
- package/dist/content-sass/content/styles.scss +0 -51
- package/dist/content-sass/images/extension_128.png +0 -0
- package/dist/content-sass/images/extension_16.png +0 -0
- package/dist/content-sass/images/extension_48.png +0 -0
- package/dist/content-sass/manifest.json +0 -35
- package/dist/content-sass/package.json +0 -21
- package/dist/content-sass-module/README.md +0 -37
- package/dist/content-sass-module/background.js +0 -21
- package/dist/content-sass-module/content/Logo.module.scss +0 -18
- package/dist/content-sass-module/content/scripts.js +0 -33
- package/dist/content-sass-module/content/styles.scss +0 -40
- package/dist/content-sass-module/images/extension_128.png +0 -0
- package/dist/content-sass-module/images/extension_16.png +0 -0
- package/dist/content-sass-module/images/extension_48.png +0 -0
- package/dist/content-sass-module/manifest.json +0 -35
- package/dist/content-sass-module/package.json +0 -21
- package/dist/content-tailwind/README.md +0 -37
- package/dist/content-tailwind/background.js +0 -21
- package/dist/content-tailwind/content/content.js +0 -45
- package/dist/content-tailwind/content/scripts.js +0 -6
- package/dist/content-tailwind/content/styles.css +0 -10
- package/dist/content-tailwind/images/chromeWindow.png +0 -0
- package/dist/content-tailwind/images/extension_128.png +0 -0
- package/dist/content-tailwind/images/extension_16.png +0 -0
- package/dist/content-tailwind/images/extension_48.png +0 -0
- package/dist/content-tailwind/images/react.png +0 -0
- package/dist/content-tailwind/images/tailwind.png +0 -0
- package/dist/content-tailwind/images/tailwind_bg.png +0 -0
- package/dist/content-tailwind/manifest.json +0 -35
- package/dist/content-tailwind/package.json +0 -23
- package/dist/content-tailwind/postcss.config.js +0 -6
- package/dist/content-tailwind/tailwind.config.js +0 -8
- package/dist/content-typescript/README.md +0 -37
- package/dist/content-typescript/background.ts +0 -26
- package/dist/content-typescript/content/scripts.ts +0 -33
- package/dist/content-typescript/content/styles.css +0 -51
- package/dist/content-typescript/extension-env.d.ts +0 -9
- package/dist/content-typescript/images/extension_128.png +0 -0
- package/dist/content-typescript/images/extension_16.png +0 -0
- package/dist/content-typescript/images/extension_48.png +0 -0
- package/dist/content-typescript/images/typescript.png +0 -0
- package/dist/content-typescript/manifest.json +0 -35
- package/dist/content-typescript/package.json +0 -21
- package/dist/content-typescript/tsconfig.json +0 -21
- package/dist/content-vue/README.md +0 -37
- package/dist/content-vue/background.ts +0 -1
- package/dist/content-vue/content/ContentApp.vue +0 -90
- package/dist/content-vue/content/scripts.ts +0 -13
- package/dist/content-vue/content/shims-vue.d.ts +0 -6
- package/dist/content-vue/content/styles.css +0 -10
- package/dist/content-vue/extension-env.d.ts +0 -9
- package/dist/content-vue/images/chromeWindow.png +0 -0
- package/dist/content-vue/images/extension_128.png +0 -0
- package/dist/content-vue/images/extension_16.png +0 -0
- package/dist/content-vue/images/extension_48.png +0 -0
- package/dist/content-vue/images/tailwind.png +0 -0
- package/dist/content-vue/images/tailwind_bg.png +0 -0
- package/dist/content-vue/images/typescript.png +0 -0
- package/dist/content-vue/images/vue.svg +0 -8
- package/dist/content-vue/manifest.json +0 -31
- package/dist/content-vue/package.json +0 -25
- package/dist/content-vue/postcss.config.js +0 -6
- package/dist/content-vue/tailwind.config.js +0 -8
- package/dist/content-vue/tsconfig.json +0 -21
- package/dist/declarative_net_request/README.md +0 -37
- package/dist/declarative_net_request/images/extension_128.png +0 -0
- package/dist/declarative_net_request/images/extension_16.png +0 -0
- package/dist/declarative_net_request/images/extension_48.png +0 -0
- package/dist/declarative_net_request/manifest.json +0 -34
- package/dist/declarative_net_request/package.json +0 -21
- package/dist/declarative_net_request/public/public_ruleset.json +0 -72
- package/dist/declarative_net_request/rules_1.json +0 -72
- package/dist/init/README.md +0 -37
- package/dist/init/manifest.json +0 -7
- package/dist/init/package.json +0 -32
- package/dist/locales/README.md +0 -37
- package/dist/locales/_locales/en/messages.json +0 -10
- package/dist/locales/_locales/pt_BR/messages.json +0 -10
- package/dist/locales/action/index.html +0 -40
- package/dist/locales/action/scripts.js +0 -3
- package/dist/locales/action/styles.css +0 -23
- package/dist/locales/images/extension_128.png +0 -0
- package/dist/locales/images/extension_16.png +0 -0
- package/dist/locales/images/extension_48.png +0 -0
- package/dist/locales/manifest.json +0 -19
- package/dist/locales/package.json +0 -21
- package/dist/new-less/README.md +0 -37
- package/dist/new-less/images/extension_128.png +0 -0
- package/dist/new-less/images/extension_16.png +0 -0
- package/dist/new-less/images/extension_48.png +0 -0
- package/dist/new-less/manifest.json +0 -15
- package/dist/new-less/newtab/index.html +0 -40
- package/dist/new-less/newtab/scripts.js +0 -11
- package/dist/new-less/newtab/styles.less +0 -19
- package/dist/new-less/package.json +0 -21
- package/dist/new-preact/README.md +0 -37
- package/dist/new-preact/extension-env.d.ts +0 -9
- package/dist/new-preact/images/extension_128.png +0 -0
- package/dist/new-preact/images/extension_16.png +0 -0
- package/dist/new-preact/images/extension_48.png +0 -0
- package/dist/new-preact/images/preact.png +0 -0
- package/dist/new-preact/manifest.json +0 -15
- package/dist/new-preact/newtab/NewTabApp.tsx +0 -27
- package/dist/new-preact/newtab/index.html +0 -13
- package/dist/new-preact/newtab/scripts.tsx +0 -5
- package/dist/new-preact/newtab/styles.css +0 -32
- package/dist/new-preact/package.json +0 -27
- package/dist/new-preact/tsconfig.json +0 -21
- package/dist/new-react/README.md +0 -37
- package/dist/new-react/extension-env.d.ts +0 -9
- package/dist/new-react/images/extension_128.png +0 -0
- package/dist/new-react/images/extension_16.png +0 -0
- package/dist/new-react/images/extension_48.png +0 -0
- package/dist/new-react/images/react.png +0 -0
- package/dist/new-react/manifest.json +0 -15
- package/dist/new-react/newtab/NewTabApp.tsx +0 -27
- package/dist/new-react/newtab/index.html +0 -13
- package/dist/new-react/newtab/scripts.tsx +0 -12
- package/dist/new-react/newtab/styles.css +0 -23
- package/dist/new-react/package.json +0 -28
- package/dist/new-react/tsconfig.json +0 -21
- package/dist/new-sass/README.md +0 -37
- package/dist/new-sass/images/extension_128.png +0 -0
- package/dist/new-sass/images/extension_16.png +0 -0
- package/dist/new-sass/images/extension_48.png +0 -0
- package/dist/new-sass/manifest.json +0 -15
- package/dist/new-sass/newtab/index.html +0 -40
- package/dist/new-sass/newtab/scripts.js +0 -11
- package/dist/new-sass/newtab/styles.scss +0 -19
- package/dist/new-sass/package.json +0 -22
- package/dist/new-tailwind/README.md +0 -37
- package/dist/new-tailwind/extension-env.d.ts +0 -9
- package/dist/new-tailwind/images/chromeWindow.png +0 -0
- package/dist/new-tailwind/images/extension_128.png +0 -0
- package/dist/new-tailwind/images/extension_16.png +0 -0
- package/dist/new-tailwind/images/extension_48.png +0 -0
- package/dist/new-tailwind/images/react.png +0 -0
- package/dist/new-tailwind/images/tailwind.png +0 -0
- package/dist/new-tailwind/images/tailwind_bg.png +0 -0
- package/dist/new-tailwind/manifest.json +0 -15
- package/dist/new-tailwind/newtab/NewTabApp.tsx +0 -67
- package/dist/new-tailwind/newtab/index.html +0 -13
- package/dist/new-tailwind/newtab/scripts.tsx +0 -12
- package/dist/new-tailwind/newtab/styles.css +0 -3
- package/dist/new-tailwind/package.json +0 -28
- package/dist/new-tailwind/postcss.config.js +0 -6
- package/dist/new-tailwind/tailwind.config.js +0 -8
- package/dist/new-tailwind/tsconfig.json +0 -21
- package/dist/new-typescript/README.md +0 -37
- package/dist/new-typescript/extension-env.d.ts +0 -9
- package/dist/new-typescript/images/extension_128.png +0 -0
- package/dist/new-typescript/images/extension_16.png +0 -0
- package/dist/new-typescript/images/extension_48.png +0 -0
- package/dist/new-typescript/images/typescript.png +0 -0
- package/dist/new-typescript/manifest.json +0 -15
- package/dist/new-typescript/newtab/index.html +0 -25
- package/dist/new-typescript/newtab/scripts.ts +0 -10
- package/dist/new-typescript/newtab/styles.css +0 -18
- package/dist/new-typescript/package.json +0 -22
- package/dist/new-typescript/tsconfig.json +0 -21
- package/dist/new-vue/README.md +0 -37
- package/dist/new-vue/extension-env.d.ts +0 -9
- package/dist/new-vue/images/extension_128.png +0 -0
- package/dist/new-vue/images/extension_16.png +0 -0
- package/dist/new-vue/images/extension_48.png +0 -0
- package/dist/new-vue/images/vue.svg +0 -8
- package/dist/new-vue/manifest.json +0 -15
- package/dist/new-vue/newtab/NewTabApp.vue +0 -30
- package/dist/new-vue/newtab/index.html +0 -13
- package/dist/new-vue/newtab/scripts.ts +0 -7
- package/dist/new-vue/newtab/styles.css +0 -36
- package/dist/new-vue/package.json +0 -25
- package/dist/new-vue/tsconfig.json +0 -21
- package/dist/sidebar/README.md +0 -37
- package/dist/sidebar/images/extension_128.png +0 -0
- package/dist/sidebar/images/extension_16.png +0 -0
- package/dist/sidebar/images/extension_48.png +0 -0
- package/dist/sidebar/manifest.json +0 -25
- package/dist/sidebar/package.json +0 -21
- package/dist/sidebar/puzzle.png +0 -0
- package/dist/sidebar/sidebar/index.html +0 -39
- package/dist/sidebar/sidebar/scripts.js +0 -11
- package/dist/sidebar/sidebar/styles.css +0 -27
- package/dist/sidebar/test_16.png +0 -0
- package/dist/sidebar/test_32.png +0 -0
- package/dist/sidebar/test_48.png +0 -0
- package/dist/sidebar/test_64.png +0 -0
- package/dist/special-folders-pages/README.md +0 -37
- package/dist/special-folders-pages/background.js +0 -5
- package/dist/special-folders-pages/images/extension_128.png +0 -0
- package/dist/special-folders-pages/images/extension_16.png +0 -0
- package/dist/special-folders-pages/images/extension_48.png +0 -0
- package/dist/special-folders-pages/images/notpublic-file.png +0 -0
- package/dist/special-folders-pages/manifest.json +0 -26
- package/dist/special-folders-pages/package.json +0 -21
- package/dist/special-folders-pages/pages/custom.html +0 -8
- package/dist/special-folders-pages/pages/main.css +0 -18
- package/dist/special-folders-pages/pages/main.html +0 -16
- package/dist/special-folders-pages/pages/main.js +0 -1
- package/dist/special-folders-pages/public/css/file.css +0 -3
- package/dist/special-folders-pages/public/html/file.html +0 -8
- package/dist/special-folders-pages/public/img/icon.png +0 -0
- package/dist/special-folders-pages/public/js/file.js +0 -0
- package/dist/special-folders-pages/sandbox/index.html +0 -24
- package/dist/special-folders-pages/sandbox/scripts.js +0 -0
- package/dist/special-folders-pages/sandbox/styles.css +0 -1
- package/dist/special-folders-scripts/README.md +0 -37
- package/dist/special-folders-scripts/background.js +0 -24
- package/dist/special-folders-scripts/images/extension_128.png +0 -0
- package/dist/special-folders-scripts/images/extension_16.png +0 -0
- package/dist/special-folders-scripts/images/extension_48.png +0 -0
- package/dist/special-folders-scripts/manifest.json +0 -27
- package/dist/special-folders-scripts/package.json +0 -21
- package/dist/special-folders-scripts/pages/index.css +0 -5
- package/dist/special-folders-scripts/pages/index.html +0 -3
- package/dist/special-folders-scripts/pages/index.js +0 -1
- package/dist/special-folders-scripts/public/extension.png +0 -0
- package/dist/special-folders-scripts/scripts/content-script.js +0 -3
- package/dist/storage/README.md +0 -37
- package/dist/storage/images/extension_128.png +0 -0
- package/dist/storage/images/extension_16.png +0 -0
- package/dist/storage/images/extension_48.png +0 -0
- package/dist/storage/manifest.json +0 -15
- package/dist/storage/package.json +0 -21
- package/dist/storage/schema.json +0 -44
package/dist/module.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var ze=Object.create;var k=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var Xe=Object.getOwnPropertyNames;var Le=Object.getPrototypeOf,Ue=Object.prototype.hasOwnProperty;var Ye=(e,t)=>{for(var i in t)k(e,i,{get:t[i],enumerable:!0})},W=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Xe(t))!Ue.call(e,n)&&n!==i&&k(e,n,{get:()=>t[n],enumerable:!(r=Ve(t,n))||r.enumerable});return e};var c=(e,t,i)=>(i=e!=null?ze(Le(e)):{},W(t||!e||!e.__esModule?k(i,"default",{value:e,enumerable:!0}):i,e)),qe=e=>W(k({},"__esModule",{value:!0}),e);var ot={};Ye(ot,{extensionCreate:()=>it});module.exports=qe(ot);var C=c(require("path"));var x=c(require("path")),o=require("@colors/colors/safe"),G=c(require("fs/promises")),A=require("detect-package-manager");function O(e){let t=x.default.basename(e);return`Failed to write in the destination directory. Path for \`${t}\` is not writable.
|
|
2
2
|
Ensure you have write permissions for this folder.
|
|
3
|
-
Path: ${t}`}async function
|
|
4
|
-
Conflict! Path to ${(0,
|
|
3
|
+
Path: ${t}`}async function z(e,t){let i=x.default.basename(e),r=`
|
|
4
|
+
Conflict! Path to ${(0,o.cyan)(i)} includes conflicting files:
|
|
5
5
|
|
|
6
|
-
`;for(let n of t){let
|
|
7
|
-
`:`${(0,
|
|
8
|
-
`}return
|
|
6
|
+
`;for(let n of t){let s=await G.default.lstat(x.default.join(e,n));r+=s.isDirectory()?`${(0,o.gray)("-")} ${(0,o.brightYellow)(n)}
|
|
7
|
+
`:`${(0,o.gray)("-")} ${(0,o.brightYellow)(n)}
|
|
8
|
+
`}return r+=`
|
|
9
9
|
You need to either rename/remove the files listed above, or choose a new directory name for your extension.
|
|
10
10
|
|
|
11
|
-
Path to conflicting directory: ${(0,
|
|
11
|
+
Path to conflicting directory: ${(0,o.underline)(e)}`,r}function V(){return"You need to provide an extension name to create one. \nSee `--help` for command info."}function X(){return"URLs are not allowed as a project path. Either write a name or a path to a local folder."}async function L(e,t){let i=x.default.relative(process.cwd(),e),r=await(0,A.detect)(),n="npm run";switch(r){case"yarn":n="yarn dev";break;case"pnpm":n="pnpm run dev";break;default:n="npm run dev"}return`\u{1F9E9} - ${(0,o.brightGreen)("Success!")} Extension ${(0,o.cyan)(t)} created.
|
|
12
12
|
|
|
13
|
-
Now ${(0,
|
|
13
|
+
Now ${(0,o.brightBlue)(`cd ${(0,o.underline)(i)}`)} and ${(0,o.brightBlue)(`${n}`)} to open a new browser instance
|
|
14
14
|
with your extension installed, loaded, and enabled for development.
|
|
15
15
|
|
|
16
|
-
${(0,
|
|
16
|
+
${(0,o.brightGreen)("You are ready")}. Time to hack on your extension!`}function U(e){return`\u{1F423} - Starting a new browser extension named ${(0,o.cyan)(e)}...`}function Y(){return"\u{1F91E} - Checking if destination path is writeable..."}function q(){return"\u{1F50E} - Scanning for potential conflicting files..."}function H(e,t){return`${(0,o.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't create directory ${(0,o.cyan)(e)}. ${t}`}function B(e){return`\u{1F537} - Writing ${(0,o.cyan)(e)} type definitions...`}function K(e){return`${(0,o.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Failed to write the extension type definition. ${e}`}function h(e,t){return t==="init"?`\u{1F9F0} - Installing ${(0,o.cyan)(e)}...`:`\u{1F9F0} - Installing ${(0,o.cyan)(e)} from template ${(0,o.brightBlue)(t)}...`}function b(e,t,i){return`${(0,o.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't find template ${(0,o.brightBlue)(t)} for ${(0,o.cyan)(e)}. ${i}`}function Q(e){return`\u{1F332} - Initializing git repository for ${(0,o.cyan)(e)}...`}function Z(e,t,i){return`Command ${e} ${t.join(" ")} failed with exit code ${i}`}function ee(e,t){return`${(0,o.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Child process error: Can't initialize ${(0,o.brightYellow)("git")} for ${(0,o.cyan)(e)}. ${t.message}`}function te(e,t){return`${(0,o.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't initialize ${(0,o.brightYellow)("git")} for ${(0,o.cyan)(e)}. ${t.message||t.toString()}`}function ne(){return"\u{1F6E0} - Installing dependencies... (takes a moment)"}function re(e,t,i){return`Command ${e} ${t.join(" ")} failed with exit code ${i}`}function ie(e,t){return`${(0,o.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Child process error: Can't install dependencies for ${(0,o.cyan)(e)}. ${t}`}function oe(e,t){return`${(0,o.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't install dependencies for ${(0,o.cyan)(e)}. ${t.message||t.toString()}`}function se(){return"Symlink created successfully."}function ae(e,t){return`Failed to create symlink: ${e} ${t.join(" ")}`}function ce(){return`\u{1F4DD} - Writing ${(0,o.brightYellow)("package.json")} metadata...`}function le(e,t){return`${(0,o.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't write ${(0,o.brightYellow)("package.json")} for ${(0,o.cyan)(e)}. ${t}`}function me(){return`\u{1F4DC} - Writing ${(0,o.brightYellow)("manifest.json")} metadata...`}function pe(e,t){return`${(0,o.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't write ${(0,o.brightYellow)("manifest.json")} for ${(0,o.cyan)(e)}. ${t}`}function ge(){return`\u{1F4C4} - Writing ${(0,o.brightYellow)("README.md")} metadata...`}function de(){return`\u{1F648} - Writing ${(0,o.brightYellow)(".gitignore")} lines...`}function fe(e,t){return`${(0,o.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't write the ${(0,o.brightYellow)("README.md")} file for ${(0,o.cyan)(e)}. ${t}`}function ue(e){return`\u{1F91D} - Ensuring ${(0,o.cyan)(e)} folder exists...`}function we(e){return"Error while checking directory writability: "+e}var E=c(require("fs/promises")),$=c(require("path")),ye=require("detect-package-manager");async function S(e,t){let i=await E.default.readdir(e,{withFileTypes:!0});return await E.default.mkdir(t,{recursive:!0}),await Promise.all(i.map(async r=>{let n=$.default.join(e,r.name),s=$.default.join(t,r.name);r.isDirectory()?await S(n,s):await E.default.copyFile(n,s)}))}async function y(){let e=await(0,ye.detect)(),t="npm run";switch(e){case"yarn":t="yarn";break;case"pnpm":t="pnpm run";break;default:t="npm run"}return t}function xe(e){let t=$.default.resolve(__dirname,"template");return $.default.resolve(e,t)}async function he(e,t){try{return console.log(ue(t)),await E.default.mkdir(e,{recursive:!0}),!0}catch(i){return console.log(we(i)),!1}}function P(e){return e!=="init"}function Ee(e){return P(e)?!1:e==="typescript"||e.startsWith("typescript-")||e.endsWith("-typescript")}var $e=c(require("path")),I=c(require("fs/promises"));var He=["LICENSE","node_modules"];async function ve(e,t){console.log(U(t));try{let i=await he(e,t);console.log(Y()),i||(console.error(O(e)),process.exit(1));let r=await I.default.readdir(e);console.log(q());let n=await Promise.all(r.filter(s=>!s.startsWith(".")).filter(s=>!s.endsWith(".log")).filter(s=>!He.includes(s)).map(async s=>(await I.default.lstat($e.default.join(e,s))).isDirectory()?`${s}/`:`${s}`));if(n.length>0){let s=await z(e,n);throw new Error(s)}}catch(i){console.error(H(t,i)),process.exit(1)}}var ke=c(require("path"));async function be(e,t,i){let r=ke.default.resolve(__dirname,"template");try{console.log(h(t,i)),await S(r,e)}catch(n){console.error(b(t,i,n)),process.exit(1)}}var p=c(require("path")),f=c(require("fs/promises")),De=c(require("go-git-it"));async function Te(e,t,i){let r=p.default.dirname(e),n=p.default.basename(i),a=`https://github.com/extension-js/extension.js/tree/main/examples/${i}`;try{await f.default.mkdir(e,{recursive:!0});let l="";if(process.env.EXTENSION_ENV==="development"?(console.log(h(t,i)),l=p.default.join(e,n),await f.default.cp(p.default.join(__dirname,"..","..","..","examples",n),l,{recursive:!0})):(await(0,De.default)(a,r,h(t,n)),l=p.default.join(r,n)),t!==n){let m=p.default.join(r,t);await f.default.mkdir(m,{recursive:!0});let g=await f.default.readdir(l);for(let u of g)await f.default.rename(p.default.join(l,u),p.default.join(m,u));await f.default.rm(l,{recursive:!0,force:!0})}else{let m=p.default.join(r,t+"-temp");await f.default.rename(l,m);let g=p.default.join(m,n),u=p.default.join(r,t);await f.default.mkdir(u,{recursive:!0});let Oe=await f.default.readdir(g);for(let j of Oe)await f.default.rename(p.default.join(g,j),p.default.join(u,j));await f.default.rm(m,{recursive:!0,force:!0})}}catch(l){console.error(b(t,n,l)),process.exit(1)}}var v=c(require("path")),J=c(require("fs/promises"));var Be={dev:process.env.EXTENSION_ENV==="development"?"node node_modules/extension dev":"extension dev",start:process.env.EXTENSION_ENV==="development"?"node node_modules/extension start":"extension start",build:process.env.EXTENSION_ENV==="development"?"node node_modules/extension build":"extension build"};async function Fe(e,t,i){let r=xe(process.cwd()),n=P(i)?v.default.join(e,"package.json"):v.default.join(r,"package.json"),s=await J.default.readFile(n),a=JSON.parse(s.toString());a.scripts=a.scripts||{},a.dependencies=a.dependencies||{},a.devDependencies={...a.devDependencies||{},extension:process.env.EXTENSION_ENV==="development"?"*":"latest"};let l={...a,name:v.default.basename(e),private:!0,scripts:{...a.scripts,...Be},dependencies:a.dependencies,devDependencies:a.devDependencies,author:{name:"Your Name",email:"your@email.com",url:"https://yourwebsite.com"}};try{console.log(ce()),await J.default.writeFile(v.default.join(e,"package.json"),JSON.stringify(l,null,2))}catch(m){console.error(le(t,m)),process.exit(1)}}var Pe=c(require("path")),Ie=require("cross-spawn"),Je=c(require("fs"));var Ce=c(require("path")),M=require("cross-spawn");async function Se(e){let t=Ce.default.join(__dirname,"../../cli"),i=await y(),r=["link"];await new Promise((n,s)=>{(0,M.spawn)(i,r,{cwd:t}).on("close",()=>{(0,M.spawn)(i,[...r,"extension"],{stdio:"inherit",cwd:e}).on("close",m=>{m===0?(console.log(se()),n()):s(new Error(ae(i,r)))})})}),console.log("Symlink creation completed.")}function Ke(){return["install","--silent"]}async function Me(e,t){let i=Pe.default.join(e,"node_modules"),r=await y(),n=Ke();console.log(ne()),process.env.EXTENSION_ENV==="development"&&await Se(e);try{let s=process.cwd();process.chdir(e),await Je.default.promises.mkdir(i,{recursive:!0});let a=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",l=(0,Ie.spawn)(r,n,{stdio:a});await new Promise((m,g)=>{l.on("close",u=>{process.chdir(s),u!==0?g(new Error(re(r,n,u))):m()}),l.on("error",u=>{process.chdir(s),console.error(ie(t,u)),g(u)})})}catch(s){console.error(oe(t,s)),process.exit(1)}}var D=c(require("path")),T=c(require("fs/promises"));async function _e(e,t){let i=await T.default.readFile(D.default.join(__dirname,"template","README.md"),"utf-8"),r=await y(),n=require(D.default.join(e,"manifest.json")),s=i.replaceAll("[projectName]",t).replaceAll("[templateDescription]",n.description).replaceAll("[runCommand]",r);try{console.log(ge()),await T.default.mkdir(e,{recursive:!0}),await T.default.writeFile(D.default.join(e,"README.md"),s)}catch(a){console.error(fe(t,a)),process.exit(1)}}var F=c(require("path")),_=c(require("fs/promises"));async function Ne(e,t){let i=F.default.join(e,"manifest.json"),r=await _.default.readFile(i),s={...JSON.parse(r.toString()),name:F.default.basename(e),author:"Your Name"};try{console.log(me()),await _.default.writeFile(F.default.join(e,"manifest.json"),JSON.stringify(s,null,2))}catch(a){console.error(pe(t,a)),process.exit(1)}}var N=c(require("path")),R=c(require("fs/promises"));async function Re(e,t){let i=N.default.join(e,"extension-env.d.ts"),r=process.env.EXTENSION_ENV==="development"?N.default.resolve(process.cwd(),"programs/develop/types"):"extension-develop/dist/types",n=`// Required Extension.js types for TypeScript projects.
|
|
17
17
|
// This file auto-generated and should not be excluded.
|
|
18
18
|
// If you need extra types, consider creating a new *.d.ts and
|
|
19
19
|
// referencing it in the "include" array in your tsconfig.json file.
|
|
20
20
|
// See https://www.typescriptlang.org/tsconfig#include for info.
|
|
21
|
-
/// <reference types="${
|
|
21
|
+
/// <reference types="${r}/index.d.ts" />
|
|
22
22
|
|
|
23
23
|
// Polyfill types for browser.* APIs.
|
|
24
|
-
/// <reference types="${
|
|
25
|
-
`;try{await
|
|
24
|
+
/// <reference types="${r}/polyfill.d.ts" />
|
|
25
|
+
`;try{await R.default.mkdir(e,{recursive:!0}),console.log(B(t)),await R.default.writeFile(i,n)}catch(s){console.error(K(s)),process.exit(1)}}var je=c(require("fs/promises"));var Qe=["# dependencies","/node_modules"],Ze=["# testing","/coverage"],et=["# production","/dist"],tt=["# misc",".DS_Store",".env.local",".env.development.local",".env.test.local",".env.production.local","npm-debug.log*","yarn-debug.log*","yarn-error.log*","extension.d.ts"],nt=["# lock files","yarn.lock","package-lock.json"],rt=[...Qe,...Ze,...et,...tt,...nt];async function We(e){let t=e+"/.gitignore",i=await je.default.open(t,"a+").catch(s=>{console.error(s),process.exit(1)}),r=new Set;for await(let s of i.readLines({autoClose:!1}))s=s.trim(),s.length!==0&&r.add(s);let n=rt.filter(s=>!r.has(s));console.log(de()),await i.appendFile(n.join(`
|
|
26
|
+
`),{flush:!0}).catch(s=>{console.error(s),process.exit(1)})}var Ge=require("cross-spawn");async function Ae(e,t){let i="git",r=["init","--quiet"];console.log(Q(t));try{let n=process.cwd();process.chdir(e);let s=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",a=(0,Ge.spawn)(i,r,{stdio:s});await new Promise((l,m)=>{a.on("close",g=>{process.chdir(n),g!==0?m(new Error(Z(i,r,g))):l()}),a.on("error",g=>{process.chdir(n),console.error(ee(t,g)),m(g)})})}catch(n){console.error(te(t,n)),process.exit(1)}}async function it(e,{template:t="init",noInstall:i=!1}){if(!e)throw new Error(V());if(e.startsWith("http"))throw new Error(X());let r=C.default.isAbsolute(e)?e:C.default.join(process.cwd(),e),n=C.default.basename(r);try{await ve(r,n),t==="init"?await be(r,n,t):await Te(r,n,t),await Fe(r,n,t),i||await Me(r,n),await _e(r,n),await Ne(r,n),await Ae(r,n),await We(r),Ee(t)&&await Re(r,n);let s=await L(r,n);console.log(s)}catch(s){throw console.error(s),s}}0&&(module.exports={extensionCreate});
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"node": ">=18"
|
|
10
10
|
},
|
|
11
11
|
"name": "extension-create",
|
|
12
|
-
"version": "2.0.0-alpha.
|
|
12
|
+
"version": "2.0.0-alpha.7",
|
|
13
13
|
"description": "The Extension.js create step",
|
|
14
14
|
"main": "./dist/module.js",
|
|
15
15
|
"types": "./dist/module.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@colors/colors": "^1.6.0",
|
|
33
33
|
"cross-spawn": "^7.0.3",
|
|
34
34
|
"detect-package-manager": "^3.0.2",
|
|
35
|
-
"go-git-it": "
|
|
35
|
+
"go-git-it": "2.0.4"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/cross-spawn": "^6.0.6",
|
package/dist/action/README.md
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# action
|
|
2
|
-
|
|
3
|
-
> An Extension.js example.
|
|
4
|
-
|
|
5
|
-
## Scripts Available
|
|
6
|
-
|
|
7
|
-
In the project directory, you can run:
|
|
8
|
-
|
|
9
|
-
### yarn dev
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
// Runs the app in the development mode.
|
|
13
|
-
// Will open a new browser instance with your extension loaded.
|
|
14
|
-
// The page will reload when you make changes.
|
|
15
|
-
yarn dev
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
### yarn start
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
// Runs the app in the production mode.
|
|
22
|
-
// Will open a new browser instance with your extension loaded.
|
|
23
|
-
// This is how your browser extension will work once published.
|
|
24
|
-
yarn start
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### yarn build
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
// Builds the app for production.
|
|
31
|
-
// Bundles your browser extension in production mode for the target browser.
|
|
32
|
-
yarn build
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Learn More
|
|
36
|
-
|
|
37
|
-
Learn more about creating cross-browser extensions in the [Extension.js](https://extension.js.org) documentation.
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<title>Action Extension</title>
|
|
7
|
-
<link
|
|
8
|
-
rel="stylesheet"
|
|
9
|
-
href="https://unpkg.com/sakura.css/css/sakura.css"
|
|
10
|
-
media="screen"
|
|
11
|
-
/>
|
|
12
|
-
<link
|
|
13
|
-
rel="stylesheet"
|
|
14
|
-
href="https://unpkg.com/sakura.css/css/sakura-dark.css"
|
|
15
|
-
media="screen and (prefers-color-scheme: dark)"
|
|
16
|
-
/>
|
|
17
|
-
<link rel="stylesheet" href="./styles.css" media="screen" />
|
|
18
|
-
</head>
|
|
19
|
-
<body class="popup">
|
|
20
|
-
<header>
|
|
21
|
-
<h1>
|
|
22
|
-
<img
|
|
23
|
-
class="action"
|
|
24
|
-
src="../images/extension_128.png"
|
|
25
|
-
alt="The Extension logo"
|
|
26
|
-
width="72px"
|
|
27
|
-
/>
|
|
28
|
-
<br />
|
|
29
|
-
Welcome to your Action Extension
|
|
30
|
-
</h1>
|
|
31
|
-
<p>
|
|
32
|
-
Learn more about creating cross-browser extensions at
|
|
33
|
-
<a href="https://extension.js.org" target="_blank"
|
|
34
|
-
>https://extension.js.org</a
|
|
35
|
-
>.
|
|
36
|
-
</p>
|
|
37
|
-
</header>
|
|
38
|
-
</body>
|
|
39
|
-
<script src="./scripts.js"></script>
|
|
40
|
-
</html>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
body {
|
|
2
|
-
display: flex;
|
|
3
|
-
justify-content: center;
|
|
4
|
-
align-items: center;
|
|
5
|
-
width: 300px;
|
|
6
|
-
padding: 2em;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
h1 {
|
|
10
|
-
font-size: 2.7em;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.action {
|
|
14
|
-
filter: grayscale(1);
|
|
15
|
-
transition:
|
|
16
|
-
filter 2s,
|
|
17
|
-
border-color 2s;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.action:hover {
|
|
21
|
-
filter: grayscale(0);
|
|
22
|
-
border-color: aquamarine;
|
|
23
|
-
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"manifest_version": 3,
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"name": "action",
|
|
5
|
-
"description": "An Extension.js example.",
|
|
6
|
-
"icons": {
|
|
7
|
-
"16": "images/extension_16.png",
|
|
8
|
-
"48": "images/extension_48.png",
|
|
9
|
-
"128": "images/extension_128.png"
|
|
10
|
-
},
|
|
11
|
-
"action": {
|
|
12
|
-
"default_popup": "action/index.html",
|
|
13
|
-
"default_title": "Action",
|
|
14
|
-
"default_icon": {
|
|
15
|
-
"16": "images/extension_16.png",
|
|
16
|
-
"48": "images/extension_48.png",
|
|
17
|
-
"128": "images/extension_128.png"
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"author": "Your Name"
|
|
21
|
-
}
|
package/dist/action/package.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"private": true,
|
|
3
|
-
"name": "action",
|
|
4
|
-
"description": "An Extension.js example.",
|
|
5
|
-
"version": "0.0.1",
|
|
6
|
-
"author": {
|
|
7
|
-
"name": "Your Name",
|
|
8
|
-
"email": "your@email.com",
|
|
9
|
-
"url": "https://yourwebsite.com"
|
|
10
|
-
},
|
|
11
|
-
"license": "MIT",
|
|
12
|
-
"scripts": {
|
|
13
|
-
"dev": "extension dev",
|
|
14
|
-
"start": "extension start",
|
|
15
|
-
"build": "extension build"
|
|
16
|
-
},
|
|
17
|
-
"dependencies": {},
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
"extension": "latest"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
EXTENSION_OPENAI_API_KEY='My API Key'
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# action-chatgpt
|
|
2
|
-
|
|
3
|
-
> An Extension.js example.
|
|
4
|
-
|
|
5
|
-
## Scripts Available
|
|
6
|
-
|
|
7
|
-
In the project directory, you can run:
|
|
8
|
-
|
|
9
|
-
### yarn dev
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
// Runs the app in the development mode.
|
|
13
|
-
// Will open a new browser instance with your extension loaded.
|
|
14
|
-
// The page will reload when you make changes.
|
|
15
|
-
yarn dev
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
### yarn start
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
// Runs the app in the production mode.
|
|
22
|
-
// Will open a new browser instance with your extension loaded.
|
|
23
|
-
// This is how your browser extension will work once published.
|
|
24
|
-
yarn start
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### yarn build
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
// Builds the app for production.
|
|
31
|
-
// Bundles your browser extension in production mode for the target browser.
|
|
32
|
-
yarn build
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Learn More
|
|
36
|
-
|
|
37
|
-
Learn more about creating cross-browser extensions in the [Extension.js](https://extension.js.org) documentation.
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import {useState, type FormEvent} from 'react'
|
|
2
|
-
import OpenAI from 'openai'
|
|
3
|
-
import chatgptLogo from '../images/chatgpt.png'
|
|
4
|
-
import extensionJsLogo from '../images/extension_128.png'
|
|
5
|
-
|
|
6
|
-
const openai = new OpenAI({
|
|
7
|
-
apiKey: process.env.EXTENSION_OPENAI_API_KEY!,
|
|
8
|
-
dangerouslyAllowBrowser: true
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
interface Message {
|
|
12
|
-
content: string
|
|
13
|
-
role: 'user' | 'assistant'
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function ActionApp() {
|
|
17
|
-
const [messages, setMessages] = useState<Message[]>([
|
|
18
|
-
{
|
|
19
|
-
content:
|
|
20
|
-
'Hello there! This is your ChatGPT extension sample, ' +
|
|
21
|
-
'built with React, Tailwind.css, and DaisyUI. ' +
|
|
22
|
-
'For it to work, create a .env file with your EXTENSION_OPENAI_API_KEY. ' +
|
|
23
|
-
"You can get an API key from OpenAI's website",
|
|
24
|
-
role: 'assistant'
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
content: 'https://platform.openai.com/api-keys',
|
|
28
|
-
role: 'assistant'
|
|
29
|
-
}
|
|
30
|
-
])
|
|
31
|
-
|
|
32
|
-
const [isTyping, setIsTyping] = useState(false)
|
|
33
|
-
|
|
34
|
-
const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {
|
|
35
|
-
e.preventDefault()
|
|
36
|
-
|
|
37
|
-
const form = e.target as HTMLFormElement
|
|
38
|
-
const input = form[0] as HTMLInputElement
|
|
39
|
-
|
|
40
|
-
const newMessage: Message = {
|
|
41
|
-
content: input.value,
|
|
42
|
-
role: 'user'
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const newMessages = [...messages, newMessage]
|
|
46
|
-
|
|
47
|
-
setMessages(newMessages)
|
|
48
|
-
setIsTyping(true)
|
|
49
|
-
form.reset()
|
|
50
|
-
|
|
51
|
-
const completion = await openai.chat.completions.create({
|
|
52
|
-
model: 'gpt-3.5-turbo',
|
|
53
|
-
messages: newMessages
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
setMessages([...newMessages, completion.choices[0].message as Message])
|
|
57
|
-
setIsTyping(false)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<section className="container mx-auto p-5 fixed inset-0">
|
|
62
|
-
<div className="w-full h-full flex flex-col">
|
|
63
|
-
<div className="flex-grow overflow-auto">
|
|
64
|
-
{messages.length &&
|
|
65
|
-
messages.map((msg, i) => (
|
|
66
|
-
<div
|
|
67
|
-
className={`chat ${
|
|
68
|
-
msg.role === 'assistant' ? 'chat-start' : 'chat-end'
|
|
69
|
-
}`}
|
|
70
|
-
key={'chatKey' + i}
|
|
71
|
-
>
|
|
72
|
-
<div className="chat-image avatar">
|
|
73
|
-
<div className="w-10 rounded-full">
|
|
74
|
-
<img
|
|
75
|
-
src={
|
|
76
|
-
msg.role === 'assistant' ? chatgptLogo : extensionJsLogo
|
|
77
|
-
}
|
|
78
|
-
alt="avatar"
|
|
79
|
-
/>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
<div className="chat-bubble">{msg.content}</div>
|
|
83
|
-
</div>
|
|
84
|
-
))}
|
|
85
|
-
</div>
|
|
86
|
-
|
|
87
|
-
<form className="form-control items-center" onSubmit={handleSubmit}>
|
|
88
|
-
<div className="input-group max-w-full w-[800px] relative flex items-center">
|
|
89
|
-
{isTyping && (
|
|
90
|
-
<small className="absolute -top-5 left-0.5 animate-pulse">
|
|
91
|
-
ChatGPT Extension is typing...
|
|
92
|
-
</small>
|
|
93
|
-
)}
|
|
94
|
-
|
|
95
|
-
<input
|
|
96
|
-
type="text"
|
|
97
|
-
placeholder="Ask ChatGPT a question."
|
|
98
|
-
className="input input-bordered flex-grow mr-2.5"
|
|
99
|
-
required
|
|
100
|
-
/>
|
|
101
|
-
<button className="btn btn-square" type="submit">
|
|
102
|
-
<svg
|
|
103
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
104
|
-
className="h-6 w-6"
|
|
105
|
-
fill="currentColor"
|
|
106
|
-
viewBox="0 0 16 16"
|
|
107
|
-
>
|
|
108
|
-
<path d="M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576 6.636 10.07Zm6.787-8.201L1.591 6.602l4.339 2.76 7.494-7.493Z" />
|
|
109
|
-
</svg>
|
|
110
|
-
</button>
|
|
111
|
-
</div>
|
|
112
|
-
</form>
|
|
113
|
-
</div>
|
|
114
|
-
</section>
|
|
115
|
-
)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export default ActionApp
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<title>ChatGPT Template</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<noscript>You need to enable JavaScript to run this extension.</noscript>
|
|
10
|
-
<div id="root"></div>
|
|
11
|
-
</body>
|
|
12
|
-
<script src="./scripts.tsx"></script>
|
|
13
|
-
</html>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import ReactDOM from 'react-dom/client'
|
|
3
|
-
import ActionApp from './ActionApp'
|
|
4
|
-
import './styles.css'
|
|
5
|
-
|
|
6
|
-
const root = ReactDOM.createRoot(document.getElementById('root')!)
|
|
7
|
-
|
|
8
|
-
root.render(
|
|
9
|
-
<React.StrictMode>
|
|
10
|
-
<ActionApp />
|
|
11
|
-
</React.StrictMode>
|
|
12
|
-
)
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// Required Extension.js types for TypeScript projects.
|
|
2
|
-
// This file is auto-generated and should not be excluded.
|
|
3
|
-
// If you need extra types, consider creating a new *.d.ts and
|
|
4
|
-
// referencing it in the "include" array of your tsconfig.json file.
|
|
5
|
-
// See https://www.typescriptlang.org/tsconfig#include for info.
|
|
6
|
-
/// <reference types="../../programs/develop/dist/types/index.d.ts" />
|
|
7
|
-
|
|
8
|
-
// Polyfill types for browser.* APIs.
|
|
9
|
-
/// <reference types="../../programs/develop/dist/types/polyfill.d.ts" />
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"manifest_version": 3,
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"name": "action-chatgpt",
|
|
5
|
-
"description": "An Extension.js example.",
|
|
6
|
-
"icons": {
|
|
7
|
-
"16": "images/extension_16.png",
|
|
8
|
-
"48": "images/extension_48.png",
|
|
9
|
-
"128": "images/extension_128.png"
|
|
10
|
-
},
|
|
11
|
-
"action": {
|
|
12
|
-
"default_icon": {
|
|
13
|
-
"16": "images/extension_16.png",
|
|
14
|
-
"48": "images/extension_48.png",
|
|
15
|
-
"128": "images/extension_128.png"
|
|
16
|
-
},
|
|
17
|
-
"default_title": "ChatGPT",
|
|
18
|
-
"default_popup": "action/index.html"
|
|
19
|
-
},
|
|
20
|
-
"author": "Your Name"
|
|
21
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"private": true,
|
|
3
|
-
"name": "action-chatgpt",
|
|
4
|
-
"description": "An Extension.js example.",
|
|
5
|
-
"version": "0.0.1",
|
|
6
|
-
"author": {
|
|
7
|
-
"name": "Your Name",
|
|
8
|
-
"email": "your@email.com",
|
|
9
|
-
"url": "https://yourwebsite.com"
|
|
10
|
-
},
|
|
11
|
-
"license": "MIT",
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"daisyui": "^4.12.10",
|
|
14
|
-
"openai": "^4.54.0",
|
|
15
|
-
"react": "^18.1.0",
|
|
16
|
-
"react-dom": "^18.1.0",
|
|
17
|
-
"tailwindcss": "^3.4.1"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@types/react": "^18.0.9",
|
|
21
|
-
"@types/react-dom": "^18.0.5",
|
|
22
|
-
"typescript": "5.3.3",
|
|
23
|
-
"extension": "latest"
|
|
24
|
-
},
|
|
25
|
-
"scripts": {
|
|
26
|
-
"dev": "extension dev",
|
|
27
|
-
"start": "extension start",
|
|
28
|
-
"build": "extension build"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"allowJs": true,
|
|
4
|
-
"allowSyntheticDefaultImports": true,
|
|
5
|
-
"esModuleInterop": true,
|
|
6
|
-
"forceConsistentCasingInFileNames": true,
|
|
7
|
-
"isolatedModules": true,
|
|
8
|
-
"jsx": "react-jsx",
|
|
9
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
10
|
-
"moduleResolution": "node",
|
|
11
|
-
"module": "esnext",
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"strict": true,
|
|
14
|
-
"target": "esnext",
|
|
15
|
-
"verbatimModuleSyntax": true,
|
|
16
|
-
"useDefineForClassFields": true,
|
|
17
|
-
"skipLibCheck": true
|
|
18
|
-
},
|
|
19
|
-
"include": ["./"],
|
|
20
|
-
"exclude": ["node_modules", "dist"]
|
|
21
|
-
}
|