@aakaar/cli 0.0.3 → 0.0.5
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/dist/index.cjs +38 -36
- package/dist/index.js +45 -43
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -12,14 +12,31 @@ var import_execa = require("execa");
|
|
|
12
12
|
// src/lib/operations/utils/config.ts
|
|
13
13
|
var import_node_fs = require("fs");
|
|
14
14
|
var CONFIG_FILE = "./aakaar.json";
|
|
15
|
-
var
|
|
15
|
+
var DEFAULT_CONFIG = {
|
|
16
|
+
host: "http://aakaar.navnote.com",
|
|
17
|
+
core: {
|
|
18
|
+
path: "src/design",
|
|
19
|
+
import: "../../core"
|
|
20
|
+
},
|
|
16
21
|
tokens: {
|
|
17
|
-
color: "
|
|
18
|
-
|
|
22
|
+
color: "a42700",
|
|
23
|
+
strategy: "harmony",
|
|
24
|
+
output: "src/design/css"
|
|
19
25
|
},
|
|
20
26
|
react: {
|
|
21
|
-
output: "
|
|
27
|
+
output: "src/design/components"
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var config = (0, import_node_fs.existsSync)(CONFIG_FILE) ? JSON.parse((0, import_node_fs.readFileSync)(CONFIG_FILE, "utf-8")) : DEFAULT_CONFIG;
|
|
31
|
+
var writeConfig = (config2) => {
|
|
32
|
+
(0, import_node_fs.writeFileSync)(CONFIG_FILE, JSON.stringify(config2, null, 2));
|
|
33
|
+
};
|
|
34
|
+
var readConfig = () => {
|
|
35
|
+
if ((0, import_node_fs.existsSync)(CONFIG_FILE)) {
|
|
36
|
+
return JSON.parse((0, import_node_fs.readFileSync)(CONFIG_FILE, "utf-8"));
|
|
22
37
|
}
|
|
38
|
+
writeConfig(DEFAULT_CONFIG);
|
|
39
|
+
return DEFAULT_CONFIG;
|
|
23
40
|
};
|
|
24
41
|
|
|
25
42
|
// src/lib/operations/utils/pm.ts
|
|
@@ -52,16 +69,20 @@ var add = new import_commander.Command().name("add").description("add component
|
|
|
52
69
|
const response = await fetch(componentUrl);
|
|
53
70
|
const componentConfig = await response.json();
|
|
54
71
|
if (componentConfig.dependencies) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
if (!config.disableInstall) {
|
|
73
|
+
await (0, import_execa.execa)(
|
|
74
|
+
packageManager,
|
|
75
|
+
[
|
|
76
|
+
packageManager === "npm" ? "install" : "add",
|
|
77
|
+
...componentConfig.dependencies
|
|
78
|
+
],
|
|
79
|
+
{
|
|
80
|
+
cwd
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
} else {
|
|
84
|
+
console.log(`Skipping installation of dependencies for ${component}`);
|
|
85
|
+
}
|
|
65
86
|
}
|
|
66
87
|
if (componentConfig.files.length > 0) {
|
|
67
88
|
for (const file of componentConfig.files) {
|
|
@@ -95,7 +116,8 @@ var REQUIRED_PACKAGES = [
|
|
|
95
116
|
"clsx",
|
|
96
117
|
"tailwind-merge",
|
|
97
118
|
"react",
|
|
98
|
-
"react-dom"
|
|
119
|
+
"react-dom",
|
|
120
|
+
"framer-motion"
|
|
99
121
|
];
|
|
100
122
|
|
|
101
123
|
// src/lib/operations/utils/verify.ts
|
|
@@ -122,27 +144,7 @@ var verify = async () => {
|
|
|
122
144
|
// src/lib/operations/commands/setup.ts
|
|
123
145
|
var setup = new import_commander2.Command().name("setup").description("setup the aakaar ui").action(async () => {
|
|
124
146
|
await verify();
|
|
125
|
-
const
|
|
126
|
-
host: "http://aakaar.navnote.com",
|
|
127
|
-
core: {
|
|
128
|
-
path: "src/design",
|
|
129
|
-
import: "../../core"
|
|
130
|
-
},
|
|
131
|
-
tokens: {
|
|
132
|
-
color: "a42700",
|
|
133
|
-
strategy: "harmony",
|
|
134
|
-
output: "src/design/css"
|
|
135
|
-
},
|
|
136
|
-
react: {
|
|
137
|
-
output: "src/design/components"
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
const finalAakaarJson = (0, import_node_fs4.existsSync)("aakaar.json") ? JSON.parse((0, import_node_fs4.readFileSync)("aakaar.json", "utf-8")) : aakaarJson;
|
|
141
|
-
if (!(0, import_node_fs4.existsSync)("aakaar.json")) {
|
|
142
|
-
(0, import_node_fs4.writeFileSync)("aakaar.json", JSON.stringify(aakaarJson, null, 2));
|
|
143
|
-
} else {
|
|
144
|
-
console.log("aakaar.json already exists");
|
|
145
|
-
}
|
|
147
|
+
const finalAakaarJson = readConfig();
|
|
146
148
|
const proceed = await new Promise((resolve) => {
|
|
147
149
|
const readline = (0, import_node_readline.createInterface)({
|
|
148
150
|
input: process.stdin,
|
package/dist/index.js
CHANGED
|
@@ -4,21 +4,38 @@
|
|
|
4
4
|
import { Command as Command4 } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/lib/operations/commands/add.ts
|
|
7
|
-
import { existsSync as existsSync2, mkdirSync, writeFileSync } from "fs";
|
|
7
|
+
import { existsSync as existsSync2, mkdirSync, writeFileSync as writeFileSync2 } from "fs";
|
|
8
8
|
import { Command } from "commander";
|
|
9
9
|
import { execa } from "execa";
|
|
10
10
|
|
|
11
11
|
// src/lib/operations/utils/config.ts
|
|
12
|
-
import { existsSync, readFileSync } from "fs";
|
|
12
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
13
13
|
var CONFIG_FILE = "./aakaar.json";
|
|
14
|
-
var
|
|
14
|
+
var DEFAULT_CONFIG = {
|
|
15
|
+
host: "http://aakaar.navnote.com",
|
|
16
|
+
core: {
|
|
17
|
+
path: "src/design",
|
|
18
|
+
import: "../../core"
|
|
19
|
+
},
|
|
15
20
|
tokens: {
|
|
16
|
-
color: "
|
|
17
|
-
|
|
21
|
+
color: "a42700",
|
|
22
|
+
strategy: "harmony",
|
|
23
|
+
output: "src/design/css"
|
|
18
24
|
},
|
|
19
25
|
react: {
|
|
20
|
-
output: "
|
|
26
|
+
output: "src/design/components"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var config = existsSync(CONFIG_FILE) ? JSON.parse(readFileSync(CONFIG_FILE, "utf-8")) : DEFAULT_CONFIG;
|
|
30
|
+
var writeConfig = (config2) => {
|
|
31
|
+
writeFileSync(CONFIG_FILE, JSON.stringify(config2, null, 2));
|
|
32
|
+
};
|
|
33
|
+
var readConfig = () => {
|
|
34
|
+
if (existsSync(CONFIG_FILE)) {
|
|
35
|
+
return JSON.parse(readFileSync(CONFIG_FILE, "utf-8"));
|
|
21
36
|
}
|
|
37
|
+
writeConfig(DEFAULT_CONFIG);
|
|
38
|
+
return DEFAULT_CONFIG;
|
|
22
39
|
};
|
|
23
40
|
|
|
24
41
|
// src/lib/operations/utils/pm.ts
|
|
@@ -51,16 +68,20 @@ var add = new Command().name("add").description("add component to your project")
|
|
|
51
68
|
const response = await fetch(componentUrl);
|
|
52
69
|
const componentConfig = await response.json();
|
|
53
70
|
if (componentConfig.dependencies) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
71
|
+
if (!config.disableInstall) {
|
|
72
|
+
await execa(
|
|
73
|
+
packageManager,
|
|
74
|
+
[
|
|
75
|
+
packageManager === "npm" ? "install" : "add",
|
|
76
|
+
...componentConfig.dependencies
|
|
77
|
+
],
|
|
78
|
+
{
|
|
79
|
+
cwd
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
} else {
|
|
83
|
+
console.log(`Skipping installation of dependencies for ${component}`);
|
|
84
|
+
}
|
|
64
85
|
}
|
|
65
86
|
if (componentConfig.files.length > 0) {
|
|
66
87
|
for (const file of componentConfig.files) {
|
|
@@ -70,7 +91,7 @@ var add = new Command().name("add").description("add component to your project")
|
|
|
70
91
|
"../../core/core",
|
|
71
92
|
`${config.core.import}`
|
|
72
93
|
);
|
|
73
|
-
|
|
94
|
+
writeFileSync2(filePath, file.content, {
|
|
74
95
|
encoding: "utf8",
|
|
75
96
|
flag: "w"
|
|
76
97
|
});
|
|
@@ -79,7 +100,7 @@ var add = new Command().name("add").description("add component to your project")
|
|
|
79
100
|
});
|
|
80
101
|
|
|
81
102
|
// src/lib/operations/commands/setup.ts
|
|
82
|
-
import { existsSync as existsSync3, mkdirSync as mkdirSync2,
|
|
103
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
83
104
|
import { createInterface } from "readline";
|
|
84
105
|
import { Command as Command2 } from "commander";
|
|
85
106
|
|
|
@@ -94,7 +115,8 @@ var REQUIRED_PACKAGES = [
|
|
|
94
115
|
"clsx",
|
|
95
116
|
"tailwind-merge",
|
|
96
117
|
"react",
|
|
97
|
-
"react-dom"
|
|
118
|
+
"react-dom",
|
|
119
|
+
"framer-motion"
|
|
98
120
|
];
|
|
99
121
|
|
|
100
122
|
// src/lib/operations/utils/verify.ts
|
|
@@ -121,27 +143,7 @@ var verify = async () => {
|
|
|
121
143
|
// src/lib/operations/commands/setup.ts
|
|
122
144
|
var setup = new Command2().name("setup").description("setup the aakaar ui").action(async () => {
|
|
123
145
|
await verify();
|
|
124
|
-
const
|
|
125
|
-
host: "http://aakaar.navnote.com",
|
|
126
|
-
core: {
|
|
127
|
-
path: "src/design",
|
|
128
|
-
import: "../../core"
|
|
129
|
-
},
|
|
130
|
-
tokens: {
|
|
131
|
-
color: "a42700",
|
|
132
|
-
strategy: "harmony",
|
|
133
|
-
output: "src/design/css"
|
|
134
|
-
},
|
|
135
|
-
react: {
|
|
136
|
-
output: "src/design/components"
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
const finalAakaarJson = existsSync3("aakaar.json") ? JSON.parse(readFileSync3("aakaar.json", "utf-8")) : aakaarJson;
|
|
140
|
-
if (!existsSync3("aakaar.json")) {
|
|
141
|
-
writeFileSync2("aakaar.json", JSON.stringify(aakaarJson, null, 2));
|
|
142
|
-
} else {
|
|
143
|
-
console.log("aakaar.json already exists");
|
|
144
|
-
}
|
|
146
|
+
const finalAakaarJson = readConfig();
|
|
145
147
|
const proceed = await new Promise((resolve) => {
|
|
146
148
|
const readline = createInterface({
|
|
147
149
|
input: process.stdin,
|
|
@@ -188,7 +190,7 @@ var setup = new Command2().name("setup").description("setup the aakaar ui").acti
|
|
|
188
190
|
if (!existsSync3(corePath)) {
|
|
189
191
|
mkdirSync2(corePath, { recursive: true });
|
|
190
192
|
}
|
|
191
|
-
|
|
193
|
+
writeFileSync3(`${corePath}/${firstCoreFile.name}`, firstCoreFile.content, {
|
|
192
194
|
encoding: "utf-8",
|
|
193
195
|
flag: "w"
|
|
194
196
|
});
|
|
@@ -197,7 +199,7 @@ var setup = new Command2().name("setup").description("setup the aakaar ui").acti
|
|
|
197
199
|
});
|
|
198
200
|
|
|
199
201
|
// src/lib/operations/commands/token.ts
|
|
200
|
-
import { existsSync as existsSync4, mkdirSync as mkdirSync3, writeFileSync as
|
|
202
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
201
203
|
import { runCss } from "@aakaar/dictionary";
|
|
202
204
|
import { Command as Command3 } from "commander";
|
|
203
205
|
var token = new Command3().name("token").description("build design tokens for your project").option(
|
|
@@ -221,7 +223,7 @@ var token = new Command3().name("token").description("build design tokens for yo
|
|
|
221
223
|
recursive: true
|
|
222
224
|
});
|
|
223
225
|
}
|
|
224
|
-
|
|
226
|
+
writeFileSync4(`${finalOutput}/tokens.css`, cssOutput, {
|
|
225
227
|
encoding: "utf8",
|
|
226
228
|
flag: "w"
|
|
227
229
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aakaar/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"commander": "^12.1.0",
|
|
24
24
|
"execa": "^9.6.0",
|
|
25
25
|
"signal-exit": "^4.1.0",
|
|
26
|
-
"@aakaar/dictionary": "0.0.
|
|
27
|
-
"@aakaar/global": "0.0.
|
|
26
|
+
"@aakaar/dictionary": "0.0.5",
|
|
27
|
+
"@aakaar/global": "0.0.5"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|