@optimizely/ocp-cli 1.2.17 → 1.3.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/README.md +28 -6
- package/dist/commands/Dev.d.ts +3 -0
- package/dist/commands/Dev.js +23 -0
- package/dist/commands/Dev.js.map +1 -0
- package/dist/commands/dev-server/DevServer.d.ts +34 -0
- package/dist/commands/dev-server/DevServer.js +187 -0
- package/dist/commands/dev-server/DevServer.js.map +1 -0
- package/dist/lib/AppPackager.js +1 -1
- package/dist/lib/AppPackager.js.map +1 -1
- package/dist/oo-cli.manifest.json +87 -2
- package/package.json +1 -1
- package/src/commands/Dev.ts +12 -0
- package/src/commands/dev-server/DevServer.ts +180 -0
- package/src/lib/AppPackager.ts +1 -1
package/README.md
CHANGED
|
@@ -17,13 +17,35 @@ ocp
|
|
|
17
17
|
ocp <namespace> -h
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
##
|
|
20
|
+
## Commands
|
|
21
21
|
|
|
22
|
-
###
|
|
22
|
+
### `ocp dev-server`
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Start the local development server for OCP applications.
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
-
|
|
26
|
+
The `@optimizely/ocp-local-env` package is automatically managed by this command:
|
|
27
|
+
- First run: Automatically installs the package globally
|
|
28
|
+
- Daily check: Checks for updates once per day and auto-upgrades when available
|
|
29
|
+
- No manual installation required
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
**Options:**
|
|
32
|
+
- `-p, --port <port>` - Port to run the server on (default: 3000)
|
|
33
|
+
- `-c, --config <path>` - Path to custom config file
|
|
34
|
+
- `--path <path>` - Path to the OCP app root directory (default: current directory)
|
|
35
|
+
- `-v, --verbose` - Enable verbose logging
|
|
36
|
+
- `--no-open` - Don't automatically open browser
|
|
37
|
+
|
|
38
|
+
**Examples:**
|
|
39
|
+
```bash
|
|
40
|
+
# Start server in current directory on default port
|
|
41
|
+
ocp dev-server start
|
|
42
|
+
|
|
43
|
+
# Start on custom port
|
|
44
|
+
ocp dev-server start -p 4000
|
|
45
|
+
|
|
46
|
+
# Start with specific app directory
|
|
47
|
+
ocp dev-server start --path /path/to/my-app
|
|
48
|
+
|
|
49
|
+
# Short version to start server
|
|
50
|
+
ocp dev
|
|
51
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Dev = void 0;
|
|
10
|
+
const DevServer_1 = require("./dev-server/DevServer");
|
|
11
|
+
const oo_cli_1 = require("oo-cli");
|
|
12
|
+
class Dev {
|
|
13
|
+
async dev() {
|
|
14
|
+
const dev = new DevServer_1.DevServerCommand();
|
|
15
|
+
await dev.start();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
__decorate([
|
|
19
|
+
oo_cli_1.command,
|
|
20
|
+
(0, oo_cli_1.help)('Start the local development server for OCP apps (for more configuration options use ocp dev-server start)')
|
|
21
|
+
], Dev.prototype, "dev", null);
|
|
22
|
+
exports.Dev = Dev;
|
|
23
|
+
//# sourceMappingURL=Dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dev.js","sourceRoot":"","sources":["../../src/commands/Dev.ts"],"names":[],"mappings":";;;;;;;;;AAAA,sDAAwD;AACxD,mCAAqC;AAErC,MAAa,GAAG;IAID,AAAN,KAAK,CAAC,GAAG;QACd,MAAM,GAAG,GAAG,IAAI,4BAAgB,EAAE,CAAC;QACnC,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;CACF;AAJc;IAFZ,gBAAO;IACP,IAAA,aAAI,EAAC,2GAA2G,CAAC;8BAIjH;AAPH,kBAQC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev Server command - starts the local development server for OCP apps
|
|
3
|
+
* This is a top-level command (no namespace decorator), so it runs as `ocp dev-server`
|
|
4
|
+
*/
|
|
5
|
+
export declare class DevServerCommand {
|
|
6
|
+
port: string;
|
|
7
|
+
config?: string;
|
|
8
|
+
path?: string;
|
|
9
|
+
verbose: boolean;
|
|
10
|
+
noOpen: boolean;
|
|
11
|
+
private PACKAGE_NAME;
|
|
12
|
+
start(): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Ensure @optimizely/ocp-local-env is installed globally and up-to-date.
|
|
15
|
+
* Checks once per day and auto-installs or auto-upgrades as needed.
|
|
16
|
+
*/
|
|
17
|
+
private ensureOcpLocalEnv;
|
|
18
|
+
/**
|
|
19
|
+
* Check if a package is installed globally and return its version.
|
|
20
|
+
* @returns The installed version or null if not installed
|
|
21
|
+
*/
|
|
22
|
+
private getInstalledVersion;
|
|
23
|
+
/**
|
|
24
|
+
* Get the latest version of a package from npm registry.
|
|
25
|
+
* @returns The latest version or null if unavailable
|
|
26
|
+
*/
|
|
27
|
+
private getLatestVersion;
|
|
28
|
+
/**
|
|
29
|
+
* Install or update a global npm package.
|
|
30
|
+
* @param isUpgrade Whether this is an upgrade (affects success message)
|
|
31
|
+
* @returns True if successful, false otherwise
|
|
32
|
+
*/
|
|
33
|
+
private installGlobalPackage;
|
|
34
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.DevServerCommand = void 0;
|
|
10
|
+
const chalk = require("chalk");
|
|
11
|
+
const fs = require("fs");
|
|
12
|
+
const os = require("os");
|
|
13
|
+
const path = require("path");
|
|
14
|
+
const semver = require("semver");
|
|
15
|
+
const oo_cli_1 = require("oo-cli");
|
|
16
|
+
const die_1 = require("../../lib/die");
|
|
17
|
+
const formatError_1 = require("../../lib/formatError");
|
|
18
|
+
const handleInterrupt_1 = require("../../lib/handleInterrupt");
|
|
19
|
+
const TerminalOutput_1 = require("../../lib/TerminalOutput");
|
|
20
|
+
const TeminalPassthru_1 = require("../../lib/TeminalPassthru");
|
|
21
|
+
/**
|
|
22
|
+
* Dev Server command - starts the local development server for OCP apps
|
|
23
|
+
* This is a top-level command (no namespace decorator), so it runs as `ocp dev-server`
|
|
24
|
+
*/
|
|
25
|
+
let DevServerCommand = class DevServerCommand {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.PACKAGE_NAME = '@optimizely/ocp-local-env';
|
|
28
|
+
}
|
|
29
|
+
async start() {
|
|
30
|
+
var _a;
|
|
31
|
+
(0, handleInterrupt_1.handleInterrupt)();
|
|
32
|
+
try {
|
|
33
|
+
// Ensure ocp-local-env is installed and up-to-date
|
|
34
|
+
await this.ensureOcpLocalEnv();
|
|
35
|
+
// Set environment variables that ocp-local-env expects
|
|
36
|
+
process.env.OCP_LOCAL_PORT = this.port;
|
|
37
|
+
if (this.config) {
|
|
38
|
+
process.env.OCP_LOCAL_CONFIG_PATH = this.config;
|
|
39
|
+
}
|
|
40
|
+
process.env.OCP_LOCAL_VERBOSE = this.verbose ? 'true' : 'false';
|
|
41
|
+
process.env.OCP_LOCAL_OPEN_BROWSER = this.noOpen ? 'false' : 'true';
|
|
42
|
+
if (this.path) {
|
|
43
|
+
process.env.APP_ROOT_DIR = this.path;
|
|
44
|
+
}
|
|
45
|
+
// Import and call startServer from ocp-local-env (installed globally)
|
|
46
|
+
// Get the global npm modules path and construct the full package path
|
|
47
|
+
const globalRoot = TerminalOutput_1.TerminalOutput.exec('npm root -g').stdout.trim();
|
|
48
|
+
const packagePath = path.join(globalRoot, this.PACKAGE_NAME);
|
|
49
|
+
// @ts-ignore - Package is installed globally, not in node_modules
|
|
50
|
+
const { startServer } = await (_a = packagePath, Promise.resolve().then(() => require(_a)));
|
|
51
|
+
console.log(chalk.gray('Starting OCP local development server...'));
|
|
52
|
+
await startServer();
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
(0, die_1.die)((0, formatError_1.formatError)(e));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Ensure @optimizely/ocp-local-env is installed globally and up-to-date.
|
|
60
|
+
* Checks once per day and auto-installs or auto-upgrades as needed.
|
|
61
|
+
*/
|
|
62
|
+
async ensureOcpLocalEnv() {
|
|
63
|
+
// Ensure ~/.ocp directory exists
|
|
64
|
+
const ocpDir = path.join(os.homedir(), '.ocp');
|
|
65
|
+
if (!fs.existsSync(ocpDir)) {
|
|
66
|
+
fs.mkdirSync(ocpDir, { recursive: true });
|
|
67
|
+
}
|
|
68
|
+
const checkFile = path.join(os.homedir(), '.ocp', 'last-ocp-local-env-check');
|
|
69
|
+
// Check if we should skip (< 24 hours since last check)
|
|
70
|
+
if (fs.existsSync(checkFile)) {
|
|
71
|
+
const stats = fs.statSync(checkFile);
|
|
72
|
+
const hoursSinceCheck = (Date.now() - stats.mtimeMs) / (1000 * 60 * 60);
|
|
73
|
+
if (hoursSinceCheck < 24) {
|
|
74
|
+
return; // Skip check
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Check if installed globally
|
|
78
|
+
const installedVersion = this.getInstalledVersion();
|
|
79
|
+
if (!installedVersion) {
|
|
80
|
+
// Not installed - auto-install
|
|
81
|
+
console.log(chalk.gray('Installing @optimizely/ocp-local-env globally...'));
|
|
82
|
+
this.installGlobalPackage(false);
|
|
83
|
+
fs.writeFileSync(checkFile, '');
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
// Check for updates
|
|
87
|
+
const latestVersion = await this.getLatestVersion();
|
|
88
|
+
if (latestVersion && semver.gt(latestVersion, installedVersion)) {
|
|
89
|
+
// Newer version available - auto-upgrade
|
|
90
|
+
console.log(chalk.gray(`Upgrading @optimizely/ocp-local-env (${installedVersion} → ${latestVersion})...`));
|
|
91
|
+
this.installGlobalPackage(true);
|
|
92
|
+
}
|
|
93
|
+
// Touch check file
|
|
94
|
+
fs.writeFileSync(checkFile, '');
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Check if a package is installed globally and return its version.
|
|
98
|
+
* @returns The installed version or null if not installed
|
|
99
|
+
*/
|
|
100
|
+
getInstalledVersion() {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
try {
|
|
103
|
+
const result = TerminalOutput_1.TerminalOutput.exec(`npm list -g --depth=0 --json ${this.PACKAGE_NAME}`);
|
|
104
|
+
if (result.status === 0) {
|
|
105
|
+
const data = JSON.parse(result.stdout);
|
|
106
|
+
return ((_b = (_a = data.dependencies) === null || _a === void 0 ? void 0 : _a[this.PACKAGE_NAME]) === null || _b === void 0 ? void 0 : _b.version) || null;
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
catch (_c) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Get the latest version of a package from npm registry.
|
|
116
|
+
* @returns The latest version or null if unavailable
|
|
117
|
+
*/
|
|
118
|
+
async getLatestVersion() {
|
|
119
|
+
try {
|
|
120
|
+
const result = TerminalOutput_1.TerminalOutput.exec(`npm view ${this.PACKAGE_NAME} version`);
|
|
121
|
+
if (result.status === 0) {
|
|
122
|
+
return result.stdout.trim() || null;
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
catch (_a) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Install or update a global npm package.
|
|
132
|
+
* @param isUpgrade Whether this is an upgrade (affects success message)
|
|
133
|
+
* @returns True if successful, false otherwise
|
|
134
|
+
*/
|
|
135
|
+
installGlobalPackage(isUpgrade) {
|
|
136
|
+
const spec = isUpgrade ? `${this.PACKAGE_NAME}@latest` : this.PACKAGE_NAME;
|
|
137
|
+
const result = TeminalPassthru_1.TerminalPassthru.exec(`npm install -g ${spec}`);
|
|
138
|
+
if (result.status === 0) {
|
|
139
|
+
if (isUpgrade) {
|
|
140
|
+
// Get the newly installed version for the success message
|
|
141
|
+
const newVersion = this.getInstalledVersion();
|
|
142
|
+
console.log(chalk.green(`✓ Updated to version ${newVersion}`));
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
console.log(chalk.green('✓ Installed @optimizely/ocp-local-env'));
|
|
146
|
+
}
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
console.log(chalk.red('Installation failed. Please install manually with:'));
|
|
151
|
+
console.log(chalk.red(` npm install -g ${this.PACKAGE_NAME}`));
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
__decorate([
|
|
157
|
+
(0, oo_cli_1.option)('p'),
|
|
158
|
+
(0, oo_cli_1.help)('Port to run the server on'),
|
|
159
|
+
(0, oo_cli_1.defaultValue)('3000')
|
|
160
|
+
], DevServerCommand.prototype, "port", void 0);
|
|
161
|
+
__decorate([
|
|
162
|
+
(0, oo_cli_1.option)('c'),
|
|
163
|
+
(0, oo_cli_1.help)('Path to custom config file')
|
|
164
|
+
], DevServerCommand.prototype, "config", void 0);
|
|
165
|
+
__decorate([
|
|
166
|
+
oo_cli_1.option,
|
|
167
|
+
(0, oo_cli_1.help)('Path to the OCP app root directory')
|
|
168
|
+
], DevServerCommand.prototype, "path", void 0);
|
|
169
|
+
__decorate([
|
|
170
|
+
(0, oo_cli_1.flag)('v'),
|
|
171
|
+
(0, oo_cli_1.help)('Enable verbose logging'),
|
|
172
|
+
(0, oo_cli_1.defaultValue)(false)
|
|
173
|
+
], DevServerCommand.prototype, "verbose", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
(0, oo_cli_1.flag)('no-open'),
|
|
176
|
+
(0, oo_cli_1.help)('Don\'t automatically open browser'),
|
|
177
|
+
(0, oo_cli_1.defaultValue)(false)
|
|
178
|
+
], DevServerCommand.prototype, "noOpen", void 0);
|
|
179
|
+
__decorate([
|
|
180
|
+
oo_cli_1.command,
|
|
181
|
+
(0, oo_cli_1.help)('Start the local development server for OCP apps')
|
|
182
|
+
], DevServerCommand.prototype, "start", null);
|
|
183
|
+
DevServerCommand = __decorate([
|
|
184
|
+
(0, oo_cli_1.namespace)('dev-server')
|
|
185
|
+
], DevServerCommand);
|
|
186
|
+
exports.DevServerCommand = DevServerCommand;
|
|
187
|
+
//# sourceMappingURL=DevServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DevServer.js","sourceRoot":"","sources":["../../../src/commands/dev-server/DevServer.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+BAA+B;AAC/B,yBAAyB;AACzB,yBAAyB;AACzB,6BAA6B;AAC7B,iCAAiC;AACjC,mCAA4E;AAC5E,uCAAkC;AAClC,uDAAkD;AAClD,+DAA0D;AAC1D,6DAAwD;AACxD,+DAA2D;AAE3D;;;GAGG;AAEI,IAAM,gBAAgB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,qBAAY,EAAC,KAAK,CAAC;gDACI;AAMX;IAFZ,gBAAO;IACP,IAAA,aAAI,EAAC,iDAAiD,CAAC;6CAgCvD;AA3DU,gBAAgB;IAD5B,IAAA,kBAAS,EAAC,YAAY,CAAC;GACX,gBAAgB,CAkK5B;AAlKY,4CAAgB"}
|
package/dist/lib/AppPackager.js
CHANGED
|
@@ -14,7 +14,7 @@ class AppPackager {
|
|
|
14
14
|
console.log(chalk.gray(`Packaging files in ${this.rootPath}`));
|
|
15
15
|
const files = await globby(['**/*'], {
|
|
16
16
|
gitignore: true,
|
|
17
|
-
ignore: ['node_modules/**/*', '*.zip', '.git/**/*'],
|
|
17
|
+
ignore: ['node_modules/**/*', '*.zip', '.git/**/*', '.ocp-local/**/*'],
|
|
18
18
|
cwd: this.rootPath,
|
|
19
19
|
dot: true,
|
|
20
20
|
onlyFiles: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppPackager.js","sourceRoot":"","sources":["../../src/lib/AppPackager.ts"],"names":[],"mappings":";;;AAAA,kCAAkC;AAClC,+BAA+B;AAC/B,yBAAyB;AACzB,6BAA6B;AAC7B,iCAAiC;AAEjC,MAAa,WAAW;IAGtB,YAAY,QAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,sBAAsB,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAE/D,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE;YACnC,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,CAAC,mBAAmB,EAAE,OAAO,EAAE,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"AppPackager.js","sourceRoot":"","sources":["../../src/lib/AppPackager.ts"],"names":[],"mappings":";;;AAAA,kCAAkC;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jCD,kCAiCC"}
|
|
@@ -1016,6 +1016,78 @@
|
|
|
1016
1016
|
}
|
|
1017
1017
|
]
|
|
1018
1018
|
},
|
|
1019
|
+
"dev-server": {
|
|
1020
|
+
"namespaces": {},
|
|
1021
|
+
"commands": [
|
|
1022
|
+
{
|
|
1023
|
+
"path": "commands/dev-server/DevServer.js",
|
|
1024
|
+
"className": "DevServerCommand",
|
|
1025
|
+
"key": "start",
|
|
1026
|
+
"command": "start",
|
|
1027
|
+
"aliases": [],
|
|
1028
|
+
"help": "Start the local development server for OCP apps",
|
|
1029
|
+
"documentation": "TBD",
|
|
1030
|
+
"flags": [
|
|
1031
|
+
{
|
|
1032
|
+
"name": "verbose",
|
|
1033
|
+
"key": "verbose",
|
|
1034
|
+
"aliases": [
|
|
1035
|
+
"v"
|
|
1036
|
+
],
|
|
1037
|
+
"invertedAliases": [],
|
|
1038
|
+
"help": "Enable verbose logging",
|
|
1039
|
+
"defaultValue": false,
|
|
1040
|
+
"invertible": false,
|
|
1041
|
+
"optional": true
|
|
1042
|
+
},
|
|
1043
|
+
{
|
|
1044
|
+
"name": "noOpen",
|
|
1045
|
+
"key": "noOpen",
|
|
1046
|
+
"aliases": [
|
|
1047
|
+
"no-open"
|
|
1048
|
+
],
|
|
1049
|
+
"invertedAliases": [],
|
|
1050
|
+
"help": "Don't automatically open browser",
|
|
1051
|
+
"defaultValue": false,
|
|
1052
|
+
"invertible": false,
|
|
1053
|
+
"optional": true
|
|
1054
|
+
}
|
|
1055
|
+
],
|
|
1056
|
+
"options": [
|
|
1057
|
+
{
|
|
1058
|
+
"name": "port",
|
|
1059
|
+
"key": "port",
|
|
1060
|
+
"aliases": [
|
|
1061
|
+
"p"
|
|
1062
|
+
],
|
|
1063
|
+
"help": "Port to run the server on",
|
|
1064
|
+
"defaultValue": "3000",
|
|
1065
|
+
"optional": true,
|
|
1066
|
+
"multiple": false
|
|
1067
|
+
},
|
|
1068
|
+
{
|
|
1069
|
+
"name": "config",
|
|
1070
|
+
"key": "config",
|
|
1071
|
+
"aliases": [
|
|
1072
|
+
"c"
|
|
1073
|
+
],
|
|
1074
|
+
"help": "Path to custom config file",
|
|
1075
|
+
"optional": true,
|
|
1076
|
+
"multiple": false
|
|
1077
|
+
},
|
|
1078
|
+
{
|
|
1079
|
+
"name": "path",
|
|
1080
|
+
"key": "path",
|
|
1081
|
+
"aliases": [],
|
|
1082
|
+
"help": "Path to the OCP app root directory",
|
|
1083
|
+
"optional": true,
|
|
1084
|
+
"multiple": false
|
|
1085
|
+
}
|
|
1086
|
+
],
|
|
1087
|
+
"params": []
|
|
1088
|
+
}
|
|
1089
|
+
]
|
|
1090
|
+
},
|
|
1019
1091
|
"env": {
|
|
1020
1092
|
"namespaces": {},
|
|
1021
1093
|
"commands": [
|
|
@@ -1369,9 +1441,22 @@
|
|
|
1369
1441
|
]
|
|
1370
1442
|
}
|
|
1371
1443
|
},
|
|
1372
|
-
"commands": [
|
|
1444
|
+
"commands": [
|
|
1445
|
+
{
|
|
1446
|
+
"path": "commands/Dev.js",
|
|
1447
|
+
"className": "Dev",
|
|
1448
|
+
"key": "dev",
|
|
1449
|
+
"command": "dev",
|
|
1450
|
+
"aliases": [],
|
|
1451
|
+
"help": "Start the local development server for OCP apps (for more configuration options use ocp dev-server start)",
|
|
1452
|
+
"documentation": "TBD",
|
|
1453
|
+
"flags": [],
|
|
1454
|
+
"options": [],
|
|
1455
|
+
"params": []
|
|
1456
|
+
}
|
|
1457
|
+
],
|
|
1373
1458
|
"package": {
|
|
1374
|
-
"version": "1.
|
|
1459
|
+
"version": "1.3.0",
|
|
1375
1460
|
"name": "@optimizely/ocp-cli",
|
|
1376
1461
|
"license": "Apache-2.0",
|
|
1377
1462
|
"executable": "ocp"
|
package/package.json
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {DevServerCommand} from './dev-server/DevServer';
|
|
2
|
+
import {command, help} from 'oo-cli';
|
|
3
|
+
|
|
4
|
+
export class Dev {
|
|
5
|
+
|
|
6
|
+
@command
|
|
7
|
+
@help('Start the local development server for OCP apps (for more configuration options use ocp dev-server start)')
|
|
8
|
+
public async dev() {
|
|
9
|
+
const dev = new DevServerCommand();
|
|
10
|
+
await dev.start();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import * as chalk from 'chalk';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import * as os from 'os';
|
|
4
|
+
import * as path from 'path';
|
|
5
|
+
import * as semver from 'semver';
|
|
6
|
+
import {command, defaultValue, flag, help, option, namespace} from 'oo-cli';
|
|
7
|
+
import {die} from '../../lib/die';
|
|
8
|
+
import {formatError} from '../../lib/formatError';
|
|
9
|
+
import {handleInterrupt} from '../../lib/handleInterrupt';
|
|
10
|
+
import {TerminalOutput} from '../../lib/TerminalOutput';
|
|
11
|
+
import {TerminalPassthru} from '../../lib/TeminalPassthru';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Dev Server command - starts the local development server for OCP apps
|
|
15
|
+
* This is a top-level command (no namespace decorator), so it runs as `ocp dev-server`
|
|
16
|
+
*/
|
|
17
|
+
@namespace('dev-server')
|
|
18
|
+
export class DevServerCommand {
|
|
19
|
+
@option('p')
|
|
20
|
+
@help('Port to run the server on')
|
|
21
|
+
@defaultValue('3000')
|
|
22
|
+
public port!: string;
|
|
23
|
+
|
|
24
|
+
@option('c')
|
|
25
|
+
@help('Path to custom config file')
|
|
26
|
+
public config?: string;
|
|
27
|
+
|
|
28
|
+
@option
|
|
29
|
+
@help('Path to the OCP app root directory')
|
|
30
|
+
public path?: string;
|
|
31
|
+
|
|
32
|
+
@flag('v')
|
|
33
|
+
@help('Enable verbose logging')
|
|
34
|
+
@defaultValue(false)
|
|
35
|
+
public verbose!: boolean;
|
|
36
|
+
|
|
37
|
+
@flag('no-open')
|
|
38
|
+
@help('Don\'t automatically open browser')
|
|
39
|
+
@defaultValue(false)
|
|
40
|
+
public noOpen!: boolean;
|
|
41
|
+
|
|
42
|
+
private PACKAGE_NAME = '@optimizely/ocp-local-env';
|
|
43
|
+
|
|
44
|
+
@command
|
|
45
|
+
@help('Start the local development server for OCP apps')
|
|
46
|
+
public async start() {
|
|
47
|
+
handleInterrupt();
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
// Ensure ocp-local-env is installed and up-to-date
|
|
51
|
+
await this.ensureOcpLocalEnv();
|
|
52
|
+
|
|
53
|
+
// Set environment variables that ocp-local-env expects
|
|
54
|
+
process.env.OCP_LOCAL_PORT = this.port;
|
|
55
|
+
if (this.config) {
|
|
56
|
+
process.env.OCP_LOCAL_CONFIG_PATH = this.config;
|
|
57
|
+
}
|
|
58
|
+
process.env.OCP_LOCAL_VERBOSE = this.verbose ? 'true' : 'false';
|
|
59
|
+
process.env.OCP_LOCAL_OPEN_BROWSER = this.noOpen ? 'false' : 'true';
|
|
60
|
+
if (this.path) {
|
|
61
|
+
process.env.APP_ROOT_DIR = this.path;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Import and call startServer from ocp-local-env (installed globally)
|
|
65
|
+
// Get the global npm modules path and construct the full package path
|
|
66
|
+
const globalRoot = TerminalOutput.exec('npm root -g').stdout.trim();
|
|
67
|
+
const packagePath = path.join(globalRoot, this.PACKAGE_NAME);
|
|
68
|
+
|
|
69
|
+
// @ts-ignore - Package is installed globally, not in node_modules
|
|
70
|
+
const {startServer} = await import(packagePath);
|
|
71
|
+
|
|
72
|
+
console.log(chalk.gray('Starting OCP local development server...'));
|
|
73
|
+
await startServer();
|
|
74
|
+
} catch (e: any) {
|
|
75
|
+
die(formatError(e));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Ensure @optimizely/ocp-local-env is installed globally and up-to-date.
|
|
81
|
+
* Checks once per day and auto-installs or auto-upgrades as needed.
|
|
82
|
+
*/
|
|
83
|
+
private async ensureOcpLocalEnv(): Promise<void> {
|
|
84
|
+
// Ensure ~/.ocp directory exists
|
|
85
|
+
const ocpDir = path.join(os.homedir(), '.ocp');
|
|
86
|
+
if (!fs.existsSync(ocpDir)) {
|
|
87
|
+
fs.mkdirSync(ocpDir, {recursive: true});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const checkFile = path.join(os.homedir(), '.ocp', 'last-ocp-local-env-check');
|
|
91
|
+
// Check if we should skip (< 24 hours since last check)
|
|
92
|
+
if (fs.existsSync(checkFile)) {
|
|
93
|
+
const stats = fs.statSync(checkFile);
|
|
94
|
+
const hoursSinceCheck = (Date.now() - stats.mtimeMs) / (1000 * 60 * 60);
|
|
95
|
+
if (hoursSinceCheck < 24) {
|
|
96
|
+
return; // Skip check
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Check if installed globally
|
|
101
|
+
const installedVersion = this.getInstalledVersion();
|
|
102
|
+
|
|
103
|
+
if (!installedVersion) {
|
|
104
|
+
// Not installed - auto-install
|
|
105
|
+
console.log(chalk.gray('Installing @optimizely/ocp-local-env globally...'));
|
|
106
|
+
this.installGlobalPackage(false);
|
|
107
|
+
fs.writeFileSync(checkFile, '');
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Check for updates
|
|
112
|
+
const latestVersion = await this.getLatestVersion();
|
|
113
|
+
if (latestVersion && semver.gt(latestVersion, installedVersion)) {
|
|
114
|
+
// Newer version available - auto-upgrade
|
|
115
|
+
console.log(chalk.gray(`Upgrading @optimizely/ocp-local-env (${installedVersion} → ${latestVersion})...`));
|
|
116
|
+
this.installGlobalPackage(true);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Touch check file
|
|
120
|
+
fs.writeFileSync(checkFile, '');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Check if a package is installed globally and return its version.
|
|
125
|
+
* @returns The installed version or null if not installed
|
|
126
|
+
*/
|
|
127
|
+
private getInstalledVersion(): string | null {
|
|
128
|
+
try {
|
|
129
|
+
const result = TerminalOutput.exec(`npm list -g --depth=0 --json ${this.PACKAGE_NAME}`);
|
|
130
|
+
if (result.status === 0) {
|
|
131
|
+
const data = JSON.parse(result.stdout);
|
|
132
|
+
return data.dependencies?.[this.PACKAGE_NAME]?.version || null;
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
} catch {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Get the latest version of a package from npm registry.
|
|
142
|
+
* @returns The latest version or null if unavailable
|
|
143
|
+
*/
|
|
144
|
+
private async getLatestVersion(): Promise<string | null> {
|
|
145
|
+
try {
|
|
146
|
+
const result = TerminalOutput.exec(`npm view ${this.PACKAGE_NAME} version`);
|
|
147
|
+
if (result.status === 0) {
|
|
148
|
+
return result.stdout.trim() || null;
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
} catch {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Install or update a global npm package.
|
|
158
|
+
* @param isUpgrade Whether this is an upgrade (affects success message)
|
|
159
|
+
* @returns True if successful, false otherwise
|
|
160
|
+
*/
|
|
161
|
+
private installGlobalPackage(isUpgrade: boolean): boolean {
|
|
162
|
+
const spec = isUpgrade ? `${this.PACKAGE_NAME}@latest` : this.PACKAGE_NAME;
|
|
163
|
+
const result = TerminalPassthru.exec(`npm install -g ${spec}`);
|
|
164
|
+
|
|
165
|
+
if (result.status === 0) {
|
|
166
|
+
if (isUpgrade) {
|
|
167
|
+
// Get the newly installed version for the success message
|
|
168
|
+
const newVersion = this.getInstalledVersion();
|
|
169
|
+
console.log(chalk.green(`✓ Updated to version ${newVersion}`));
|
|
170
|
+
} else {
|
|
171
|
+
console.log(chalk.green('✓ Installed @optimizely/ocp-local-env'));
|
|
172
|
+
}
|
|
173
|
+
return true;
|
|
174
|
+
} else {
|
|
175
|
+
console.log(chalk.red('Installation failed. Please install manually with:'));
|
|
176
|
+
console.log(chalk.red(` npm install -g ${this.PACKAGE_NAME}`));
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
package/src/lib/AppPackager.ts
CHANGED
|
@@ -16,7 +16,7 @@ export class AppPackager {
|
|
|
16
16
|
|
|
17
17
|
const files = await globby(['**/*'], {
|
|
18
18
|
gitignore: true, // respects .gitignore
|
|
19
|
-
ignore: ['node_modules/**/*', '*.zip', '.git/**/*'],
|
|
19
|
+
ignore: ['node_modules/**/*', '*.zip', '.git/**/*', '.ocp-local/**/*'],
|
|
20
20
|
cwd: this.rootPath,
|
|
21
21
|
dot: true,
|
|
22
22
|
onlyFiles: true,
|