test-bdk-cli 0.1.3 → 0.1.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/README.md CHANGED
@@ -1,19 +1,3 @@
1
- # bdk-cli (BoldDesk Developer Kit)
1
+ # React template
2
2
 
3
- This project contains a TypeScript-based CLI scaffold for creating, validating, and packaging BoldDesk apps.
4
-
5
- Quick start:
6
-
7
- Install dependencies and build:
8
-
9
- ```bash
10
- cd bdk-cli
11
- npm install
12
- npm run build
13
- ```
14
-
15
- Run in development with `ts-node`:
16
-
17
- ```bash
18
- npm run dev -- create my-app --template react
19
- ```
3
+ This is a minimal React template for BoldDesk apps. Use `bdk create my-app --template react` to scaffold.
@@ -26,10 +26,41 @@ function registerCreate(program) {
26
26
  .option('--api-url <url>', 'BoldDesk API base URL (env BOLD_API_URL)')
27
27
  .option('--token <token>', 'BoldDesk API token (env BOLD_API_TOKEN)')
28
28
  .action(async (...args) => {
29
- const opts = args[args.length - 1];
29
+ // normalize action arguments: support both (appDirectories..., opts) and (opts) shapes
30
+ let opts = {};
31
+ let appDirectories = ['.'];
32
+ if (args.length === 0) {
33
+ opts = {};
34
+ appDirectories = ['.'];
35
+ }
36
+ else {
37
+ // pick the last plain object (non-array) as options if present
38
+ for (let i = args.length - 1; i >= 0; i--) {
39
+ const a = args[i];
40
+ if (typeof a === 'object' && !Array.isArray(a)) {
41
+ opts = a;
42
+ break;
43
+ }
44
+ }
45
+ // collect directory arguments: strings or arrays of strings
46
+ const collected = [];
47
+ for (const a of args) {
48
+ if (typeof a === 'string')
49
+ collected.push(a);
50
+ else if (Array.isArray(a)) {
51
+ for (const s of a)
52
+ if (typeof s === 'string')
53
+ collected.push(s);
54
+ }
55
+ }
56
+ appDirectories = collected.length ? collected : ['.'];
57
+ }
30
58
  const template = opts.template || 'react';
31
59
  const basePath = path_1.default.resolve(opts.path || '.');
32
- const appDirectories = args.slice(0, -1).length ? args.slice(0, -1) : ['.'];
60
+ // flatten nested array if commander wrapped variadic into single array
61
+ if (Array.isArray(appDirectories) && appDirectories.length === 1 && Array.isArray(appDirectories[0])) {
62
+ appDirectories = appDirectories[0];
63
+ }
33
64
  const templatesDir = path_1.default.resolve(__dirname, '../../templates', template);
34
65
  if (!fs_1.default.existsSync(templatesDir)) {
35
66
  console.error(`Template not found: ${templatesDir}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-bdk-cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "test CLI",
5
5
  "author": "@raisulaslam",
6
6
  "bin": {
@@ -17,12 +17,13 @@
17
17
  "dependencies": {
18
18
  "ajv": "^8.12.0",
19
19
  "archiver": "^5.3.1",
20
- "bolddesk-bdk-cli": "^0.1.1",
20
+ "test-bdk-cli": "^0.1.5",
21
21
  "chokidar": "^3.5.3",
22
22
  "commander": "^10.0.0",
23
23
  "form-data": "^4.0.0",
24
24
  "inquirer": "^9.0.0",
25
- "node-fetch": "^2.6.7"
25
+ "node-fetch": "^2.6.7",
26
+ "test-bdk-cli": "^0.1.3"
26
27
  },
27
28
  "devDependencies": {
28
29
  "@types/archiver": "^7.0.0",