dbdocs 1.6.0 → 1.7.0
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/oclif.manifest.json +1 -1
- package/package.json +2 -2
- package/src/assets/callback-success.html +2 -2
- package/src/commands/build.js +11 -5
- package/src/utils/org.js +5 -1
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dbdocs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"author": "@holistics",
|
|
5
5
|
"bin": {
|
|
6
6
|
"dbdocs": "./bin/run"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"@dbml/core": "10.1.1",
|
|
15
15
|
"@oclif/core": "1.26.2",
|
|
16
16
|
"@oclif/plugin-help": "6.2.32",
|
|
17
|
-
"axios": "^1.
|
|
17
|
+
"axios": "^1.20.0",
|
|
18
18
|
"chalk": "^3.0.0",
|
|
19
19
|
"dotenv": "^8.2.0",
|
|
20
20
|
"inquirer": "^12.9.4",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>dbdocs CLI -
|
|
6
|
+
<title>dbdocs CLI - Authentication Successful</title>
|
|
7
7
|
<style>
|
|
8
8
|
* {
|
|
9
9
|
margin: 0;
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
</svg>
|
|
66
66
|
</div>
|
|
67
67
|
|
|
68
|
-
<h1>
|
|
68
|
+
<h1>Authentication Successful</h1>
|
|
69
69
|
|
|
70
70
|
<p>You can close this window and return to your terminal to continue.</p>
|
|
71
71
|
</div>
|
package/src/commands/build.js
CHANGED
|
@@ -36,7 +36,7 @@ async function enterOrgName (defaultOrgName) {
|
|
|
36
36
|
name: 'orgName',
|
|
37
37
|
},
|
|
38
38
|
]);
|
|
39
|
-
return answer.orgName || defaultOrgName;
|
|
39
|
+
return { orgName: answer.orgName || defaultOrgName, isUsingDefaultOrg: !answer.orgName };
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
async function enterProjectName () {
|
|
@@ -94,20 +94,23 @@ class BuildCommand extends Command {
|
|
|
94
94
|
const message = rawMessage ? `You have syntax error(s) in ${path.basename(filepath)}\n${rawMessage}` : 'Something wrong :( Please try again.';
|
|
95
95
|
throw new Error(message);
|
|
96
96
|
}
|
|
97
|
-
|
|
98
|
-
if (!orgName)
|
|
97
|
+
let isUsingDefaultOrg = false;
|
|
98
|
+
if (!orgName) {
|
|
99
|
+
orgName = defaultOrgName;
|
|
100
|
+
isUsingDefaultOrg = true;
|
|
101
|
+
}
|
|
99
102
|
|
|
100
103
|
let projectName = projectNameFromInput || projectNameFromDbml;
|
|
101
104
|
|
|
102
105
|
// if project name is not defined yet, ask user to input the project name
|
|
103
106
|
if (!projectName) {
|
|
104
107
|
// ask the username to publish to
|
|
105
|
-
orgName = await enterOrgName(defaultOrgName);
|
|
108
|
+
({ orgName, isUsingDefaultOrg } = await enterOrgName(defaultOrgName));
|
|
106
109
|
while (!isValidName(orgName)) {
|
|
107
110
|
// eslint-disable-next-line max-len
|
|
108
111
|
spinner.warn('Invalid username! Username can only contain alphabets, numbers, space, "-" or "_", or leave it blank to publish to your personal account!');
|
|
109
112
|
// eslint-disable-next-line no-await-in-loop
|
|
110
|
-
orgName = await enterOrgName(defaultOrgName);
|
|
113
|
+
({ orgName, isUsingDefaultOrg } = await enterOrgName(defaultOrgName));
|
|
111
114
|
}
|
|
112
115
|
projectName = await enterProjectName();
|
|
113
116
|
}
|
|
@@ -151,6 +154,9 @@ class BuildCommand extends Command {
|
|
|
151
154
|
default:
|
|
152
155
|
break;
|
|
153
156
|
}
|
|
157
|
+
if (isUsingDefaultOrg) {
|
|
158
|
+
spinner.info(`No username specified, defaulting to: ${chalk.cyan(defaultOrgName)}`);
|
|
159
|
+
}
|
|
154
160
|
spinner.succeed(`Done. Visit: ${chalk.cyan(getProjectUrl(vars.hostUrl, newProject.org.name, newProject.urlName))}\n`);
|
|
155
161
|
if (shouldAskForFeedback()) {
|
|
156
162
|
spinner.info(`Thanks for using dbdocs! We'd love to hear your feedback: ${chalk.cyan('https://form.jotform.com/200962053361448')}`);
|
package/src/utils/org.js
CHANGED
|
@@ -3,7 +3,11 @@ const { vars } = require('../vars');
|
|
|
3
3
|
|
|
4
4
|
async function getOrg (authConfig) {
|
|
5
5
|
const { data: { orgs } } = await axios.get(`${vars.apiUrl}/orgs`, authConfig);
|
|
6
|
-
|
|
6
|
+
const defaultOrg = orgs.find((org) => org.isDefault) || orgs[0];
|
|
7
|
+
if (!defaultOrg) {
|
|
8
|
+
throw new Error(`Your account has no workspace. Please visit ${vars.loginUrl}/workspace to create a workspace first and then try again.`);
|
|
9
|
+
}
|
|
10
|
+
return defaultOrg;
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
async function getAssociatedOrgs (authConfig) {
|