json-crud-ui-components 1.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/LICENSE +21 -0
- package/README.md +225 -0
- package/bin/cli.js +12 -0
- package/bin/core/getLatestVersion.js +13 -0
- package/bin/core/loadRunner.js +9 -0
- package/bin/v1/commands/addListeners/steps/announce.js +3 -0
- package/bin/v1/commands/addListeners/steps/createProject.js +7 -0
- package/bin/v1/commands/addListeners/steps/locateDestination.js +5 -0
- package/bin/v1/commands/addListeners/steps/locateSource.js +32 -0
- package/bin/v1/commands/addListeners/steps/resolveFolderName.js +17 -0
- package/bin/v1/commands/addListeners/template/v1/AddListeners/start.js +14 -0
- package/bin/v1/commands/addListeners/template/v2/start.js +4 -0
- package/bin/v1/commands/addListeners.js +20 -0
- package/bin/v1/commands/htmlIdClick/steps/announce.js +3 -0
- package/bin/v1/commands/htmlIdClick/steps/createProject.js +7 -0
- package/bin/v1/commands/htmlIdClick/steps/locateDestination.js +5 -0
- package/bin/v1/commands/htmlIdClick/steps/locateSource.js +32 -0
- package/bin/v1/commands/htmlIdClick/steps/resolveFolderName.js +17 -0
- package/bin/v1/commands/htmlIdClick/template/v1/clickFunc.js +4 -0
- package/bin/v1/commands/htmlIdClick/template/v1/start.js +9 -0
- package/bin/v1/commands/htmlIdClick.js +20 -0
- package/bin/v1/commands/init/steps/announce.js +3 -0
- package/bin/v1/commands/init/steps/createProject.js +7 -0
- package/bin/v1/commands/init/steps/locateDestination.js +5 -0
- package/bin/v1/commands/init/steps/locateSource.js +32 -0
- package/bin/v1/commands/init/steps/resolveFolderName.js +17 -0
- package/bin/v1/commands/init/template/v1/Index/FormLoad/DomContentLoaded/buildHeader.js +68 -0
- package/bin/v1/commands/init/template/v1/Index/FormLoad/DomContentLoaded/buildMenuItem.js +121 -0
- package/bin/v1/commands/init/template/v1/Index/FormLoad/DomContentLoaded/runAfterDomLoad.js +7 -0
- package/bin/v1/commands/init/template/v1/Index/FormLoad/DomContentLoaded/start.js +7 -0
- package/bin/v1/commands/init/template/v1/Index/FormLoad/start.js +5 -0
- package/bin/v1/commands/init/template/v1/Index/start.js +7 -0
- package/bin/v1/commands/init/template/v2/FormLoad/DomContentLoaded/buildHeader.js +68 -0
- package/bin/v1/commands/init/template/v2/FormLoad/DomContentLoaded/buildMenuItem.js +121 -0
- package/bin/v1/commands/init/template/v2/FormLoad/DomContentLoaded/runAfterDomLoad.js +7 -0
- package/bin/v1/commands/init/template/v2/FormLoad/DomContentLoaded/start.js +7 -0
- package/bin/v1/commands/init/template/v2/FormLoad/start.js +5 -0
- package/bin/v1/commands/init/template/v2/start.js +7 -0
- package/bin/v1/commands/init/template/v3/FormLoad/DomContentLoaded/buildHeader.js +58 -0
- package/bin/v1/commands/init/template/v3/FormLoad/DomContentLoaded/buildMenuItem.js +121 -0
- package/bin/v1/commands/init/template/v3/FormLoad/DomContentLoaded/runAfterDomLoad.js +7 -0
- package/bin/v1/commands/init/template/v3/FormLoad/DomContentLoaded/start.js +7 -0
- package/bin/v1/commands/init/template/v3/FormLoad/start.js +5 -0
- package/bin/v1/commands/init/template/v3/headers.json +45 -0
- package/bin/v1/commands/init/template/v3/start.js +7 -0
- package/bin/v1/commands/init.js +22 -0
- package/bin/v1/core/parseInput.js +9 -0
- package/bin/v1/core/resolveCommand.js +14 -0
- package/bin/v1/core/showUsage.js +39 -0
- package/bin/v1/start.js +25 -0
- package/index.js +5 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 KeshavSoft
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to do so, subject to the
|
|
10
|
+
following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
````md
|
|
2
|
+
# KSchema API Check
|
|
3
|
+
|
|
4
|
+
A lightweight CLI utility to validate and inspect `end-points.js` files inside KSchema-based projects.
|
|
5
|
+
|
|
6
|
+
Built for fast development workflows, clean architecture, and reusable tooling.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
### Run directly with npx
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx kschema-api-check
|
|
16
|
+
````
|
|
17
|
+
|
|
18
|
+
### Global install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm i -g kschema-api-check
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Purpose
|
|
27
|
+
|
|
28
|
+
This package helps developers:
|
|
29
|
+
|
|
30
|
+
* Validate `end-points.js`
|
|
31
|
+
* Inspect API route structure
|
|
32
|
+
* Automate repetitive checks
|
|
33
|
+
* Build scalable CLI workflows
|
|
34
|
+
* Extend command-based tooling cleanly
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
# Features
|
|
39
|
+
|
|
40
|
+
* Clean command architecture
|
|
41
|
+
* Action-based execution
|
|
42
|
+
* Modular structure
|
|
43
|
+
* Easy to extend
|
|
44
|
+
* Lightweight
|
|
45
|
+
* ES Modules support
|
|
46
|
+
* Zero framework dependency
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
# Commands
|
|
51
|
+
|
|
52
|
+
## endPointsJs
|
|
53
|
+
|
|
54
|
+
Checks and processes `end-points.js`.
|
|
55
|
+
|
|
56
|
+
### Usage
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx kschema-api-check endPointsJs
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
# Actions
|
|
65
|
+
|
|
66
|
+
## ShowAll
|
|
67
|
+
|
|
68
|
+
Displays all detected endpoints.
|
|
69
|
+
|
|
70
|
+
### Usage
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npx kschema-api-check endPointsJs ShowAll
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
# Example
|
|
79
|
+
|
|
80
|
+
Suppose your project contains:
|
|
81
|
+
|
|
82
|
+
```txt
|
|
83
|
+
/end-points.js
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Running:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npx kschema-api-check endPointsJs ShowAll
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
will analyze the file and display endpoint information.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
# Project Structure
|
|
97
|
+
|
|
98
|
+
```txt
|
|
99
|
+
bin/
|
|
100
|
+
└── v10/
|
|
101
|
+
├── commands/
|
|
102
|
+
├── core/
|
|
103
|
+
├── tasks/
|
|
104
|
+
│ ├── actions/
|
|
105
|
+
│ ├── common/
|
|
106
|
+
│ └── tables/
|
|
107
|
+
└── start.js
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
# Architecture
|
|
113
|
+
|
|
114
|
+
The CLI follows a layered architecture:
|
|
115
|
+
|
|
116
|
+
## Core
|
|
117
|
+
|
|
118
|
+
Responsible for:
|
|
119
|
+
|
|
120
|
+
* parsing input
|
|
121
|
+
* resolving commands
|
|
122
|
+
* showing usage
|
|
123
|
+
* bootstrapping execution
|
|
124
|
+
|
|
125
|
+
## Commands
|
|
126
|
+
|
|
127
|
+
Responsible for:
|
|
128
|
+
|
|
129
|
+
* command routing
|
|
130
|
+
* command validation
|
|
131
|
+
|
|
132
|
+
## Actions
|
|
133
|
+
|
|
134
|
+
Responsible for:
|
|
135
|
+
|
|
136
|
+
* feature execution
|
|
137
|
+
* business logic
|
|
138
|
+
|
|
139
|
+
This separation keeps the codebase maintainable and scalable.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
# Why This Project Exists
|
|
144
|
+
|
|
145
|
+
Most projects repeatedly write the same API inspection logic.
|
|
146
|
+
|
|
147
|
+
This tool centralizes:
|
|
148
|
+
|
|
149
|
+
* validation
|
|
150
|
+
* inspection
|
|
151
|
+
* command execution
|
|
152
|
+
* reusable CLI workflows
|
|
153
|
+
|
|
154
|
+
into one clean developer utility.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
# Development
|
|
159
|
+
|
|
160
|
+
Clone repository:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
git clone https://github.com/keshavsoft/kschema-api-check.git
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Install dependencies:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
npm install
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Run locally:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
node test/insert.js
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
# Future Plans
|
|
181
|
+
|
|
182
|
+
* Insert endpoint templates
|
|
183
|
+
* Auto route generation
|
|
184
|
+
* Schema validation
|
|
185
|
+
* API documentation generation
|
|
186
|
+
* Interactive CLI prompts
|
|
187
|
+
* Multi-project scanning
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
# Tech Stack
|
|
192
|
+
|
|
193
|
+
* Node.js
|
|
194
|
+
* ES Modules
|
|
195
|
+
* JavaScript
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
# Philosophy
|
|
200
|
+
|
|
201
|
+
> Simple tools. Clean architecture. Fast development.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
# Author
|
|
206
|
+
|
|
207
|
+
KeshavSoft
|
|
208
|
+
|
|
209
|
+
GitHub:
|
|
210
|
+
https://github.com/keshavsoft
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
# Repository
|
|
215
|
+
|
|
216
|
+
https://github.com/keshavsoft/kschema-api-check
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
# License
|
|
221
|
+
|
|
222
|
+
MIT
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
```
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import getLatestVersion from "./core/getLatestVersion.js";
|
|
4
|
+
import loadRunner from "./core/loadRunner.js";
|
|
5
|
+
|
|
6
|
+
const run = async () => {
|
|
7
|
+
const version = getLatestVersion();
|
|
8
|
+
const runner = await loadRunner(version);
|
|
9
|
+
await runner();
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
run();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
|
|
5
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
|
|
7
|
+
export default function getLatestVersion() {
|
|
8
|
+
const versions = fs.readdirSync(path.join(__dirname, ".."))
|
|
9
|
+
.filter(n => /^v\d+$/.test(n))
|
|
10
|
+
.sort((a, b) => parseInt(a.slice(1)) - parseInt(b.slice(1)));
|
|
11
|
+
|
|
12
|
+
return versions.at(-1);
|
|
13
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
|
|
9
|
+
const templatePath = path.join(
|
|
10
|
+
__dirname,
|
|
11
|
+
"..",
|
|
12
|
+
"template"
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const versions = fs
|
|
16
|
+
.readdirSync(templatePath)
|
|
17
|
+
.filter(item => item.startsWith("v"));
|
|
18
|
+
|
|
19
|
+
const highestVersion =
|
|
20
|
+
versions.sort().at(-1);
|
|
21
|
+
|
|
22
|
+
const sourceVersion =
|
|
23
|
+
highestVersion;
|
|
24
|
+
|
|
25
|
+
export const locateSource = () => {
|
|
26
|
+
return path.join(
|
|
27
|
+
__dirname,
|
|
28
|
+
"..",
|
|
29
|
+
"template",
|
|
30
|
+
sourceVersion
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
export default function resolveFolderName({ name }) {
|
|
4
|
+
const defaultFolerName = "htmlId";
|
|
5
|
+
|
|
6
|
+
// case 1: force new → timestamp
|
|
7
|
+
if (name === null) {
|
|
8
|
+
name = defaultFolerName;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// case 2: user provided → strict
|
|
12
|
+
if (fs.existsSync(name)) {
|
|
13
|
+
throw new Error(`Folder already exists: ${name}`);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return name;
|
|
17
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { funcToRun as funcToRunForLedgersHtmlId } from "./LedgersHtmlId/start.js";
|
|
2
|
+
import { funcToRun as funcToRunForStockItemsHtmlId } from "./StockItemsHtmlId/start.js";
|
|
3
|
+
|
|
4
|
+
import { funcToRun as funcToRunForImportHtmlId } from "./ImportHtmlId/start.js";
|
|
5
|
+
|
|
6
|
+
const hookAllListeners = () => {
|
|
7
|
+
funcToRunForLedgersHtmlId();
|
|
8
|
+
funcToRunForStockItemsHtmlId();
|
|
9
|
+
|
|
10
|
+
funcToRunForImportHtmlId();
|
|
11
|
+
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { hookAllListeners };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { locateSource } from "./addListeners/steps/locateSource.js";
|
|
2
|
+
import { locateDestination } from "./addListeners/steps/locateDestination.js";
|
|
3
|
+
|
|
4
|
+
import { createProject } from "./addListeners/steps/createProject.js";
|
|
5
|
+
import { announce } from "./addListeners/steps/announce.js";
|
|
6
|
+
|
|
7
|
+
import resolveFolderName from "./addListeners/steps/resolveFolderName.js";
|
|
8
|
+
|
|
9
|
+
export default ({ folderName = "", toPath = process.cwd(), inAnnounce = true }) => {
|
|
10
|
+
const resolvedFolderName = resolveFolderName({
|
|
11
|
+
name: folderName
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const source = locateSource();
|
|
15
|
+
const destination = locateDestination({ inResolvedFolderName: resolvedFolderName });
|
|
16
|
+
|
|
17
|
+
createProject({ source, destination });
|
|
18
|
+
|
|
19
|
+
if (inAnnounce) announce({ inResolvedFolderName: resolvedFolderName });
|
|
20
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
|
|
9
|
+
const templatePath = path.join(
|
|
10
|
+
__dirname,
|
|
11
|
+
"..",
|
|
12
|
+
"template"
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const versions = fs
|
|
16
|
+
.readdirSync(templatePath)
|
|
17
|
+
.filter(item => item.startsWith("v"));
|
|
18
|
+
|
|
19
|
+
const highestVersion =
|
|
20
|
+
versions.sort().at(-1);
|
|
21
|
+
|
|
22
|
+
const sourceVersion =
|
|
23
|
+
highestVersion;
|
|
24
|
+
|
|
25
|
+
export const locateSource = () => {
|
|
26
|
+
return path.join(
|
|
27
|
+
__dirname,
|
|
28
|
+
"..",
|
|
29
|
+
"template",
|
|
30
|
+
sourceVersion
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
export default function resolveFolderName({ name, inType = "basic" }) {
|
|
4
|
+
const defaultFolerName = "AddListeners";
|
|
5
|
+
|
|
6
|
+
// case 1: force new → timestamp
|
|
7
|
+
if (name === null) {
|
|
8
|
+
name = defaultFolerName;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// case 2: user provided → strict
|
|
12
|
+
if (fs.existsSync(name)) {
|
|
13
|
+
throw new Error(`Folder already exists: ${name}`);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return name;
|
|
17
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { locateSource } from "./htmlIdClick/steps/locateSource.js";
|
|
2
|
+
import { locateDestination } from "./htmlIdClick/steps/locateDestination.js";
|
|
3
|
+
|
|
4
|
+
import { createProject } from "./htmlIdClick/steps/createProject.js";
|
|
5
|
+
import { announce } from "./htmlIdClick/steps/announce.js";
|
|
6
|
+
|
|
7
|
+
import resolveFolderName from "./htmlIdClick/steps/resolveFolderName.js";
|
|
8
|
+
|
|
9
|
+
export default ({ folderName = "", toPath = process.cwd(), inAnnounce = true }) => {
|
|
10
|
+
const resolvedFolderName = resolveFolderName({
|
|
11
|
+
name: folderName
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const source = locateSource();
|
|
15
|
+
const destination = locateDestination({ inResolvedFolderName: resolvedFolderName });
|
|
16
|
+
|
|
17
|
+
createProject({ source, destination });
|
|
18
|
+
|
|
19
|
+
if (inAnnounce) announce({ inResolvedFolderName: resolvedFolderName });
|
|
20
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
|
|
9
|
+
const templatePath = path.join(
|
|
10
|
+
__dirname,
|
|
11
|
+
"..",
|
|
12
|
+
"template"
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const versions = fs
|
|
16
|
+
.readdirSync(templatePath)
|
|
17
|
+
.filter(item => item.startsWith("v"));
|
|
18
|
+
|
|
19
|
+
const highestVersion =
|
|
20
|
+
versions.sort().at(-1);
|
|
21
|
+
|
|
22
|
+
const sourceVersion =
|
|
23
|
+
highestVersion;
|
|
24
|
+
|
|
25
|
+
export const locateSource = () => {
|
|
26
|
+
return path.join(
|
|
27
|
+
__dirname,
|
|
28
|
+
"..",
|
|
29
|
+
"template",
|
|
30
|
+
sourceVersion
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
export default function resolveFolderName({ name, inType = "basic" }) {
|
|
4
|
+
const defaultFolerName = "Index";
|
|
5
|
+
|
|
6
|
+
// case 1: force new → timestamp
|
|
7
|
+
if (name === null) {
|
|
8
|
+
name = defaultFolerName;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// case 2: user provided → strict
|
|
12
|
+
if (fs.existsSync(name)) {
|
|
13
|
+
throw new Error(`Folder already exists: ${name}`);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return name;
|
|
17
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { initHeader } from "../../../../../../header/v6/initHeader.js";
|
|
2
|
+
|
|
3
|
+
const buildHeader = () => {
|
|
4
|
+
const headerConfig = {
|
|
5
|
+
items: [
|
|
6
|
+
{
|
|
7
|
+
text: "ShowAll",
|
|
8
|
+
id: "ShowAllHtmlId",
|
|
9
|
+
icon: [
|
|
10
|
+
"M4 6h16",
|
|
11
|
+
"M4 10h16",
|
|
12
|
+
"M4 14h10",
|
|
13
|
+
"M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
text: "StockItems",
|
|
18
|
+
id: "StockItemsHtmlId",
|
|
19
|
+
icon: [
|
|
20
|
+
"M3 7l9 4 9-4",
|
|
21
|
+
"M3 7l9-4 9 4",
|
|
22
|
+
"M3 7v10l9 4 9-4V7",
|
|
23
|
+
"M12 11v10"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
text: "Transactions",
|
|
28
|
+
id: "1",
|
|
29
|
+
icon: [
|
|
30
|
+
|
|
31
|
+
"M6 2h9l5 5v15a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z",
|
|
32
|
+
"M14 2v6h6",
|
|
33
|
+
"M8 12h8",
|
|
34
|
+
"M8 16h8"
|
|
35
|
+
],
|
|
36
|
+
href: "../../Transactions/V7/Create/index.html"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
text: "FromTally",
|
|
40
|
+
id: "ImportHtmlId",
|
|
41
|
+
icon: [
|
|
42
|
+
"M4 6h16",
|
|
43
|
+
"M4 10h16",
|
|
44
|
+
"M4 14h10",
|
|
45
|
+
"M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
initHeader(headerConfig);
|
|
52
|
+
// callKSHeader(headerConfig).then();
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const callKSHeader = async (config) => {
|
|
56
|
+
if (window.KSHeader?.initHeader) {
|
|
57
|
+
console.log("table loaded from window.KSTable");
|
|
58
|
+
|
|
59
|
+
return window.KSHeader.initHeader(config); // extension or CDN
|
|
60
|
+
} else {
|
|
61
|
+
// const { initTableOnly } = await import("../../../../../../../../KSTableAi/V28/entry.js"); // local
|
|
62
|
+
const { initTableOnly } = await import("https://keshavsoft.github.io/KsJsTableAi/Public/kstable.js"); // local
|
|
63
|
+
|
|
64
|
+
return initTableOnly(config);
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export { buildHeader };
|