@cimplify/cli 0.9.1 → 0.10.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/{chunk-N3YC3V2N.mjs → chunk-2ODNBO3D.mjs} +7 -1
- package/dist/{chunk-SS3XKLBR.mjs → chunk-QU6DN3WR.mjs} +1 -1
- package/dist/{dev-OLW755ID.mjs → dev-ABN3HOO2.mjs} +20 -0
- package/dist/dispatcher.mjs +7 -7
- package/dist/{doctor-JIPUNSOC.mjs → doctor-6YCHMCZO.mjs} +2 -2
- package/dist/{explain-6LPKSOBY.mjs → explain-CUVUG7O5.mjs} +1 -1
- package/dist/{introspect-TDUKKAZE.mjs → introspect-J3REAIDU.mjs} +2 -2
- package/dist/preview-config-CHDYYWUY.mjs +120 -0
- package/dist/{update-7BHT5CL5.mjs → update-DI3MW7TW.mjs} +1 -1
- package/package.json +7 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// package.json
|
|
3
3
|
var package_default = {
|
|
4
4
|
name: "@cimplify/cli",
|
|
5
|
-
version: "0.
|
|
5
|
+
version: "0.10.1",
|
|
6
6
|
description: "Cimplify CLI \u2014 deploy, manage env vars, link projects, and scaffold storefronts",
|
|
7
7
|
keywords: [
|
|
8
8
|
"cimplify",
|
|
@@ -40,6 +40,8 @@ var package_default = {
|
|
|
40
40
|
},
|
|
41
41
|
devDependencies: {
|
|
42
42
|
"@aws-sdk/client-s3": "^3.1070.0",
|
|
43
|
+
"@types/babel__generator": "^7.27.0",
|
|
44
|
+
"@types/babel__traverse": "^7.28.0",
|
|
43
45
|
"@types/node": "^25.9.3",
|
|
44
46
|
"@typescript/native-preview": "^7.0.0-dev.20260616.1",
|
|
45
47
|
tsup: "^8.5.1",
|
|
@@ -47,6 +49,10 @@ var package_default = {
|
|
|
47
49
|
vitest: "^4.1.9"
|
|
48
50
|
},
|
|
49
51
|
dependencies: {
|
|
52
|
+
"@babel/generator": "^8.0.0",
|
|
53
|
+
"@babel/parser": "^8.0.4",
|
|
54
|
+
"@babel/traverse": "^8.0.4",
|
|
55
|
+
"@babel/types": "^8.0.4",
|
|
50
56
|
"@cimplify/sdk": "^0.96.0"
|
|
51
57
|
}
|
|
52
58
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { gitDetectRoot, gitCurrentBranch, gitCurrentSha, gitStatusPorcelain } from './chunk-K5464A3L.mjs';
|
|
3
3
|
import { parseEnvFile } from './chunk-DBZ3UOQ2.mjs';
|
|
4
|
-
import { package_default } from './chunk-
|
|
4
|
+
import { package_default } from './chunk-2ODNBO3D.mjs';
|
|
5
5
|
import { parseArgs } from './chunk-C4M3DXKC.mjs';
|
|
6
6
|
import { readAuthOrNull, readProjectLinkOrNull, readProjectState } from './chunk-UBAI443T.mjs';
|
|
7
7
|
import { bold, dim, yellow, green, info, result, red } from './chunk-E2T2SBP5.mjs';
|
|
@@ -14,6 +14,22 @@ var PACKAGE_JSON = "package.json";
|
|
|
14
14
|
var ENV_LOCAL_FILE = ".env.local";
|
|
15
15
|
var PUBLIC_API_URL_KEY = "NEXT_PUBLIC_CIMPLIFY_API_URL";
|
|
16
16
|
var SCRIPT_DEV = "dev";
|
|
17
|
+
var PREVIEW_ORIGIN_ENV = "CIMPLIFY_PREVIEW_ORIGIN";
|
|
18
|
+
async function applyPreviewOrigin(cwd, origin) {
|
|
19
|
+
const { ensurePreviewOrigin } = await import('./preview-config-CHDYYWUY.mjs');
|
|
20
|
+
try {
|
|
21
|
+
const result = await ensurePreviewOrigin(cwd, origin);
|
|
22
|
+
if (result.status === "unrecognized") {
|
|
23
|
+
info(
|
|
24
|
+
dim(
|
|
25
|
+
`(preview: could not resolve ${result.file} config shape; hot-reload may be limited)`
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
} catch (err) {
|
|
30
|
+
info(dim(`(preview: dev-origin setup skipped: ${err.message})`));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
17
33
|
var PM_BUN = "bun";
|
|
18
34
|
var PM_PNPM = "pnpm";
|
|
19
35
|
var PM_YARN = "yarn";
|
|
@@ -92,6 +108,7 @@ async function run(argv) {
|
|
|
92
108
|
const args = parseArgs(argv);
|
|
93
109
|
const remote = flagBool(args, FLAG_REMOTE);
|
|
94
110
|
const cwd = process.cwd();
|
|
111
|
+
const previewOrigin = process.env[PREVIEW_ORIGIN_ENV];
|
|
95
112
|
if (remote) {
|
|
96
113
|
const auth = await readAuth();
|
|
97
114
|
const link = await readProjectLink();
|
|
@@ -105,6 +122,8 @@ async function run(argv) {
|
|
|
105
122
|
);
|
|
106
123
|
const label = link.businessHandle ?? auth.businessHandle ?? auth.businessId;
|
|
107
124
|
info(`Dev mode: connected to ${label} production data (${publicCount} public var${publicCount === 1 ? "" : "s"} merged)`);
|
|
125
|
+
} else if (previewOrigin) {
|
|
126
|
+
info("Dev mode: hosted preview");
|
|
108
127
|
} else {
|
|
109
128
|
info("Dev mode: using local mock (`cimplify mock`)");
|
|
110
129
|
}
|
|
@@ -115,6 +134,7 @@ async function run(argv) {
|
|
|
115
134
|
`No "${SCRIPT_DEV}" script in package.json. Add one (e.g. "next dev") and re-run.`
|
|
116
135
|
);
|
|
117
136
|
}
|
|
137
|
+
if (previewOrigin) await applyPreviewOrigin(cwd, previewOrigin);
|
|
118
138
|
const pm = await detectPackageManager(cwd);
|
|
119
139
|
info(dim(`(running: ${pm} run ${SCRIPT_DEV})`));
|
|
120
140
|
const child = spawn(pm, ["run", SCRIPT_DEV], { cwd, stdio: "inherit" });
|
package/dist/dispatcher.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { package_default } from './chunk-
|
|
2
|
+
import { package_default } from './chunk-2ODNBO3D.mjs';
|
|
3
3
|
import { TEMPLATES } from './chunk-WBNI7PWA.mjs';
|
|
4
4
|
|
|
5
5
|
// src/dispatcher.ts
|
|
@@ -142,18 +142,18 @@ var COMMANDS = {
|
|
|
142
142
|
domains: () => import('./domains-H3K2WW55.mjs'),
|
|
143
143
|
logs: () => import('./logs-2ECJQ3MU.mjs'),
|
|
144
144
|
status: () => import('./status-IA7PJ4TV.mjs'),
|
|
145
|
-
dev: () => import('./dev-
|
|
145
|
+
dev: () => import('./dev-ABN3HOO2.mjs'),
|
|
146
146
|
mock: () => import('./mock-TSUKCLWU.mjs'),
|
|
147
|
-
introspect: () => import('./introspect-
|
|
147
|
+
introspect: () => import('./introspect-J3REAIDU.mjs'),
|
|
148
148
|
inspect: () => import('./inspect-CGYX4DDF.mjs'),
|
|
149
|
-
doctor: () => import('./doctor-
|
|
150
|
-
explain: () => import('./explain-
|
|
149
|
+
doctor: () => import('./doctor-6YCHMCZO.mjs'),
|
|
150
|
+
explain: () => import('./explain-CUVUG7O5.mjs'),
|
|
151
151
|
assets: () => import('./assets-4D7VXRUE.mjs'),
|
|
152
152
|
repo: () => import('./repo-WSUAHXWO.mjs'),
|
|
153
153
|
list: () => import('./list-FCBWJ5DY.mjs'),
|
|
154
154
|
add: () => import('./add-ZRSE2STJ.mjs'),
|
|
155
|
-
update: () => import('./update-
|
|
156
|
-
upgrade: () => import('./update-
|
|
155
|
+
update: () => import('./update-DI3MW7TW.mjs'),
|
|
156
|
+
upgrade: () => import('./update-DI3MW7TW.mjs'),
|
|
157
157
|
"auth-step-up": () => import('./auth-step-up-NOSM4PUR.mjs')
|
|
158
158
|
};
|
|
159
159
|
var COMMAND_PREFIXES = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { gatherIntrospection } from './chunk-
|
|
2
|
+
import { gatherIntrospection } from './chunk-QU6DN3WR.mjs';
|
|
3
3
|
import './chunk-K5464A3L.mjs';
|
|
4
4
|
import './chunk-DBZ3UOQ2.mjs';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-2ODNBO3D.mjs';
|
|
6
6
|
import { parseArgs, flagBool } from './chunk-C4M3DXKC.mjs';
|
|
7
7
|
import { SDK_ENV_API_URL, DEFAULT_API_BASE_URL, ApiClient, ENV_API_BASE_URL } from './chunk-F4S5KETY.mjs';
|
|
8
8
|
import { readAuthOrNull } from './chunk-UBAI443T.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { package_default } from './chunk-
|
|
2
|
+
import { package_default } from './chunk-2ODNBO3D.mjs';
|
|
3
3
|
import { parseArgs } from './chunk-C4M3DXKC.mjs';
|
|
4
4
|
import { bold, dim, info, result, CliError, CLI_ERROR_CODE } from './chunk-E2T2SBP5.mjs';
|
|
5
5
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export { run as default, extractMockSeed, gatherIntrospection, renderIntrospection } from './chunk-
|
|
2
|
+
export { run as default, extractMockSeed, gatherIntrospection, renderIntrospection } from './chunk-QU6DN3WR.mjs';
|
|
3
3
|
import './chunk-K5464A3L.mjs';
|
|
4
4
|
import './chunk-DBZ3UOQ2.mjs';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-2ODNBO3D.mjs';
|
|
6
6
|
import './chunk-C4M3DXKC.mjs';
|
|
7
7
|
import './chunk-UBAI443T.mjs';
|
|
8
8
|
import './chunk-E2T2SBP5.mjs';
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { promises } from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { parse } from '@babel/parser';
|
|
5
|
+
import _traverse from '@babel/traverse';
|
|
6
|
+
import _generate from '@babel/generator';
|
|
7
|
+
import * as t from '@babel/types';
|
|
8
|
+
|
|
9
|
+
var traverse = _traverse.default ?? _traverse;
|
|
10
|
+
var generate = _generate.default ?? _generate;
|
|
11
|
+
var PROPERTY = "allowedDevOrigins";
|
|
12
|
+
var CONFIG_FILENAMES = [
|
|
13
|
+
"next.config.ts",
|
|
14
|
+
"next.config.mts",
|
|
15
|
+
"next.config.cts",
|
|
16
|
+
"next.config.js",
|
|
17
|
+
"next.config.mjs",
|
|
18
|
+
"next.config.cjs"
|
|
19
|
+
];
|
|
20
|
+
function unwrapTs(node) {
|
|
21
|
+
let current = node;
|
|
22
|
+
while (t.isTSAsExpression(current) || t.isTSSatisfiesExpression(current)) {
|
|
23
|
+
current = current.expression;
|
|
24
|
+
}
|
|
25
|
+
return current;
|
|
26
|
+
}
|
|
27
|
+
function returnedObject(body) {
|
|
28
|
+
for (const statement of body.body) {
|
|
29
|
+
if (t.isReturnStatement(statement) && statement.argument) {
|
|
30
|
+
const value = unwrapTs(statement.argument);
|
|
31
|
+
if (t.isObjectExpression(value)) return value;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
function resolveConfigObject(node, scope) {
|
|
37
|
+
const value = unwrapTs(node);
|
|
38
|
+
if (t.isObjectExpression(value)) return value;
|
|
39
|
+
if (t.isIdentifier(value)) {
|
|
40
|
+
const binding = scope.getBinding(value.name);
|
|
41
|
+
const init = binding?.path.isVariableDeclarator() ? binding.path.node.init : null;
|
|
42
|
+
return init ? resolveConfigObject(init, scope) : null;
|
|
43
|
+
}
|
|
44
|
+
if (t.isCallExpression(value)) {
|
|
45
|
+
for (const arg of value.arguments) {
|
|
46
|
+
if (t.isObjectExpression(arg)) return arg;
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
if (t.isArrowFunctionExpression(value) || t.isFunctionExpression(value) || t.isFunctionDeclaration(value)) {
|
|
51
|
+
if (t.isBlockStatement(value.body)) return returnedObject(value.body);
|
|
52
|
+
return resolveConfigObject(value.body, scope);
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
function findConfigObject(ast) {
|
|
57
|
+
let found = null;
|
|
58
|
+
traverse(ast, {
|
|
59
|
+
ExportDefaultDeclaration(path2) {
|
|
60
|
+
found ??= resolveConfigObject(path2.node.declaration, path2.scope);
|
|
61
|
+
},
|
|
62
|
+
AssignmentExpression(path2) {
|
|
63
|
+
const { left, right } = path2.node;
|
|
64
|
+
const isModuleExports = t.isMemberExpression(left) && t.isIdentifier(left.object, { name: "module" }) && t.isIdentifier(left.property, { name: "exports" });
|
|
65
|
+
if (isModuleExports) found ??= resolveConfigObject(right, path2.scope);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return found;
|
|
69
|
+
}
|
|
70
|
+
function upsertOrigin(config, origin) {
|
|
71
|
+
const existing = config.properties.find(
|
|
72
|
+
(prop) => t.isObjectProperty(prop) && t.isIdentifier(prop.key, { name: PROPERTY })
|
|
73
|
+
);
|
|
74
|
+
if (existing) {
|
|
75
|
+
if (!t.isArrayExpression(existing.value)) return false;
|
|
76
|
+
const already = existing.value.elements.some(
|
|
77
|
+
(el) => t.isStringLiteral(el) && el.value === origin
|
|
78
|
+
);
|
|
79
|
+
if (already) return false;
|
|
80
|
+
existing.value.elements.push(t.stringLiteral(origin));
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
config.properties.unshift(
|
|
84
|
+
t.objectProperty(t.identifier(PROPERTY), t.arrayExpression([t.stringLiteral(origin)]))
|
|
85
|
+
);
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
function injectAllowedDevOrigins(source, origin) {
|
|
89
|
+
const ast = parse(source, {
|
|
90
|
+
sourceType: "module",
|
|
91
|
+
plugins: ["typescript"]
|
|
92
|
+
});
|
|
93
|
+
const config = findConfigObject(ast);
|
|
94
|
+
if (!config) return { code: source, changed: false, resolved: false };
|
|
95
|
+
if (!upsertOrigin(config, origin)) return { code: source, changed: false, resolved: true };
|
|
96
|
+
return {
|
|
97
|
+
code: generate(ast, { retainLines: true }, source).code,
|
|
98
|
+
changed: true,
|
|
99
|
+
resolved: true
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
async function ensurePreviewOrigin(cwd, origin) {
|
|
103
|
+
for (const filename of CONFIG_FILENAMES) {
|
|
104
|
+
const file = path.join(cwd, filename);
|
|
105
|
+
let source;
|
|
106
|
+
try {
|
|
107
|
+
source = await promises.readFile(file, "utf8");
|
|
108
|
+
} catch (err) {
|
|
109
|
+
if (err.code === "ENOENT") continue;
|
|
110
|
+
throw err;
|
|
111
|
+
}
|
|
112
|
+
const { code, changed, resolved } = injectAllowedDevOrigins(source, origin);
|
|
113
|
+
if (!resolved) return { status: "unrecognized", file: filename };
|
|
114
|
+
if (changed) await promises.writeFile(file, code, "utf8");
|
|
115
|
+
return { status: changed ? "injected" : "already-present", file: filename };
|
|
116
|
+
}
|
|
117
|
+
return { status: "no-config" };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export { ensurePreviewOrigin, injectAllowedDevOrigins };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { package_default } from './chunk-
|
|
2
|
+
import { package_default } from './chunk-2ODNBO3D.mjs';
|
|
3
3
|
import { promptYesNo } from './chunk-ITAFAORS.mjs';
|
|
4
4
|
import { parseArgs, flagBool, flagString } from './chunk-C4M3DXKC.mjs';
|
|
5
5
|
import { success, bold, info, dim, result, failure, CliError, CLI_ERROR_CODE, step, isJsonMode } from './chunk-E2T2SBP5.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cimplify/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Cimplify CLI — deploy, manage env vars, link projects, and scaffold storefronts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cimplify",
|
|
@@ -38,6 +38,8 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@aws-sdk/client-s3": "^3.1070.0",
|
|
41
|
+
"@types/babel__generator": "^7.27.0",
|
|
42
|
+
"@types/babel__traverse": "^7.28.0",
|
|
41
43
|
"@types/node": "^25.9.3",
|
|
42
44
|
"@typescript/native-preview": "^7.0.0-dev.20260616.1",
|
|
43
45
|
"tsup": "^8.5.1",
|
|
@@ -45,6 +47,10 @@
|
|
|
45
47
|
"vitest": "^4.1.9"
|
|
46
48
|
},
|
|
47
49
|
"dependencies": {
|
|
50
|
+
"@babel/generator": "^8.0.0",
|
|
51
|
+
"@babel/parser": "^8.0.4",
|
|
52
|
+
"@babel/traverse": "^8.0.4",
|
|
53
|
+
"@babel/types": "^8.0.4",
|
|
48
54
|
"@cimplify/sdk": "^0.96.0"
|
|
49
55
|
}
|
|
50
56
|
}
|