yargs-file-commands 0.0.17 → 0.0.19
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/CHANGELOG.md +7 -15
- package/dist/lib/importCommand.js +2 -1
- package/package.json +1 -1
- package/src/lib/importCommand.ts +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,37 +1,29 @@
|
|
|
1
1
|
# yargs-file-commands
|
|
2
2
|
|
|
3
|
+
## 0.0.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Improved debugging logging
|
|
8
|
+
- fix windows bug
|
|
9
|
+
|
|
3
10
|
## 0.0.17
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
6
13
|
|
|
7
14
|
- Throw if a command exports unrecognized names, catches a lot of bugs.
|
|
8
|
-
- More explicit exceptions when bad parameters are passed in
|
|
9
|
-
- Validate that provided command directories are aboslute
|
|
10
|
-
- More robust parameter checking and logging
|
|
11
|
-
- Improved debugging logging
|
|
12
|
-
- added support for default commands and optional command names to support position arguments
|
|
13
|
-
- More robust debug messages
|
|
14
15
|
|
|
15
16
|
## 0.0.15
|
|
16
17
|
|
|
17
18
|
### Patch Changes
|
|
18
19
|
|
|
19
20
|
- Throw if a command exports unrecognized names, catches a lot of bugs.
|
|
20
|
-
- More explicit exceptions when bad parameters are passed in
|
|
21
|
-
- Validate that provided command directories are aboslute
|
|
22
|
-
- More robust parameter checking and logging
|
|
23
|
-
- Improved debugging logging
|
|
24
|
-
- More robust debug messages
|
|
25
21
|
|
|
26
22
|
## 0.0.14
|
|
27
23
|
|
|
28
24
|
### Patch Changes
|
|
29
25
|
|
|
30
26
|
- More explicit exceptions when bad parameters are passed in
|
|
31
|
-
- Validate that provided command directories are aboslute
|
|
32
|
-
- More robust parameter checking and logging
|
|
33
|
-
- Improved debugging logging
|
|
34
|
-
- More robust debug messages
|
|
35
27
|
|
|
36
28
|
## 0.0.13
|
|
37
29
|
|
|
@@ -16,7 +16,8 @@ export const importCommandFromFile = async (filePath, name, options) => {
|
|
|
16
16
|
if (fs.existsSync(filePath) === false) {
|
|
17
17
|
throw new Error(`Can not import command from non-existence file path: ${filePath}`);
|
|
18
18
|
}
|
|
19
|
-
const
|
|
19
|
+
const url = 'file://' + filePath;
|
|
20
|
+
const handlerModule = (await import(url));
|
|
20
21
|
const { logLevel = 'info' } = options;
|
|
21
22
|
// Check if this is the default command
|
|
22
23
|
const isDefault = name === '$default';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yargs-file-commands",
|
|
3
3
|
"description": "A yargs helper function that lets you define your commands structure via directory and file naming conventions.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.19",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
package/src/lib/importCommand.ts
CHANGED
|
@@ -92,12 +92,14 @@ export const importCommandFromFile = async (
|
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
const
|
|
95
|
+
const url = 'file://' + filePath;
|
|
96
|
+
|
|
97
|
+
const handlerModule = (await import(url)) as CommandImportModule;
|
|
96
98
|
const { logLevel = 'info' } = options;
|
|
97
99
|
|
|
98
100
|
// Check if this is the default command
|
|
99
101
|
const isDefault = name === '$default';
|
|
100
|
-
|
|
102
|
+
|
|
101
103
|
const command = {
|
|
102
104
|
command: handlerModule.command ?? (isDefault ? '$0' : name),
|
|
103
105
|
describe: handlerModule.describe,
|