grab 0.1.0-beta.8 → 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/README.md +11 -144
- package/bin/cli.js +2 -0
- package/dist/chunk-3OELABVY.cjs +106 -0
- package/dist/chunk-BJ4BJEGF.js +11 -0
- package/dist/chunk-HAJQCKRJ.cjs +11 -0
- package/dist/chunk-OQ26BP5I.js +106 -0
- package/dist/chunk-USOEKKKR.js +10 -0
- package/dist/chunk-XDK4TTNO.cjs +10 -0
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/design-system.cjs +1 -0
- package/dist/design-system.d.cts +6 -0
- package/dist/design-system.d.ts +6 -0
- package/dist/design-system.js +1 -0
- package/dist/{index-BUAJ3r2H.d.ts → index-CNbOr8nS.d.cts} +62 -8
- package/dist/{index-BUAJ3r2H.d.cts → index-CNbOr8nS.d.ts} +62 -8
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.global.js +46 -29
- package/dist/index.js +2 -2
- package/dist/styles.css +1 -1
- package/package.json +30 -26
- package/dist/chunk-JA5IN6QI.cjs +0 -90
- package/dist/chunk-NK2BNSLR.js +0 -90
- package/dist/cli.cjs +0 -87
package/dist/cli.cjs
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var child_process = require('child_process');
|
|
5
|
-
var fs = require('fs');
|
|
6
|
-
|
|
7
|
-
var cliPackage = "@react-grab/cli" ;
|
|
8
|
-
var withLoader = (fn) => {
|
|
9
|
-
const frames = ["|", "/", "-", "\\"];
|
|
10
|
-
let i = 0;
|
|
11
|
-
process.stdout.write(frames[0]);
|
|
12
|
-
const interval = setInterval(() => {
|
|
13
|
-
i = (i + 1) % frames.length;
|
|
14
|
-
process.stdout.write(`\r${frames[i]}`);
|
|
15
|
-
}, 80);
|
|
16
|
-
return fn().finally(() => {
|
|
17
|
-
clearInterval(interval);
|
|
18
|
-
process.stdout.write("\r \r");
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var getGlobalRoot = () => {
|
|
22
|
-
try {
|
|
23
|
-
return child_process.execSync("npm root -g", { encoding: "utf-8" }).trim();
|
|
24
|
-
} catch {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
var getGlobalCliPath = (globalRoot) => {
|
|
29
|
-
if (!globalRoot) return null;
|
|
30
|
-
const cliPath = `${globalRoot}/@react-grab/cli/dist/cli.js`;
|
|
31
|
-
return fs.existsSync(cliPath) ? cliPath : null;
|
|
32
|
-
};
|
|
33
|
-
var getInstalledVersion = (globalRoot) => {
|
|
34
|
-
if (!globalRoot) return null;
|
|
35
|
-
const pkgPath = `${globalRoot}/@react-grab/cli/package.json`;
|
|
36
|
-
if (!fs.existsSync(pkgPath)) return null;
|
|
37
|
-
try {
|
|
38
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
39
|
-
return pkg.version;
|
|
40
|
-
} catch {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
var installCli = () => {
|
|
45
|
-
return new Promise((resolve, reject) => {
|
|
46
|
-
const child = child_process.spawn("npm", ["install", "-g", cliPackage], {
|
|
47
|
-
stdio: "pipe"
|
|
48
|
-
});
|
|
49
|
-
child.on(
|
|
50
|
-
"close",
|
|
51
|
-
(code) => code === 0 ? resolve() : reject(new Error("Install failed"))
|
|
52
|
-
);
|
|
53
|
-
child.on("error", (err) => reject(err));
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
var main = async () => {
|
|
57
|
-
const globalRoot = getGlobalRoot();
|
|
58
|
-
let cliPath = getGlobalCliPath(globalRoot);
|
|
59
|
-
if (!cliPath) {
|
|
60
|
-
try {
|
|
61
|
-
await withLoader(installCli);
|
|
62
|
-
} catch {
|
|
63
|
-
console.error("Setup failed. Please try again.");
|
|
64
|
-
process.exit(1);
|
|
65
|
-
}
|
|
66
|
-
cliPath = getGlobalCliPath(getGlobalRoot());
|
|
67
|
-
} else {
|
|
68
|
-
getInstalledVersion(globalRoot);
|
|
69
|
-
}
|
|
70
|
-
if (!cliPath) {
|
|
71
|
-
console.error("Setup failed. Please try again.");
|
|
72
|
-
process.exit(1);
|
|
73
|
-
}
|
|
74
|
-
const result = child_process.spawnSync(
|
|
75
|
-
process.execPath,
|
|
76
|
-
[cliPath, ...process.argv.slice(2)],
|
|
77
|
-
{
|
|
78
|
-
stdio: "inherit"
|
|
79
|
-
}
|
|
80
|
-
);
|
|
81
|
-
if (result.error) {
|
|
82
|
-
console.error("Setup failed. Please try again.");
|
|
83
|
-
process.exit(1);
|
|
84
|
-
}
|
|
85
|
-
process.exit(result.status ?? 0);
|
|
86
|
-
};
|
|
87
|
-
void main();
|