@remkoj/optimizely-cms-cli 6.0.0-pre9 → 6.0.0-rc.3
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/AGENTS.md +68 -0
- package/README.md +348 -38
- package/dist/index.js +1239 -508
- package/dist/index.js.map +1 -1
- package/package.json +33 -17
- package/script/postinstall.mjs +45 -0
package/package.json
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
"name": "@remkoj/optimizely-cms-cli",
|
|
3
3
|
"description": "CLI Utility to work with Optimizely SaaS CMS.",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/remkoj/optimizely-dxp-clients.git",
|
|
8
|
+
"directory": "packages/optimizely-cms-cli"
|
|
9
|
+
},
|
|
10
|
+
"bugs": "https://github.com/remkoj/optimizely-dxp-clients/issues",
|
|
11
|
+
"homepage": "https://github.com/remkoj/optimizely-dxp-clients/blob/main/packages/optimizely-cms-cli/README.md",
|
|
5
12
|
"author": "Remko Jantzen <693172+remkoj@users.noreply.github.com>",
|
|
6
13
|
"keywords": [
|
|
7
14
|
"Optimizely CMS",
|
|
@@ -9,49 +16,58 @@
|
|
|
9
16
|
"CMS",
|
|
10
17
|
"CLI"
|
|
11
18
|
],
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=24.0.0 <25.0.0"
|
|
21
|
+
},
|
|
12
22
|
"type": "module",
|
|
13
|
-
"version": "6.0.0-
|
|
23
|
+
"version": "6.0.0-rc.3",
|
|
14
24
|
"bin": {
|
|
15
25
|
"opti-cms": "./dist/index.js",
|
|
16
26
|
"optimizely-cms-cli": "./dist/index.js"
|
|
17
27
|
},
|
|
18
28
|
"files": [
|
|
19
|
-
"./dist"
|
|
29
|
+
"./dist",
|
|
30
|
+
"./script/postinstall.mjs",
|
|
31
|
+
"./AGENTS.md"
|
|
20
32
|
],
|
|
21
33
|
"scripts": {
|
|
22
34
|
"update-cfg": "node ./script/update-cfg.js",
|
|
35
|
+
"postinstall": "node ./script/postinstall.mjs",
|
|
23
36
|
"prepare": "node ./script/update-cfg.js && rollup -c",
|
|
37
|
+
"recompile": "node ./script/update-cfg.js && rollup -c",
|
|
24
38
|
"watch": "rollup -c ./rollup.config.js -w",
|
|
25
39
|
"compile": "rollup -c ./rollup.config.js",
|
|
26
40
|
"opti-cms": "node ./dist/index.js"
|
|
27
41
|
},
|
|
28
42
|
"devDependencies": {
|
|
29
|
-
"@remkoj/optimizely-cms-api": "6.0.0-
|
|
30
|
-
"@remkoj/optimizely-graph-functions": "6.0.0-
|
|
43
|
+
"@remkoj/optimizely-cms-api": "6.0.0-rc.3",
|
|
44
|
+
"@remkoj/optimizely-graph-functions": "6.0.0-rc.3",
|
|
31
45
|
"@rollup/plugin-json": "^6.1.0",
|
|
32
|
-
"@rollup/plugin-typescript": "^12.
|
|
33
|
-
"@types/node": "^
|
|
34
|
-
"@types/yargs": "^17.0.
|
|
35
|
-
"rollup": "^4.
|
|
46
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
47
|
+
"@types/node": "^24.13.3",
|
|
48
|
+
"@types/yargs": "^17.0.35",
|
|
49
|
+
"rollup": "^4.62.2",
|
|
36
50
|
"tslib": "^2.8.1",
|
|
37
51
|
"typescript": "^5.9.3"
|
|
38
52
|
},
|
|
39
53
|
"dependencies": {
|
|
40
|
-
"@fastify/deepmerge": "^3.1
|
|
41
|
-
"@inquirer/prompts": "^
|
|
42
|
-
"@remkoj/optimizely-cms-api": "
|
|
43
|
-
"@remkoj/optimizely-graph-functions": "6.0.0-
|
|
44
|
-
"
|
|
54
|
+
"@fastify/deepmerge": "^3.2.1",
|
|
55
|
+
"@inquirer/prompts": "^8.5.2",
|
|
56
|
+
"@remkoj/optimizely-cms-api": "6.0.0-rc.3",
|
|
57
|
+
"@remkoj/optimizely-graph-functions": "6.0.0-rc.3",
|
|
58
|
+
"@sindresorhus/slugify": "^3.0.0",
|
|
59
|
+
"ajv": "^8.20.0",
|
|
45
60
|
"ajv-formats": "^3.0.1",
|
|
46
61
|
"chalk": "^5.6.2",
|
|
47
62
|
"cli-table3": "^0.6.5",
|
|
48
|
-
"
|
|
49
|
-
"dotenv
|
|
63
|
+
"deep-object-diff": "^1.1.9",
|
|
64
|
+
"dotenv": "^17.4.2",
|
|
65
|
+
"dotenv-expand": "^13.0.0",
|
|
50
66
|
"fast-deep-equal": "^3.1.3",
|
|
51
67
|
"figures": "^6.1.0",
|
|
52
|
-
"glob": "^
|
|
68
|
+
"glob": "^13.0.6",
|
|
53
69
|
"tslib": "^2.8.1",
|
|
54
70
|
"yargs": "^18.0.0"
|
|
55
71
|
},
|
|
56
|
-
"stableVersion": "5.
|
|
72
|
+
"stableVersion": "5.2.0"
|
|
57
73
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Post-install hook: runs `opti-cms project:ai` in the consumer project so
|
|
4
|
+
* that AI assistant configuration files (AGENTS.md, CLAUDE.md, VS Code Copilot
|
|
5
|
+
* instruction files, Cursor rules) are created or updated automatically after
|
|
6
|
+
* each install or upgrade.
|
|
7
|
+
*
|
|
8
|
+
* Any failure is silenced and exits 0 so it never blocks `npm install` /
|
|
9
|
+
* `yarn install`.
|
|
10
|
+
*/
|
|
11
|
+
import { execFileSync } from 'node:child_process'
|
|
12
|
+
import { fileURLToPath } from 'node:url'
|
|
13
|
+
import path from 'node:path'
|
|
14
|
+
|
|
15
|
+
const scriptDir = path.dirname(fileURLToPath(import.meta.url))
|
|
16
|
+
const cliEntry = path.resolve(scriptDir, '..', 'dist', 'index.js')
|
|
17
|
+
|
|
18
|
+
// npm and Yarn 4 both set INIT_CWD to the directory where the install was
|
|
19
|
+
// invoked, which is the consumer project root.
|
|
20
|
+
const projectPath = process.env.INIT_CWD ?? process.cwd()
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
execFileSync(process.execPath, [cliEntry, 'project:ai', '--path', projectPath], {
|
|
24
|
+
// Show stdout (progress ticks) but suppress stderr so transient errors
|
|
25
|
+
// (e.g. missing env vars) do not pollute the install output.
|
|
26
|
+
stdio: ['ignore', 'inherit', 'ignore'],
|
|
27
|
+
env: {
|
|
28
|
+
...process.env,
|
|
29
|
+
// project:ai does not use CMS credentials, but the global CLI argument
|
|
30
|
+
// parser demands them via yargs when the environment variables are absent.
|
|
31
|
+
// Provide placeholder values to satisfy the demand check without altering
|
|
32
|
+
// any real configuration.
|
|
33
|
+
OPTIMIZELY_CMS_URL:
|
|
34
|
+
process.env.OPTIMIZELY_CMS_URL || 'https://placeholder.example.com',
|
|
35
|
+
OPTIMIZELY_CMS_CLIENT_ID: process.env.OPTIMIZELY_CMS_CLIENT_ID || 'placeholder',
|
|
36
|
+
OPTIMIZELY_CMS_CLIENT_SECRET: process.env.OPTIMIZELY_CMS_CLIENT_SECRET || 'placeholder',
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
} catch {
|
|
40
|
+
// Silently ignore any failure:
|
|
41
|
+
// - dist/ not yet built (fresh clone, pre-prepare)
|
|
42
|
+
// - No @remkoj packages discovered in the target project
|
|
43
|
+
// - Unsupported Node version or environment
|
|
44
|
+
// - Any other non-zero exit from the CLI
|
|
45
|
+
}
|