@kdcloudjs/cli 0.0.4 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kdcloudjs/cli",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Kingdee CLI",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -50,38 +50,43 @@ module.exports = async function debug(options = {}) {
50
50
  }
51
51
 
52
52
  // 3. Get Form IDs
53
- const pagesDir = path.join(root, 'app/pages')
54
- const pageFiles = walk(pagesDir)
55
- const forms = []
56
-
57
- for (const file of pageFiles) {
58
- const id = getFormId(file)
59
- if (id) {
60
- forms.push({
61
- title: id,
62
- value: id
63
- })
53
+ let formId = options.formid
54
+
55
+ if (!formId) {
56
+ const pagesDir = path.join(root, 'app/pages')
57
+ const pageFiles = walk(pagesDir)
58
+ const forms = []
59
+
60
+ for (const file of pageFiles) {
61
+ const id = getFormId(file)
62
+ if (id) {
63
+ forms.push({
64
+ title: id,
65
+ value: id
66
+ })
67
+ }
64
68
  }
65
- }
66
69
 
67
- if (forms.length === 0) {
68
- error('No pages found in app/pages')
69
- return
70
- }
70
+ if (forms.length === 0) {
71
+ error('No pages found in app/pages')
72
+ return
73
+ }
71
74
 
72
- // 4. Select Form
73
- const response = await safePrompts({
74
- type: 'select',
75
- name: 'formId',
76
- message: 'Select a form to debug',
77
- choices: forms
78
- })
75
+ // 4. Select Form
76
+ const response = await safePrompts({
77
+ type: 'select',
78
+ name: 'formId',
79
+ message: 'Select a form to debug',
80
+ choices: forms
81
+ })
79
82
 
80
- if (!response.formId) return
83
+ if (!response.formId) return
84
+ formId = response.formId
85
+ }
81
86
 
82
87
  // 5. Construct URL
83
88
  const targetUrl = new URL(env.url)
84
- targetUrl.searchParams.append('formId', response.formId)
89
+ targetUrl.searchParams.append('formId', formId)
85
90
  targetUrl.searchParams.append('kdkwc_cdn', 'http://localhost:3333')
86
91
  const finalUrl = targetUrl.toString()
87
92
 
@@ -3,6 +3,7 @@ module.exports = function registerDebug(program) {
3
3
  .command('debug')
4
4
  .description('debug project')
5
5
  .option('-e, --target-env <env>', 'specified target environment')
6
+ .option('-f, --formid <formId>', 'specified form id to debug')
6
7
  .action((options) =>
7
8
  require('../actions/debug')(options)
8
9
  )