Skip to content

Commit

Permalink
Make Build Script and Icon
Browse files Browse the repository at this point in the history
- Make Build Script
- Make Icon
- Update Gitignore to ignore build files
  • Loading branch information
SethuSenthil committed Dec 22, 2022
1 parent b80537e commit 44e0a9d
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 4 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ rad.json
TestResults.xml
# Ignore Mac DS_Store files
.DS_Store
**/.DS_Store
**/.DS_Store

# Ignore Build Files
build/*
build.zip
build.crx
36 changes: 36 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const fs = require('fs');

//delete old build folder if it exists
if (fs.existsSync('build')) {
fs.rmdirSync('build', { recursive: true });
}

//create folder called build
fs.mkdirSync('build');

//copy manifest.json to build folder
fs.copyFileSync('manifest.json', 'build/manifest.json');

const manifest = require('./manifest.json');

//copy all files referenced in manifest.json to build folder
const cs = manifest.content_scripts[0]

cs.js.forEach((jsFile) => {
fs.copyFileSync(jsFile, `build/${jsFile}`);
});

cs.css.forEach((cssFile) => {
fs.copyFileSync(cssFile, `build/${cssFile}`);
});

//made media directory in build folder
fs.mkdirSync('build/media');

//copy all files referenced in media directory to build folder
const icns = manifest.icons;

//loop through icons in object
for (const size in icns) {
fs.copyFileSync(icns[size], `build/${icns[size]}`);
}
2 changes: 1 addition & 1 deletion init.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const chatbubbles = chatContainer.querySelectorAll('main.w-full .border-b');
if (chatbubbles.length % 2 === 0) {
//if last chat is from bot
const lastChatBubble = chatbubbles.at(-1);
const lastChatBubble = chatbubbles[chatbubbles.length - 1];
const text = lastChatBubble.querySelector('.markdown').innerText
copyToClipboard(text);
}
Expand Down
11 changes: 9 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
"manifest_version": 3,
"author": "Sethu Senthil",
"name": "Copy for Chat GPT",
"description": "This extension allows you to copy chat GPT responses with a click of a button",
"version": "1.0",
"icons": {
"16": "media/16.jpg",
"19": "media/19.jpg",
"38": "media/38.jpg",
"48": "media/48.jpg",
"128": "media/128.jpg"
},
"description": "This extension allows you to copy chat GPT responses with a click of a button or through CMD+K",
"version": "0.1",
"content_scripts":[
{
"js" : ["init.js"],
Expand Down
Binary file added media/128.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/16.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/19.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/38.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/48.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "copy-for-chatgpt",
"version": "1.0.0",
"description": "The purpose of this extention is to copy output given from ChatGPT with just a click of a button or through a keyboard command (CMD+K on Mac or CTRL+K on Windows) ## This is still in development, I made this quickly before I went to bed 💀",
"main": "build.js",
"scripts": {
"build": "node build.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/SethuSenthil/Copy-for-ChatGPT.git"
},
"author": "Sethu Senthil",
"license": "MIT",
"bugs": {
"url": "https://github.com/SethuSenthil/Copy-for-ChatGPT/issues"
},
"homepage": "https://github.com/SethuSenthil/Copy-for-ChatGPT#readme"
}

0 comments on commit 44e0a9d

Please sign in to comment.