create-identity 0.2.3 → 0.2.4
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/letus.js +79 -0
- package/package.json +5 -3
package/letus.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawnSync } = require('node:child_process');
|
|
3
|
+
const { existsSync } = require('node:fs');
|
|
4
|
+
const { homedir } = require('node:os');
|
|
5
|
+
const { dirname, join } = require('node:path');
|
|
6
|
+
|
|
7
|
+
function resolveInstalledAspCli() {
|
|
8
|
+
try {
|
|
9
|
+
const packageJsonPath = require.resolve('asp-protocol/package.json');
|
|
10
|
+
return join(dirname(packageJsonPath), 'dist', 'bin', 'asp.js');
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function getManifestPath() {
|
|
17
|
+
const storeDir = process.env.ASP_STORE_DIR || join(homedir(), '.asp');
|
|
18
|
+
return join(storeDir, 'manifest.yaml');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function run(bin, args) {
|
|
22
|
+
let result = spawnSync(bin, args, { stdio: 'inherit' });
|
|
23
|
+
if (result.error && result.error.code === 'ENOENT') {
|
|
24
|
+
result = spawnSync('npx', [bin, ...args], { stdio: 'inherit' });
|
|
25
|
+
}
|
|
26
|
+
process.exit(result.status ?? 1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const args = process.argv.slice(2);
|
|
30
|
+
const first = args[0];
|
|
31
|
+
|
|
32
|
+
if (!first) {
|
|
33
|
+
console.log('\n letus — consumer entrypoint for ASP\n');
|
|
34
|
+
console.log(' letus social [referrer] Join letus.social');
|
|
35
|
+
console.log(' letus date Start the dating onboarding');
|
|
36
|
+
console.log(' letus meet [target] Start the scheduling onboarding');
|
|
37
|
+
console.log(' letus follow @target Follow someone, onboarding first if needed');
|
|
38
|
+
console.log(' letus <asp-command> Run the protocol CLI through the letus brand');
|
|
39
|
+
console.log('');
|
|
40
|
+
process.exit(0);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (first === 'social') {
|
|
44
|
+
run('letussocial', args.slice(1));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (first === 'date') {
|
|
48
|
+
run('letusdate', args.slice(1));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (first === 'meet') {
|
|
52
|
+
run('letusmeet', args.slice(1));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (first === 'play') {
|
|
56
|
+
run('letusplay', args.slice(1));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (first === 'follow' && !existsSync(getManifestPath())) {
|
|
60
|
+
const target = args[1];
|
|
61
|
+
if (!target) {
|
|
62
|
+
console.log(' Usage: letus follow <@handle or url>\n');
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
run('letussocial', [target]);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
let result = spawnSync('asp', args, { stdio: 'inherit' });
|
|
69
|
+
if (result.error && result.error.code === 'ENOENT') {
|
|
70
|
+
const installedAspCli = resolveInstalledAspCli();
|
|
71
|
+
if (installedAspCli) {
|
|
72
|
+
result = spawnSync(process.execPath, [installedAspCli, ...args], { stdio: 'inherit' });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (result.error && result.error.code === 'ENOENT') {
|
|
76
|
+
result = spawnSync('npx', ['-y', '-p', 'asp-protocol', 'asp', ...args], { stdio: 'inherit' });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
process.exit(result.status ?? 1);
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-identity",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Create your ASP identity — public onboarding alias for letus.social",
|
|
5
5
|
"bin": {
|
|
6
|
-
"create-identity": "index.js"
|
|
6
|
+
"create-identity": "index.js",
|
|
7
|
+
"letus": "letus.js"
|
|
7
8
|
},
|
|
8
9
|
"dependencies": {
|
|
9
|
-
"asp-create": "^0.2.2"
|
|
10
|
+
"asp-create": "^0.2.2",
|
|
11
|
+
"asp-protocol": "^0.2.2"
|
|
10
12
|
},
|
|
11
13
|
"keywords": [
|
|
12
14
|
"asp",
|