hiuhu-table-generator 1.0.0 → 1.1.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
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { initConfig } from "../src/commands/init-config.js";
|
|
4
|
+
import "../src/commands/gen-datatable.js";
|
|
5
|
+
|
|
6
|
+
const cmd = process.argv[2];
|
|
7
|
+
|
|
8
|
+
switch (cmd) {
|
|
9
|
+
case "init":
|
|
10
|
+
initConfig();
|
|
11
|
+
break;
|
|
12
|
+
|
|
13
|
+
case "gen-datatable":
|
|
14
|
+
// biarkan file gen-datatable baca argv sendiri
|
|
15
|
+
break;
|
|
16
|
+
|
|
17
|
+
default:
|
|
18
|
+
console.log(`
|
|
19
|
+
Usage:
|
|
20
|
+
hiuhu-table-generator init
|
|
21
|
+
hiuhu-table-generator gen-datatable <feature> <tableKey> <endpoint> <Type>
|
|
22
|
+
`);
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hiuhu-table-generator",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "CLI generator for table feature in Next.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"
|
|
7
|
+
"hiuhu-table-generator": "./bin/index.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"bin",
|
|
@@ -152,7 +152,7 @@ Object.entries(files).forEach(([target, template]) => {
|
|
|
152
152
|
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
153
153
|
|
|
154
154
|
const tpl = fs.readFileSync(
|
|
155
|
-
path.join(__dirname, "templates", template),
|
|
155
|
+
path.join(__dirname, "../templates", template),
|
|
156
156
|
"utf-8",
|
|
157
157
|
);
|
|
158
158
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = path.dirname(__filename);
|
|
7
|
+
|
|
8
|
+
const ROOT = process.cwd();
|
|
9
|
+
const CONFIG_PATH = path.join(ROOT, "generator.config.json");
|
|
10
|
+
const TEMPLATE_PATH = path.resolve(
|
|
11
|
+
__dirname,
|
|
12
|
+
"../templates/generator.config.json.tpl",
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export function initConfig() {
|
|
16
|
+
if (fs.existsSync(CONFIG_PATH)) {
|
|
17
|
+
console.error("❌ generator.config.json already exists");
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const tpl = fs.readFileSync(TEMPLATE_PATH, "utf-8");
|
|
22
|
+
fs.writeFileSync(CONFIG_PATH, tpl);
|
|
23
|
+
|
|
24
|
+
console.log("✅ generator.config.json created at project root");
|
|
25
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"paths": {
|
|
3
|
+
"sharedTypes": "src/@shared/types",
|
|
4
|
+
"sharedTypesAlias": "@/@shared/types",
|
|
5
|
+
|
|
6
|
+
"features": "src/frontend/features",
|
|
7
|
+
"featuresAlias": "@/frontend/features",
|
|
8
|
+
|
|
9
|
+
"redux": "src/app/store",
|
|
10
|
+
"reduxAlias": "@/app/store",
|
|
11
|
+
"reduxStore": "store.ts",
|
|
12
|
+
"reduxHook": "hooks.ts"
|
|
13
|
+
},
|
|
14
|
+
"datatable": {
|
|
15
|
+
"components": {
|
|
16
|
+
"table": {
|
|
17
|
+
"component": "DataTable",
|
|
18
|
+
"importPath": "@/frontend/components/organisms/DataTable/data-table",
|
|
19
|
+
"filePath": "src/frontend/components/organisms/DataTable/data-table.tsx"
|
|
20
|
+
},
|
|
21
|
+
"columnHeader": {
|
|
22
|
+
"component": "DataTableColumnHeader",
|
|
23
|
+
"importPath": "@/frontend/components/molecules/DataTable/data-table-column-header",
|
|
24
|
+
"filePath": "src/frontend/components/molecules/DataTable/data-table-column-header.tsx"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"types": {
|
|
28
|
+
"state": {
|
|
29
|
+
"name": "DataTableState",
|
|
30
|
+
"importPath": "@/frontend/types/data-table/data-table-state",
|
|
31
|
+
"filePath": "src/frontend/types/data-table/data-table-state.ts"
|
|
32
|
+
},
|
|
33
|
+
"redux": {
|
|
34
|
+
"name": "DataTableRedux",
|
|
35
|
+
"importPath": "@/frontend/types/data-table/data-table-redux",
|
|
36
|
+
"filePath": "src/frontend/types/data-table/data-table-redux.ts"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
package/bin/gen-datatable.js
DELETED