@thnoxs/thnoxs 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +30 -0
  2. package/index.js +115 -0
  3. package/package.json +37 -0
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # Thnoxs HTML Template CLI πŸš€
2
+
3
+ [![npm version](https://img.shields.io/npm/v/thnoxs-html.svg)](https://www.npmjs.com/package/thnoxs-html)
4
+ [![License](https://img.shields.io/badge/license-ISC-blue.svg)](LICENSE)
5
+
6
+ ---
7
+
8
+ ## ✨ Overview
9
+
10
+ **Thnoxs HTML Template CLI** is a lightweight, professional, and beginner-friendly **command-line tool** to instantly generate a clean HTML, CSS, and JavaScript project template on your local machine.
11
+
12
+ No more creating files manually β€” just one command, and you’re ready to code.
13
+
14
+ - βœ… Modern HTML5 structure
15
+ - βœ… Font Awesome integration
16
+ - βœ… Custom CSS & JS starter files
17
+ - βœ… `src/` folder organization for a clean project
18
+ - βœ… Works with **Live Server** for instant preview
19
+ - βœ… Npx-ready for easy global usage
20
+
21
+ ---
22
+
23
+ ## πŸ’‘ Features
24
+
25
+ - CLI tool powered by Node.js
26
+ - Automatically installs dependencies (`live-server`)
27
+ - Professional colored CLI messages with ASCII banner
28
+ - Ready-to-use **`src/` folder** structure
29
+ - Optional: open browser automatically via `npm start`
30
+
package/index.js ADDED
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "fs";
4
+ import path from "path";
5
+ import { execSync } from "child_process";
6
+
7
+ let ora, chalk, open;
8
+
9
+ // βœ… Try importing dependencies, fallback to simple console if not available
10
+ try {
11
+ ora = (await import("ora")).default;
12
+ chalk = (await import("chalk")).default;
13
+ open = (await import("open")).default;
14
+ } catch {
15
+ ora = () => ({ start: () => ({ succeed: () => {} }) });
16
+ chalk = { blue: (txt) => txt, green: (txt) => txt };
17
+ open = () => {};
18
+ }
19
+
20
+ const cwd = process.cwd();
21
+ const srcFolder = path.join(cwd, "src");
22
+
23
+ // 0️⃣ Create src folder
24
+ if (!fs.existsSync(srcFolder)) fs.mkdirSync(srcFolder);
25
+
26
+ // 1️⃣ Template files
27
+ const files = {
28
+ "index.html": `<!DOCTYPE html>
29
+ <html lang="en">
30
+ <head>
31
+ <meta charset="UTF-8" />
32
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
33
+ <link rel="icon" href="data:," />
34
+ <title>Thnoxs - Template</title>
35
+ <link
36
+ rel="stylesheet"
37
+ href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css"
38
+ integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLJAJ9/2PkPKZ5QiAj6Ta86w+fsb2TkcmfRyVX3pBnMFcV7oQPJkl9QevSCWr3W6A=="
39
+ crossorigin="anonymous"
40
+ referrerpolicy="no-referrer"
41
+ />
42
+ <link rel="stylesheet" href="style.css" />
43
+ </head>
44
+ <body>
45
+ <h1>Welcome to Thnoxs Template</h1>
46
+ <script src="script.js"></script>
47
+ </body>
48
+ </html>
49
+ `,
50
+
51
+ "style.css": `* {
52
+ margin:0;
53
+ padding:0;
54
+ box-sizing:border-box;
55
+ }
56
+
57
+ body {
58
+ font-family: system-ui, sans-serif;
59
+ }`,
60
+
61
+ "script.js": `console.log("Thnoxs template running πŸš€");`,
62
+ };
63
+
64
+ // 2️⃣ Create files inside src
65
+ Object.entries(files).forEach(([file, content]) => {
66
+ const filePath = path.join(srcFolder, file);
67
+ if (!fs.existsSync(filePath)) fs.writeFileSync(filePath, content);
68
+ });
69
+
70
+ // 3️⃣ Create package.json if not exists
71
+ const packageJsonPath = path.join(cwd, "package.json");
72
+ if (!fs.existsSync(packageJsonPath)) {
73
+ const packageJson = {
74
+ name: "thnoxs-template",
75
+ version: "1.0.0",
76
+ private: false,
77
+ scripts: { start: "live-server src --quiet --port=8080" },
78
+ devDependencies: { "live-server": "^1.2.2" },
79
+ };
80
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
81
+ console.log("πŸ“¦ package.json created");
82
+ }
83
+
84
+ // 4️⃣ ASCII Banner for pro feel
85
+ console.log(
86
+ chalk.green(`
87
+ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
88
+ β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•”β•β•β•β•β•
89
+ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
90
+ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β•šβ•β•β•β•β–ˆβ–ˆβ•‘
91
+ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘
92
+ β•šβ•β• β•šβ•β• β•šβ•β•β•šβ•β• β•šβ•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β•β•šβ•β•β•β•β•β•β•
93
+ `)
94
+ );
95
+
96
+ // 5️⃣ Install dependencies with spinner
97
+ const spinner = ora("Installing dependencies...").start();
98
+ execSync("npm install --silent", { cwd, stdio: "ignore" });
99
+ spinner.succeed(chalk.green("Dependencies installed βœ…"));
100
+
101
+ // 7️⃣ Link Outopen
102
+ const url = "https://github.com/Thnoxs";
103
+ url;
104
+
105
+ // 6️⃣ Final clean message
106
+ console.log(
107
+ chalk.blue(`
108
+ ✨ Thnoxs HTML Template Ready!
109
+ πŸ“ All template files are in /src folder
110
+ 🌐 Browser opened automatically
111
+ πŸ”­ Explore the project on GitHub: ${url}
112
+
113
+ πŸ‘‰ Run 'npm start' to restart the server
114
+ `)
115
+ );
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@thnoxs/thnoxs",
3
+ "version": "1.0.0",
4
+ "description": "A command-line tool for generating HTML, CSS, and JavaScript files from templates.",
5
+ "keywords": [
6
+ "html generator",
7
+ "css generator",
8
+ "javascript generator",
9
+ "template generator",
10
+ "cli tool"
11
+ ],
12
+ "homepage": "https://github.com/Thnoxs/Thnoxs#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/Thnoxs/Thnoxs/issues"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/Thnoxs/thnoxs.git"
19
+ },
20
+ "license": "ISC",
21
+ "author": "Ankit Jaiswal",
22
+ "type": "module",
23
+ "main": "index.js",
24
+ "bin": {
25
+ "thnoxs": "index.js"
26
+ },
27
+ "scripts": {
28
+ "start": "live-server src --quiet --port=8080 --open"
29
+ },
30
+ "dependencies": {
31
+ "chalk": "^5.6.2",
32
+ "ora": "^9.0.0"
33
+ },
34
+ "devDependencies": {
35
+ "live-server": "^1.2.2"
36
+ }
37
+ }