keypin 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +104 -2
- package/chunk-03233dfg.js +1959 -0
- package/chunk-8agfxsqt.js +31 -0
- package/main.js +48 -0
- package/package.json +23 -4
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/install.ts
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
|
|
5
|
+
// src/errors.ts
|
|
6
|
+
function messageOf(error) {
|
|
7
|
+
return error instanceof Error ? error.message : String(error);
|
|
8
|
+
}
|
|
9
|
+
function errorCode(error) {
|
|
10
|
+
if (error instanceof Error && "code" in error && typeof error.code === "string")
|
|
11
|
+
return error.code;
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// src/install.ts
|
|
16
|
+
var INSTALL = "bunx --package vite-plus@1.5.1 vp install";
|
|
17
|
+
var REINSTALL = "bun add -g keypin";
|
|
18
|
+
function checkout() {
|
|
19
|
+
if (!import.meta.url.endsWith("/apps/cli/src/install.ts"))
|
|
20
|
+
return null;
|
|
21
|
+
return fileURLToPath(new URL("../../..", import.meta.url)).replace(/\/$/, "");
|
|
22
|
+
}
|
|
23
|
+
function installProblem(error, repo = checkout()) {
|
|
24
|
+
if (errorCode(error) !== "ERR_MODULE_NOT_FOUND")
|
|
25
|
+
return null;
|
|
26
|
+
const name = /'([^']+)'/.exec(messageOf(error))?.[1];
|
|
27
|
+
const fix = repo === null ? `reinstall keypin with "${REINSTALL}"` : `run "${INSTALL}" in ${repo}`;
|
|
28
|
+
return `${name ? `the package ${name}` : "a package"} isn't installed; ${fix}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { messageOf, errorCode, installProblem };
|
package/main.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// @bun
|
|
3
|
+
import {
|
|
4
|
+
installProblem
|
|
5
|
+
} from "./chunk-8agfxsqt.js";
|
|
6
|
+
|
|
7
|
+
// src/runtime.ts
|
|
8
|
+
var MIN_BUN = "1.4.4";
|
|
9
|
+
function runtimeProblem(bun, script) {
|
|
10
|
+
if (bun === undefined)
|
|
11
|
+
return `keypin runs on Bun ${MIN_BUN} or newer, not Node.`;
|
|
12
|
+
if (olderThan(bun, MIN_BUN)) {
|
|
13
|
+
return `keypin needs Bun ${MIN_BUN} or newer, because older Bun can read a keypin.toml wrong, and this is Bun ${bun}. Upgrade Bun, or run it with "bunx bun@${MIN_BUN} ${script}".`;
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
function olderThan(version, minimum) {
|
|
18
|
+
const parts = (v) => v.split(/[.+-]/).slice(0, 3).map(Number);
|
|
19
|
+
const a = parts(version);
|
|
20
|
+
const b = parts(minimum);
|
|
21
|
+
for (let i = 0;i < 3; i++) {
|
|
22
|
+
const left = a[i] ?? 0;
|
|
23
|
+
const right = b[i] ?? 0;
|
|
24
|
+
if (left !== right)
|
|
25
|
+
return left < right;
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// src/main.ts
|
|
31
|
+
var problem = runtimeProblem(typeof Bun === "undefined" ? undefined : Bun.version, process.argv[1] ?? "keypin");
|
|
32
|
+
if (problem) {
|
|
33
|
+
process.stderr.write(`keypin: ${problem}
|
|
34
|
+
`);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
var start;
|
|
38
|
+
try {
|
|
39
|
+
start = await import("./chunk-03233dfg.js");
|
|
40
|
+
} catch (error) {
|
|
41
|
+
const hint = installProblem(error);
|
|
42
|
+
if (!hint)
|
|
43
|
+
throw error;
|
|
44
|
+
process.stderr.write(`keypin: ${hint}
|
|
45
|
+
`);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
process.exitCode = await start.main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keypin",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A map of every app key across your projects, published to the account it's pinned to. Values stay in your vault.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/caiopizzol/keypin#readme",
|
|
7
|
+
"bugs": {
|
|
8
|
+
"url": "https://github.com/caiopizzol/keypin/issues"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/caiopizzol/keypin.git"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"bin": {
|
|
16
|
+
"keypin": "main.js"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"bun": ">=1.4.4"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@1password/sdk": "0.5.0",
|
|
23
|
+
"libsodium-wrappers": "0.8.4"
|
|
24
|
+
}
|
|
25
|
+
}
|