@y4wee/nupo 0.1.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/dist/App.d.ts +8 -0
- package/dist/App.js +109 -0
- package/dist/__tests__/checks.test.d.ts +1 -0
- package/dist/__tests__/checks.test.js +68 -0
- package/dist/__tests__/config.test.d.ts +1 -0
- package/dist/__tests__/config.test.js +61 -0
- package/dist/components/ConfirmExit.d.ts +9 -0
- package/dist/components/ConfirmExit.js +12 -0
- package/dist/components/ErrorPanel.d.ts +7 -0
- package/dist/components/ErrorPanel.js +12 -0
- package/dist/components/Header.d.ts +10 -0
- package/dist/components/Header.js +17 -0
- package/dist/components/LeftPanel.d.ts +9 -0
- package/dist/components/LeftPanel.js +31 -0
- package/dist/components/OptionsPanel.d.ts +11 -0
- package/dist/components/OptionsPanel.js +18 -0
- package/dist/components/PathInput.d.ts +10 -0
- package/dist/components/PathInput.js +133 -0
- package/dist/components/ProgressBar.d.ts +5 -0
- package/dist/components/ProgressBar.js +21 -0
- package/dist/components/StepsPanel.d.ts +8 -0
- package/dist/components/StepsPanel.js +24 -0
- package/dist/hooks/useConfig.d.ts +8 -0
- package/dist/hooks/useConfig.js +26 -0
- package/dist/hooks/useTerminalSize.d.ts +4 -0
- package/dist/hooks/useTerminalSize.js +18 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +169 -0
- package/dist/screens/ConfigScreen.d.ts +10 -0
- package/dist/screens/ConfigScreen.js +182 -0
- package/dist/screens/ConfigureServiceScreen.d.ts +11 -0
- package/dist/screens/ConfigureServiceScreen.js +499 -0
- package/dist/screens/HomeScreen.d.ts +14 -0
- package/dist/screens/HomeScreen.js +24 -0
- package/dist/screens/IdeScreen.d.ts +9 -0
- package/dist/screens/IdeScreen.js +101 -0
- package/dist/screens/InitScreen.d.ts +9 -0
- package/dist/screens/InitScreen.js +182 -0
- package/dist/screens/InstallVersionScreen.d.ts +10 -0
- package/dist/screens/InstallVersionScreen.js +495 -0
- package/dist/screens/OdooScreen.d.ts +13 -0
- package/dist/screens/OdooScreen.js +76 -0
- package/dist/screens/OdooServiceScreen.d.ts +10 -0
- package/dist/screens/OdooServiceScreen.js +51 -0
- package/dist/screens/StartServiceScreen.d.ts +12 -0
- package/dist/screens/StartServiceScreen.js +386 -0
- package/dist/screens/UpgradeVersionScreen.d.ts +9 -0
- package/dist/screens/UpgradeVersionScreen.js +259 -0
- package/dist/services/checks.d.ts +8 -0
- package/dist/services/checks.js +48 -0
- package/dist/services/config.d.ts +11 -0
- package/dist/services/config.js +146 -0
- package/dist/services/git.d.ts +35 -0
- package/dist/services/git.js +173 -0
- package/dist/services/ide.d.ts +10 -0
- package/dist/services/ide.js +126 -0
- package/dist/services/python.d.ts +14 -0
- package/dist/services/python.js +81 -0
- package/dist/services/system.d.ts +2 -0
- package/dist/services/system.js +22 -0
- package/dist/types/index.d.ts +82 -0
- package/dist/types/index.js +26 -0
- package/package.json +37 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { spawnSync } from 'child_process';
|
|
2
|
+
/**
|
|
3
|
+
* Temporarily suspends Ink's raw-mode and opens a file in the user's
|
|
4
|
+
* preferred editor ($EDITOR / $VISUAL, fallback: nano).
|
|
5
|
+
* Blocks until the editor process exits, then restores raw mode.
|
|
6
|
+
*/
|
|
7
|
+
function withRawModeDisabled(fn) {
|
|
8
|
+
const stdin = process.stdin;
|
|
9
|
+
if (stdin.isTTY)
|
|
10
|
+
stdin.setRawMode?.(false);
|
|
11
|
+
process.stdout.write('\u001B[?25h'); // ensure cursor visible
|
|
12
|
+
fn();
|
|
13
|
+
if (stdin.isTTY)
|
|
14
|
+
stdin.setRawMode?.(true);
|
|
15
|
+
}
|
|
16
|
+
export function openInEditor(filePath) {
|
|
17
|
+
const editor = process.env['EDITOR'] ?? process.env['VISUAL'] ?? 'nano';
|
|
18
|
+
withRawModeDisabled(() => spawnSync(editor, [filePath], { stdio: 'inherit' }));
|
|
19
|
+
}
|
|
20
|
+
export function runInTerminal(cmd, args) {
|
|
21
|
+
withRawModeDisabled(() => spawnSync(cmd, args, { stdio: 'inherit' }));
|
|
22
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export interface OdooVersion {
|
|
2
|
+
branch: string;
|
|
3
|
+
path: string;
|
|
4
|
+
}
|
|
5
|
+
export interface PendingInstall {
|
|
6
|
+
branch: string;
|
|
7
|
+
path: string;
|
|
8
|
+
lastCompletedStep: InstallStepId | null;
|
|
9
|
+
}
|
|
10
|
+
export interface OdooServiceConfig {
|
|
11
|
+
name: string;
|
|
12
|
+
branch: string;
|
|
13
|
+
versionPath: string;
|
|
14
|
+
useEnterprise: boolean;
|
|
15
|
+
customFolders: string[];
|
|
16
|
+
confPath: string;
|
|
17
|
+
}
|
|
18
|
+
export interface NupoConfig {
|
|
19
|
+
initiated: boolean;
|
|
20
|
+
python_installed: boolean;
|
|
21
|
+
pip_installed: boolean;
|
|
22
|
+
odoo_path_repo: string;
|
|
23
|
+
odoo_versions: Record<string, OdooVersion>;
|
|
24
|
+
pending_installs?: Record<string, PendingInstall>;
|
|
25
|
+
odoo_services?: Record<string, OdooServiceConfig>;
|
|
26
|
+
log_buffer_size?: number;
|
|
27
|
+
primary_color?: string;
|
|
28
|
+
secondary_color?: string;
|
|
29
|
+
text_color?: string;
|
|
30
|
+
cursor_color?: string;
|
|
31
|
+
venv_installed?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare const DEFAULT_CONFIG: NupoConfig;
|
|
34
|
+
export declare function getPrimaryColor(config?: NupoConfig | null): string;
|
|
35
|
+
export declare function getSecondaryColor(config?: NupoConfig | null): string;
|
|
36
|
+
export declare function getTextColor(config?: NupoConfig | null): string;
|
|
37
|
+
export declare function getCursorColor(config?: NupoConfig | null): string;
|
|
38
|
+
export interface CliStartArgs {
|
|
39
|
+
serviceName: string;
|
|
40
|
+
db?: string;
|
|
41
|
+
module?: string;
|
|
42
|
+
install?: string;
|
|
43
|
+
stopAfterInit: boolean;
|
|
44
|
+
shell: boolean;
|
|
45
|
+
}
|
|
46
|
+
export type Screen = 'home' | 'init' | 'odoo' | 'ide' | 'config';
|
|
47
|
+
export type StepStatus = 'pending' | 'running' | 'success' | 'error';
|
|
48
|
+
export type InitStepId = 'python' | 'pip' | 'venv' | 'odoo_path';
|
|
49
|
+
export interface InitStep {
|
|
50
|
+
id: InitStepId;
|
|
51
|
+
label: string;
|
|
52
|
+
status: StepStatus;
|
|
53
|
+
errorMessage?: string;
|
|
54
|
+
}
|
|
55
|
+
export type UpgradeStepId = 'update_community' | 'update_enterprise';
|
|
56
|
+
export interface UpgradeStep {
|
|
57
|
+
id: UpgradeStepId;
|
|
58
|
+
label: string;
|
|
59
|
+
status: StepStatus;
|
|
60
|
+
errorMessage?: string;
|
|
61
|
+
}
|
|
62
|
+
export type InstallStepId = 'branch_input' | 'check_community' | 'check_enterprise' | 'create_dir' | 'clone_community' | 'clone_enterprise' | 'create_venv' | 'install_requirements' | 'create_extras';
|
|
63
|
+
export interface InstallStep {
|
|
64
|
+
id: InstallStepId;
|
|
65
|
+
label: string;
|
|
66
|
+
status: StepStatus;
|
|
67
|
+
errorMessage?: string;
|
|
68
|
+
}
|
|
69
|
+
/** Structural type accepted by StepsPanel / ErrorPanel */
|
|
70
|
+
export interface AnyStep {
|
|
71
|
+
id: string;
|
|
72
|
+
label: string;
|
|
73
|
+
status: StepStatus;
|
|
74
|
+
errorMessage?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface MenuOption {
|
|
77
|
+
id: string;
|
|
78
|
+
label: string;
|
|
79
|
+
description: string;
|
|
80
|
+
screen: Screen;
|
|
81
|
+
visible: boolean;
|
|
82
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const DEFAULT_CONFIG = {
|
|
2
|
+
initiated: false,
|
|
3
|
+
python_installed: false,
|
|
4
|
+
pip_installed: false,
|
|
5
|
+
odoo_path_repo: '',
|
|
6
|
+
odoo_versions: {},
|
|
7
|
+
pending_installs: {},
|
|
8
|
+
odoo_services: {},
|
|
9
|
+
log_buffer_size: 500,
|
|
10
|
+
primary_color: '#9F0C58',
|
|
11
|
+
secondary_color: '#E79439',
|
|
12
|
+
text_color: '#848484',
|
|
13
|
+
cursor_color: 'cyan',
|
|
14
|
+
};
|
|
15
|
+
export function getPrimaryColor(config) {
|
|
16
|
+
return config?.primary_color ?? '#9F0C58';
|
|
17
|
+
}
|
|
18
|
+
export function getSecondaryColor(config) {
|
|
19
|
+
return config?.secondary_color ?? '#E79439';
|
|
20
|
+
}
|
|
21
|
+
export function getTextColor(config) {
|
|
22
|
+
return config?.text_color ?? '#848484';
|
|
23
|
+
}
|
|
24
|
+
export function getCursorColor(config) {
|
|
25
|
+
return config?.cursor_color ?? 'cyan';
|
|
26
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@y4wee/nupo",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "nupo CLI - Odoo development environment manager",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"nupo": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=18"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"dev": "tsx src/index.tsx",
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"start": "node dist/index.js",
|
|
19
|
+
"prepublishOnly": "npm run build",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest",
|
|
22
|
+
"install:local": "npm run build && mkdir -p $HOME/.local/bin && ln -sf $(pwd)/dist/index.js $HOME/.local/bin/nupo && chmod +x dist/index.js && echo 'nupo installé dans ~/.local/bin/nupo'"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"ink": "^5.1.0",
|
|
26
|
+
"ink-text-input": "^6.0.0",
|
|
27
|
+
"react": "^18.3.1",
|
|
28
|
+
"chalk": "^5.3.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/react": "^18.3.1",
|
|
32
|
+
"@types/node": "^20.0.0",
|
|
33
|
+
"typescript": "^5.4.0",
|
|
34
|
+
"tsx": "^4.7.0",
|
|
35
|
+
"vitest": "^2.0.0"
|
|
36
|
+
}
|
|
37
|
+
}
|