dbdocs 0.8.0 → 0.8.2
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/bin/run +0 -0
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
- package/src/commands/build.js +17 -10
- package/src/commands/remove.js +1 -1
- package/src/utils/constants.js +5 -0
- package/src/utils/helper.js +9 -0
package/README.md
CHANGED
package/bin/run
CHANGED
|
File without changes
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.8.
|
|
1
|
+
{"version":"0.8.2","commands":{"build":{"id":"build","description":"build docs","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","description":"project name","multiple":false},"public":{"name":"public","type":"boolean","description":"anyone with the URL can access","helpGroup":"sharing","allowNo":false,"exclusive":["private","password"]},"private":{"name":"private","type":"boolean","description":"only invited people can access","helpGroup":"sharing","allowNo":false,"exclusive":["public","password"]},"password":{"name":"password","type":"option","char":"p","description":"anyone with the URL + password can access","helpGroup":"sharing","multiple":false,"exclusive":["public","private"]}},"args":[{"name":"filepath","description":"dbml file path"}]},"login":{"id":"login","description":"login to dbdocs\nlogin with your dbdocs credentials\n","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"logout":{"id":"logout","description":"logout\nclears local login credentials\n","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"ls":{"id":"ls","description":"list projects","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"password":{"id":"password","description":"set password for your project or remove password","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","char":"p","description":"project name","helpValue":"project name","multiple":false},"set":{"name":"set","type":"option","char":"s","description":"password for your project","helpValue":"password","multiple":false},"remove":{"name":"remove","type":"boolean","char":"r","description":"remove password from your project","allowNo":false}},"args":[]},"remove":{"id":"remove","description":"remove project","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"project_name","description":"name of the project which you want to remove"}]},"rename":{"id":"rename","description":"change your username","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"token":{"id":"token","description":"generate or revoke your authentication token","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{"generate":{"name":"generate","type":"boolean","char":"g","description":"generate authentication token","allowNo":false},"revoke":{"name":"revoke","type":"boolean","char":"r","description":"revoke authentication token","allowNo":false}},"args":[]},"validate":{"id":"validate","description":"validate docs content","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"filepath","description":"dbml file path"}]}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dbdocs",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"author": "@holistics",
|
|
5
5
|
"bin": {
|
|
6
6
|
"dbdocs": "./bin/run"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"oclif/**/ansi-regex": "^3.0.1"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@dbml/core": "^2.
|
|
12
|
+
"@dbml/core": "^2.6.0",
|
|
13
13
|
"@oclif/core": "1.12.1",
|
|
14
14
|
"@oclif/plugin-help": "5.1.12",
|
|
15
15
|
"axios": "0.27.2",
|
package/src/commands/build.js
CHANGED
|
@@ -11,7 +11,8 @@ const { getOrg } = require('../utils/org');
|
|
|
11
11
|
const { shouldAskForFeedback } = require('../utils/feedback');
|
|
12
12
|
const { isValidName } = require('../validators/projectName');
|
|
13
13
|
const parse = require('../utils/parse');
|
|
14
|
-
const { PROJECT_GENERAL_ACCESS_TYPE } = require('../utils/constants');
|
|
14
|
+
const { PROJECT_GENERAL_ACCESS_TYPE, FLAG_HELP_GROUP } = require('../utils/constants');
|
|
15
|
+
const { getIsPublicValueFromBuildFlag } = require('../utils/helper');
|
|
15
16
|
|
|
16
17
|
async function build (project, authConfig) {
|
|
17
18
|
const res = await axios.post(`${vars.apiUrl}/projects`, project, authConfig);
|
|
@@ -38,7 +39,7 @@ class BuildCommand extends Command {
|
|
|
38
39
|
try {
|
|
39
40
|
const authConfig = await verifyToken();
|
|
40
41
|
const { flags, args } = await this.parse(BuildCommand);
|
|
41
|
-
const {
|
|
42
|
+
const { public: publicFlag, private: privateFlag, password } = flags;
|
|
42
43
|
let { project } = flags;
|
|
43
44
|
|
|
44
45
|
const { filepath } = args;
|
|
@@ -79,10 +80,10 @@ class BuildCommand extends Command {
|
|
|
79
80
|
spinner.text = `Pushing new database to project ${project}`;
|
|
80
81
|
spinner.start();
|
|
81
82
|
try {
|
|
83
|
+
const isPublic = getIsPublicValueFromBuildFlag(publicFlag, privateFlag, password);
|
|
82
84
|
const { newProject } = await build({
|
|
83
85
|
projectName: project,
|
|
84
|
-
|
|
85
|
-
isPublic: restricted ? false : undefined,
|
|
86
|
+
isPublic,
|
|
86
87
|
password,
|
|
87
88
|
orgName: org,
|
|
88
89
|
doc: {
|
|
@@ -98,7 +99,7 @@ class BuildCommand extends Command {
|
|
|
98
99
|
spinner.succeed(`Project '${newProject.name}' is protected with password`);
|
|
99
100
|
break;
|
|
100
101
|
case PROJECT_GENERAL_ACCESS_TYPE.restricted:
|
|
101
|
-
spinner.succeed(`
|
|
102
|
+
spinner.succeed(`Project '${newProject.name}' is private`);
|
|
102
103
|
break;
|
|
103
104
|
default:
|
|
104
105
|
break;
|
|
@@ -146,14 +147,20 @@ class BuildCommand extends Command {
|
|
|
146
147
|
|
|
147
148
|
BuildCommand.description = 'build docs';
|
|
148
149
|
|
|
149
|
-
//
|
|
150
|
+
// `public`, `private` and `password` are mutually exclusive flags. For example:
|
|
151
|
+
// dbdocs build ./abc.dbml --project abc --public # works
|
|
152
|
+
// dbdocs build ./abc.dbml --project abc --private # works
|
|
150
153
|
// dbdocs build ./abc.dbml --project abc --password 123456 # works
|
|
151
|
-
// dbdocs build ./abc.dbml --project abc --
|
|
152
|
-
// dbdocs build ./abc.dbml --project abc --
|
|
154
|
+
// dbdocs build ./abc.dbml --project abc --password 123456 --private # error
|
|
155
|
+
// dbdocs build ./abc.dbml --project abc --public --private # error
|
|
156
|
+
// dbdocs build ./abc.dbml --project abc --public --password 123456 # error
|
|
153
157
|
BuildCommand.flags = {
|
|
154
158
|
project: Flags.string({ description: 'project name' }),
|
|
155
|
-
|
|
156
|
-
|
|
159
|
+
public: Flags.boolean({ description: 'anyone with the URL can access', helpGroup: FLAG_HELP_GROUP.sharing, exclusive: ['private', 'password'] }),
|
|
160
|
+
private: Flags.boolean({ description: 'only invited people can access', helpGroup: FLAG_HELP_GROUP.sharing, exclusive: ['public', 'password'] }),
|
|
161
|
+
password: Flags.string({
|
|
162
|
+
char: 'p', description: 'anyone with the URL + password can access', helpGroup: FLAG_HELP_GROUP.sharing, exclusive: ['public', 'private'],
|
|
163
|
+
}),
|
|
157
164
|
};
|
|
158
165
|
|
|
159
166
|
BuildCommand.args = [
|
package/src/commands/remove.js
CHANGED
|
@@ -67,7 +67,7 @@ class RemoveCommand extends Command {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
RemoveCommand.description = 'remove
|
|
70
|
+
RemoveCommand.description = 'remove project';
|
|
71
71
|
|
|
72
72
|
RemoveCommand.args = [
|
|
73
73
|
{ name: 'project_name', description: 'name of the project which you want to remove' },
|
package/src/utils/constants.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const getIsPublicValueFromBuildFlag = (publicFlag, privateFlag, passwordFlag) => {
|
|
2
|
+
if (publicFlag || passwordFlag) return true;
|
|
3
|
+
if (privateFlag) return false;
|
|
4
|
+
return undefined; // 'undefined' means keep the old `isPublic` state
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
getIsPublicValueFromBuildFlag,
|
|
9
|
+
};
|