create-chai-tailwind-app 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.
- package/bin/index.js +44 -0
- package/package.json +8 -0
- package/template/dist/chai.css +0 -0
- package/template/index.html +29 -0
- package/template/package.json +15 -0
package/bin/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import { execSync } from "child_process";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
|
|
8
|
+
const projectName = process.argv[2];
|
|
9
|
+
|
|
10
|
+
if (!projectName) {
|
|
11
|
+
console.log("ā Please provide project name");
|
|
12
|
+
console.log("Usage: npx create-chai-app my-app");
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const targetDir = path.join(process.cwd(), projectName);
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
20
|
+
const __dirname = path.dirname(__filename);
|
|
21
|
+
|
|
22
|
+
const templateDir = path.join(__dirname, "../template");
|
|
23
|
+
|
|
24
|
+
// check if exists
|
|
25
|
+
if (fs.existsSync(targetDir)) {
|
|
26
|
+
console.log("ā Folder already exists");
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// create project
|
|
31
|
+
fs.mkdirSync(targetDir);
|
|
32
|
+
|
|
33
|
+
// copy template
|
|
34
|
+
fs.cpSync(templateDir, targetDir, { recursive: true });
|
|
35
|
+
|
|
36
|
+
console.log("š Project created");
|
|
37
|
+
|
|
38
|
+
// install dependencies
|
|
39
|
+
process.chdir(targetDir);
|
|
40
|
+
execSync("npm install", { stdio: "inherit" });
|
|
41
|
+
|
|
42
|
+
console.log("\nš Ready!");
|
|
43
|
+
console.log(`cd ${projectName}`);
|
|
44
|
+
console.log("npm run dev");
|
package/package.json
ADDED
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Chai App</title>
|
|
5
|
+
<link rel="stylesheet" href="./dist/chai.css">
|
|
6
|
+
</head>
|
|
7
|
+
|
|
8
|
+
<body class="chai-bg-gray-50 chai-text-gray-900 chai-p-20">
|
|
9
|
+
|
|
10
|
+
<h1 class="chai-fs-24 chai-fw-bold">
|
|
11
|
+
š ChaiTailwind App
|
|
12
|
+
</h1>
|
|
13
|
+
|
|
14
|
+
<div class="chai-p-20 chai-bg-blue-500 chai-text-white chai-mt-20">
|
|
15
|
+
Hello World
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<button onclick="toggleDark()" class="chai-p-10 chai-bg-gray-200">
|
|
19
|
+
Toggle Dark
|
|
20
|
+
</button>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
function toggleDark() {
|
|
24
|
+
document.body.classList.toggle("dark");
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
</body>
|
|
29
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "chai-app",
|
|
3
|
+
"scripts": {
|
|
4
|
+
"dev": "npm-run-all --parallel watch serve",
|
|
5
|
+
"watch": "chai",
|
|
6
|
+
"serve": "live-server ."
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"chai-tailwind-engine": "latest"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"live-server": "^1.2.2",
|
|
13
|
+
"npm-run-all": "^4.1.5"
|
|
14
|
+
}
|
|
15
|
+
}
|