-
Notifications
You must be signed in to change notification settings - Fork 1
Feat(extension, client): extension dist discord webhook #322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4d033b6
318a5db
23101be
b823f35
61c163e
6285ced
c25f953
68fa3c4
5d3c279
5a9eb54
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: ๐ฆ Share Pinback Extension | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| branch: | ||
| description: '๋น๋ํ ๋ธ๋์น๋ฅผ ํ์ธํ์ธ์ (๊ธฐ๋ณธ: develop)' | ||
| required: true | ||
| default: 'develop' | ||
|
|
||
| jobs: | ||
| build-and-send: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event.inputs.branch }} | ||
|
|
||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v3 | ||
| with: | ||
| version: 9 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: 'pnpm' | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Build and Share Extension | ||
| env: | ||
| VITE_DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} | ||
| run: pnpm share:ext | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,3 +24,6 @@ | |
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
|
|
||
| # build output | ||
| out/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,8 @@ | |
| "build:prod": "tsc -b && vite build --mode production", | ||
| "lint": "eslint .", | ||
| "format": "prettier -w .", | ||
| "zip": "pnpm build:prod && node scripts/zip.mjs" | ||
| "zip": "pnpm build:prod && node scripts/zip.mjs", | ||
| "share:dev": "pnpm build:dev && node --env-file=.env.development scripts/zip.mjs" | ||
|
Comment on lines
+13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๐งฉ Analysis chain๐ Web query:
๐ก Result: The --env-file flag was introduced in Node.js version 20.6.0. Citations:
๐ Script executed: # Verify the actual package.json files and scripts
find . -name "package.json" -path "*/extension/*" -o -name "package.json" -path "./package.json" | head -20Repository: Pinback-Team/pinback-client Length of output: 115 ๐ Script executed: # Check root package.json for engine declaration
cat -n package.json | grep -A 2 -B 2 '"node"'Repository: Pinback-Team/pinback-client Length of output: 198 ๐ Script executed: # Check apps/extension/package.json for the scripts and dependencies
cat -n apps/extension/package.jsonRepository: Pinback-Team/pinback-client Length of output: 2172 ๐ Script executed: # Search for share:ext script in all package.json files
grep -r "share:ext" . --include="package.json"Repository: Pinback-Team/pinback-client Length of output: 147 ๐ Script executed: # Also search in any script files
grep -r "share:ext" . --include="*.mjs" --include="*.js" --include="*.json"Repository: Pinback-Team/pinback-client Length of output: 147
์์ง ํํ์ ๐ค Prompt for AI Agents |
||
| }, | ||
| "dependencies": { | ||
| "@pinback/contracts": "workspace:*", | ||
|
|
@@ -32,12 +33,14 @@ | |
| "@types/react": "^18.3.5", | ||
| "@types/react-dom": "^18.3.0", | ||
| "@vitejs/plugin-react-swc": "^4.0.0", | ||
| "adm-zip": "^0.5.16", | ||
| "autoprefixer": "^10.4.21", | ||
| "eslint": "^9.33.0", | ||
| "eslint-plugin-jsx-a11y": "^6.9.0", | ||
| "eslint-plugin-react": "^7.35.0", | ||
| "eslint-plugin-react-hooks": "^5.2.0", | ||
| "eslint-plugin-react-refresh": "^0.4.20", | ||
| "form-data": "^4.0.5", | ||
| "prettier": "^3.3.3", | ||
| "prettier-plugin-tailwindcss": "^0.6.8", | ||
| "tailwindcss": "^4.1.12", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| /* global process */ | ||
| import AdmZip from 'adm-zip'; | ||
| import axios from 'axios'; | ||
| import FormData from 'form-data'; | ||
| import fs from 'fs'; | ||
| import path from 'path'; | ||
|
|
||
| const WEBHOOK_URL = process.env.DISCORD_WEBHOOK_URL; // eslint-disable-line | ||
| const DIST_DIR = path.resolve('dist'); | ||
| const OUT_DIR = path.resolve('out'); | ||
| const ZIP_NAME = 'pinback-ext-dev.zip'; | ||
| const ZIP_PATH = path.join(OUT_DIR, ZIP_NAME); | ||
|
Comment on lines
+11
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ํ๋ก๋์
๋น๋๋ ์ด ์คํฌ๋ฆฝํธ๋ ๐ค Prompt for AI Agents |
||
|
|
||
| const getTimestamp = () => | ||
| new Date().toLocaleString('ko-KR', { timeZone: 'Asia/Seoul' }); | ||
|
|
||
| const createTemplate = (type, details) => { | ||
| const { time, fileName, error } = details; | ||
| const divider = 'โโโโโโโโโโโโโโโโโโโโ'; | ||
|
|
||
| if (type === 'success') { | ||
| return `๐ฆ **Pinback ํ์ฅ ํ๋ก๊ทธ๋จ ๋น๋ ์๋ฃ**\n${divider}\n **๋น๋ ์๊ฐ:** ${time}\n **ํ์ผ๋ช :** \`${fileName}\`\n\n ์ต์ ๋น๋ ํ์ผ์ด ๋์ฐฉํ์ต๋๋ค. ์์ถ์ ํ๊ณ ์ฌ์ฉํ์ธ์!`; | ||
| } | ||
| return `๐จ **Pinback ๋น๋ ๊ณต์ ์คํจ**\n${divider}\nโ **์๋ฌ ๋ด์ฉ:** ${error}\n๐ **๋ฐ์ ์๊ฐ:** ${time}\nโ ๏ธ ํฐ๋ฏธ๋ ๋ก๊ทธ๋ฅผ ํ์ธํด ์ฃผ์ธ์.`; | ||
| }; | ||
|
|
||
| const archiveDist = () => { | ||
| if (!fs.existsSync(DIST_DIR)) { | ||
| throw new Error('dist ํด๋๊ฐ ์กด์ฌํ์ง ์์ต๋๋ค. ๋น๋๋ฅผ ๋จผ์ ์คํํด์ฃผ์ธ์.'); | ||
| } | ||
|
|
||
| if (!fs.existsSync(OUT_DIR)) fs.mkdirSync(OUT_DIR, { recursive: true }); | ||
| if (fs.existsSync(ZIP_PATH)) fs.unlinkSync(ZIP_PATH); | ||
|
|
||
| const zip = new AdmZip(); | ||
| zip.addLocalFolder(DIST_DIR); | ||
| zip.writeZip(ZIP_PATH); | ||
|
|
||
| console.log(`โ ์์ถ ์๋ฃ: ${ZIP_PATH}`); | ||
| }; | ||
|
|
||
| const uploadToDiscord = async (content, fileStream = null) => { | ||
| if (!WEBHOOK_URL) | ||
| throw new Error('DISCORD_WEBHOOK_URL์ด ์ค์ ๋์ง ์์์ต๋๋ค.'); | ||
|
|
||
| const form = new FormData(); | ||
| form.append('content', content); | ||
| if (fileStream) form.append('file', fileStream); | ||
|
|
||
| await axios.post(WEBHOOK_URL, form, { headers: form.getHeaders() }); | ||
| }; | ||
|
|
||
| async function run() { | ||
| try { | ||
| console.log('๐ฆ dist ํด๋๋ฅผ ์์ถํ๋ ์ค...'); | ||
| archiveDist(); | ||
|
|
||
| console.log('๐ค ๋์ค์ฝ๋๋ก ์ ์ก ์ค...'); | ||
| const message = createTemplate('success', { | ||
| time: getTimestamp(), | ||
| fileName: ZIP_NAME, | ||
| }); | ||
| await uploadToDiscord(message, fs.createReadStream(ZIP_PATH)); | ||
|
|
||
| console.log('โ ๋ชจ๋ ์์ ์ฑ๊ณต!'); | ||
| } catch (err) { | ||
| const isPayloadTooLarge = err.response?.status === 413; | ||
| const errorMsg = isPayloadTooLarge | ||
| ? 'ํ์ผ ์ฉ๋์ด ๋๋ฌด ํฝ๋๋ค (25MB ์ ํ).' | ||
| : err.message; | ||
|
|
||
| const failMessage = createTemplate('fail', { | ||
| time: getTimestamp(), | ||
| error: errorMsg, | ||
| }); | ||
|
|
||
| await uploadToDiscord(failMessage).catch((e) => | ||
| console.error('โ ์๋ฌ ์๋ฆผ ์ ์ก ์คํจ:', e.message) | ||
| ); | ||
|
|
||
| console.error('โ ์์ ์คํจ:', errorMsg); | ||
| process.exitCode = 1; | ||
| } | ||
| } | ||
|
|
||
| run(); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,38 @@ | ||
| import { Icon } from "@pinback/design-system/icons"; | ||
| import extesionPop from '@assets/extension_pop.svg' | ||
| import extesionPop from '@assets/extension_pop.svg'; | ||
| interface DuplicatePopProps { | ||
| onLeftClick: () => void; | ||
| onRightClick: () => void; | ||
| } | ||
|
|
||
| const DuplicatePop = ({onLeftClick,onRightClick} : DuplicatePopProps) => { | ||
| const DuplicatePop = ({ onLeftClick, onRightClick }: DuplicatePopProps) => { | ||
| return ( | ||
| <div className="bg-white-bg flex w-[26rem] cursor-pointer flex-col items-center justify-center rounded-[1.2rem] px-[1.6rem] py-[2.4rem] common-shadow"> | ||
| <img src={extesionPop} className="w-[7.2rem] h-[7.2rem] m-auto text-center"/> | ||
| <div className="sub2-sb text-font-black-1 pb-[0.8rem]">์น์๊ฐ ์ด๋ฏธ ์ฑ๊ฒจ๋์ด์! <Icon name="dotori" /> </div> | ||
| <div className="flex flex-row items-center justify-center gap-[1.2rem] pt-[0.8rem]"> | ||
| <button | ||
| className="border-gray200 sub5-sb bg-white-bg text-font-black-1 w-[10.8rem] rounded-[0.4rem] border py-[0.85rem]" | ||
| onClick={onLeftClick} | ||
| > | ||
| ์์ ํ๊ธฐ | ||
| </button> | ||
| <button | ||
| className="sub5-sb bg-gray900 text-white-bg w-[10.8rem] rounded-[0.4rem] py-[0.85rem]" | ||
| onClick={onRightClick} | ||
| > | ||
| ๋์๋ณด๋ | ||
| </button> | ||
| </div> | ||
| </div> | ||
| ) | ||
| <div className="bg-white-bg common-shadow flex w-[26rem] cursor-pointer flex-col items-center justify-center rounded-[1.2rem] px-[1.6rem] py-[2.4rem]"> | ||
| <img | ||
| alt="" | ||
| src={extesionPop} | ||
| className="m-auto h-[7.2rem] w-[7.2rem] text-center" | ||
| /> | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| <div className="sub2-sb text-font-black-1 pb-[0.8rem]"> | ||
| ์น์๊ฐ ์ด๋ฏธ ์ฑ๊ฒจ๋์ด์! ๐ฐ | ||
| </div> | ||
| <div className="flex flex-row items-center justify-center gap-[1.2rem] pt-[0.8rem]"> | ||
| <button | ||
| className="border-gray200 sub5-sb bg-white-bg text-font-black-1 w-[10.8rem] rounded-[0.4rem] border py-[0.85rem]" | ||
| onClick={onLeftClick} | ||
| type="button" | ||
| > | ||
| ์์ ํ๊ธฐ | ||
| </button> | ||
| <button | ||
| className="sub5-sb bg-gray900 text-white-bg w-[10.8rem] rounded-[0.4rem] py-[0.85rem]" | ||
| onClick={onRightClick} | ||
| type="button" | ||
| > | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| ๋์๋ณด๋ | ||
| </button> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default DuplicatePop; | ||
| export default DuplicatePop; | ||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์นํ ํ๊ฒฝ ๋ณ์๋ช ์ด ์คํฌ๋ฆฝํธ์ ๋ฌ๋ผ ์ ๋ก๋๊ฐ ์คํจํฉ๋๋ค.
Line 29์์
VITE_DISCORD_WEBHOOK_URL๋ฅผ ์ฃผ์ ํ์ง๋ง,apps/extension/scripts/zip.mjs๋ Line 8์์DISCORD_WEBHOOK_URL๋ฅผ ์ฝ๊ณ Line 43-44์์ ์์ผ๋ฉด ์ฆ์ ์์ธ๋ฅผ ๋์ง๋๋ค. ํ์ฌ ์ค์ ์ด๋ฉด Discord ์ ์ก ๋จ๊ณ๊ฐ ์คํจํฉ๋๋ค.์์ ์ ์ (diff)
- name: Build and Share Extension env: - VITE_DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} + DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} run: pnpm share:ext๐ Committable suggestion
๐ค Prompt for AI Agents