@contrail/cli 2.1.16 → 2.1.17
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 +1 -1
- package/dist/commands/app/create.js +10 -5
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ $ npm install -g @contrail/cli
|
|
|
15
15
|
$ contrail COMMAND
|
|
16
16
|
running command...
|
|
17
17
|
$ contrail (--version)
|
|
18
|
-
@contrail/cli/2.1.
|
|
18
|
+
@contrail/cli/2.1.17 darwin-arm64 node-v18.13.0
|
|
19
19
|
$ contrail --help [COMMAND]
|
|
20
20
|
USAGE
|
|
21
21
|
$ contrail COMMAND
|
|
@@ -11,8 +11,9 @@ class CreateApp extends core_1.Command {
|
|
|
11
11
|
async run() {
|
|
12
12
|
await (0, login_1.authUser)();
|
|
13
13
|
const currentUser = await (0, login_1.getCurrentUser)();
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
const username = currentUser.email.split('@')[0];
|
|
15
|
+
const defaultAppName = `Hello World by ${username}`;
|
|
16
|
+
const defaultAppIdentifier = `@${username}/hello-world`;
|
|
16
17
|
const defaultAppDescription = `Hello world app by ${currentUser.email}`;
|
|
17
18
|
const defaultAppPublisher = `${currentUser.email}`;
|
|
18
19
|
const answers = await inquirer_1.default.prompt([{
|
|
@@ -43,8 +44,12 @@ class CreateApp extends core_1.Command {
|
|
|
43
44
|
default: defaultAppPublisher,
|
|
44
45
|
required: true
|
|
45
46
|
}]);
|
|
47
|
+
let sanitizedIdentifier = answers.appIdentifier;
|
|
48
|
+
if (!sanitizedIdentifier.startsWith('@')) {
|
|
49
|
+
sanitizedIdentifier = `@${sanitizedIdentifier}`;
|
|
50
|
+
}
|
|
46
51
|
const newApp = {
|
|
47
|
-
identifier:
|
|
52
|
+
identifier: sanitizedIdentifier,
|
|
48
53
|
name: answers.appName,
|
|
49
54
|
publisher: answers.appPublisher,
|
|
50
55
|
public: false,
|
|
@@ -56,12 +61,12 @@ class CreateApp extends core_1.Command {
|
|
|
56
61
|
await new sdk_1.Entities().create({ entityName: 'app', object: newApp });
|
|
57
62
|
}
|
|
58
63
|
catch (e) {
|
|
59
|
-
console.error(`%s Failed to create new app: ${
|
|
64
|
+
console.error(`%s Failed to create new app: ${sanitizedIdentifier}`, chalk_1.default.red.bold('APP'));
|
|
60
65
|
this.exit(1);
|
|
61
66
|
}
|
|
62
67
|
await (0, setup_template_1.setUpTemplate)({
|
|
63
68
|
appName: answers.appName,
|
|
64
|
-
appIdentifier:
|
|
69
|
+
appIdentifier: sanitizedIdentifier,
|
|
65
70
|
appDescription: answers.appDescription
|
|
66
71
|
});
|
|
67
72
|
}
|
package/oclif.manifest.json
CHANGED