@rockcarver/frodo-cli 0.12.4-5 → 0.12.4-6
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 +5 -1
- package/package.json +4 -3
- package/src/app.js +5 -2
- package/src/cli/admin/admin-create-oauth2-client-with-admin-privileges.js +5 -5
- package/src/cli/esv/esv-apply.js +8 -8
- package/src/cli/esv/esv-secret-describe.js +2 -2
- package/src/cli/idp/idp-export.js +8 -4
- package/src/cli/idp/idp-import.js +8 -8
- package/src/cli/idp/idp-list.js +2 -2
- package/src/cli/journey/journey-describe.js +6 -6
- package/src/cli/saml/saml-describe.js +3 -3
- package/src/cli/saml/saml-export.js +9 -5
- package/src/cli/saml/saml-import.js +10 -10
- package/src/cli/saml/saml-list.js +3 -3
- package/src/cli/saml/saml-metadata-export.js +3 -3
- package/src/cli/theme/theme-delete.js +3 -3
- package/src/utils/Console.js +17 -15
- package/tsconfig.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.12.4-6] - 2022-09-15
|
|
11
|
+
|
|
10
12
|
## [0.12.4-5] - 2022-09-13
|
|
11
13
|
|
|
12
14
|
## [0.12.4-4] - 2022-09-12
|
|
@@ -462,7 +464,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
462
464
|
- Fixed problem with adding connection profiles
|
|
463
465
|
- Miscellaneous bug fixes
|
|
464
466
|
|
|
465
|
-
[Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.12.4-
|
|
467
|
+
[Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.12.4-6...HEAD
|
|
468
|
+
|
|
469
|
+
[0.12.4-6]: https://github.com/rockcarver/frodo-cli/compare/v0.12.4-5...v0.12.4-6
|
|
466
470
|
|
|
467
471
|
[0.12.4-5]: https://github.com/rockcarver/frodo-cli/compare/v0.12.4-4...v0.12.4-5
|
|
468
472
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rockcarver/frodo-cli",
|
|
3
|
-
"version": "0.12.4-
|
|
3
|
+
"version": "0.12.4-6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A command line interface to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
|
|
6
6
|
"keywords": [
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
87
|
"@colors/colors": "^1.5.0",
|
|
88
|
-
"@rockcarver/frodo-lib": "0.12.2-
|
|
88
|
+
"@rockcarver/frodo-lib": "0.12.2-10",
|
|
89
89
|
"cli-progress": "^3.11.2",
|
|
90
90
|
"cli-table3": "^0.6.2",
|
|
91
91
|
"commander": "^9.4.0",
|
|
@@ -115,6 +115,7 @@
|
|
|
115
115
|
"jest": "^28.1.3",
|
|
116
116
|
"map-stream": "^0.0.7",
|
|
117
117
|
"pkg": "^5.8.0",
|
|
118
|
-
"prettier": "^2.7.1"
|
|
118
|
+
"prettier": "^2.7.1",
|
|
119
|
+
"typescript": "^4.8.3"
|
|
119
120
|
}
|
|
120
121
|
}
|
package/src/app.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import { getVersion, ConnectionProfile } from '@rockcarver/frodo-lib';
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import { Command } from 'commander';
|
|
6
|
-
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
7
8
|
|
|
8
9
|
// commands
|
|
9
10
|
import admin from './cli/admin/admin.js';
|
|
@@ -21,8 +22,10 @@ import saml from './cli/saml/saml.js';
|
|
|
21
22
|
import script from './cli/script/script.js';
|
|
22
23
|
import theme from './cli/theme/theme.js';
|
|
23
24
|
|
|
25
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
|
|
24
27
|
const pkg = JSON.parse(
|
|
25
|
-
fs.readFileSync(
|
|
28
|
+
fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf8')
|
|
26
29
|
);
|
|
27
30
|
|
|
28
31
|
const { initConnectionProfiles } = ConnectionProfile;
|
|
@@ -102,16 +102,16 @@ program
|
|
|
102
102
|
options.lltEsv,
|
|
103
103
|
options.lltTtl
|
|
104
104
|
);
|
|
105
|
-
table.push(['Secret Name'
|
|
106
|
-
table.push(['Scope'
|
|
105
|
+
table.push(['Secret Name'['brightCyan'], response.secret]);
|
|
106
|
+
table.push(['Scope'['brightCyan'], response.scope]);
|
|
107
107
|
// table.push(['Token Lifetime'.brightCyan, response.expires_in]);
|
|
108
|
-
table.push(['Expires'
|
|
108
|
+
table.push(['Expires'['brightCyan'], response.expires_on]);
|
|
109
109
|
} catch (error) {
|
|
110
110
|
console.log(error, 'error');
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
table.push(['Client ID'
|
|
114
|
-
table.push(['Client Secret'
|
|
113
|
+
table.push(['Client ID'['brightCyan'], clientId]);
|
|
114
|
+
table.push(['Client Secret'['brightCyan'], clientSecret]);
|
|
115
115
|
console.log(table.toString());
|
|
116
116
|
}
|
|
117
117
|
}
|
package/src/cli/esv/esv-apply.js
CHANGED
|
@@ -70,24 +70,24 @@ program
|
|
|
70
70
|
'Modifier',
|
|
71
71
|
]);
|
|
72
72
|
for (const secret of updates.secrets) {
|
|
73
|
-
if (!secret
|
|
73
|
+
if (!secret['loaded']) {
|
|
74
74
|
updatesTable.push([
|
|
75
75
|
'secret',
|
|
76
|
-
secret
|
|
77
|
-
new Date(secret
|
|
76
|
+
secret['_id'],
|
|
77
|
+
new Date(secret['lastChangeDate']).toLocaleString(),
|
|
78
78
|
// eslint-disable-next-line no-await-in-loop
|
|
79
|
-
await resolveUserName('teammember', secret
|
|
79
|
+
await resolveUserName('teammember', secret['lastChangedBy']),
|
|
80
80
|
]);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
for (const variable of updates.variables) {
|
|
84
|
-
if (!variable
|
|
84
|
+
if (!variable['loaded']) {
|
|
85
85
|
updatesTable.push([
|
|
86
86
|
'variable',
|
|
87
|
-
variable
|
|
88
|
-
new Date(variable
|
|
87
|
+
variable['_id'],
|
|
88
|
+
new Date(variable['lastChangeDate']).toLocaleString(),
|
|
89
89
|
// eslint-disable-next-line no-await-in-loop
|
|
90
|
-
await resolveUserName('teammember', variable
|
|
90
|
+
await resolveUserName('teammember', variable['lastChangedBy']),
|
|
91
91
|
]);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
|
-
import { Authenticate, state } from '@rockcarver/frodo-lib';
|
|
2
|
+
import { Authenticate, Secrets, state } from '@rockcarver/frodo-lib';
|
|
3
3
|
import * as common from '../cmd_common.js';
|
|
4
4
|
|
|
5
|
-
const { getTokens
|
|
5
|
+
const { getTokens } = Authenticate;
|
|
6
6
|
const { describeSecret } = Secrets;
|
|
7
7
|
|
|
8
8
|
const program = new Command('frodo esv secret describe');
|
|
@@ -3,7 +3,11 @@ import { Authenticate, Idp, state } from '@rockcarver/frodo-lib';
|
|
|
3
3
|
import * as common from '../cmd_common.js';
|
|
4
4
|
|
|
5
5
|
const { getTokens } = Authenticate;
|
|
6
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
exportSocialProviderToFile,
|
|
8
|
+
exportSocialProvidersToFile,
|
|
9
|
+
exportSocialProvidersToFiles,
|
|
10
|
+
} = Idp;
|
|
7
11
|
|
|
8
12
|
const program = new Command('frodo idp export');
|
|
9
13
|
|
|
@@ -58,17 +62,17 @@ program
|
|
|
58
62
|
options.idpId
|
|
59
63
|
}" from realm "${state.default.session.getRealm()}"...`
|
|
60
64
|
);
|
|
61
|
-
|
|
65
|
+
exportSocialProviderToFile(options.idpId, options.file);
|
|
62
66
|
}
|
|
63
67
|
// --all -a
|
|
64
68
|
else if (options.all) {
|
|
65
69
|
console.log('Exporting all providers to a single file...');
|
|
66
|
-
|
|
70
|
+
exportSocialProvidersToFile(options.file);
|
|
67
71
|
}
|
|
68
72
|
// --all-separate -A
|
|
69
73
|
else if (options.allSeparate) {
|
|
70
74
|
console.log('Exporting all providers to separate files...');
|
|
71
|
-
|
|
75
|
+
exportSocialProvidersToFiles();
|
|
72
76
|
}
|
|
73
77
|
// unrecognized combination of options or no options
|
|
74
78
|
else {
|
|
@@ -4,10 +4,10 @@ import * as common from '../cmd_common.js';
|
|
|
4
4
|
|
|
5
5
|
const { getTokens } = Authenticate;
|
|
6
6
|
const {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
importSocialProviderFromFile,
|
|
8
|
+
importFirstSocialProviderFromFile,
|
|
9
|
+
importSocialProvidersFromFile,
|
|
10
|
+
importSocialProvidersFromFiles,
|
|
11
11
|
} = Idp;
|
|
12
12
|
|
|
13
13
|
const program = new Command('frodo idp import');
|
|
@@ -63,21 +63,21 @@ program
|
|
|
63
63
|
options.idpId
|
|
64
64
|
}" into realm "${state.default.session.getRealm()}"...`
|
|
65
65
|
);
|
|
66
|
-
|
|
66
|
+
importSocialProviderFromFile(options.idpId, options.file);
|
|
67
67
|
}
|
|
68
68
|
// --all -a
|
|
69
69
|
else if (options.all && options.file) {
|
|
70
70
|
console.log(
|
|
71
71
|
`Importing all providers from a single file (${options.file})...`
|
|
72
72
|
);
|
|
73
|
-
|
|
73
|
+
importSocialProvidersFromFile(options.file);
|
|
74
74
|
}
|
|
75
75
|
// --all-separate -A
|
|
76
76
|
else if (options.allSeparate && !options.file) {
|
|
77
77
|
console.log(
|
|
78
78
|
'Importing all providers from separate files in current directory...'
|
|
79
79
|
);
|
|
80
|
-
|
|
80
|
+
importSocialProvidersFromFiles();
|
|
81
81
|
}
|
|
82
82
|
// import first provider from file
|
|
83
83
|
else if (options.file) {
|
|
@@ -86,7 +86,7 @@ program
|
|
|
86
86
|
options.file
|
|
87
87
|
}" into realm "${state.default.session.getRealm()}"...`
|
|
88
88
|
);
|
|
89
|
-
|
|
89
|
+
importFirstSocialProviderFromFile(options.file);
|
|
90
90
|
}
|
|
91
91
|
// unrecognized combination of options or no options
|
|
92
92
|
else {
|
package/src/cli/idp/idp-list.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Authenticate, Idp, state } from '@rockcarver/frodo-lib';
|
|
|
3
3
|
import * as common from '../cmd_common.js';
|
|
4
4
|
|
|
5
5
|
const { getTokens } = Authenticate;
|
|
6
|
-
const {
|
|
6
|
+
const { listSocialProviders } = Idp;
|
|
7
7
|
|
|
8
8
|
const program = new Command('frodo idp list');
|
|
9
9
|
|
|
@@ -33,7 +33,7 @@ program
|
|
|
33
33
|
console.log(
|
|
34
34
|
`Listing providers in realm "${state.default.session.getRealm()}"...`
|
|
35
35
|
);
|
|
36
|
-
|
|
36
|
+
listSocialProviders();
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
// end command logic inside action handler
|
|
@@ -4,7 +4,7 @@ import { Authenticate, Journey, state } from '@rockcarver/frodo-lib';
|
|
|
4
4
|
import * as common from '../cmd_common.js';
|
|
5
5
|
|
|
6
6
|
const { getTokens } = Authenticate;
|
|
7
|
-
const { getJourneys,
|
|
7
|
+
const { getJourneys, exportJourney, describeJourney } = Journey;
|
|
8
8
|
|
|
9
9
|
const program = new Command('frodo journey describe');
|
|
10
10
|
|
|
@@ -61,7 +61,7 @@ program
|
|
|
61
61
|
try {
|
|
62
62
|
const data = fs.readFileSync(options.file, 'utf8');
|
|
63
63
|
const journeyData = JSON.parse(data);
|
|
64
|
-
|
|
64
|
+
describeJourney(journeyData);
|
|
65
65
|
} catch (error) {
|
|
66
66
|
console.log(error.message);
|
|
67
67
|
process.exitCode = 1;
|
|
@@ -76,8 +76,8 @@ program
|
|
|
76
76
|
for (const journey of journeys) {
|
|
77
77
|
try {
|
|
78
78
|
// eslint-disable-next-line no-await-in-loop
|
|
79
|
-
const treeData = await
|
|
80
|
-
|
|
79
|
+
const treeData = await exportJourney(journey['_id']);
|
|
80
|
+
describeJourney(treeData);
|
|
81
81
|
} catch (error) {
|
|
82
82
|
console.log(error.message);
|
|
83
83
|
process.exitCode = 1;
|
|
@@ -85,8 +85,8 @@ program
|
|
|
85
85
|
}
|
|
86
86
|
} else {
|
|
87
87
|
try {
|
|
88
|
-
const treeData = await
|
|
89
|
-
|
|
88
|
+
const treeData = await exportJourney(options.journeyId);
|
|
89
|
+
describeJourney(treeData);
|
|
90
90
|
} catch (error) {
|
|
91
91
|
console.log(error.message);
|
|
92
92
|
process.exitCode = 1;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
|
-
import { Authenticate,
|
|
2
|
+
import { Authenticate, Saml2, state } from '@rockcarver/frodo-lib';
|
|
3
3
|
import * as common from '../cmd_common.js';
|
|
4
4
|
|
|
5
5
|
const { getTokens } = Authenticate;
|
|
6
|
-
const {
|
|
6
|
+
const { describeSaml2Provider } = Saml2;
|
|
7
7
|
|
|
8
8
|
const program = new Command('frodo saml describe');
|
|
9
9
|
|
|
@@ -33,7 +33,7 @@ program
|
|
|
33
33
|
options.entityId
|
|
34
34
|
} in realm "${state.default.session.getRealm()}"...`
|
|
35
35
|
);
|
|
36
|
-
|
|
36
|
+
describeSaml2Provider(options.entityId);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
// end command logic inside action handler
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
|
-
import { Authenticate,
|
|
2
|
+
import { Authenticate, Saml2, state } from '@rockcarver/frodo-lib';
|
|
3
3
|
import * as common from '../cmd_common.js';
|
|
4
4
|
|
|
5
5
|
const { getTokens } = Authenticate;
|
|
6
6
|
|
|
7
|
-
const {
|
|
7
|
+
const {
|
|
8
|
+
exportSaml2ProviderToFile,
|
|
9
|
+
exportSaml2ProvidersToFile,
|
|
10
|
+
exportSaml2ProvidersToFiles,
|
|
11
|
+
} = Saml2;
|
|
8
12
|
|
|
9
13
|
const program = new Command('frodo saml export');
|
|
10
14
|
|
|
@@ -59,17 +63,17 @@ program
|
|
|
59
63
|
options.entityId
|
|
60
64
|
}" from realm "${state.default.session.getRealm()}"...`
|
|
61
65
|
);
|
|
62
|
-
|
|
66
|
+
exportSaml2ProviderToFile(options.entityId, options.file);
|
|
63
67
|
}
|
|
64
68
|
// --all -a
|
|
65
69
|
else if (options.all) {
|
|
66
70
|
console.log('Exporting all providers to a single file...');
|
|
67
|
-
|
|
71
|
+
exportSaml2ProvidersToFile(options.file);
|
|
68
72
|
}
|
|
69
73
|
// --all-separate -A
|
|
70
74
|
else if (options.allSeparate) {
|
|
71
75
|
console.log('Exporting all providers to separate files...');
|
|
72
|
-
|
|
76
|
+
exportSaml2ProvidersToFiles();
|
|
73
77
|
}
|
|
74
78
|
// unrecognized combination of options or no options
|
|
75
79
|
else {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
|
-
import { Authenticate,
|
|
2
|
+
import { Authenticate, Saml2, state } from '@rockcarver/frodo-lib';
|
|
3
3
|
import * as common from '../cmd_common.js';
|
|
4
4
|
|
|
5
5
|
const { getTokens } = Authenticate;
|
|
6
6
|
|
|
7
7
|
const {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} =
|
|
8
|
+
importSaml2ProviderFromFile,
|
|
9
|
+
importSaml2ProvidersFromFile,
|
|
10
|
+
importSaml2ProvidersFromFiles,
|
|
11
|
+
importFirstSaml2ProviderFromFile,
|
|
12
|
+
} = Saml2;
|
|
13
13
|
|
|
14
14
|
const program = new Command('frodo saml import');
|
|
15
15
|
|
|
@@ -64,21 +64,21 @@ program
|
|
|
64
64
|
options.entityId
|
|
65
65
|
}" into realm "${state.default.session.getRealm()}"...`
|
|
66
66
|
);
|
|
67
|
-
|
|
67
|
+
importSaml2ProviderFromFile(options.entityId, options.file);
|
|
68
68
|
}
|
|
69
69
|
// --all -a
|
|
70
70
|
else if (options.all && options.file) {
|
|
71
71
|
console.log(
|
|
72
72
|
`Importing all providers from a single file (${options.file})...`
|
|
73
73
|
);
|
|
74
|
-
|
|
74
|
+
importSaml2ProvidersFromFile(options.file);
|
|
75
75
|
}
|
|
76
76
|
// --all-separate -A
|
|
77
77
|
else if (options.allSeparate && !options.file) {
|
|
78
78
|
console.log(
|
|
79
79
|
'Importing all providers from separate files (*.saml.json) in current directory...'
|
|
80
80
|
);
|
|
81
|
-
|
|
81
|
+
importSaml2ProvidersFromFiles();
|
|
82
82
|
}
|
|
83
83
|
// import first provider from file
|
|
84
84
|
else if (options.file) {
|
|
@@ -87,7 +87,7 @@ program
|
|
|
87
87
|
options.file
|
|
88
88
|
}" into realm "${state.default.session.getRealm()}"...`
|
|
89
89
|
);
|
|
90
|
-
|
|
90
|
+
importFirstSaml2ProviderFromFile(options.file);
|
|
91
91
|
}
|
|
92
92
|
// unrecognized combination of options or no options
|
|
93
93
|
else {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
|
-
import { Authenticate,
|
|
2
|
+
import { Authenticate, Saml2, state } from '@rockcarver/frodo-lib';
|
|
3
3
|
import * as common from '../cmd_common.js';
|
|
4
4
|
|
|
5
5
|
const { getTokens } = Authenticate;
|
|
6
|
-
const {
|
|
6
|
+
const { listSaml2Providers } = Saml2;
|
|
7
7
|
|
|
8
8
|
const program = new Command('frodo saml list');
|
|
9
9
|
|
|
@@ -33,7 +33,7 @@ program
|
|
|
33
33
|
console.log(
|
|
34
34
|
`Listing SAML entity providers in realm "${state.default.session.getRealm()}"...`
|
|
35
35
|
);
|
|
36
|
-
|
|
36
|
+
listSaml2Providers(options.long);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
// end command logic inside action handler
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
|
-
import { Authenticate,
|
|
2
|
+
import { Authenticate, Saml2, state } from '@rockcarver/frodo-lib';
|
|
3
3
|
import * as common from '../cmd_common.js';
|
|
4
4
|
|
|
5
5
|
const { getTokens } = Authenticate;
|
|
6
6
|
|
|
7
|
-
const {
|
|
7
|
+
const { exportSaml2Metadata } = Saml2;
|
|
8
8
|
|
|
9
9
|
const program = new Command('frodo saml metadata export');
|
|
10
10
|
|
|
@@ -53,7 +53,7 @@ program
|
|
|
53
53
|
options.entityId
|
|
54
54
|
}" from realm "${state.default.session.getRealm()}"...`
|
|
55
55
|
);
|
|
56
|
-
|
|
56
|
+
exportSaml2Metadata(options.entityId, options.file);
|
|
57
57
|
}
|
|
58
58
|
// // --all-separate -A
|
|
59
59
|
// else if (options.allSeparate) {
|
|
@@ -52,7 +52,7 @@ program
|
|
|
52
52
|
options.themeName
|
|
53
53
|
}" from realm "${state.default.session.getRealm()}"...`
|
|
54
54
|
);
|
|
55
|
-
deleteThemeByNameCmd(options.themeName
|
|
55
|
+
deleteThemeByNameCmd(options.themeName);
|
|
56
56
|
}
|
|
57
57
|
// delete by id
|
|
58
58
|
else if (options.themeId) {
|
|
@@ -61,14 +61,14 @@ program
|
|
|
61
61
|
options.themeId
|
|
62
62
|
}" from realm "${state.default.session.getRealm()}"...`
|
|
63
63
|
);
|
|
64
|
-
deleteThemeCmd(options.themeId
|
|
64
|
+
deleteThemeCmd(options.themeId);
|
|
65
65
|
}
|
|
66
66
|
// --all -a
|
|
67
67
|
else if (options.all) {
|
|
68
68
|
console.log(
|
|
69
69
|
`Deleting all themes from realm "${state.default.session.getRealm()}"...`
|
|
70
70
|
);
|
|
71
|
-
deleteThemesCmd(
|
|
71
|
+
deleteThemesCmd();
|
|
72
72
|
}
|
|
73
73
|
// unrecognized combination of options or no options
|
|
74
74
|
else {
|
package/src/utils/Console.js
CHANGED
|
@@ -105,7 +105,7 @@ export function printMessage(message, type = 'text', newline = true) {
|
|
|
105
105
|
if (newline) {
|
|
106
106
|
info(message);
|
|
107
107
|
} else {
|
|
108
|
-
process.stderr.write(message
|
|
108
|
+
process.stderr.write(message['brightCyan']);
|
|
109
109
|
}
|
|
110
110
|
break;
|
|
111
111
|
case 'warn':
|
|
@@ -119,14 +119,14 @@ export function printMessage(message, type = 'text', newline = true) {
|
|
|
119
119
|
if (newline) {
|
|
120
120
|
error(message);
|
|
121
121
|
} else {
|
|
122
|
-
process.stderr.write(message
|
|
122
|
+
process.stderr.write(message['brightRed']);
|
|
123
123
|
}
|
|
124
124
|
break;
|
|
125
125
|
default:
|
|
126
126
|
if (newline) {
|
|
127
127
|
error(message);
|
|
128
128
|
} else {
|
|
129
|
-
process.stderr.write(message
|
|
129
|
+
process.stderr.write(message['bgBrightRed']);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
}
|
|
@@ -315,11 +315,11 @@ export function stopProgressIndicator(message, status = 'none') {
|
|
|
315
315
|
|
|
316
316
|
/**
|
|
317
317
|
* Create an empty table
|
|
318
|
-
* @param {[
|
|
319
|
-
* @returns {
|
|
318
|
+
* @param {string[]} head header row as an array of strings
|
|
319
|
+
* @returns {any} an empty table
|
|
320
320
|
*/
|
|
321
321
|
export function createTable(head) {
|
|
322
|
-
|
|
322
|
+
const table = new Table({
|
|
323
323
|
head,
|
|
324
324
|
chars: {
|
|
325
325
|
top: '',
|
|
@@ -339,14 +339,15 @@ export function createTable(head) {
|
|
|
339
339
|
},
|
|
340
340
|
style: { 'padding-left': 0, 'padding-right': 0, head: ['brightCyan'] },
|
|
341
341
|
});
|
|
342
|
+
return table;
|
|
342
343
|
}
|
|
343
344
|
|
|
344
345
|
/**
|
|
345
346
|
* Create a new key/value table
|
|
346
|
-
* @returns {
|
|
347
|
+
* @returns {any} an empty key/value table
|
|
347
348
|
*/
|
|
348
349
|
export function createKeyValueTable() {
|
|
349
|
-
|
|
350
|
+
const table = new Table({
|
|
350
351
|
chars: {
|
|
351
352
|
top: '',
|
|
352
353
|
'top-mid': '',
|
|
@@ -366,6 +367,7 @@ export function createKeyValueTable() {
|
|
|
366
367
|
style: { 'padding-left': 0, 'padding-right': 0 },
|
|
367
368
|
wordWrap: true,
|
|
368
369
|
});
|
|
370
|
+
return table;
|
|
369
371
|
}
|
|
370
372
|
|
|
371
373
|
/**
|
|
@@ -398,10 +400,10 @@ function hasValues(object) {
|
|
|
398
400
|
|
|
399
401
|
/**
|
|
400
402
|
* Helper function (recursive) to add rows to an object table
|
|
401
|
-
* @param {
|
|
402
|
-
* @param {
|
|
403
|
-
* @param {
|
|
404
|
-
* @param {
|
|
403
|
+
* @param {object} object object to render
|
|
404
|
+
* @param {number} depth total depth of initial object
|
|
405
|
+
* @param {number} level current level
|
|
406
|
+
* @param {any} table the object table to add the rows to
|
|
405
407
|
* @returns the updated object table
|
|
406
408
|
*/
|
|
407
409
|
function addRows(object, depth, level, table, keyMap) {
|
|
@@ -411,7 +413,7 @@ function addRows(object, depth, level, table, keyMap) {
|
|
|
411
413
|
if (Object(object[key]) !== object[key]) {
|
|
412
414
|
if (level === 1) {
|
|
413
415
|
table.push([
|
|
414
|
-
keyMap[key] ? keyMap[key].brightCyan : key
|
|
416
|
+
keyMap[key] ? keyMap[key].brightCyan : key['brightCyan'],
|
|
415
417
|
object[key],
|
|
416
418
|
]);
|
|
417
419
|
} else {
|
|
@@ -433,7 +435,7 @@ function addRows(object, depth, level, table, keyMap) {
|
|
|
433
435
|
if (level < 3) indention = `\n${indention}`;
|
|
434
436
|
table.push([
|
|
435
437
|
indention.concat(
|
|
436
|
-
keyMap[key] ? keyMap[key].brightCyan : key
|
|
438
|
+
keyMap[key] ? keyMap[key].brightCyan : key['brightCyan']
|
|
437
439
|
),
|
|
438
440
|
'',
|
|
439
441
|
]);
|
|
@@ -448,7 +450,7 @@ function addRows(object, depth, level, table, keyMap) {
|
|
|
448
450
|
/**
|
|
449
451
|
* Create and populate an object table from any JSON object. Use for describe commands.
|
|
450
452
|
* @param {Object} object JSON object to create
|
|
451
|
-
* @returns {
|
|
453
|
+
* @returns {any} a table that can be printed to the console
|
|
452
454
|
*/
|
|
453
455
|
export function createObjectTable(object, keyMap = {}) {
|
|
454
456
|
// eslint-disable-next-line no-param-reassign
|
package/tsconfig.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
8
|
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
9
|
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
-
|
|
10
|
+
"disableSolutionSearching": false /* Opt a project out of multi-project reference checking when editing. */,
|
|
11
11
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
12
|
|
|
13
13
|
/* Language and Environment */
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
|
|
42
42
|
/* JavaScript Support */
|
|
43
43
|
"allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */,
|
|
44
|
-
|
|
44
|
+
"checkJs": true /* Enable error reporting in type-checked JavaScript files. */,
|
|
45
45
|
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
46
46
|
|
|
47
47
|
/* Emit */
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
/* Interop Constraints */
|
|
72
72
|
"isolatedModules": false /* Ensure that each file can be safely transpiled without relying on other imports. */,
|
|
73
73
|
"allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */,
|
|
74
|
-
"esModuleInterop":
|
|
74
|
+
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
75
75
|
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
76
76
|
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
77
77
|
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
},
|
|
103
103
|
"files": ["src/app.js"],
|
|
104
104
|
"include": ["src/**/*.js"],
|
|
105
|
-
"exclude": ["src/**/*.test.js"]
|
|
105
|
+
"exclude": ["src/**/*.test.js", "src/**/*.test_.js"]
|
|
106
106
|
}
|