@dynamicweb/cli 1.0.9 → 1.0.11
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/commands/files.js +3 -2
- package/bin/commands/query.js +12 -3
- package/package.json +1 -1
package/bin/commands/files.js
CHANGED
|
@@ -112,7 +112,7 @@ async function handleFiles(argv) {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
function getFilesInDirectory(dirPath) {
|
|
115
|
-
return fs.readdirSync(dirPath)
|
|
115
|
+
return fs.statSync(dirPath).isFile() ? [ dirPath ] : fs.readdirSync(dirPath)
|
|
116
116
|
.map(file => path.join(dirPath, file))
|
|
117
117
|
.filter(file => fs.statSync(file).isFile());
|
|
118
118
|
}
|
|
@@ -283,13 +283,14 @@ export function resolveFilePath(filePath) {
|
|
|
283
283
|
console.log('Could not find any files with the name ' + filePath);
|
|
284
284
|
process.exit(1);
|
|
285
285
|
}
|
|
286
|
-
return resolvedPath;
|
|
286
|
+
return path.join(p.dir, resolvedPath);
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
function wildcardToRegExp(wildcard) {
|
|
290
290
|
return new RegExp('^' + wildcard
|
|
291
291
|
.replace(/\./g, '\\.')
|
|
292
292
|
.replace(/\*/g, '.*')
|
|
293
|
+
.replace(/\+/g, '.+')
|
|
293
294
|
.replace(/\?/g, '.')
|
|
294
295
|
+ '$');
|
|
295
296
|
}
|
package/bin/commands/query.js
CHANGED
|
@@ -54,16 +54,25 @@ async function getProperties(argv) {
|
|
|
54
54
|
})
|
|
55
55
|
if (res.ok) {
|
|
56
56
|
let body = await res.json()
|
|
57
|
-
|
|
57
|
+
if (body.model.properties.groups === undefined) {
|
|
58
|
+
console.log('Unable to fetch query parameters');
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
return body.model.properties.groups.filter(g => g.name === 'Properties')[0].fields.map(field => `${field.name} (${field.typeName})`)
|
|
58
62
|
}
|
|
59
|
-
console.log(
|
|
63
|
+
console.log('Unable to fetch query parameters');
|
|
64
|
+
console.log(res);
|
|
65
|
+
process.exit(1);
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
async function getQueryParams(argv) {
|
|
63
69
|
let params = {}
|
|
64
70
|
if (argv.interactive) {
|
|
65
71
|
let props = { interactive: { default: true }}
|
|
66
|
-
|
|
72
|
+
let properties = await getProperties(argv);
|
|
73
|
+
console.log('The following properties will be requested:')
|
|
74
|
+
console.log(properties)
|
|
75
|
+
Array.from(properties).forEach(p => props[p] = { type: 'input', prompt: 'if-no-arg'})
|
|
67
76
|
await yargsInteractive()
|
|
68
77
|
.interactive(props)
|
|
69
78
|
.then((result) => {
|
package/package.json
CHANGED