instant-cli 1.0.40 → 1.0.41-branch-python-sdk-v1.26586025551.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/.turbo/turbo-build.log +1 -1
- package/dist/commands/genpy.d.ts +39 -0
- package/dist/commands/genpy.d.ts.map +1 -0
- package/dist/commands/genpy.js +537 -0
- package/dist/commands/genpy.js.map +1 -0
- package/dist/context/projectInfo.d.ts +1 -1
- package/dist/context/projectInfo.d.ts.map +1 -1
- package/dist/context/projectInfo.js +2 -2
- package/dist/context/projectInfo.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/util/loadConfig.d.ts.map +1 -1
- package/dist/util/loadConfig.js +7 -12
- package/dist/util/loadConfig.js.map +1 -1
- package/dist/util/projectDir.d.ts +1 -1
- package/dist/util/projectDir.d.ts.map +1 -1
- package/dist/util/projectDir.js +35 -13
- package/dist/util/projectDir.js.map +1 -1
- package/package.json +6 -5
- package/src/commands/genpy.ts +671 -0
- package/src/context/projectInfo.ts +3 -3
- package/src/index.ts +23 -0
- package/src/util/loadConfig.ts +8 -12
- package/src/util/projectDir.ts +36 -15
package/dist/util/projectDir.js
CHANGED
|
@@ -1,21 +1,43 @@
|
|
|
1
1
|
import { packageDirectory } from 'package-directory';
|
|
2
2
|
import { findUp } from 'find-up-simple';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
// Same-directory tie-breaker: Deno > Python > Node. Deno may coexist
|
|
5
|
+
// with package.json for npm interop; pyproject.toml signals Python.
|
|
6
|
+
const TYPE_PRIORITY = {
|
|
7
|
+
deno: 0,
|
|
8
|
+
python: 1,
|
|
9
|
+
node: 2,
|
|
10
|
+
};
|
|
11
|
+
const depth = (filepath) => filepath.split(path.sep).length;
|
|
4
12
|
export async function findProjectDir(cwd) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const [denoJson, denoJsonc, pyproject, nodeDir] = await Promise.all([
|
|
14
|
+
findUp('deno.json', { cwd }),
|
|
15
|
+
findUp('deno.jsonc', { cwd }),
|
|
16
|
+
findUp('pyproject.toml', { cwd }),
|
|
17
|
+
packageDirectory({ cwd }),
|
|
18
|
+
]);
|
|
19
|
+
// Push deno.json and deno.jsonc independently so the depth-sort can
|
|
20
|
+
// pick the nearer one when both exist at different levels.
|
|
21
|
+
const candidates = [];
|
|
22
|
+
if (denoJson)
|
|
23
|
+
candidates.push({ file: denoJson, type: 'deno' });
|
|
24
|
+
if (denoJsonc)
|
|
25
|
+
candidates.push({ file: denoJsonc, type: 'deno' });
|
|
26
|
+
if (pyproject)
|
|
27
|
+
candidates.push({ file: pyproject, type: 'python' });
|
|
16
28
|
if (nodeDir) {
|
|
17
|
-
|
|
29
|
+
candidates.push({ file: path.join(nodeDir, 'package.json'), type: 'node' });
|
|
18
30
|
}
|
|
19
|
-
|
|
31
|
+
if (candidates.length === 0)
|
|
32
|
+
return null;
|
|
33
|
+
// Nearest marker wins (deepest path), so a Python project nested in a
|
|
34
|
+
// Node monorepo isn't misclassified by a parent's package.json.
|
|
35
|
+
candidates.sort((a, b) => {
|
|
36
|
+
const depthDiff = depth(b.file) - depth(a.file);
|
|
37
|
+
return depthDiff !== 0
|
|
38
|
+
? depthDiff
|
|
39
|
+
: TYPE_PRIORITY[a.type] - TYPE_PRIORITY[b.type];
|
|
40
|
+
});
|
|
41
|
+
return { dir: path.dirname(candidates[0].file), type: candidates[0].type };
|
|
20
42
|
}
|
|
21
43
|
//# sourceMappingURL=projectDir.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projectDir.js","sourceRoot":"","sources":["../../src/util/projectDir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,M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AE,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAClE,IAAI,SAAS;QAAE,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACpE,IAAI,OAAO,EAAE,CAAC;QACZ,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEzC,sEAAsE;IACtE,gEAAgE;IAChE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACvB,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAChD,OAAO,SAAS,KAAK,CAAC;YACpB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC7E,CAAC","sourcesContent":["import { packageDirectory } from 'package-directory';\nimport { findUp } from 'find-up-simple';\nimport path from 'node:path';\n\nexport type ProjectType = 'node' | 'deno' | 'python';\n\nexport interface ProjectInfo {\n dir: string;\n type: ProjectType;\n}\n\n// Same-directory tie-breaker: Deno > Python > Node. Deno may coexist\n// with package.json for npm interop; pyproject.toml signals Python.\nconst TYPE_PRIORITY: Record<ProjectType, number> = {\n deno: 0,\n python: 1,\n node: 2,\n};\n\nconst depth = (filepath: string) => filepath.split(path.sep).length;\n\nexport async function findProjectDir(\n cwd?: string,\n): Promise<ProjectInfo | null> {\n const [denoJson, denoJsonc, pyproject, nodeDir] = await Promise.all([\n findUp('deno.json', { cwd }),\n findUp('deno.jsonc', { cwd }),\n findUp('pyproject.toml', { cwd }),\n packageDirectory({ cwd }),\n ]);\n\n // Push deno.json and deno.jsonc independently so the depth-sort can\n // pick the nearer one when both exist at different levels.\n const candidates: { file: string; type: ProjectType }[] = [];\n if (denoJson) candidates.push({ file: denoJson, type: 'deno' });\n if (denoJsonc) candidates.push({ file: denoJsonc, type: 'deno' });\n if (pyproject) candidates.push({ file: pyproject, type: 'python' });\n if (nodeDir) {\n candidates.push({ file: path.join(nodeDir, 'package.json'), type: 'node' });\n }\n\n if (candidates.length === 0) return null;\n\n // Nearest marker wins (deepest path), so a Python project nested in a\n // Node monorepo isn't misclassified by a parent's package.json.\n candidates.sort((a, b) => {\n const depthDiff = depth(b.file) - depth(a.file);\n return depthDiff !== 0\n ? depthDiff\n : TYPE_PRIORITY[a.type] - TYPE_PRIORITY[b.type];\n });\n\n return { dir: path.dirname(candidates[0].file), type: candidates[0].type };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "instant-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.41-branch-python-sdk-v1.26586025551.1",
|
|
5
5
|
"description": "Instant's CLI",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"homepage": "https://github.com/instantdb/instant/tree/main/client/packages/cli",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"types": "./dist/ui/index.d.ts",
|
|
17
17
|
"default": "./dist/ui/index.js"
|
|
18
18
|
}
|
|
19
|
-
}
|
|
19
|
+
},
|
|
20
|
+
"./bin/index.js": "./bin/index.js"
|
|
20
21
|
},
|
|
21
22
|
"bin": {
|
|
22
23
|
"instant-cli": "bin/index.js"
|
|
@@ -50,9 +51,9 @@
|
|
|
50
51
|
"strip-ansi": "^7.1.2",
|
|
51
52
|
"supports-hyperlinks": "^4.4.0",
|
|
52
53
|
"unconfig": "^7.5.0",
|
|
53
|
-
"@instantdb/
|
|
54
|
-
"@instantdb/
|
|
55
|
-
"@instantdb/
|
|
54
|
+
"@instantdb/platform": "1.0.41-branch-python-sdk-v1.26586025551.1",
|
|
55
|
+
"@instantdb/version": "1.0.41-branch-python-sdk-v1.26586025551.1",
|
|
56
|
+
"@instantdb/core": "1.0.41-branch-python-sdk-v1.26586025551.1"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"@babel/core": "^7.17.9",
|