instant-cli 0.22.99-experimental.add-user-perm-rules.20792844601.1 → 0.22.99-experimental.add-user-perm-rules.20792984656.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/index.js +1041 -1146
- package/dist/index.js.map +1 -1
- package/dist/rename.js +58 -69
- package/dist/rename.js.map +1 -1
- package/dist/renderSchemaPlan.js +10 -22
- package/dist/renderSchemaPlan.js.map +1 -1
- package/dist/ui/index.js +115 -102
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/lib.js +29 -30
- package/dist/ui/lib.js.map +1 -1
- package/dist/util/fs.js +17 -30
- package/dist/util/fs.js.map +1 -1
- package/dist/util/isHeadlessEnvironment.js +1 -1
- package/dist/util/isHeadlessEnvironment.js.map +1 -1
- package/dist/util/loadConfig.js +32 -32
- package/dist/util/loadConfig.js.map +1 -1
- package/dist/util/packageManager.js +26 -37
- package/dist/util/packageManager.js.map +1 -1
- package/dist/util/projectDir.js +16 -27
- package/dist/util/projectDir.js.map +1 -1
- package/dist/util/promptOk.js +14 -21
- package/dist/util/promptOk.js.map +1 -1
- package/dist/util/renamePrompt.js +4 -2
- package/dist/util/renamePrompt.js.map +1 -1
- package/package.json +4 -4
package/dist/util/loadConfig.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { loadConfig as _loadConfig, } from 'unconfig';
|
|
11
2
|
import { createRequire } from 'module';
|
|
12
3
|
import path from 'path';
|
|
@@ -31,31 +22,40 @@ function getInstantAliases() {
|
|
|
31
22
|
'@instantdb/admin': coreDir,
|
|
32
23
|
};
|
|
33
24
|
}
|
|
34
|
-
catch
|
|
25
|
+
catch {
|
|
35
26
|
return null;
|
|
36
27
|
}
|
|
37
28
|
}
|
|
38
|
-
export function loadConfig(opts) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
29
|
+
export async function loadConfig(opts) {
|
|
30
|
+
const projectInfo = await findProjectDir();
|
|
31
|
+
const isDeno = projectInfo?.type === 'deno';
|
|
32
|
+
// Deno projects don't have node_modules, so we need to alias @instantdb/*
|
|
33
|
+
// packages to resolve from the CLI's own dependencies
|
|
34
|
+
let res;
|
|
35
|
+
if (isDeno) {
|
|
36
|
+
const alias = getInstantAliases();
|
|
37
|
+
res = await _loadConfig({
|
|
38
|
+
...opts,
|
|
39
|
+
importx: {
|
|
40
|
+
...opts.importx,
|
|
41
|
+
loaderOptions: {
|
|
42
|
+
...opts.importx?.loaderOptions,
|
|
43
|
+
jiti: {
|
|
44
|
+
...opts.importx?.loaderOptions?.jiti,
|
|
45
|
+
alias,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
res = await _loadConfig(opts);
|
|
53
|
+
}
|
|
54
|
+
// Unconfig seems to add an __esModule property to the config object
|
|
55
|
+
// Removing it.
|
|
56
|
+
if (typeof res.config === 'object' && '__esModule' in res.config) {
|
|
57
|
+
delete res.config.__esModule;
|
|
58
|
+
}
|
|
59
|
+
return res;
|
|
60
60
|
}
|
|
61
61
|
//# sourceMappingURL=loadConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadConfig.js","sourceRoot":"","sources":["../../src/util/loadConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadConfig.js","sourceRoot":"","sources":["../../src/util/loadConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,IAAI,WAAW,GAG1B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;GAIG;AACH,SAAS,iBAAiB;IACxB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,2DAA2D;QAC3D,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAAC;QACxE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QAC9C,4DAA4D;QAC5D,+DAA+D;QAC/D,OAAO;YACL,iBAAiB,EAAE,OAAO;YAC1B,kBAAkB,EAAE,OAAO;YAC3B,yBAAyB,EAAE,OAAO;YAClC,kBAAkB,EAAE,OAAO;SAC5B,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,IAA0B;IAE1B,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;IAC3C,MAAM,MAAM,GAAG,WAAW,EAAE,IAAI,KAAK,MAAM,CAAC;IAE5C,0EAA0E;IAC1E,sDAAsD;IACtD,IAAI,GAAG,CAAC;IACR,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,KAAK,GAAG,iBAAiB,EAAE,CAAC;QAClC,GAAG,GAAG,MAAM,WAAW,CAAC;YACtB,GAAG,IAAI;YACP,OAAO,EAAE;gBACP,GAAG,IAAI,CAAC,OAAO;gBACf,aAAa,EAAE;oBACb,GAAG,IAAI,CAAC,OAAO,EAAE,aAAa;oBAC9B,IAAI,EAAE;wBACJ,GAAG,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI;wBACpC,KAAK;qBACN;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,GAAG,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,oEAAoE;IACpE,eAAe;IACf,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,YAAY,IAAI,GAAG,CAAC,MAAO,EAAE,CAAC;QAClE,OAAO,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC;IAC/B,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import {\n loadConfig as _loadConfig,\n LoadConfigOptions,\n LoadConfigResult,\n} from 'unconfig';\nimport { createRequire } from 'module';\nimport path from 'path';\nimport { findProjectDir } from './projectDir.js';\n\n/**\n * Resolve @instantdb packages from CLI's dependency tree.\n * For Deno projects, we alias all common @instantdb packages to @instantdb/core\n * since they all re-export the schema types from core.\n */\nfunction getInstantAliases(): Record<string, string> | null {\n try {\n const require = createRequire(import.meta.url);\n // Resolve @instantdb/core directly from CLI's dependencies\n const corePackageJson = require.resolve('@instantdb/core/package.json');\n const coreDir = path.dirname(corePackageJson);\n // All @instantdb packages re-export schema types from core,\n // so we can alias them all to core for schema loading purposes\n return {\n '@instantdb/core': coreDir,\n '@instantdb/react': coreDir,\n '@instantdb/react-native': coreDir,\n '@instantdb/admin': coreDir,\n };\n } catch {\n return null;\n }\n}\n\nexport async function loadConfig<T>(\n opts: LoadConfigOptions<T>,\n): Promise<LoadConfigResult<T>> {\n const projectInfo = await findProjectDir();\n const isDeno = projectInfo?.type === 'deno';\n\n // Deno projects don't have node_modules, so we need to alias @instantdb/*\n // packages to resolve from the CLI's own dependencies\n let res;\n if (isDeno) {\n const alias = getInstantAliases();\n res = await _loadConfig({\n ...opts,\n importx: {\n ...opts.importx,\n loaderOptions: {\n ...opts.importx?.loaderOptions,\n jiti: {\n ...opts.importx?.loaderOptions?.jiti,\n alias,\n },\n },\n },\n });\n } else {\n res = await _loadConfig(opts);\n }\n\n // Unconfig seems to add an __esModule property to the config object\n // Removing it.\n if (typeof res.config === 'object' && '__esModule' in res.config!) {\n delete res.config.__esModule;\n }\n return res;\n}\n"]}
|
|
@@ -1,49 +1,38 @@
|
|
|
1
1
|
// Note:
|
|
2
2
|
// Extracted the main logic for `detectPackageManager` from:
|
|
3
3
|
// https://github.com/vercel/vercel/blob/eb7fe8a9266563cfeaf275cd77cd9fad3f17c92b/packages/build-utils/src/fs/run-user-scripts.ts
|
|
4
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
4
|
import { pathExists, readJsonFile } from './fs.js';
|
|
14
5
|
import path from 'path';
|
|
15
|
-
function detectPackageManager(destPath) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
for (const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return cliType;
|
|
29
|
-
}
|
|
6
|
+
async function detectPackageManager(destPath) {
|
|
7
|
+
const lockfileNames = {
|
|
8
|
+
'yarn.lock': 'yarn',
|
|
9
|
+
'package-lock.json': 'npm',
|
|
10
|
+
'pnpm-lock.yaml': 'pnpm',
|
|
11
|
+
'bun.lockb': 'bun',
|
|
12
|
+
'bun.lock': 'bun',
|
|
13
|
+
};
|
|
14
|
+
for (const dir of traverseUpDirectories(destPath)) {
|
|
15
|
+
for (const [lockfileName, cliType] of Object.entries(lockfileNames)) {
|
|
16
|
+
const lockfilePath = path.join(dir, lockfileName);
|
|
17
|
+
if (await pathExists(lockfilePath)) {
|
|
18
|
+
return cliType;
|
|
30
19
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
20
|
+
}
|
|
21
|
+
const packageJsonPath = path.join(dir, 'package.json');
|
|
22
|
+
if (await pathExists(packageJsonPath)) {
|
|
23
|
+
const packageJson = await readJsonFile(packageJsonPath);
|
|
24
|
+
if (packageJson.packageManager) {
|
|
25
|
+
const corepackPackageManager = parsePackageManagerField(packageJson.packageManager);
|
|
26
|
+
if (corepackPackageManager) {
|
|
27
|
+
return corepackPackageManager.packageName;
|
|
39
28
|
}
|
|
40
29
|
}
|
|
41
|
-
if (dir === path.parse(dir).root) {
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
30
|
}
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
if (dir === path.parse(dir).root) {
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return 'npm';
|
|
47
36
|
}
|
|
48
37
|
function* traverseUpDirectories(start) {
|
|
49
38
|
let current = path.resolve(start);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageManager.js","sourceRoot":"","sources":["../../src/util/packageManager.js"],"names":[],"mappings":"AAAA,QAAQ;AACR,4DAA4D;AAC5D,iIAAiI
|
|
1
|
+
{"version":3,"file":"packageManager.js","sourceRoot":"","sources":["../../src/util/packageManager.js"],"names":[],"mappings":"AAAA,QAAQ;AACR,4DAA4D;AAC5D,iIAAiI;AAEjI,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,KAAK,UAAU,oBAAoB,CAAC,QAAQ;IAC1C,MAAM,aAAa,GAAG;QACpB,WAAW,EAAE,MAAM;QACnB,mBAAmB,EAAE,KAAK;QAC1B,gBAAgB,EAAE,MAAM;QACxB,WAAW,EAAE,KAAK;QAClB,UAAU,EAAE,KAAK;KAClB,CAAC;IAEF,KAAK,MAAM,GAAG,IAAI,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC;QAClD,KAAK,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;YACpE,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;YAClD,IAAI,MAAM,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;gBACnC,OAAO,OAAO,CAAC;YACjB,CAAC;QACH,CAAC;QAED,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QACvD,IAAI,MAAM,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;YACtC,MAAM,WAAW,GAAG,MAAM,YAAY,CAAC,eAAe,CAAC,CAAC;YACxD,IAAI,WAAW,CAAC,cAAc,EAAE,CAAC;gBAC/B,MAAM,sBAAsB,GAAG,wBAAwB,CACrD,WAAW,CAAC,cAAc,CAC3B,CAAC;gBACF,IAAI,sBAAsB,EAAE,CAAC;oBAC3B,OAAO,sBAAsB,CAAC,WAAW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AAQ,UAAU,EAAE,CAAC;IAC/C,CAAC;AACH,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["// Note:\n// Extracted the main logic for `detectPackageManager` from:\n// https://github.com/vercel/vercel/blob/eb7fe8a9266563cfeaf275cd77cd9fad3f17c92b/packages/build-utils/src/fs/run-user-scripts.ts\n\nimport { pathExists, readJsonFile } from './fs.js';\nimport path from 'path';\n\nasync function detectPackageManager(destPath) {\n const lockfileNames = {\n 'yarn.lock': 'yarn',\n 'package-lock.json': 'npm',\n 'pnpm-lock.yaml': 'pnpm',\n 'bun.lockb': 'bun',\n 'bun.lock': 'bun',\n };\n\n for (const dir of traverseUpDirectories(destPath)) {\n for (const [lockfileName, cliType] of Object.entries(lockfileNames)) {\n const lockfilePath = path.join(dir, lockfileName);\n if (await pathExists(lockfilePath)) {\n return cliType;\n }\n }\n\n const packageJsonPath = path.join(dir, 'package.json');\n if (await pathExists(packageJsonPath)) {\n const packageJson = await readJsonFile(packageJsonPath);\n if (packageJson.packageManager) {\n const corepackPackageManager = parsePackageManagerField(\n packageJson.packageManager,\n );\n if (corepackPackageManager) {\n return corepackPackageManager.packageName;\n }\n }\n }\n\n if (dir === path.parse(dir).root) {\n break;\n }\n }\n\n return 'npm';\n}\n\nfunction* traverseUpDirectories(start) {\n let current = path.resolve(start);\n while (true) {\n yield current;\n const parent = path.dirname(current);\n if (parent === current) {\n break;\n }\n current = parent;\n }\n}\n\nfunction parsePackageManagerField(packageManager) {\n if (!packageManager) return null;\n const atIndex = packageManager.lastIndexOf('@');\n if (atIndex <= 0) return null; // '@' at position 0 is invalid\n const packageName = packageManager.slice(0, atIndex);\n const packageVersion = packageManager.slice(atIndex + 1);\n if (!packageName || !packageVersion) {\n return null;\n }\n return { packageName, packageVersion };\n}\n\nfunction getInstallCommand(packageManager, moduleName) {\n if (packageManager === 'npm') {\n return `npm install ${moduleName}`;\n } else {\n return `${packageManager} add ${moduleName}`;\n }\n}\n\nexport { detectPackageManager, getInstallCommand };\n"]}
|
package/dist/util/projectDir.js
CHANGED
|
@@ -1,32 +1,21 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { packageDirectory } from 'package-directory';
|
|
11
2
|
import { findUp } from 'find-up-simple';
|
|
12
3
|
import path from 'path';
|
|
13
|
-
export function findProjectDir(cwd) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return null;
|
|
30
|
-
});
|
|
4
|
+
export async function findProjectDir(cwd) {
|
|
5
|
+
// Check for Deno first. A Deno project may also have a package.json (for npm
|
|
6
|
+
// compatibility), but if deno.json exists, the user intends to use Deno and
|
|
7
|
+
// we should use Deno-specific behavior (e.g., resolving @instantdb/* from
|
|
8
|
+
// CLI's dependencies instead of node_modules).
|
|
9
|
+
const denoConfig = (await findUp('deno.json', { cwd })) ||
|
|
10
|
+
(await findUp('deno.jsonc', { cwd }));
|
|
11
|
+
if (denoConfig) {
|
|
12
|
+
return { dir: path.dirname(denoConfig), type: 'deno' };
|
|
13
|
+
}
|
|
14
|
+
// Fall back to package-directory for Node
|
|
15
|
+
const nodeDir = await packageDirectory({ cwd });
|
|
16
|
+
if (nodeDir) {
|
|
17
|
+
return { dir: nodeDir, type: 'node' };
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
31
20
|
}
|
|
32
21
|
//# sourceMappingURL=projectDir.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projectDir.js","sourceRoot":"","sources":["../../src/util/projectDir.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"projectDir.js","sourceRoot":"","sources":["../../src/util/projectDir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AASxB,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAY;IAEZ,6EAA6E;IAC7E,4EAA4E;IAC5E,0EAA0E;IAC1E,+CAA+C;IAC/C,MAAM,UAAU,GACd,CAAC,MAAM,MAAM,CAAC,WAAW,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QACpC,CAAC,MAAM,MAAM,CAAC,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;IACxC,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IACzD,CAAC;IAED,0CAA0C;IAC1C,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAChD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IACxC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { packageDirectory } from 'package-directory';\nimport { findUp } from 'find-up-simple';\nimport path from 'path';\n\nexport type ProjectType = 'node' | 'deno';\n\nexport interface ProjectInfo {\n dir: string;\n type: ProjectType;\n}\n\nexport async function findProjectDir(\n cwd?: string,\n): Promise<ProjectInfo | null> {\n // Check for Deno first. A Deno project may also have a package.json (for npm\n // compatibility), but if deno.json exists, the user intends to use Deno and\n // we should use Deno-specific behavior (e.g., resolving @instantdb/* from\n // CLI's dependencies instead of node_modules).\n const denoConfig =\n (await findUp('deno.json', { cwd })) ||\n (await findUp('deno.jsonc', { cwd }));\n if (denoConfig) {\n return { dir: path.dirname(denoConfig), type: 'deno' };\n }\n\n // Fall back to package-directory for Node\n const nodeDir = await packageDirectory({ cwd });\n if (nodeDir) {\n return { dir: nodeDir, type: 'node' };\n }\n\n return null;\n}\n"]}
|
package/dist/util/promptOk.js
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { renderUnwrap, UI } from '../ui/index.js';
|
|
11
2
|
import boxen from 'boxen';
|
|
12
|
-
export function promptOk(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
3
|
+
export async function promptOk(props, opts, defaultValue = true) {
|
|
4
|
+
if (opts?.yes)
|
|
5
|
+
return defaultValue;
|
|
6
|
+
return await renderUnwrap(new UI.Confirmation({
|
|
7
|
+
modifyOutput: (out) => boxen(out, {
|
|
8
|
+
dimBorder: true,
|
|
9
|
+
padding: {
|
|
10
|
+
left: 1,
|
|
11
|
+
right: 1,
|
|
12
|
+
},
|
|
13
|
+
}),
|
|
14
|
+
...props,
|
|
15
|
+
defaultValue,
|
|
16
|
+
})).catch(() => defaultValue);
|
|
24
17
|
}
|
|
25
18
|
//# sourceMappingURL=promptOk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promptOk.js","sourceRoot":"","sources":["../../src/util/promptOk.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"promptOk.js","sourceRoot":"","sources":["../../src/util/promptOk.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,KAA2B,EAC3B,IAAmB,EACnB,eAAwB,IAAI;IAE5B,IAAI,IAAI,EAAE,GAAG;QAAE,OAAO,YAAY,CAAC;IAEnC,OAAO,MAAM,YAAY,CACvB,IAAI,EAAE,CAAC,YAAY,CAAC;QAClB,YAAY,EAAE,CAAC,GAAG,EAAE,EAAE,CACpB,KAAK,CAAC,GAAG,EAAE;YACT,SAAS,EAAE,IAAI;YACf,OAAO,EAAE;gBACP,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,CAAC;aACT;SACF,CAAC;QACJ,GAAG,KAAK;QACR,YAAY;KACb,CAAC,CACH,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import { OptionValues } from 'commander';\nimport { renderUnwrap, UI } from '../ui/index.js';\nimport boxen from 'boxen';\n\nexport async function promptOk(\n props: UI.ConfirmationProps,\n opts?: OptionValues,\n defaultValue: boolean = true,\n) {\n if (opts?.yes) return defaultValue;\n\n return await renderUnwrap(\n new UI.Confirmation({\n modifyOutput: (out) =>\n boxen(out, {\n dimBorder: true,\n padding: {\n left: 1,\n right: 1,\n },\n }),\n ...props,\n defaultValue,\n }),\n ).catch(() => defaultValue);\n}\n"]}
|
|
@@ -2,18 +2,20 @@ import chalk from 'chalk';
|
|
|
2
2
|
import { Prompt, SelectState } from '../ui/lib.js';
|
|
3
3
|
import { isRenamePromptItem } from '@instantdb/platform';
|
|
4
4
|
export class ResolveRenamePrompt extends Prompt {
|
|
5
|
+
base;
|
|
6
|
+
state;
|
|
5
7
|
result() {
|
|
6
8
|
return this.state.items[this.state.selectedIdx];
|
|
7
9
|
}
|
|
10
|
+
thingType = 'attr';
|
|
8
11
|
constructor(base, data, extraInfo, modifyOutput) {
|
|
9
12
|
super(modifyOutput);
|
|
10
13
|
this.base = base;
|
|
11
|
-
this.thingType = 'attr';
|
|
12
14
|
this.on('attach', (terminal) => terminal.toggleCursor('hide'));
|
|
13
15
|
this.state = new SelectState(data);
|
|
14
16
|
this.state.bind(this);
|
|
15
17
|
this.base = base;
|
|
16
|
-
if (extraInfo
|
|
18
|
+
if (extraInfo?.type) {
|
|
17
19
|
this.thingType = extraInfo.type;
|
|
18
20
|
}
|
|
19
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renamePrompt.js","sourceRoot":"","sources":["../../src/util/renamePrompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAkB,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAOzD,MAAM,OAAO,mBAAsC,SAAQ,MAE1D;
|
|
1
|
+
{"version":3,"file":"renamePrompt.js","sourceRoot":"","sources":["../../src/util/renamePrompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAkB,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC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AC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC;YAEhF,IAAI,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG,cAAc,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC;YAChE,IAAI,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import chalk from 'chalk';\nimport { ModifyOutputFn, Prompt, SelectState } from '../ui/lib.js';\nimport { isRenamePromptItem } from '@instantdb/platform';\n\nexport interface RenamePromptItem<T> {\n from: T;\n to: T;\n}\n\nexport class ResolveRenamePrompt<T extends string> extends Prompt<\n RenamePromptItem<T> | T\n> {\n private readonly state: SelectState<RenamePromptItem<T> | T>;\n\n result(): RenamePromptItem<T> | T {\n return this.state.items[this.state.selectedIdx]!;\n }\n\n private thingType = 'attr';\n\n constructor(\n private readonly base: string,\n data: (RenamePromptItem<T> | T)[],\n extraInfo?: any,\n modifyOutput?: ModifyOutputFn,\n ) {\n super(modifyOutput);\n this.on('attach', (terminal) => terminal.toggleCursor('hide'));\n this.state = new SelectState(data);\n this.state.bind(this);\n this.base = base;\n if (extraInfo?.type) {\n this.thingType = extraInfo.type;\n }\n }\n render(status: 'idle' | 'submitted' | 'aborted'): string {\n if (status === 'submitted' || status === 'aborted') {\n return '';\n }\n\n let text = `Is ${chalk.bold.hex('#EA570B')(\n this.base,\n )} created or renamed from another ${this.thingType}?\\n`;\n const isSelectedRenamed = isRenamePromptItem(\n this.state.items[this.state.selectedIdx],\n );\n const selectedPrefix = isSelectedRenamed\n ? chalk.yellow('❯ ')\n : chalk.green('❯ ');\n\n const labelLength: number = this.state.items\n .filter((it) => isRenamePromptItem(it))\n .map((it: RenamePromptItem<T>) => {\n return this.base.length + 3 + it['from'].length;\n })\n .reduce((a, b) => {\n if (a > b) {\n return a;\n }\n return b;\n }, 0);\n\n this.state.items.forEach((it, idx) => {\n const isSelected = idx === this.state.selectedIdx;\n const isRenamed = isRenamePromptItem(it);\n const title = isRenamed\n ? `${it.from} › ${it.to}`.padEnd(labelLength, ' ')\n : it.padEnd(labelLength, ' ');\n const label = isRenamed\n ? `${chalk.yellow('~')} ${title} ${chalk.gray(` rename ${this.thingType}`)}`\n : `${chalk.green('+')} ${title} ${chalk.gray(` create ${this.thingType}`)}`;\n\n text += isSelected ? `${selectedPrefix}${label}` : ` ${label}`;\n text += idx != this.state.items.length - 1 ? '\\n' : '';\n });\n return text;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "instant-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.22.99-experimental.add-user-perm-rules.
|
|
4
|
+
"version": "0.22.99-experimental.add-user-perm-rules.20792984656.1",
|
|
5
5
|
"description": "Instant's CLI",
|
|
6
6
|
"homepage": "https://github.com/instantdb/instant/tree/main/client/packages/cli",
|
|
7
7
|
"repository": {
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"strip-ansi": "^7.1.2",
|
|
42
42
|
"terminal-link": "^3.0.0",
|
|
43
43
|
"unconfig": "^0.5.5",
|
|
44
|
-
"@instantdb/core": "0.22.99-experimental.add-user-perm-rules.
|
|
45
|
-
"@instantdb/platform": "0.22.99-experimental.add-user-perm-rules.
|
|
46
|
-
"@instantdb/version": "0.22.99-experimental.add-user-perm-rules.
|
|
44
|
+
"@instantdb/core": "0.22.99-experimental.add-user-perm-rules.20792984656.1",
|
|
45
|
+
"@instantdb/platform": "0.22.99-experimental.add-user-perm-rules.20792984656.1",
|
|
46
|
+
"@instantdb/version": "0.22.99-experimental.add-user-perm-rules.20792984656.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@babel/core": "^7.17.9",
|