diff --git a/.gitignore b/.gitignore index db400be..3e8bb73 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -node_modules -yarn.lock -dist.zip -dist \ No newline at end of file +node_modules/ +acode-plugin/node_modules/ +*.zip diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..96eb606 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,41 @@ +# Changelog + +All notable changes to this project will be documented here. + +## [1.1.0] - 2026-08-04 + +### Added + +- Added new project templates: + - Python + - C + - C++ + - Java + + +- Added complete project generation. +- Added automatic file creation. +- Added new default project files. +- Improved template management. + +### Improved + +- Improved plugin structure. +- Improved project creation speed. +- Updated documentation. + +### Fixed + +- Fixed command registration issues. +- Fixed template creation errors. + +--- + +## [1.0.0] - Initial Release + +### Added + +- HTML template support. +- PHP template support. +- JavaScript template support. +- Basic project creation inside Acode. diff --git a/LICENSE b/LICENSE index 7c8c4b7..4e93c22 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ +cat > LICENSE << 'EOF' MIT License -Copyright (c) 2025 Acode Foundation +Copyright (c) 2026 KIMINOU Degrace Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -14,8 +15,5 @@ copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +EOF diff --git a/License b/License new file mode 100644 index 0000000..fa4e45b --- /dev/null +++ b/License @@ -0,0 +1,23 @@ +cat > LICENSE << 'EOF' +MIT License + +Copyright (c) 2026 KIMINOU Degrace + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +EOF diff --git a/acode-plugin/CHANGELOG.md b/acode-plugin/CHANGELOG.md new file mode 100644 index 0000000..96eb606 --- /dev/null +++ b/acode-plugin/CHANGELOG.md @@ -0,0 +1,41 @@ +# Changelog + +All notable changes to this project will be documented here. + +## [1.1.0] - 2026-08-04 + +### Added + +- Added new project templates: + - Python + - C + - C++ + - Java + + +- Added complete project generation. +- Added automatic file creation. +- Added new default project files. +- Improved template management. + +### Improved + +- Improved plugin structure. +- Improved project creation speed. +- Updated documentation. + +### Fixed + +- Fixed command registration issues. +- Fixed template creation errors. + +--- + +## [1.0.0] - Initial Release + +### Added + +- HTML template support. +- PHP template support. +- JavaScript template support. +- Basic project creation inside Acode. diff --git a/acode-plugin/dist/main.js b/acode-plugin/dist/main.js new file mode 100644 index 0000000..2213c1f --- /dev/null +++ b/acode-plugin/dist/main.js @@ -0,0 +1,25 @@ +(()=>{var i={$schema:"https://acode.app/schema/plugin/v0.1.0.json",id:"com.degrace.templates",name:"Templates",main:"dist/main.js",version:"1.0.0",icon:"icon.png",minVersionCode:290,license:"MIT",price:0,keywords:["template","html","php","javascript"],author:{name:"Hacker2.0",email:"kiminoudegrace64@gmail.com",github:"Degrace15"},description:"Create HTML, PHP and JavaScript project templates in Acode."};function n(c,d,p){let o=acode.require("commands"),s=acode.require("select"),r=acode.require("fsOperation");o.addCommand({name:"templates",description:"Create project templates",exec:async()=>{let t=await s("Choose a template",[["html","HTML5 Template"],["php","PHP Template"],["js","JavaScript Template"]]);if(!t)return;let a=addedFolder[0];if(!a){acode.alert("Error","Please open a folder in Acode first.");return}try{let e=await r(a.url);t==="html"?(await e.createFile("index.html",` + + + + +My Project + + + + + +

Hello Acode \u{1F680}

+ + + + +` + ); + + + await fs.createFile( + "style.css", +`body { + margin: 0; + padding: 20px; + font-family: Arial, sans-serif; +}` + ); + + + await fs.createFile( + "script.js", +`console.log("JavaScript loaded successfully");` + ); + + + } + else if (choice === "php") { + + await fs.createFile( + "index.php", +`` + ); + + + } else if (choice === "js") { + + await fs.createFile( + "index.js", +`console.log("Hello JavaScript 🚀");` + ); + + } + + + folder.reload(); + + + window.toast( + "Template created successfully ✅" + ); + + + } catch (error) { + + + acode.alert( + "Error", + error.message + ); + + + } + + + } + + }); + + +} + + +function unmount() { + + const commands = acode.require("commands"); + + commands.removeCommand("templates"); + +} + + +acode.setPluginInit( + plugin.id, + init +); + + +acode.setPluginUnmount( + plugin.id, + unmount +); diff --git a/acode-plugin/src/templates/c/main.c b/acode-plugin/src/templates/c/main.c new file mode 100644 index 0000000..f72db1f --- /dev/null +++ b/acode-plugin/src/templates/c/main.c @@ -0,0 +1,7 @@ +#include + +int main() { + printf("Hello from C 🚀\n"); + + return 0; +} diff --git a/acode-plugin/src/templates/cpp/main.cpp b/acode-plugin/src/templates/cpp/main.cpp new file mode 100644 index 0000000..75d1088 --- /dev/null +++ b/acode-plugin/src/templates/cpp/main.cpp @@ -0,0 +1,9 @@ +#include + +using namespace std; + +int main() { + cout << "Hello from C++ 🚀" << endl; + + return 0; +} diff --git a/acode-plugin/src/templates/html/index.html b/acode-plugin/src/templates/html/index.html new file mode 100644 index 0000000..46bb442 --- /dev/null +++ b/acode-plugin/src/templates/html/index.html @@ -0,0 +1,15 @@ + + + + + + My Project + + + + +

Hello Acode 🚀

+ + + + diff --git a/acode-plugin/src/templates/html/script.js b/acode-plugin/src/templates/html/script.js new file mode 100644 index 0000000..19b8192 --- /dev/null +++ b/acode-plugin/src/templates/html/script.js @@ -0,0 +1,11 @@ +document.addEventListener("DOMContentLoaded", () => { + console.log("Project loaded successfully!"); + + const button = document.querySelector("button"); + + if (button) { + button.addEventListener("click", () => { + alert("Hello from Templates 🚀"); + }); + } +}); diff --git a/acode-plugin/src/templates/html/style.css b/acode-plugin/src/templates/html/style.css new file mode 100644 index 0000000..d7e9eb0 --- /dev/null +++ b/acode-plugin/src/templates/html/style.css @@ -0,0 +1,34 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: Arial, sans-serif; + background-color: #f5f5f5; + color: #333; + padding: 20px; +} + +h1 { + color: #0066cc; + margin-bottom: 10px; +} + +p { + line-height: 1.6; +} + +button { + padding: 10px 15px; + border: none; + border-radius: 5px; + background-color: #0066cc; + color: white; + cursor: pointer; +} + +button:hover { + background-color: #0052a3; +} diff --git a/acode-plugin/src/templates/java/Main.java b/acode-plugin/src/templates/java/Main.java new file mode 100644 index 0000000..9bbb894 --- /dev/null +++ b/acode-plugin/src/templates/java/Main.java @@ -0,0 +1,8 @@ +public class Main { + + public static void main(String[] args) { + + System.out.println("Hello from Java 🚀"); + + } +} diff --git a/acode-plugin/src/templates/javascript/index.js b/acode-plugin/src/templates/javascript/index.js new file mode 100644 index 0000000..99478d7 --- /dev/null +++ b/acode-plugin/src/templates/javascript/index.js @@ -0,0 +1,11 @@ +"use strict"; + +function main() { + console.log("JavaScript project started 🚀"); + + const message = "Hello from Templates"; + + console.log(message); +} + +main(); diff --git a/acode-plugin/src/templates/php/config.php b/acode-plugin/src/templates/php/config.php new file mode 100644 index 0000000..eb6f1f1 --- /dev/null +++ b/acode-plugin/src/templates/php/config.php @@ -0,0 +1,27 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); + +} catch (PDOException $e) { + die("Database connection failed: " . $e->getMessage()); +} diff --git a/acode-plugin/src/templates/php/index.php b/acode-plugin/src/templates/php/index.php new file mode 100644 index 0000000..132041e --- /dev/null +++ b/acode-plugin/src/templates/php/index.php @@ -0,0 +1,20 @@ + + + + + + + PHP Project + + + +

+ +

Your PHP project is ready.

+ + + diff --git a/acode-plugin/src/templates/python/main.py b/acode-plugin/src/templates/python/main.py new file mode 100644 index 0000000..07a3575 --- /dev/null +++ b/acode-plugin/src/templates/python/main.py @@ -0,0 +1,14 @@ +""" +Python Project Template +Created with Templates plugin for Acode +""" + +def main(): + print("Hello from Python 🚀") + + message = "Python project started successfully" + print(message) + + +if __name__ == "__main__": + main() diff --git a/acode-plugin/src/templates/python/requirements.txt b/acode-plugin/src/templates/python/requirements.txt new file mode 100644 index 0000000..1d3e96f --- /dev/null +++ b/acode-plugin/src/templates/python/requirements.txt @@ -0,0 +1,4 @@ +# Python project dependencies +# Add your packages here + +requests==2.32.3 diff --git a/dist/main.js b/dist/main.js new file mode 100644 index 0000000..53d4670 --- /dev/null +++ b/dist/main.js @@ -0,0 +1,54 @@ +(()=>{var i={$schema:"https://acode.app/schema/plugin/v0.1.0.json",id:"com.degrace.templates",name:"Templates",main:"dist/main.js",version:"1.1.0",readme:"readme.md",changelogs:"CHANGELOG.md",repository:"https://github.com/Degrace15/acode-templates",icon:"icon.png",minVersionCode:290,license:"MIT",price:0,keywords:["template","html","css","php","javascript","python","c","cpp","java","project-generator"],author:{name:"Hacker2.0",email:"kiminoudegrace64@gmail.com",github:"Degrace15"},description:"Create complete project templates for HTML, PHP, JavaScript, Python, C, C++, Java in Acode."};function n(o,m,d){let c=acode.require("commands"),r=acode.require("select"),s=acode.require("fsOperation");c.addCommand({name:"templates",description:"Create project templates",exec:async()=>{let a=await r("Choose a template",[["html","HTML5 Project"],["php","PHP Project"],["javascript","JavaScript Project"],["python","Python Project"],["c","C Project"],["cpp","C++ Project"],["java","Java Project"]]);if(!a)return;let t=addedFolder[0];if(!t){acode.alert("Error","Please open a folder in Acode first.");return}try{let e=await s(t.url);a==="html"?(await e.createFile("index.html",` + + +My Website + + + + + +

Hello Acode \u{1F680}

+ + + + +` + ); + + + await fs.createFile( + "style.css", +`body { + margin: 0; + padding: 20px; + font-family: Arial; +}` + ); + + + await fs.createFile( + "script.js", +`console.log("JavaScript loaded");` + ); + + } + + + else if (choice === "php") { + + await fs.createFile( + "index.php", +`` + ); + + + await fs.createFile( + "config.php", +`` + ); + + } + + + else if (choice === "javascript") { + + await fs.createFile( + "index.js", +`console.log("Hello JavaScript 🚀");` + ); + + } + + + else if (choice === "python") { + + await fs.createFile( + "main.py", +`print("Hello Python 🚀")` + ); + + + await fs.createFile( + "requirements.txt", +`` + ); + + } + + + else if (choice === "c") { + + await fs.createFile( + "main.c", +`#include + +int main(){ + + printf("Hello C 🚀"); + + return 0; +}` + ); + + } + + + else if (choice === "cpp") { + + await fs.createFile( + "main.cpp", +`#include + +using namespace std; + +int main(){ + + cout << "Hello C++ 🚀"; + + return 0; +}` + ); + + } + + + else if (choice === "java") { + + await fs.createFile( + "Main.java", +`public class Main { + + public static void main(String[] args){ + + System.out.println("Hello Java 🚀"); -if (window.acode) { - const acodePlugin = new AcodePlugin(); - acode.setPluginInit(plugin.id, async (baseUrl, $page, { cacheFileUrl, cacheFile }) => { - if (!baseUrl.endsWith('/')) { - baseUrl += '/'; } - acodePlugin.baseUrl = baseUrl; - await acodePlugin.init($page, cacheFile, cacheFileUrl); - }); - acode.setPluginUnmount(plugin.id, () => { - acodePlugin.destroy(); + +}` + ); + + } + + + folder.reload(); + + + window.toast( + "Template created successfully ✅" + ); + + + } catch(error) { + + + acode.alert( + "Error", + error.message + ); + + + } + + } + }); + } + + + +function unmount(){ + + const commands = acode.require("commands"); + + commands.removeCommand("templates"); + +} + + + +acode.setPluginInit( + plugin.id, + init +); + + +acode.setPluginUnmount( + plugin.id, + unmount +); diff --git a/src/main.js b/src/main.js new file mode 100644 index 0000000..a595e01 --- /dev/null +++ b/src/main.js @@ -0,0 +1,250 @@ +import plugin from "../plugin.json"; + +function init(baseUrl, $page, cache) { + + const commands = acode.require("commands"); + const select = acode.require("select"); + const fsOperation = acode.require("fsOperation"); + + commands.addCommand({ + + name: "templates", + description: "Create project templates", + + exec: async () => { + + const templates = [ + ["html", "HTML5 Project"], + ["php", "PHP Project"], + ["javascript", "JavaScript Project"], + ["python", "Python Project"], + ["c", "C Project"], + ["cpp", "C++ Project"], + ["java", "Java Project"] + ]; + + + const choice = await select( + "Choose a template", + templates + ); + + + if (!choice) return; + + + const folder = addedFolder[0]; + + + if (!folder) { + + acode.alert( + "Error", + "Please open a folder in Acode first." + ); + + return; + } + + + try { + + const fs = await fsOperation(folder.url); + + + if (choice === "html") { + + await fs.createFile( + "index.html", +` + + +My Website + + + + + +

Hello Acode 🚀

+ + + + +` + ); + + + await fs.createFile( + "style.css", +`body { + margin: 0; + padding: 20px; + font-family: Arial; +}` + ); + + + await fs.createFile( + "script.js", +`console.log("JavaScript loaded");` + ); + + } + + + else if (choice === "php") { + + await fs.createFile( + "index.php", +`` + ); + + + await fs.createFile( + "config.php", +`` + ); + + } + + + else if (choice === "javascript") { + + await fs.createFile( + "index.js", +`console.log("Hello JavaScript 🚀");` + ); + + } + + + else if (choice === "python") { + + await fs.createFile( + "main.py", +`print("Hello Python 🚀")` + ); + + + await fs.createFile( + "requirements.txt", +`` + ); + + } + + + else if (choice === "c") { + + await fs.createFile( + "main.c", +`#include + +int main(){ + + printf("Hello C 🚀"); + + return 0; +}` + ); + + } + + + else if (choice === "cpp") { + + await fs.createFile( + "main.cpp", +`#include + +using namespace std; + +int main(){ + + cout << "Hello C++ 🚀"; + + return 0; +}` + ); + + } + + + else if (choice === "java") { + + await fs.createFile( + "Main.java", +`public class Main { + + public static void main(String[] args){ + + System.out.println("Hello Java 🚀"); + + } + +}` + ); + + } + + + folder.reload(); + + + window.toast( + "Template created successfully ✅" + ); + + + } catch(error) { + + + acode.alert( + "Error", + error.message + ); + + + } + + } + + }); + +} + + + +function unmount(){ + + const commands = acode.require("commands"); + + commands.removeCommand("templates"); + +} + + + +acode.setPluginInit( + plugin.id, + init +); + + +acode.setPluginUnmount( + plugin.id, + unmount +); + + diff --git a/src/templates/c/main.c b/src/templates/c/main.c new file mode 100644 index 0000000..f72db1f --- /dev/null +++ b/src/templates/c/main.c @@ -0,0 +1,7 @@ +#include + +int main() { + printf("Hello from C 🚀\n"); + + return 0; +} diff --git a/src/templates/cpp/main.cpp b/src/templates/cpp/main.cpp new file mode 100644 index 0000000..75d1088 --- /dev/null +++ b/src/templates/cpp/main.cpp @@ -0,0 +1,9 @@ +#include + +using namespace std; + +int main() { + cout << "Hello from C++ 🚀" << endl; + + return 0; +} diff --git a/src/templates/html/index.html b/src/templates/html/index.html new file mode 100644 index 0000000..46bb442 --- /dev/null +++ b/src/templates/html/index.html @@ -0,0 +1,15 @@ + + + + + + My Project + + + + +

Hello Acode 🚀

+ + + + diff --git a/src/templates/html/script.js b/src/templates/html/script.js new file mode 100644 index 0000000..19b8192 --- /dev/null +++ b/src/templates/html/script.js @@ -0,0 +1,11 @@ +document.addEventListener("DOMContentLoaded", () => { + console.log("Project loaded successfully!"); + + const button = document.querySelector("button"); + + if (button) { + button.addEventListener("click", () => { + alert("Hello from Templates 🚀"); + }); + } +}); diff --git a/src/templates/html/style.css b/src/templates/html/style.css new file mode 100644 index 0000000..d7e9eb0 --- /dev/null +++ b/src/templates/html/style.css @@ -0,0 +1,34 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: Arial, sans-serif; + background-color: #f5f5f5; + color: #333; + padding: 20px; +} + +h1 { + color: #0066cc; + margin-bottom: 10px; +} + +p { + line-height: 1.6; +} + +button { + padding: 10px 15px; + border: none; + border-radius: 5px; + background-color: #0066cc; + color: white; + cursor: pointer; +} + +button:hover { + background-color: #0052a3; +} diff --git a/src/templates/java/Main.java b/src/templates/java/Main.java new file mode 100644 index 0000000..9bbb894 --- /dev/null +++ b/src/templates/java/Main.java @@ -0,0 +1,8 @@ +public class Main { + + public static void main(String[] args) { + + System.out.println("Hello from Java 🚀"); + + } +} diff --git a/src/templates/javascript/index.js b/src/templates/javascript/index.js new file mode 100644 index 0000000..99478d7 --- /dev/null +++ b/src/templates/javascript/index.js @@ -0,0 +1,11 @@ +"use strict"; + +function main() { + console.log("JavaScript project started 🚀"); + + const message = "Hello from Templates"; + + console.log(message); +} + +main(); diff --git a/src/templates/php/config.php b/src/templates/php/config.php new file mode 100644 index 0000000..eb6f1f1 --- /dev/null +++ b/src/templates/php/config.php @@ -0,0 +1,27 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); + +} catch (PDOException $e) { + die("Database connection failed: " . $e->getMessage()); +} diff --git a/src/templates/php/index.php b/src/templates/php/index.php new file mode 100644 index 0000000..132041e --- /dev/null +++ b/src/templates/php/index.php @@ -0,0 +1,20 @@ + + + + + + + PHP Project + + + +

+ +

Your PHP project is ready.

+ + + diff --git a/src/templates/python/main.py b/src/templates/python/main.py new file mode 100644 index 0000000..07a3575 --- /dev/null +++ b/src/templates/python/main.py @@ -0,0 +1,14 @@ +""" +Python Project Template +Created with Templates plugin for Acode +""" + +def main(): + print("Hello from Python 🚀") + + message = "Python project started successfully" + print(message) + + +if __name__ == "__main__": + main() diff --git a/src/templates/python/requirements.txt b/src/templates/python/requirements.txt new file mode 100644 index 0000000..1d3e96f --- /dev/null +++ b/src/templates/python/requirements.txt @@ -0,0 +1,4 @@ +# Python project dependencies +# Add your packages here + +requests==2.32.3