heroui-native-pro 1.0.0-beta.2 → 1.0.0-beta.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/dist/postinstall/index.js +22 -0
- package/package.json +3 -3
- package/pre/postinstall/index.js +0 -70
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import{Chalk as t}from"chalk";import{dirname as s,join as a}from"node:path";import{fileURLToPath as d}from"node:url";import{HEROUI_AUTH_TOKEN as r,PRODUCTS as c,HEROUI_WEB_URL as l,HELP_EMAIL as m}from"heroui-pro/consts";import{downloadFromCI as p,downloadFromCLI as u}from"heroui-pro/cdn";import{getCredentials as g}from"heroui-pro/auth/keyring";import{getCIToken as f}from"heroui-pro/auth/ci";const h=s(d(import.meta.url)),e=a(h,"../../");e.includes("node_modules")||process.exit(0);const o=c["react-native"],n=new t({level:3}),b=()=>{console.log(n.yellow.bold(`
|
|
2
|
+
Sign in to finish installing ${o.name}.
|
|
3
|
+
`)),console.log(n.yellow(`Run:
|
|
4
|
+
|
|
5
|
+
${n.bold("npx heroui-pro login")}
|
|
6
|
+
|
|
7
|
+
Then re-run install, or:
|
|
8
|
+
|
|
9
|
+
${n.bold("npx heroui-pro install")}
|
|
10
|
+
|
|
11
|
+
For CI/CD, set the ${n.bold.underline(r)} environment variable.
|
|
12
|
+
Need a license? Visit ${n.bold.underline(l)}.
|
|
13
|
+
`))},C=async()=>{if(f())return await p(o,e);if(await g())return await u(o,e);b(),process.exit(0)};C().catch(i=>{console.log(n.red.bold(`Access denied: You don't have permission to install ${o.name}.
|
|
14
|
+
`)),console.log(n.red(`To get a license, visit ${n.bold.underline(l)}.
|
|
15
|
+
If you already have one, run:
|
|
16
|
+
|
|
17
|
+
${n.bold("npx heroui-pro login")}
|
|
18
|
+
|
|
19
|
+
For CI/CD environments, ensure the ${n.bold.underline(r)} environment variable is set.
|
|
20
|
+
|
|
21
|
+
Need help? Contact ${n.bold.underline(m)} for assistance.
|
|
22
|
+
`)),console.log(n.gray(i.message)),process.exit(1)});
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "heroui-native-pro",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"description": "HeroUI React Native",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "HeroUI",
|
|
7
7
|
"files": [
|
|
8
|
-
"
|
|
8
|
+
"dist",
|
|
9
9
|
"README.md",
|
|
10
10
|
"LICENSE"
|
|
11
11
|
],
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"postinstall": "node ./
|
|
17
|
+
"postinstall": "node ./dist/postinstall/index.js"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"chalk": "5.6.2",
|
package/pre/postinstall/index.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Chalk } from 'chalk';
|
|
2
|
-
import { dirname, join } from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { HEROUI_AUTH_TOKEN, PRODUCTS, HEROUI_WEB_URL, HELP_EMAIL } from 'heroui-pro/consts';
|
|
5
|
-
import { downloadFromCI, downloadFromCLI } from 'heroui-pro/cdn';
|
|
6
|
-
import { getCredentials } from 'heroui-pro/auth/keyring';
|
|
7
|
-
import { getCIToken } from 'heroui-pro/auth/ci';
|
|
8
|
-
|
|
9
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
const PKG_ROOT = join(__dirname, '../../');
|
|
11
|
-
|
|
12
|
-
// Skip postinstall in development workspace
|
|
13
|
-
if (!PKG_ROOT.includes('node_modules')) {
|
|
14
|
-
process.exit(0);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const product = PRODUCTS['react-native'];
|
|
18
|
-
const chalk = new Chalk({ level: 3 });
|
|
19
|
-
|
|
20
|
-
const printLoginPrompt = () => {
|
|
21
|
-
console.log(chalk.yellow.bold(`\nSign in to finish installing ${product.name}.\n`));
|
|
22
|
-
console.log(
|
|
23
|
-
chalk.yellow(
|
|
24
|
-
`Run:\n\n` +
|
|
25
|
-
` ${chalk.bold('npx heroui-pro login')}\n\n` +
|
|
26
|
-
`Then re-run install, or:\n\n` +
|
|
27
|
-
` ${chalk.bold('npx heroui-pro install')}\n\n` +
|
|
28
|
-
`For CI/CD, set the ${chalk.bold.underline(HEROUI_AUTH_TOKEN)} environment variable.\n` +
|
|
29
|
-
`Need a license? Visit ${chalk.bold.underline(HEROUI_WEB_URL)}.\n`,
|
|
30
|
-
),
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const main = async () => {
|
|
35
|
-
const ciToken = getCIToken();
|
|
36
|
-
|
|
37
|
-
if (ciToken) {
|
|
38
|
-
return await downloadFromCI(product, PKG_ROOT);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const creds = await getCredentials();
|
|
42
|
-
|
|
43
|
-
if (creds) {
|
|
44
|
-
return await downloadFromCLI(product, PKG_ROOT);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// No credentials yet — expected first-run state. Exit cleanly so `npm install`
|
|
48
|
-
// succeeds and the user can run `npx heroui-pro login` to finish setup.
|
|
49
|
-
printLoginPrompt();
|
|
50
|
-
process.exit(0);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
main().catch(error => {
|
|
54
|
-
console.log(
|
|
55
|
-
chalk.red.bold(`Access denied: You don't have permission to install ${product.name}.\n`),
|
|
56
|
-
);
|
|
57
|
-
console.log(
|
|
58
|
-
chalk.red(
|
|
59
|
-
`To get a license, visit ${chalk.bold.underline(HEROUI_WEB_URL)}.\n` +
|
|
60
|
-
`If you already have one, run:\n\n` +
|
|
61
|
-
`${chalk.bold('npx heroui-pro login')}\n\n` +
|
|
62
|
-
`For CI/CD environments, ensure the ${chalk.bold.underline(HEROUI_AUTH_TOKEN)} environment variable is set.\n\n` +
|
|
63
|
-
`Need help? Contact ${chalk.bold.underline(HELP_EMAIL)} for assistance.\n`,
|
|
64
|
-
),
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
console.log(chalk.gray(error.message));
|
|
68
|
-
|
|
69
|
-
process.exit(1);
|
|
70
|
-
});
|