my-cli-44lahb 0.1.0 → 0.1.1
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/index.ts +26 -1
- package/new-site/README.md +15 -0
- package/new-site/bun.lock +26 -0
- package/new-site/data.json +106 -0
- package/new-site/home.html +10 -0
- package/new-site/home.ts +21 -0
- package/new-site/index.ts +10 -0
- package/new-site/package.json +11 -0
- package/new-site/table.html +33 -0
- package/new-site/table.ts +51 -0
- package/new-site/tsconfig.json +29 -0
- package/package.json +3 -2
package/index.ts
CHANGED
|
@@ -1,2 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
|
|
2
|
+
import { cp } from "node:fs/promises";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
|
|
5
|
+
const projectName = Bun.argv[2] || "my-new-site";
|
|
6
|
+
const targetDir = join(process.cwd(), projectName);
|
|
7
|
+
|
|
8
|
+
// Path to your template folder relative to this index.ts file
|
|
9
|
+
const templateDir = join(import.meta.dir, "new-site");
|
|
10
|
+
|
|
11
|
+
console.log(`✨ Scaffolding project from template...`);
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
// Copy the entire directory recursively
|
|
15
|
+
await cp(templateDir, targetDir, { recursive: true });
|
|
16
|
+
|
|
17
|
+
console.log("✅ Files copied.");
|
|
18
|
+
|
|
19
|
+
// Run install
|
|
20
|
+
const proc = Bun.spawn(["bun", "install"], {
|
|
21
|
+
cwd: targetDir,
|
|
22
|
+
stdout: "inherit",
|
|
23
|
+
});
|
|
24
|
+
await proc.exited;
|
|
25
|
+
} catch (err) {
|
|
26
|
+
console.error("Error creating project:", err.message);
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# new-site
|
|
2
|
+
|
|
3
|
+
To install dependencies:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
bun install
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
To run:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bun run index.ts
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This project was created using `bun init` in bun v1.3.6. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lockfileVersion": 1,
|
|
3
|
+
"configVersion": 1,
|
|
4
|
+
"workspaces": {
|
|
5
|
+
"": {
|
|
6
|
+
"name": "new-site",
|
|
7
|
+
"devDependencies": {
|
|
8
|
+
"@types/bun": "latest",
|
|
9
|
+
},
|
|
10
|
+
"peerDependencies": {
|
|
11
|
+
"typescript": "^5",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
"packages": {
|
|
16
|
+
"@types/bun": ["@types/bun@1.3.5", "", { "dependencies": { "bun-types": "1.3.5" } }, "sha512-RnygCqNrd3srIPEWBd5LFeUYG7plCoH2Yw9WaZGyNmdTEei+gWaHqydbaIRkIkcbXwhBT94q78QljxN0Sk838w=="],
|
|
17
|
+
|
|
18
|
+
"@types/node": ["@types/node@25.0.8", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-powIePYMmC3ibL0UJ2i2s0WIbq6cg6UyVFQxSCpaPxxzAaziRfimGivjdF943sSGV6RADVbk0Nvlm5P/FB44Zg=="],
|
|
19
|
+
|
|
20
|
+
"bun-types": ["bun-types@1.3.5", "", { "dependencies": { "@types/node": "*" } }, "sha512-inmAYe2PFLs0SUbFOWSVD24sg1jFlMPxOjOSSCYqUgn4Hsc3rDc7dFvfVYjFPNHtov6kgUeulV4SxbuIV/stPw=="],
|
|
21
|
+
|
|
22
|
+
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
|
|
23
|
+
|
|
24
|
+
"undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"table_schema": "public",
|
|
4
|
+
"table_name": "product_dim",
|
|
5
|
+
"column_name": "id",
|
|
6
|
+
"data_type": "integer",
|
|
7
|
+
"referenced_table": null,
|
|
8
|
+
"referenced_column": null
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"table_schema": "public",
|
|
12
|
+
"table_name": "product_dim",
|
|
13
|
+
"column_name": "name",
|
|
14
|
+
"data_type": "text",
|
|
15
|
+
"referenced_table": null,
|
|
16
|
+
"referenced_column": null
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"table_schema": "public",
|
|
20
|
+
"table_name": "product_dim",
|
|
21
|
+
"column_name": "price",
|
|
22
|
+
"data_type": "numeric",
|
|
23
|
+
"referenced_table": null,
|
|
24
|
+
"referenced_column": null
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"table_schema": "public",
|
|
28
|
+
"table_name": "product_dim",
|
|
29
|
+
"column_name": "category",
|
|
30
|
+
"data_type": "text",
|
|
31
|
+
"referenced_table": null,
|
|
32
|
+
"referenced_column": null
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"table_schema": "public",
|
|
36
|
+
"table_name": "purchase_fact",
|
|
37
|
+
"column_name": "id",
|
|
38
|
+
"data_type": "integer",
|
|
39
|
+
"referenced_table": null,
|
|
40
|
+
"referenced_column": null
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"table_schema": "public",
|
|
44
|
+
"table_name": "purchase_fact",
|
|
45
|
+
"column_name": "user_id",
|
|
46
|
+
"data_type": "integer",
|
|
47
|
+
"referenced_table": "user_dim",
|
|
48
|
+
"referenced_column": "id"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"table_schema": "public",
|
|
52
|
+
"table_name": "purchase_fact",
|
|
53
|
+
"column_name": "product_id",
|
|
54
|
+
"data_type": "integer",
|
|
55
|
+
"referenced_table": "product_dim",
|
|
56
|
+
"referenced_column": "id"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"table_schema": "public",
|
|
60
|
+
"table_name": "purchase_fact",
|
|
61
|
+
"column_name": "quantity",
|
|
62
|
+
"data_type": "integer",
|
|
63
|
+
"referenced_table": null,
|
|
64
|
+
"referenced_column": null
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"table_schema": "public",
|
|
68
|
+
"table_name": "purchase_fact",
|
|
69
|
+
"column_name": "purchase_date",
|
|
70
|
+
"data_type": "timestamp without time zone",
|
|
71
|
+
"referenced_table": null,
|
|
72
|
+
"referenced_column": null
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"table_schema": "public",
|
|
76
|
+
"table_name": "user_dim",
|
|
77
|
+
"column_name": "id",
|
|
78
|
+
"data_type": "integer",
|
|
79
|
+
"referenced_table": null,
|
|
80
|
+
"referenced_column": null
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"table_schema": "public",
|
|
84
|
+
"table_name": "user_dim",
|
|
85
|
+
"column_name": "name",
|
|
86
|
+
"data_type": "text",
|
|
87
|
+
"referenced_table": null,
|
|
88
|
+
"referenced_column": null
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"table_schema": "public",
|
|
92
|
+
"table_name": "user_dim",
|
|
93
|
+
"column_name": "email",
|
|
94
|
+
"data_type": "text",
|
|
95
|
+
"referenced_table": null,
|
|
96
|
+
"referenced_column": null
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"table_schema": "public",
|
|
100
|
+
"table_name": "user_dim",
|
|
101
|
+
"column_name": "created_at",
|
|
102
|
+
"data_type": "timestamp without time zone",
|
|
103
|
+
"referenced_table": null,
|
|
104
|
+
"referenced_column": null
|
|
105
|
+
}
|
|
106
|
+
]
|
package/new-site/home.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import data from "./data.json";
|
|
2
|
+
const testElement = document.getElementById("test-element");
|
|
3
|
+
if (testElement) {
|
|
4
|
+
testElement.textContent = "hello js!!!";
|
|
5
|
+
}
|
|
6
|
+
const tableList = document.getElementById("table-list");
|
|
7
|
+
if (tableList) {
|
|
8
|
+
const tableNames = [...new Set(data.map((obj) => obj.table_name))];
|
|
9
|
+
console.log(tableNames);
|
|
10
|
+
tableNames.forEach((tableName) => {
|
|
11
|
+
console.log("table is: ", tableName);
|
|
12
|
+
const li = document.createElement("li");
|
|
13
|
+
const a = document.createElement("a");
|
|
14
|
+
|
|
15
|
+
a.href = `/table/${tableName}`;
|
|
16
|
+
a.textContent = tableName;
|
|
17
|
+
|
|
18
|
+
li.appendChild(a);
|
|
19
|
+
tableList.appendChild(li);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<style>
|
|
5
|
+
table {
|
|
6
|
+
border-collapse: collapse;
|
|
7
|
+
}
|
|
8
|
+
th, td {
|
|
9
|
+
border: 1px solid #ccc;
|
|
10
|
+
padding: 8px;
|
|
11
|
+
text-align: left;
|
|
12
|
+
}
|
|
13
|
+
th {
|
|
14
|
+
background-color: #f5f5f5;
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
<body>
|
|
19
|
+
<a href="/">Home</a>
|
|
20
|
+
<h2 id="table-name">Table Name Pre JS</h2>
|
|
21
|
+
<table>
|
|
22
|
+
<thead>
|
|
23
|
+
<tr>
|
|
24
|
+
<th>Column Name</th>
|
|
25
|
+
<th>Data Type</th>
|
|
26
|
+
<th>Reference</th>
|
|
27
|
+
</tr>
|
|
28
|
+
</thead>
|
|
29
|
+
<tbody id="table-body"></tbody>
|
|
30
|
+
</table>
|
|
31
|
+
<script src="./table.ts"></script>
|
|
32
|
+
</body>
|
|
33
|
+
</html>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import data from "./data.json";
|
|
2
|
+
|
|
3
|
+
console.log("okay talbe!!");
|
|
4
|
+
|
|
5
|
+
const pathParts = window.location.pathname.split("/");
|
|
6
|
+
const tableName = pathParts[pathParts.length - 1];
|
|
7
|
+
console.log(tableName); // This will give you the table name
|
|
8
|
+
|
|
9
|
+
const tableNameH = document.getElementById("table-name");
|
|
10
|
+
if (tableNameH) {
|
|
11
|
+
tableNameH.textContent = "Table: " + tableName;
|
|
12
|
+
}
|
|
13
|
+
const tableBody = document.getElementById("table-body");
|
|
14
|
+
if (tableBody) {
|
|
15
|
+
const currentTableColumns = data.filter(
|
|
16
|
+
(obj) => obj.table_name === tableName
|
|
17
|
+
);
|
|
18
|
+
currentTableColumns.forEach((col) => {
|
|
19
|
+
console.log(
|
|
20
|
+
"col name: ",
|
|
21
|
+
col.column_name,
|
|
22
|
+
" datatype: ",
|
|
23
|
+
col.data_type,
|
|
24
|
+
" references: ",
|
|
25
|
+
`${col.referenced_table}.${col.referenced_column}`
|
|
26
|
+
);
|
|
27
|
+
const row = document.createElement("tr");
|
|
28
|
+
|
|
29
|
+
const columnNameCell = document.createElement("td");
|
|
30
|
+
columnNameCell.textContent = col.column_name;
|
|
31
|
+
row.appendChild(columnNameCell);
|
|
32
|
+
|
|
33
|
+
// Data Type cell
|
|
34
|
+
const dataTypeCell = document.createElement("td");
|
|
35
|
+
dataTypeCell.textContent = col.data_type;
|
|
36
|
+
row.appendChild(dataTypeCell);
|
|
37
|
+
|
|
38
|
+
// Reference cell (combined table.column with link)
|
|
39
|
+
const referenceCell = document.createElement("td");
|
|
40
|
+
if (col.referenced_table && col.referenced_column) {
|
|
41
|
+
const link = document.createElement("a");
|
|
42
|
+
link.href = `./${col.referenced_table}`;
|
|
43
|
+
link.textContent = `${col.referenced_table}.${col.referenced_column}`;
|
|
44
|
+
referenceCell.appendChild(link);
|
|
45
|
+
} else {
|
|
46
|
+
referenceCell.textContent = "";
|
|
47
|
+
}
|
|
48
|
+
row.appendChild(referenceCell);
|
|
49
|
+
tableBody.appendChild(row);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Environment setup & latest features
|
|
4
|
+
"lib": ["ESNext", "DOM"],
|
|
5
|
+
"target": "ESNext",
|
|
6
|
+
"module": "Preserve",
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"jsx": "react-jsx",
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
|
|
11
|
+
// Bundler mode
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
|
|
17
|
+
// Best practices
|
|
18
|
+
"strict": true,
|
|
19
|
+
"skipLibCheck": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"noUncheckedIndexedAccess": true,
|
|
22
|
+
"noImplicitOverride": true,
|
|
23
|
+
|
|
24
|
+
// Some stricter flags (disabled by default)
|
|
25
|
+
"noUnusedLocals": false,
|
|
26
|
+
"noUnusedParameters": false,
|
|
27
|
+
"noPropertyAccessFromIndexSignature": false
|
|
28
|
+
}
|
|
29
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "my-cli-44lahb",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "index.ts",
|
|
6
6
|
"bin": {
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"index.ts",
|
|
11
|
-
"README.md"
|
|
11
|
+
"README.md",
|
|
12
|
+
"new-site"
|
|
12
13
|
],
|
|
13
14
|
"devDependencies": {
|
|
14
15
|
"@types/bun": "latest"
|