diff --git a/README.md b/README.md new file mode 100644 index 0000000..86b699e --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# Project Creator Plugin for Acode + +A lightweight and efficient plugin for the Acode editor that allows you to instantly generate boilerplate project structures for web development (HTML5, PHP, and JavaScript) directly inside your active workspace. + +## Features + +- **HTML5 Template:** Instantly creates an `index.html` structure (pre-linked with style and script), a starter `style.css`, and a `script.js` file. +- **PHP Template:** Generates a clean starter `index.php` file. +- **JavaScript Template:** Generates a basic `index.js` file for quick scripting or Node.js environments. +- **Native UI Integration:** Uses Acode's official built-in modules for a seamless prompt and file refresh experience. + +## How to Use + +1. Open a folder in Acode's file manager (required so the plugin knows where to create the files). +2. Open the Command Palette in Acode (`Ctrl+Shift+P` or via the sidebar menu). +3. Search for and select **"Open Project Creator"**. +4. Choose the template you want to generate from the popup selection list. +5. The files will be created instantly and your file tree will automatically refresh! + +## Project Structure Created + +### HTML5 Option +```text +your-folder/ +├── index.html +├── style.css +└── script.js diff --git a/icon.png b/icon.png index 2d5d3c6..1150298 100644 Binary files a/icon.png and b/icon.png differ diff --git a/main.js b/main.js new file mode 100644 index 0000000..e74d74b --- /dev/null +++ b/main.js @@ -0,0 +1,95 @@ +import plugin from "./plugin.json"; + +function init(baseUrl, $page, cache) { + const commands = acode.require("commands"); + + commands.addCommand({ + name: "project-creator", + description: "Open Project Creator", + exec: async () => { + try { + const openFolder = acode.require("openFolder"); + const select = acode.require("select"); + const fsOperation = acode.require("fsOperation"); + const fileList = acode.require("fileList"); + + const currentFolder = openFolder.target; + + if (!currentFolder || !currentFolder.url) { + acode.alert( + "Erreur", + "Veuillez d'abord ouvrir ou sélectionner un dossier dans le gestionnaire de fichiers d'Acode." + ); + return; + } + + const options = [ + ["html", "Template Web HTML5 (index.html, style.css, script.js)"], + ["php", "Template PHP (index.php)"], + ["js", "Template JavaScript (index.js)"] + ]; + + const choice = await select("Créer un modèle de projet", options); + if (!choice) return; + + const fs = fsOperation(currentFolder.url); + + if (choice === "html") { + await fs.createFile("index.html", ` + +
+ + +