@codenotch/codenotch.cli 1.0.33 → 1.0.34
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/index.js +2 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/validation/ValidationUtils.d.ts +28 -0
- package/dist/commands/validation/ValidationUtils.js +182 -0
- package/dist/commands/validation/ValidationUtils.js.map +1 -0
- package/dist/commands/validation/files/AppManifestValidator.d.ts +6 -0
- package/dist/commands/validation/files/AppManifestValidator.js +93 -0
- package/dist/commands/validation/files/AppManifestValidator.js.map +1 -0
- package/dist/commands/validation/files/BpmnValidator.d.ts +5 -0
- package/dist/commands/validation/files/BpmnValidator.js +32 -0
- package/dist/commands/validation/files/BpmnValidator.js.map +1 -0
- package/dist/commands/validation/files/DbSchemaValidator.d.ts +5 -0
- package/dist/commands/validation/files/DbSchemaValidator.js +16 -0
- package/dist/commands/validation/files/DbSchemaValidator.js.map +1 -0
- package/dist/commands/validation/files/DocumentValidator.d.ts +5 -0
- package/dist/commands/validation/files/DocumentValidator.js +12 -0
- package/dist/commands/validation/files/DocumentValidator.js.map +1 -0
- package/dist/commands/validation/files/I18nValidator.d.ts +5 -0
- package/dist/commands/validation/files/I18nValidator.js +13 -0
- package/dist/commands/validation/files/I18nValidator.js.map +1 -0
- package/dist/commands/validation/files/JsonValidator.d.ts +5 -0
- package/dist/commands/validation/files/JsonValidator.js +13 -0
- package/dist/commands/validation/files/JsonValidator.js.map +1 -0
- package/dist/commands/validation/files/ManifestCacheValidator.d.ts +5 -0
- package/dist/commands/validation/files/ManifestCacheValidator.js +121 -0
- package/dist/commands/validation/files/ManifestCacheValidator.js.map +1 -0
- package/dist/commands/validation/files/ManifestValidator.d.ts +5 -0
- package/dist/commands/validation/files/ManifestValidator.js +14 -0
- package/dist/commands/validation/files/ManifestValidator.js.map +1 -0
- package/dist/commands/validation/files/ScriptValidator.d.ts +12 -0
- package/dist/commands/validation/files/ScriptValidator.js +128 -0
- package/dist/commands/validation/files/ScriptValidator.js.map +1 -0
- package/dist/commands/validation/files/TableValidator.d.ts +5 -0
- package/dist/commands/validation/files/TableValidator.js +19 -0
- package/dist/commands/validation/files/TableValidator.js.map +1 -0
- package/dist/commands/validation/validate.d.ts +2 -0
- package/dist/commands/validation/validate.js +245 -0
- package/dist/commands/validation/validate.js.map +1 -0
- package/dist/utils/BuildUtils.d.ts +22 -4
- package/dist/utils/BuildUtils.js +45 -16
- package/dist/utils/BuildUtils.js.map +1 -1
- package/dist/utils/FileUtils.d.ts +13 -0
- package/dist/utils/FileUtils.js +30 -0
- package/dist/utils/FileUtils.js.map +1 -1
- package/dist/utils/I18nUtils.js +0 -2
- package/dist/utils/I18nUtils.js.map +1 -1
- package/package.json +14 -6
- package/.github/copilot-instructions.md +0 -3
- package/bin/cli.js +0 -3
- package/docs/ARCHITECTURE.md +0 -179
- package/docs/TODO.md +0 -18
- package/src/bin/cli.ts +0 -4
- package/src/commands/index.ts +0 -13
- package/src/commands/project/compile.ts +0 -20
- package/src/commands/project/deploy.ts +0 -11
- package/src/commands/project/index.ts +0 -28
- package/src/commands/project/inspect.ts +0 -12
- package/src/commands/project/new.ts +0 -11
- package/src/commands/project/open.ts +0 -21
- package/src/commands/project/package.ts +0 -20
- package/src/commands/project/refresh.ts +0 -13
- package/src/commands/project/remove.ts +0 -12
- package/src/commands/project/shared.ts +0 -9
- package/src/commands/project/start.ts +0 -24
- package/src/commands/project/test.ts +0 -15
- package/src/commands/react/build.ts +0 -12
- package/src/commands/react/index.ts +0 -12
- package/src/commands/react/serve.ts +0 -13
- package/src/commands/runtime/clear.ts +0 -11
- package/src/commands/runtime/index.ts +0 -24
- package/src/commands/runtime/info.ts +0 -47
- package/src/commands/runtime/latest.ts +0 -18
- package/src/commands/runtime/portal.ts +0 -20
- package/src/commands/runtime/start.ts +0 -16
- package/src/commands/runtime/stop.ts +0 -13
- package/src/commands/runtime/update.ts +0 -12
- package/src/commands/system/index.ts +0 -9
- package/src/commands/system/info.ts +0 -23
- package/src/commands/system/read.ts +0 -25
- package/src/index.ts +0 -22
- package/src/models/Codenotch.ts +0 -361
- package/src/models/DbModels.ts +0 -428
- package/src/models/OpenApiModels.ts +0 -145
- package/src/utils/BuildUtils.ts +0 -739
- package/src/utils/ConsoleUtils.ts +0 -22
- package/src/utils/FileUtils.ts +0 -266
- package/src/utils/GitHubAuthUtils.ts +0 -83
- package/src/utils/I18nUtils.ts +0 -58
- package/src/utils/OpenAPIUtils.ts +0 -285
- package/src/utils/OsUtils.ts +0 -32
- package/src/utils/ProjectCompilationUtils.ts +0 -1002
- package/src/utils/ProjectUtils.ts +0 -151
- package/src/utils/RuntimeUtils.ts +0 -743
- package/src/utils/ServeUtils.ts +0 -175
- package/src/utils/ShellUtils.ts +0 -26
- package/src/utils/StringUtils.ts +0 -80
- package/tsconfig.json +0 -35
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import ProjectUtils from '../../utils/ProjectUtils';
|
|
5
|
-
import { IProjectCommandOptions, withProjectPathOption } from './shared';
|
|
6
|
-
|
|
7
|
-
export function registerPackage(project: Command) {
|
|
8
|
-
withProjectPathOption(project
|
|
9
|
-
.command('package')
|
|
10
|
-
.alias('build')
|
|
11
|
-
.description('Compile and package the project, output a zip file')
|
|
12
|
-
.option('-o, --output-path <path>', 'output path for the build zip file')
|
|
13
|
-
.option('-i, --ignore-errors', 'ignore compilation errors and proceed with packaging', false))
|
|
14
|
-
.action(async (options: IProjectCommandOptions & { outputPath?: string, ignoreErrors?: boolean }) => {
|
|
15
|
-
const outputPath = options.outputPath ?? path.join(options.projectPath, "build.zip");
|
|
16
|
-
const ignoreErrors = options.ignoreErrors ?? false;
|
|
17
|
-
await ProjectUtils.packageProject(options.projectPath, outputPath, ignoreErrors);
|
|
18
|
-
console.log(chalk.green(`Project built successfully at ${outputPath}`));
|
|
19
|
-
});
|
|
20
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { IProjectCommandOptions, withProjectPathOption } from './shared';
|
|
3
|
-
|
|
4
|
-
export function registerRefresh(project: Command) {
|
|
5
|
-
withProjectPathOption(project
|
|
6
|
-
.command('refresh')
|
|
7
|
-
.alias('patch')
|
|
8
|
-
.description('Sync the project with the runtime, deploy changes and restart if needed'))
|
|
9
|
-
.action(async (options: IProjectCommandOptions) => {
|
|
10
|
-
console.log("TODO Not implemented yet");
|
|
11
|
-
//await RuntimeUtils.patchProject(options.projectPath);
|
|
12
|
-
});
|
|
13
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import RuntimeUtils from '../../utils/RuntimeUtils';
|
|
3
|
-
import { IProjectCommandOptions, withProjectPathOption } from './shared';
|
|
4
|
-
|
|
5
|
-
export function registerRemove(project: Command) {
|
|
6
|
-
withProjectPathOption(project
|
|
7
|
-
.command('remove')
|
|
8
|
-
.description('Uninstall the project and erase its data (use with caution)'))
|
|
9
|
-
.action(async (options: IProjectCommandOptions) => {
|
|
10
|
-
await RuntimeUtils.removeProject(options.projectPath);
|
|
11
|
-
});
|
|
12
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
|
|
3
|
-
// These commands apply to a project, default to current directory
|
|
4
|
-
export type IProjectCommandOptions = {
|
|
5
|
-
projectPath: string;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const withProjectPathOption = (command: Command): Command =>
|
|
9
|
-
command.option('-p, --project-path <path>', 'path to the project directory (default current directory)', process.cwd());
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import RuntimeUtils from '../../utils/RuntimeUtils';
|
|
3
|
-
import ProjectUtils from '../../utils/ProjectUtils';
|
|
4
|
-
import { OsUtils } from '../../utils/OsUtils';
|
|
5
|
-
import { IProjectCommandOptions, withProjectPathOption } from './shared';
|
|
6
|
-
|
|
7
|
-
export function registerStart(project: Command) {
|
|
8
|
-
withProjectPathOption(project
|
|
9
|
-
.command('start')
|
|
10
|
-
.description('Build, deploy and start the local project')
|
|
11
|
-
.option('-q, --quiet', 'do not open the project in the browser after starting', false)
|
|
12
|
-
//TODO expose runtime start args here ?
|
|
13
|
-
//TODO --watch (auto apply chnages with patch without restarting the runtime, for development purposes)
|
|
14
|
-
)
|
|
15
|
-
.action(async (options: IProjectCommandOptions & { quiet: boolean }) => {
|
|
16
|
-
await RuntimeUtils.startProject(options.projectPath);
|
|
17
|
-
|
|
18
|
-
if (!options.quiet) {
|
|
19
|
-
const basePath = await RuntimeUtils.getRuntimeBaseUrl();
|
|
20
|
-
const serviceName = await ProjectUtils.getProjectServiceName(options.projectPath);
|
|
21
|
-
OsUtils.openInBrowser(`${basePath}/${serviceName}`);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import RuntimeUtils from '../../utils/RuntimeUtils';
|
|
3
|
-
import { IProjectCommandOptions, withProjectPathOption } from './shared';
|
|
4
|
-
|
|
5
|
-
export function registerTest(project: Command) {
|
|
6
|
-
withProjectPathOption(project
|
|
7
|
-
.command('test')
|
|
8
|
-
.description('Run tests for the project')
|
|
9
|
-
.option('-f, --file-filter <pattern>', 'filter test files by pattern')
|
|
10
|
-
.option('-t, --name-filter <pattern>', 'filter tests by name pattern')
|
|
11
|
-
.option('--in-place', 'if compilation is needed, compile and modify files directly in the project folder', false))
|
|
12
|
-
.action(async (options: IProjectCommandOptions & { fileFilter?: string, nameFilter?: string, inPlace?: boolean }) => {
|
|
13
|
-
await RuntimeUtils.testProject(options.projectPath, options.fileFilter, options.nameFilter, options.inPlace);
|
|
14
|
-
});
|
|
15
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import BuildUtils, { IBuildOptions } from '../../utils/BuildUtils';
|
|
3
|
-
|
|
4
|
-
export function registerBuild(react: Command) {
|
|
5
|
-
react
|
|
6
|
-
.command('build [file]')
|
|
7
|
-
.description('Build a React application inside Codenotch project')
|
|
8
|
-
.option('-c, --cluster <url>', 'Cluster URL to make the .env file.')
|
|
9
|
-
.action(async (filePath: string, options: IBuildOptions) => {
|
|
10
|
-
await BuildUtils.buildApp(filePath, options.cluster);
|
|
11
|
-
});
|
|
12
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { registerServe } from './serve';
|
|
3
|
-
import { registerBuild } from './build';
|
|
4
|
-
|
|
5
|
-
export function registerReactCommands(program: Command) {
|
|
6
|
-
const react = program
|
|
7
|
-
.command('react')
|
|
8
|
-
.description('React application management commands');
|
|
9
|
-
|
|
10
|
-
registerServe(react);
|
|
11
|
-
registerBuild(react);
|
|
12
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import ServeUtils, { IServeOptions } from '../../utils/ServeUtils';
|
|
3
|
-
|
|
4
|
-
export function registerServe(react: Command) {
|
|
5
|
-
react
|
|
6
|
-
.command('serve [directory]')
|
|
7
|
-
.description('Serve a built React application using a simple HTTP server')
|
|
8
|
-
.option('-p, --port <port>', 'port to serve the application on (default 5000)', (value: string) => parseInt(value, 10), 5000)
|
|
9
|
-
.option('-i, --index <name>', 'index file name (default index.html)', 'index.html')
|
|
10
|
-
.action(async (directory: string, options: IServeOptions) => {
|
|
11
|
-
await ServeUtils.serveApp(directory, options);
|
|
12
|
-
});
|
|
13
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import RuntimeUtils from '../../utils/RuntimeUtils';
|
|
3
|
-
|
|
4
|
-
export function registerClear(runtime: Command) {
|
|
5
|
-
runtime
|
|
6
|
-
.command('clear')
|
|
7
|
-
.description('Erase all runtime data (ie. all projects, users, ...) but keep the runtime itself (use with caution)')
|
|
8
|
-
.action(async () => {
|
|
9
|
-
await RuntimeUtils.clearRuntime();
|
|
10
|
-
});
|
|
11
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { registerInfo } from './info';
|
|
3
|
-
import { registerUpdate } from './update';
|
|
4
|
-
import { registerStart } from './start';
|
|
5
|
-
import { registerStop } from './stop';
|
|
6
|
-
import { registerClear } from './clear';
|
|
7
|
-
import { registerLatest } from './latest';
|
|
8
|
-
import { registerPortal } from './portal';
|
|
9
|
-
|
|
10
|
-
// General commands on the runtime, probably not directly useful for users but good to have for debugging and development purposes, we can hide them later if we want
|
|
11
|
-
export function registerRuntimeCommands(program: Command) {
|
|
12
|
-
const runtime = program
|
|
13
|
-
.command('runtime') //TODO name subject to change
|
|
14
|
-
.description('Runtime specific commands, use these commands to manage the Codenotch runtime.');
|
|
15
|
-
|
|
16
|
-
registerInfo(runtime);
|
|
17
|
-
registerUpdate(runtime);
|
|
18
|
-
registerStart(runtime);
|
|
19
|
-
registerStop(runtime);
|
|
20
|
-
registerClear(runtime);
|
|
21
|
-
registerLatest(runtime);
|
|
22
|
-
|
|
23
|
-
registerPortal(program);
|
|
24
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import RuntimeUtils from '../../utils/RuntimeUtils';
|
|
4
|
-
|
|
5
|
-
export function registerInfo(runtime: Command) {
|
|
6
|
-
runtime
|
|
7
|
-
.command('info')
|
|
8
|
-
.alias('status')
|
|
9
|
-
.description('Display Codenotch runtime status and version information')
|
|
10
|
-
.option('--json', 'output the result in JSON format')
|
|
11
|
-
.action(async (options: { json: boolean }) => {
|
|
12
|
-
|
|
13
|
-
const isInstalled = await RuntimeUtils.isRuntimeInstalled();
|
|
14
|
-
if (options.json) {
|
|
15
|
-
if (isInstalled === false) {
|
|
16
|
-
console.log(JSON.stringify({ installed: false }));
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const version = await RuntimeUtils.getRuntimeVersion();
|
|
20
|
-
const runtimePath = RuntimeUtils.getRuntimeExecutablePath();
|
|
21
|
-
const baseUrl = await RuntimeUtils.getRuntimeBaseUrl();
|
|
22
|
-
const isRunning = await RuntimeUtils.isRuntimeRunning();
|
|
23
|
-
const dataPath = await RuntimeUtils.getRuntimeDataPath();
|
|
24
|
-
console.log(JSON.stringify({ installed: true, version, path: runtimePath, url: baseUrl, running: isRunning, dataPath: dataPath }));
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (isInstalled === false) {
|
|
29
|
-
console.log(chalk.yellow(`Codenotch runtime is not installed. Use "codenotch runtime install" to install the latest version.`));
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const version = await RuntimeUtils.getRuntimeVersion(); // Requires running the runtime which is a bit slow
|
|
33
|
-
console.log(chalk.green(`Version: ${version}`));
|
|
34
|
-
const runtimePath = RuntimeUtils.getRuntimeExecutablePath();
|
|
35
|
-
console.log(chalk.green(`Codenotch runtime is installed at: ${runtimePath}`));
|
|
36
|
-
const baseUrl = await RuntimeUtils.getRuntimeBaseUrl();
|
|
37
|
-
console.log(chalk.green(`URL: ${baseUrl}`));
|
|
38
|
-
const isRunning = await RuntimeUtils.isRuntimeRunning();
|
|
39
|
-
console.log(chalk.green(`Status: ${isRunning ? 'Running' : 'Not running'}`));
|
|
40
|
-
const dataPath = await RuntimeUtils.getRuntimeDataPath();
|
|
41
|
-
if (dataPath) {
|
|
42
|
-
console.log(chalk.green(`Data path: ${dataPath}`));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
//TODO check if an update is available and suggest updating if that's the case
|
|
46
|
-
});
|
|
47
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import RuntimeUtils from '../../utils/RuntimeUtils';
|
|
4
|
-
|
|
5
|
-
export function registerLatest(runtime: Command) {
|
|
6
|
-
runtime
|
|
7
|
-
.command('latest')
|
|
8
|
-
.description('Display the latest available Codenotch runtime release')
|
|
9
|
-
.option('--json', 'output the result in JSON format')
|
|
10
|
-
.action(async (options: { json: boolean }) => {
|
|
11
|
-
const release = await RuntimeUtils.getLatestRuntimeRelease();
|
|
12
|
-
if (options.json) {
|
|
13
|
-
console.log(JSON.stringify(release));
|
|
14
|
-
} else {
|
|
15
|
-
console.log(chalk.green(`Latest Codenotch runtime release: ${chalk.yellow(release.version)} (released at ${release.createdAt})`));
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import RuntimeUtils from '../../utils/RuntimeUtils';
|
|
4
|
-
import { OsUtils } from '../../utils/OsUtils';
|
|
5
|
-
|
|
6
|
-
// Root-level command, but it lives here because it targets the runtime portal
|
|
7
|
-
export function registerPortal(program: Command) {
|
|
8
|
-
program
|
|
9
|
-
.command('portal')
|
|
10
|
-
.description('Open the Codenotch portal in the default browser')
|
|
11
|
-
.action(async () => {
|
|
12
|
-
|
|
13
|
-
if ((await RuntimeUtils.isRuntimeRunning()) === false) {
|
|
14
|
-
console.log(chalk.yellow(`Codenotch runtime is not running`));
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const basePath = await RuntimeUtils.getRuntimeBaseUrl();
|
|
18
|
-
OsUtils.openInBrowser(`${basePath}/portal`);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import RuntimeUtils from '../../utils/RuntimeUtils';
|
|
4
|
-
|
|
5
|
-
export function registerStart(runtime: Command) {
|
|
6
|
-
runtime
|
|
7
|
-
.command('start')
|
|
8
|
-
.option('-p, --port <port>', 'port used by the runtime (default 5005)', (value: string) => parseInt(value, 10), 5005)
|
|
9
|
-
.option('-a, --attach', 'attach to the runtime process (default false)', false)
|
|
10
|
-
.option('-d, --data-path <path>', 'path to the runtime data directory')
|
|
11
|
-
.description('Start the Codenotch runtime')
|
|
12
|
-
.action(async (options: { port: number, attach: boolean, dataPath?: string }) => {
|
|
13
|
-
await RuntimeUtils.startRuntime(options);
|
|
14
|
-
console.log(chalk.green(`Codenotch runtime started successfully`));
|
|
15
|
-
});
|
|
16
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import RuntimeUtils from '../../utils/RuntimeUtils';
|
|
4
|
-
|
|
5
|
-
export function registerStop(runtime: Command) {
|
|
6
|
-
runtime
|
|
7
|
-
.command('stop')
|
|
8
|
-
.description('Stop the Codenotch runtime')
|
|
9
|
-
.action(async () => {
|
|
10
|
-
await RuntimeUtils.stopRuntime();
|
|
11
|
-
console.log(chalk.green(`Codenotch runtime stopped successfully`));
|
|
12
|
-
});
|
|
13
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import RuntimeUtils from '../../utils/RuntimeUtils';
|
|
3
|
-
|
|
4
|
-
export function registerUpdate(runtime: Command) {
|
|
5
|
-
runtime
|
|
6
|
-
.command('update')
|
|
7
|
-
.alias('install')
|
|
8
|
-
.description('Check for Codenotch runtime updates and install if available')
|
|
9
|
-
.action(async () => {
|
|
10
|
-
await RuntimeUtils.installLatestRuntime();
|
|
11
|
-
});
|
|
12
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { registerInfo } from './info';
|
|
3
|
-
import { registerRead } from './read';
|
|
4
|
-
|
|
5
|
-
// Root-level commands that are not tied to a specific project or the runtime
|
|
6
|
-
export function registerSystemCommands(program: Command) {
|
|
7
|
-
registerInfo(program);
|
|
8
|
-
registerRead(program);
|
|
9
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { platform } from 'os';
|
|
4
|
-
|
|
5
|
-
export function registerInfo(program: Command) {
|
|
6
|
-
program
|
|
7
|
-
.command('info')
|
|
8
|
-
.description('Display system information')
|
|
9
|
-
.action(() => {
|
|
10
|
-
console.log(chalk.green('System Information:'));
|
|
11
|
-
console.log(`- Node.js version: ${chalk.yellow(process.version)}`);
|
|
12
|
-
console.log(`- Platform: ${chalk.yellow(process.platform)}`);
|
|
13
|
-
console.log(`- Architecture: ${chalk.yellow(process.arch)}`);
|
|
14
|
-
console.log(`- Nvm version: ${chalk.yellow(process.env.NVM_BIN ? 'nvm detected' : 'nvm not detected')}`);
|
|
15
|
-
console.log(`- Current directory: ${chalk.yellow(process.cwd())}`);
|
|
16
|
-
if (platform() === 'win32') {
|
|
17
|
-
console.log(`- Download Ide: https://codenotchide.blob.core.windows.net/release-win/Codenotch%20Latest.exe?sv=2023-01-03&ss=btqf&srt=sco&spr=https%2Chttp&st=2025-08-28T12%3A46%3A05Z&se=2039-06-23T15%3A46%3A00Z&sp=rlp&sig=7ivKIFM4nANK4VzdKp20bzaNZhaZZ51YIvzriUacxBw%3D`)
|
|
18
|
-
}
|
|
19
|
-
else if (platform() === 'linux') {
|
|
20
|
-
console.log(`- Download Ide: https://codenotchide.blob.core.windows.net/release-linux/codenotch-ide_latest_amd64.deb?sv=2023-01-03&ss=btqf&srt=sco&spr=https%2Chttp&st=2025-08-28T12%3A46%3A05Z&se=2039-06-23T15%3A46%3A00Z&sp=rlp&sig=7ivKIFM4nANK4VzdKp20bzaNZhaZZ51YIvzriUacxBw%3D`);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { createInterface } from 'readline';
|
|
4
|
-
import { stdin as input, stdout as output } from 'process';
|
|
5
|
-
|
|
6
|
-
export function registerRead(program: Command) {
|
|
7
|
-
program
|
|
8
|
-
.command('read')
|
|
9
|
-
.description('Read test')
|
|
10
|
-
.action(async () => {
|
|
11
|
-
console.log(chalk.green('Read test:'));
|
|
12
|
-
|
|
13
|
-
const rl = createInterface({ input, output });
|
|
14
|
-
|
|
15
|
-
try {
|
|
16
|
-
const answer = await new Promise<string>((resolve) => {
|
|
17
|
-
rl.question('Entre quelque chose : ', resolve);
|
|
18
|
-
});
|
|
19
|
-
console.log(`Tu as saisi : ${chalk.yellow(answer)}`);
|
|
20
|
-
}
|
|
21
|
-
finally {
|
|
22
|
-
rl.close();
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import { readFileSync } from 'fs';
|
|
5
|
-
import path, { join } from 'path';
|
|
6
|
-
import dotenv from 'dotenv';
|
|
7
|
-
import { registerAllCommands } from './commands';
|
|
8
|
-
|
|
9
|
-
// / Load environment variables from .env file in the CLI's own root directory, regardless of where the command is run from
|
|
10
|
-
dotenv.config({ path: path.resolve(__dirname, "../.env"), quiet: true });
|
|
11
|
-
|
|
12
|
-
const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf8'));
|
|
13
|
-
const program = new Command();
|
|
14
|
-
|
|
15
|
-
program
|
|
16
|
-
.name('codenotch-cli')
|
|
17
|
-
.description('CLI tool for Codenotch platform')
|
|
18
|
-
.version(packageJson.version);
|
|
19
|
-
|
|
20
|
-
registerAllCommands(program);
|
|
21
|
-
|
|
22
|
-
program.parse();
|