neonctl 0.3.3 → 0.4.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/package.json +2 -2
- package/src/config.js +4 -1
- package/src/index.js +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neonctl",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "CLI tool for NeonDB Cloud management",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "NeonDB",
|
|
@@ -34,6 +34,6 @@
|
|
|
34
34
|
"build": "npm run clean && tsc && cp src/*.html dist/src/",
|
|
35
35
|
"clean": "rm -rf dist",
|
|
36
36
|
"start": "node index.js",
|
|
37
|
-
"publizh": "npm run build && cd dist && npm publish"
|
|
37
|
+
"publizh": "npm run build && cd dist && npm publish && git push"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/src/config.js
CHANGED
|
@@ -11,9 +11,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ensureConfigDir = exports.defaultDir = void 0;
|
|
13
13
|
const node_path_1 = require("node:path");
|
|
14
|
+
const node_os_1 = require("node:os");
|
|
14
15
|
const node_fs_1 = require("node:fs");
|
|
15
16
|
const DIR_NAME = '.neonctl';
|
|
16
|
-
|
|
17
|
+
const cwdDir = (0, node_path_1.join)(process.cwd(), DIR_NAME);
|
|
18
|
+
const homeConfigDir = (0, node_path_1.join)((0, node_os_1.homedir)(), process.env.XDG_CONFIG_HOME || '.config', DIR_NAME);
|
|
19
|
+
exports.defaultDir = (0, node_fs_1.existsSync)(cwdDir) ? cwdDir : homeConfigDir;
|
|
17
20
|
const ensureConfigDir = ({ 'config-dir': configDir, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
21
|
if (!(0, node_fs_1.existsSync)(configDir)) {
|
|
19
22
|
(0, node_fs_1.mkdirSync)(configDir);
|
package/src/index.js
CHANGED
|
@@ -44,6 +44,7 @@ const log_1 = require("./log");
|
|
|
44
44
|
const showHelpMiddleware = (argv) => {
|
|
45
45
|
if (argv._.length === 1) {
|
|
46
46
|
yargs.showHelp();
|
|
47
|
+
process.exit(0);
|
|
47
48
|
}
|
|
48
49
|
};
|
|
49
50
|
const builder = yargs
|
|
@@ -84,8 +85,7 @@ const builder = yargs
|
|
|
84
85
|
type: 'string',
|
|
85
86
|
default: '',
|
|
86
87
|
})
|
|
87
|
-
.middleware(auth_1.ensureAuth)
|
|
88
|
-
.command('me', 'Get user info', (yargs) => yargs, (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
88
|
+
.command('me', 'Get user info', (yargs) => yargs.middleware(auth_1.ensureAuth), (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
89
89
|
yield (yield Promise.resolve().then(() => __importStar(require('./commands/users')))).me(args);
|
|
90
90
|
}))
|
|
91
91
|
.command('projects', 'Manage projects', (yargs) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -102,7 +102,8 @@ const builder = yargs
|
|
|
102
102
|
.command('create', 'Create a project', (yargs) => yargs, (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
103
103
|
yield (yield Promise.resolve().then(() => __importStar(require('./commands/projects')))).create(args);
|
|
104
104
|
}))
|
|
105
|
-
.middleware(showHelpMiddleware)
|
|
105
|
+
.middleware(showHelpMiddleware)
|
|
106
|
+
.middleware(auth_1.ensureAuth);
|
|
106
107
|
}))
|
|
107
108
|
.strict()
|
|
108
109
|
.fail((msg, err) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -118,5 +119,6 @@ const builder = yargs
|
|
|
118
119
|
const args = yield builder.argv;
|
|
119
120
|
if (args._.length === 0) {
|
|
120
121
|
yargs.showHelp();
|
|
122
|
+
process.exit(0);
|
|
121
123
|
}
|
|
122
124
|
}))();
|