Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi0498 committed Feb 12, 2023
0 parents commit b767ac2
Show file tree
Hide file tree
Showing 10 changed files with 4,742 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/submit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Submit to Web Store"
on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache pnpm modules
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v2.2.4
with:
version: latest
run_install: true
- name: Use Node.js 16.x
uses: actions/setup-node@v3.4.1
with:
node-version: 16.x
cache: "pnpm"
- name: Build the extension
run: pnpm build
- name: Package the extension into a zip artifact
run: pnpm package
- name: Browser Platform Publish
uses: PlasmoHQ/bpp@v3
with:
keys: ${{ secrets.SUBMIT_KEYS }}
artifact: build/chrome-mv3-prod.zip
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

#cache
.turbo
.next
.vercel

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*


# local env files
.env*

out/
build/
dist/

# plasmo - https://www.plasmo.com
.plasmo

# bpp - http://bpp.browser.market/
keys.json

# typescript
.tsbuildinfo
17 changes: 17 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @type {import('prettier').Options}
*/
module.exports = {
printWidth: 80,
tabWidth: 2,
useTabs: false,
semi: false,
singleQuote: false,
trailingComma: "none",
bracketSpacing: true,
bracketSameLine: true,
plugins: [require.resolve("@plasmohq/prettier-plugin-sort-imports")],
importOrder: ["^@plasmohq/(.*)$", "^~(.*)$", "^[./]"],
importOrderSeparation: true,
importOrderSortSpecifiers: true
}
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
This is a [Plasmo extension](https://docs.plasmo.com/) project bootstrapped with [`plasmo init`](https://www.npmjs.com/package/plasmo).

## Getting Started

First, run the development server:

```bash
pnpm dev
# or
npm run dev
```

Open your browser and load the appropriate development build. For example, if you are developing for the chrome browser, using manifest v3, use: `build/chrome-mv3-dev`.

You can start editing the popup by modifying `popup.tsx`. It should auto-update as you make changes. To add an options page, simply add a `options.tsx` file to the root of the project, with a react component default exported. Likewise to add a content page, add a `content.ts` file to the root of the project, importing some module and do some logic, then reload the extension on your browser.

For further guidance, [visit our Documentation](https://docs.plasmo.com/)

## Making production build

Run the following:

```bash
pnpm build
# or
npm run build
```

This should create a production bundle for your extension, ready to be zipped and published to the stores.

## Submit to the webstores

The easiest way to deploy your Plasmo extension is to use the built-in [bpp](https://bpp.browser.market) GitHub action. Prior to using this action however, make sure to build your extension and upload the first version to the store to establish the basic credentials. Then, simply follow [this setup instruction](https://docs.plasmo.com/framework/workflows/submit) and you should be on your way for automated submission!
Binary file added assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions content.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import type { PlasmoCSConfig } from "plasmo"

export {}

export const config: PlasmoCSConfig = {
run_at: "document_end",
matches: ["*://*.freshrelease.com/*"],
world: "MAIN"
}
let interval
;(async () => {
const permissionStatus = await navigator.permissions.query({
name: "clipboard-read",
allowWithoutGesture: false
})
// Will be 'granted', 'denied' or 'prompt':
console.log(permissionStatus.state)

// Listen for changes to the permission state
permissionStatus.onchange = () => {
console.log(permissionStatus.state)
}
})()

//run function on dom changes
export function run() {
const link = document.createElement("link")
link.rel = "stylesheet"
link.href =
"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0"
document.querySelector("head").appendChild(link)
console.log("Hello World")
interval = setInterval(() => {
const newElements = document.querySelectorAll("div[class='pull-right']")

console.log("Hello World", newElements)
if (newElements.length > 0) {
clearInterval(interval)
newElements.forEach((element) => {
const newElement = document.createElement("span")
newElement.classList.add("text--sec-color")
newElement.classList.add("text--ultra-semibold")
newElement.classList.add("material-symbols-outlined")
newElement.onclick = () => {
const listOfTasks =
element.parentElement.nextElementSibling.children[0].children || []
console.log(listOfTasks)
let tasks = []
for (let i = 0; i < listOfTasks.length; i++) {
const task = listOfTasks[i]
const name = task.querySelector("figure")?.children?.[0]?.ariaLabel

const texts = listOfTasks[i].textContent
.split("\n")
.map((e) => e.trim())
.filter(Boolean)
console.log(texts)

tasks.push(`${texts[0]} - ${texts[1]}` + (name ? ` - ${name}` : ""))
}
try {
window.navigator.clipboard.writeText(tasks.join("\n"))
alert("Copied to clipboard")
} catch (error) {
console.log(error)
alert(
"No permission to access clipboard. Please allow access to clipboard in the browser settings. (Chrome: chrome://settings/content/clipboard)"
)
}
// copy(tasks)
}
newElement.innerHTML = `content_copy`
element.appendChild(newElement)
})
}
}, 1000)
}

run()
36 changes: 36 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "freshrelease-export",
"displayName": "Freshrelease export",
"version": "0.0.1",
"description": "export tasks from freshrelease",
"author": "abhisekv",
"scripts": {
"dev": "plasmo dev",
"build": "plasmo build",
"package": "plasmo package"
},
"dependencies": {
"plasmo": "0.65.0",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/chrome": "0.0.210",
"@types/node": "18.11.18",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"prettier": "2.8.3",
"typescript": "4.9.4",
"@plasmohq/prettier-plugin-sort-imports": "3.6.1"
},
"manifest": {
"host_permissions": [
"https://*/*"
],
"permissions": [
"scripting",
"clipboardRead",
"clipboardWrite"
]
}
}
18 changes: 18 additions & 0 deletions popup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { useState } from "react"

function IndexPopup() {
const [data, setData] = useState("")

return (
<div
style={{
display: "flex",
flexDirection: "column",
padding: 16
}}>
<h2> Extension to copy FreshRelease Tasks </h2>
</div>
)
}

export default IndexPopup
11 changes: 11 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "plasmo/templates/tsconfig.base",
"exclude": ["node_modules"],
"include": [".plasmo/index.d.ts", "./**/*.ts", "./**/*.tsx"],
"compilerOptions": {
"paths": {
"~*": ["./*"]
},
"baseUrl": "."
}
}
Loading

0 comments on commit b767ac2

Please sign in to comment.