test-bdk-cli 1.0.0 → 1.0.1
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/dist/commands/create.js +2 -2
- package/dist/commands/help.js +83 -0
- package/dist/commands/publish.js +15 -11
- package/dist/index.js +2 -0
- package/package.json +1 -1
package/dist/commands/create.js
CHANGED
|
@@ -15,8 +15,8 @@ const appConfig_1 = require("../utils/appConfig");
|
|
|
15
15
|
const getAppSettings_1 = require("../utils/getAppSettings");
|
|
16
16
|
function registerCreate(program) {
|
|
17
17
|
program
|
|
18
|
-
.command('apps:
|
|
19
|
-
.description('Scaffold one or more new app projects (usage: apps:
|
|
18
|
+
.command('apps:create [appDirectories...]')
|
|
19
|
+
.description('Scaffold one or more new app projects (usage: apps:create ./appName)')
|
|
20
20
|
.option('--template <template>', 'template name', 'default')
|
|
21
21
|
.option('--path <dir>', 'base path for created directories', '.')
|
|
22
22
|
.option('--force', 'overwrite if exists', false)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerHelp = registerHelp;
|
|
4
|
+
const COMMANDS = [
|
|
5
|
+
{
|
|
6
|
+
command: 'apps:create',
|
|
7
|
+
alias: 'apps:create [appDirectories...]',
|
|
8
|
+
description: 'Scaffold one or more new app projects from a template.',
|
|
9
|
+
usage: 'bdk apps:create ./my-app [--template default] [--git] [--npm] [--deploy]',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
command: 'apps:run',
|
|
13
|
+
alias: 'apps:run [source]',
|
|
14
|
+
description: 'Start a local dev server with live file serving for the app.',
|
|
15
|
+
usage: 'bdk apps:run [source] [--port 3000] [--env dev] [--open]',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
command: 'apps:validate',
|
|
19
|
+
alias: 'apps:validate [appDirectory]',
|
|
20
|
+
description: 'Validate the app structure and manifest.json against the schema.',
|
|
21
|
+
usage: 'bdk apps:validate [appDirectory]',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
command: 'apps:pack',
|
|
25
|
+
alias: 'apps:pack [source]',
|
|
26
|
+
description: 'Package the app into a zip/tar archive ready for publishing.',
|
|
27
|
+
usage: 'bdk apps:pack [source] [--output ./dist] [--format zip|tar]',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
command: 'apps:test',
|
|
31
|
+
alias: 'apps:test [source]',
|
|
32
|
+
description: 'Run the app\'s unit and integration tests via npm test.',
|
|
33
|
+
usage: 'bdk apps:test [source] [--watch] [--coverage]',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
command: 'apps:version',
|
|
37
|
+
alias: 'apps:version [source]',
|
|
38
|
+
description: 'Show or bump the app version in manifest.json.',
|
|
39
|
+
usage: 'bdk apps:version [source] [--bump patch|minor|major] [--set <version>]',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
command: 'apps:help',
|
|
43
|
+
alias: 'apps:help [command]',
|
|
44
|
+
description: 'Show the list of available commands with descriptions and usage.',
|
|
45
|
+
usage: 'bdk apps:help [command]',
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
function registerHelp(program) {
|
|
49
|
+
program
|
|
50
|
+
.command('help [commandName]')
|
|
51
|
+
.alias('apps:help')
|
|
52
|
+
.description('Show available commands and their descriptions')
|
|
53
|
+
.action((commandName) => {
|
|
54
|
+
if (commandName) {
|
|
55
|
+
// Show detailed info for a specific command
|
|
56
|
+
const found = COMMANDS.find((c) => c.command.toLowerCase() === commandName.toLowerCase() ||
|
|
57
|
+
c.command.toLowerCase() === `apps:${commandName.toLowerCase()}`);
|
|
58
|
+
if (!found) {
|
|
59
|
+
console.error(`\n Unknown command: "${commandName}"`);
|
|
60
|
+
console.error(` Run "bdk apps:help" to see all available commands.\n`);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
console.log('');
|
|
65
|
+
console.log(` Command : ${found.command}`);
|
|
66
|
+
console.log(` Synopsis : ${found.alias}`);
|
|
67
|
+
console.log(` Info : ${found.description}`);
|
|
68
|
+
console.log(` Usage : ${found.usage}`);
|
|
69
|
+
console.log('');
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// Show summary of all commands
|
|
73
|
+
console.log('');
|
|
74
|
+
console.log(' BoldDesk Developer Kit (bdk) — Available Commands');
|
|
75
|
+
console.log(' ' + '─'.repeat(55));
|
|
76
|
+
const maxCmd = Math.max(...COMMANDS.map((c) => c.command.length));
|
|
77
|
+
for (const cmd of COMMANDS) {
|
|
78
|
+
const padding = ' '.repeat(maxCmd - cmd.command.length + 2);
|
|
79
|
+
console.log(` ${cmd.command}${padding}${cmd.description}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
package/dist/commands/publish.js
CHANGED
|
@@ -18,16 +18,19 @@ function registerPublish(program) {
|
|
|
18
18
|
.option('--dry-run', 'do not actually upload, show what would be sent', false)
|
|
19
19
|
.option('--private', 'mark uploaded app as private', false)
|
|
20
20
|
.option('--source <dir>', 'source directory to pack before publishing', '.')
|
|
21
|
-
.action(async (
|
|
21
|
+
.action(async (_sourceArg, _opts) => {
|
|
22
|
+
// Command is currently disabled — exit silently without any output
|
|
23
|
+
return;
|
|
24
|
+
/* ── disabled block ─────────────────────────────────────────────── */
|
|
25
|
+
// eslint-disable-next-line no-unreachable
|
|
22
26
|
try {
|
|
23
|
-
let filePath =
|
|
24
|
-
const sourceDir = path_1.default.resolve(process.cwd(),
|
|
27
|
+
let filePath = _opts.file;
|
|
28
|
+
const sourceDir = path_1.default.resolve(process.cwd(), _sourceArg || _opts.source || '.');
|
|
25
29
|
if (!filePath) {
|
|
26
30
|
console.log('No package file given — running `bdk pack` to create archive...');
|
|
27
31
|
try {
|
|
28
32
|
const cliEntry = path_1.default.resolve(__dirname, '../index.js');
|
|
29
|
-
|
|
30
|
-
const sourceArg_str = sourceArg ? `"${sourceArg}"` : '.';
|
|
33
|
+
const sourceArg_str = _sourceArg ? `"${_sourceArg}"` : '.';
|
|
31
34
|
(0, child_process_1.execSync)(`node "${cliEntry}" pack ${sourceArg_str} --output ./dist --format zip`, { cwd: process.cwd(), stdio: 'inherit' });
|
|
32
35
|
}
|
|
33
36
|
catch (e) {
|
|
@@ -54,11 +57,11 @@ function registerPublish(program) {
|
|
|
54
57
|
console.error('Package file not found:', filePath);
|
|
55
58
|
process.exit(1);
|
|
56
59
|
}
|
|
57
|
-
if (
|
|
58
|
-
console.log('Dry-run: would upload', filePath, 'to',
|
|
60
|
+
if (_opts.dryRun) {
|
|
61
|
+
console.log('Dry-run: would upload', filePath, 'to', _opts.url);
|
|
59
62
|
process.exit(0);
|
|
60
63
|
}
|
|
61
|
-
const token =
|
|
64
|
+
const token = _opts.token || process.env.BOLD_API_TOKEN || process.env.BDK_TOKEN;
|
|
62
65
|
if (!token) {
|
|
63
66
|
console.error('No API token provided. Use --token or set BOLD_API_TOKEN/BDK_TOKEN env var.');
|
|
64
67
|
process.exit(1);
|
|
@@ -67,9 +70,9 @@ function registerPublish(program) {
|
|
|
67
70
|
const fetch = require('node-fetch');
|
|
68
71
|
const form = new FormData();
|
|
69
72
|
form.append('file', fs_1.default.createReadStream(filePath));
|
|
70
|
-
form.append('private',
|
|
71
|
-
console.log(`Uploading ${path_1.default.basename(filePath)} to ${
|
|
72
|
-
const res = await fetch(
|
|
73
|
+
form.append('private', _opts.private ? 'true' : 'false');
|
|
74
|
+
console.log(`Uploading ${path_1.default.basename(filePath)} to ${_opts.url} ...`);
|
|
75
|
+
const res = await fetch(_opts.url, {
|
|
73
76
|
method: 'POST',
|
|
74
77
|
headers: {
|
|
75
78
|
Authorization: `Bearer ${token}`,
|
|
@@ -89,5 +92,6 @@ function registerPublish(program) {
|
|
|
89
92
|
console.error('Publish failed:', err && err.message ? err.message : err);
|
|
90
93
|
process.exit(3);
|
|
91
94
|
}
|
|
95
|
+
/* ── end disabled block ─────────────────────────────────────────── */
|
|
92
96
|
});
|
|
93
97
|
}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ const pack_1 = require("./commands/pack");
|
|
|
9
9
|
const test_1 = require("./commands/test");
|
|
10
10
|
const version_1 = require("./commands/version");
|
|
11
11
|
const publish_1 = require("./commands/publish");
|
|
12
|
+
const help_1 = require("./commands/help");
|
|
12
13
|
const pkg = require('../package.json');
|
|
13
14
|
const program = new commander_1.Command();
|
|
14
15
|
program.name('bdk').version(pkg.version).description('BoldDesk Developer Kit CLI');
|
|
@@ -19,4 +20,5 @@ program.name('bdk').version(pkg.version).description('BoldDesk Developer Kit CLI
|
|
|
19
20
|
(0, test_1.registerTest)(program);
|
|
20
21
|
(0, version_1.registerVersion)(program);
|
|
21
22
|
(0, publish_1.registerPublish)(program);
|
|
23
|
+
(0, help_1.registerHelp)(program);
|
|
22
24
|
program.parse(process.argv);
|