Skip to content

Commit 0748090

Browse files
committed
start update plugin
0 parents  commit 0748090

28 files changed

Lines changed: 13836 additions & 0 deletions

.acode/pack-zip.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
const path = require('path');
2+
const fs = require('fs');
3+
const JSZip = require('jszip');
4+
5+
const rootDir = path.join(__dirname, '..');
6+
const distFolder = path.join(rootDir, 'dist');
7+
const zip = new JSZip();
8+
9+
function safeAddFile(zipObj, name, filePath) {
10+
if (fs.existsSync(filePath)) {
11+
zipObj.file(name, fs.readFileSync(filePath));
12+
console.log(`Added: ${name}`);
13+
} else {
14+
console.warn(`Missing: ${filePath}`);
15+
}
16+
}
17+
18+
// tambahin file wajib di root zip
19+
safeAddFile(zip, 'icon.png', path.join(rootDir, 'icon.png'));
20+
safeAddFile(zip, 'plugin.json', path.join(rootDir, 'plugin.json'));
21+
22+
// readme case-insensitive
23+
let readmePath = path.join(rootDir, 'readme.md');
24+
if (!fs.existsSync(readmePath)) {
25+
readmePath = path.join(rootDir, 'README.md');
26+
}
27+
safeAddFile(zip, 'readme.md', readmePath);
28+
29+
// ambil main.js dari dist langsung di root zip
30+
safeAddFile(zip, 'main.js', path.join(distFolder, 'main.js'));
31+
32+
// copy folder assets (kalau ada)
33+
const assetsFolder = path.join(distFolder, 'assets');
34+
if (fs.existsSync(assetsFolder)) {
35+
function addFolder(zipObj, folderPath, relativePath = '') {
36+
const entries = fs.readdirSync(folderPath);
37+
entries.forEach((file) => {
38+
const fullPath = path.join(folderPath, file);
39+
const stat = fs.statSync(fullPath);
40+
if (stat.isDirectory()) {
41+
const subFolder = zipObj.folder(path.join(relativePath, file));
42+
addFolder(subFolder, fullPath, path.join(relativePath, file));
43+
} else {
44+
zipObj.file(path.join(relativePath, file), fs.readFileSync(fullPath));
45+
}
46+
});
47+
}
48+
addFolder(zip.folder('assets'), assetsFolder, '');
49+
}
50+
51+
// generate fresh zip
52+
const outPath = path.join(rootDir, 'AI.zip');
53+
if (fs.existsSync(outPath)) {
54+
fs.unlinkSync(outPath);
55+
}
56+
57+
zip
58+
.generateNodeStream({ type: 'nodebuffer', streamFiles: true })
59+
.pipe(fs.createWriteStream(outPath))
60+
.on('finish', () => {
61+
console.log('✅ AI.zip created cleanly');
62+
});

.github/FUNDING.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# These are supported funding model platforms
2+
3+
github: RenzMc
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/ISSUE_TEMPLATE/general.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
name: General
3+
about: feel free to ask anything or not
4+
title: "[GENERAL]"
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
---
11+
name: "📖 General Issue"
12+
about: "Use this template for general issues, questions, suggestions, or content corrections."
13+
title: "[General] "
14+
labels: ["general", "discussion"]
15+
assignees: []
16+
---
17+
18+
## 📌 Description
19+
_Describe the issue, idea, or content you want to discuss._
20+
21+
Example:
22+
- Typo found in documentation.
23+
- Suggestion to add more explanation in the API section.
24+
- General question about usage.
25+
26+
---
27+
28+
## 🔍 Details
29+
- **Topic/Title**:
30+
- **Location (file/page)**:
31+
- **Screenshots/References (optional)**:
32+
33+
---
34+
35+
## ✅ Checklist
36+
Before submitting, please confirm:
37+
- [ ] I have checked if this issue already exists.
38+
- [ ] I have clearly described the issue/idea.
39+
- [ ] I have included relevant details (if necessary).

.github/workflows/main.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Build Acode Plugin
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
workflow_dispatch: {}
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
cache: 'npm'
23+
24+
- name: Install dependencies
25+
shell: bash
26+
run: |
27+
npm install
28+
29+
- name: Run build script (show stdout/stderr)
30+
shell: bash
31+
run: |
32+
echo "== RUNNING BUILD =="
33+
node -v
34+
npm -v
35+
set -o pipefail
36+
npm run build 2>&1 | tee build-output.log || true
37+
echo "=== BUILD OUTPUT (last 200 lines) ==="
38+
tail -n 200 build-output.log || true
39+
40+
- name: Debug - show workspace recursively
41+
shell: bash
42+
run: |
43+
echo "Working dir: $(pwd)"
44+
echo "Top-level files:"
45+
ls -la
46+
echo "Find zip files (if any):"
47+
find . -type f -name "*.zip" -print -exec ls -lh {} \; || true
48+
49+
- name: Prepare artifacts
50+
shell: bash
51+
run: |
52+
mkdir -p .artifacts
53+
54+
# Kalau AI.zip sudah ada di repo, pakai itu
55+
if [ -f "AI.zip" ]; then
56+
cp AI.zip .artifacts/
57+
echo "✅ Copied AI.zip to artifacts"
58+
else
59+
echo "❌ AI.zip not found, creating from dist"
60+
if [ -d "dist" ]; then
61+
# Bikin zip clean → isi dist/* langsung di root zip
62+
if [ -f "README.md" ]; then
63+
zip -r .artifacts/AI.zip dist/* plugin.json icon.png README.md
64+
elif [ -f "readme.md" ]; then
65+
zip -r .artifacts/AI.zip dist/* plugin.json icon.png readme.md
66+
else
67+
zip -r .artifacts/AI.zip dist/* plugin.json icon.png
68+
fi
69+
else
70+
echo "❌ No dist folder found"
71+
exit 1
72+
fi
73+
fi
74+
75+
echo "=== Final artifacts check ==="
76+
ls -la .artifacts/
77+
file .artifacts/AI.zip
78+
echo "File exists check:"
79+
test -f .artifacts/AI.zip && echo "✅ AI.zip exists" || echo "❌ AI.zip missing"
80+
81+
- name: Upload plugin artifact
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: acode-plugin-ai
85+
path: .artifacts/AI.zip
86+
if-no-files-found: error

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
secrets
3+
AI.zip

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Renz
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

build.mjs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import * as esbuild from "esbuild";
2+
import { sassPlugin } from "esbuild-sass-plugin";
3+
import { exec } from "child_process";
4+
5+
let result = await esbuild.build({
6+
entryPoints: ["src/main.js"],
7+
bundle: true,
8+
minify: true,
9+
logLevel: "info",
10+
color: true,
11+
outdir: "dist",
12+
plugins: [
13+
sassPlugin({
14+
type: "css-text",
15+
}),
16+
],
17+
});
18+
19+
exec("node .acode/pack-zip.js", (err, stdout, stderr) => {
20+
if (err) {
21+
console.error(err);
22+
return;
23+
}
24+
console.log(stdout);
25+
});

0 commit comments

Comments
 (0)