dbdocs 1.5.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.
@@ -386,5 +386,5 @@
386
386
  ]
387
387
  }
388
388
  },
389
- "version": "1.5.0"
389
+ "version": "1.7.0"
390
390
  }
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "dbdocs",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "author": "@holistics",
5
5
  "bin": {
6
6
  "dbdocs": "./bin/run"
7
7
  },
8
8
  "resolutions": {
9
- "**/uuid": "11.1.1"
9
+ "**/uuid": "11.1.1",
10
+ "toml": "^4.2.0"
10
11
  },
11
12
  "dependencies": {
12
- "@dbml/connector": "9.1.0",
13
- "@dbml/core": "9.1.0",
13
+ "@dbml/connector": "10.1.1",
14
+ "@dbml/core": "10.1.1",
14
15
  "@oclif/core": "1.26.2",
15
16
  "@oclif/plugin-help": "6.2.32",
16
- "axios": "^1.18.1",
17
+ "axios": "^1.20.0",
17
18
  "chalk": "^3.0.0",
18
19
  "dotenv": "^8.2.0",
19
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 - Completing Authentication</title>
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>Completing Authentication</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>
@@ -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) orgName = defaultOrgName;
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
- return orgs[0];
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) {