uniwind-pro 1.0.0-beta.1 ā 1.0.0-beta.10
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 +5 -1
- package/package.json +23 -7
- package/pre/cli/commands.js +3 -3
- package/pre/cli/index.js +19 -17
- package/pre/postinstall/index.js +41 -3
- package/pre/postinstall/install.js +72 -14
package/README.md
CHANGED
|
@@ -23,12 +23,16 @@ Authorize and fetch your Pro package with:
|
|
|
23
23
|
bunx uniwind-pro
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
## Get Started
|
|
27
|
+
- [Purchase a license](https://docs.uniwind.dev/pro/get-license)
|
|
28
|
+
|
|
26
29
|
|
|
27
30
|
## Documentation
|
|
28
31
|
|
|
29
32
|
- [Start here](https://docs.uniwind.dev/quickstart)
|
|
30
33
|
- [Pro vs Free Version](https://docs.uniwind.dev/pro-version)
|
|
31
|
-
- [
|
|
34
|
+
- [All Pro features](https://docs.uniwind.dev/pro/theme-transitions)
|
|
35
|
+
- [Migrate from Free Version](https://docs.uniwind.dev/migrate-to-pro)
|
|
32
36
|
|
|
33
37
|
## Features
|
|
34
38
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uniwind-pro",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Uniwind Pro CLI",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"tailwindcss",
|
|
8
|
+
"tailwind",
|
|
9
|
+
"react-native",
|
|
10
|
+
"styling",
|
|
11
|
+
"expo",
|
|
12
|
+
"css",
|
|
13
|
+
"unistyles",
|
|
14
|
+
"uniwind",
|
|
15
|
+
"pro"
|
|
16
|
+
],
|
|
6
17
|
"files": [
|
|
7
18
|
"pre",
|
|
8
19
|
"README.md",
|
|
@@ -16,14 +27,19 @@
|
|
|
16
27
|
},
|
|
17
28
|
"author": "Codemask",
|
|
18
29
|
"license": "UNLICENSED",
|
|
19
|
-
"
|
|
20
|
-
"@
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@tailwindcss/node": "4.1.18",
|
|
32
|
+
"@tailwindcss/oxide": "4.1.18",
|
|
33
|
+
"@zowe/secrets-for-zowe-sdk": "8.29.4",
|
|
21
34
|
"chalk": "5.6.2",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
35
|
+
"chokidar": "5.0.0",
|
|
36
|
+
"culori": "4.0.2",
|
|
37
|
+
"eventsource": "4.1.0",
|
|
38
|
+
"figlet": "1.9.4",
|
|
39
|
+
"inquirer": "13.2.0",
|
|
25
40
|
"jwt-decode": "4.0.0",
|
|
26
|
-
"
|
|
41
|
+
"lightningcss": "1.30.2",
|
|
42
|
+
"open": "11.0.0",
|
|
27
43
|
"tar": "7.5.2"
|
|
28
44
|
}
|
|
29
45
|
}
|
package/pre/cli/commands.js
CHANGED
|
@@ -17,7 +17,7 @@ export const login = async () => {
|
|
|
17
17
|
|
|
18
18
|
open(authUrl)
|
|
19
19
|
|
|
20
|
-
console.log(chalk.
|
|
20
|
+
console.log(chalk.gray('\nWaiting for authorization response...'))
|
|
21
21
|
|
|
22
22
|
const { token, handle } = await getTokenSSE(sessionId)
|
|
23
23
|
|
|
@@ -58,7 +58,7 @@ export const logout = async () => {
|
|
|
58
58
|
const maybeCredentials = await keyring.findCredentials(SERVICE)
|
|
59
59
|
|
|
60
60
|
if (maybeCredentials.length === 0) {
|
|
61
|
-
console.log(chalk.
|
|
61
|
+
console.log(chalk.yellowBright('No credentials found.'))
|
|
62
62
|
|
|
63
63
|
return Promise.resolve()
|
|
64
64
|
}
|
|
@@ -67,5 +67,5 @@ export const logout = async () => {
|
|
|
67
67
|
await keyring.deletePassword(SERVICE, account)
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
console.log(chalk.
|
|
70
|
+
console.log(chalk.yellowBright('\nš Signed out'))
|
|
71
71
|
}
|
package/pre/cli/index.js
CHANGED
|
@@ -17,30 +17,32 @@ async function interactiveMode() {
|
|
|
17
17
|
const session = await getSesionMetadata()
|
|
18
18
|
const choices = session
|
|
19
19
|
? [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
new inquirer.Separator(
|
|
21
|
+
chalk.green(` Your session is valid for the next ${session.expiresAt}`)
|
|
22
|
+
),
|
|
23
|
+
new inquirer.Separator(chalk.gray('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā')),
|
|
24
|
+
{ name: 'Manage your account', value: 'account' },
|
|
25
|
+
{ name: 'Install Uniwind Pro', value: 'postinstall' },
|
|
26
|
+
{ name: 'Logout', value: 'logout' },
|
|
27
|
+
{ name: chalk.gray('Exit'), value: 'exit' },
|
|
28
|
+
]
|
|
27
29
|
: [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
{ name: 'Login with Github', value: 'login' },
|
|
31
|
+
{ name: 'Buy Uniwind Pro', value: 'buy' },
|
|
32
|
+
{ name: chalk.gray('Exit'), value: 'exit' },
|
|
33
|
+
]
|
|
32
34
|
|
|
33
35
|
const message = session
|
|
34
|
-
?
|
|
35
|
-
:
|
|
36
|
+
? `Hello @${session.handle}, what would you like to do?`
|
|
37
|
+
: 'What would you like to do?'
|
|
36
38
|
|
|
37
39
|
const { action } = await inquirer.prompt([
|
|
38
40
|
{
|
|
39
|
-
type: '
|
|
41
|
+
type: 'select',
|
|
40
42
|
name: 'action',
|
|
41
43
|
message,
|
|
42
|
-
choices
|
|
43
|
-
}
|
|
44
|
+
choices,
|
|
45
|
+
},
|
|
44
46
|
])
|
|
45
47
|
|
|
46
48
|
switch (action) {
|
|
@@ -61,7 +63,7 @@ async function interactiveMode() {
|
|
|
61
63
|
break
|
|
62
64
|
case 'exit':
|
|
63
65
|
shouldExit = true
|
|
64
|
-
console.log(chalk.
|
|
66
|
+
console.log(chalk.gray('\nSession closed\n'))
|
|
65
67
|
break
|
|
66
68
|
}
|
|
67
69
|
|
package/pre/postinstall/index.js
CHANGED
|
@@ -1,8 +1,45 @@
|
|
|
1
1
|
import { Chalk } from 'chalk'
|
|
2
|
-
import {
|
|
2
|
+
import { mkdirSync, symlinkSync, existsSync } from 'node:fs'
|
|
3
|
+
import { dirname, join, resolve } from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
3
5
|
import { UNIWIND_AUTH_TOKEN, SERVICE, UNIWIND_WEB_URL, HELP_EMAIL } from '../consts.js'
|
|
4
6
|
import { downloadFromCI, downloadFromCLI } from './install.js'
|
|
5
7
|
|
|
8
|
+
// Create bin symlinks for aliased package
|
|
9
|
+
const createBinSymlinks = () => {
|
|
10
|
+
try {
|
|
11
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
12
|
+
const cliPath = resolve(__dirname, '../cli/index.js')
|
|
13
|
+
let current = __dirname
|
|
14
|
+
|
|
15
|
+
while (current !== '/') {
|
|
16
|
+
if (!current.includes('node_modules')) {
|
|
17
|
+
const binDir = join(current, 'node_modules', '.bin')
|
|
18
|
+
const nodeModules = join(current, 'node_modules')
|
|
19
|
+
|
|
20
|
+
if (existsSync(nodeModules)) {
|
|
21
|
+
// Now we're at the actual project root
|
|
22
|
+
mkdirSync(binDir, { recursive: true })
|
|
23
|
+
|
|
24
|
+
for (const name of ['uniwind', 'uniwind-pro']) {
|
|
25
|
+
const linkPath = join(binDir, name)
|
|
26
|
+
|
|
27
|
+
if (!existsSync(linkPath)) {
|
|
28
|
+
symlinkSync(cliPath, linkPath)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
break
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
current = dirname(current)
|
|
37
|
+
}
|
|
38
|
+
} catch {}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
createBinSymlinks()
|
|
42
|
+
|
|
6
43
|
const chalk = new Chalk({ level: 3 })
|
|
7
44
|
|
|
8
45
|
const main = async () => {
|
|
@@ -12,6 +49,7 @@ const main = async () => {
|
|
|
12
49
|
return await downloadFromCI(maybeCICDToken)
|
|
13
50
|
}
|
|
14
51
|
|
|
52
|
+
const { keyring } = await import('@zowe/secrets-for-zowe-sdk')
|
|
15
53
|
const matchingCredentials = await keyring.findCredentials(SERVICE)
|
|
16
54
|
|
|
17
55
|
if (matchingCredentials.length !== 0) {
|
|
@@ -24,7 +62,7 @@ const main = async () => {
|
|
|
24
62
|
main().catch((error) => {
|
|
25
63
|
console.log(chalk.red.bold("Access denied: You don't have permission to install this package.\n"))
|
|
26
64
|
console.log(
|
|
27
|
-
chalk.
|
|
65
|
+
chalk.red(
|
|
28
66
|
`To get a license, visit ${chalk.bold.underline(UNIWIND_WEB_URL)}.\n` +
|
|
29
67
|
`If you already have one, run cli via:\n\n` +
|
|
30
68
|
`${chalk.bold('uniwind-pro')}\n\n` +
|
|
@@ -33,7 +71,7 @@ main().catch((error) => {
|
|
|
33
71
|
)
|
|
34
72
|
)
|
|
35
73
|
|
|
36
|
-
console.log(chalk.
|
|
74
|
+
console.log(chalk.gray(error.message))
|
|
37
75
|
|
|
38
76
|
process.exit(1)
|
|
39
77
|
})
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
|
-
import { readFileSync, mkdirSync, readdirSync, cpSync, rmSync } from 'node:fs'
|
|
3
|
-
import { keyring } from '@zowe/secrets-for-zowe-sdk'
|
|
2
|
+
import { readFileSync, mkdirSync, readdirSync, cpSync, rmSync, existsSync } from 'node:fs'
|
|
4
3
|
import { join, dirname } from 'node:path'
|
|
5
4
|
import { fileURLToPath } from 'node:url'
|
|
6
5
|
import { pipeline } from 'node:stream'
|
|
@@ -10,7 +9,6 @@ import { INSTALLATION_URL, SERVICE } from '../consts.js'
|
|
|
10
9
|
|
|
11
10
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
12
11
|
const pkgPath = join(__dirname, '../../package.json')
|
|
13
|
-
const rootPkgPath = join(__dirname, '../../../../package.json')
|
|
14
12
|
const streamPipeline = promisify(pipeline)
|
|
15
13
|
|
|
16
14
|
const getVersion = () => {
|
|
@@ -25,17 +23,76 @@ const getVersion = () => {
|
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
25
|
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
const packageJson = readFileSync(rootPkgPath, 'utf8')
|
|
31
|
-
const parsedPackageJSON = JSON.parse(packageJson)
|
|
26
|
+
const findWorkspacePackages = (rootDir, workspaces) => {
|
|
27
|
+
const packages = []
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
for (const pattern of workspaces) {
|
|
30
|
+
const wsPath = join(rootDir, pattern.replace('/*', ''))
|
|
31
|
+
|
|
32
|
+
if (existsSync(wsPath)) {
|
|
33
|
+
try {
|
|
34
|
+
const dirs = readdirSync(wsPath, { withFileTypes: true })
|
|
35
|
+
|
|
36
|
+
for (const dir of dirs) {
|
|
37
|
+
if (dir.isDirectory()) {
|
|
38
|
+
const pkgPath = join(wsPath, dir.name, 'package.json')
|
|
39
|
+
|
|
40
|
+
if (existsSync(pkgPath)) {
|
|
41
|
+
packages.push(pkgPath)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
} catch {}
|
|
46
|
+
}
|
|
38
47
|
}
|
|
48
|
+
|
|
49
|
+
return packages
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const getProjectName = () => {
|
|
53
|
+
let current = __dirname
|
|
54
|
+
|
|
55
|
+
while (current !== '/') {
|
|
56
|
+
if (!current.includes('node_modules')) {
|
|
57
|
+
const pkgPath = join(current, 'package.json')
|
|
58
|
+
|
|
59
|
+
if (existsSync(pkgPath)) {
|
|
60
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'))
|
|
61
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies }
|
|
62
|
+
|
|
63
|
+
// Direct dependency - return immediately
|
|
64
|
+
if (deps['uniwind'] || deps['uniwind-pro']) {
|
|
65
|
+
return pkg.name
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Monorepo with workspaces - search for package that depends on uniwind
|
|
69
|
+
if (pkg.workspaces) {
|
|
70
|
+
const workspaces = Array.isArray(pkg.workspaces)
|
|
71
|
+
? pkg.workspaces
|
|
72
|
+
: pkg.workspaces.packages || []
|
|
73
|
+
const wsPkgs = findWorkspacePackages(current, workspaces)
|
|
74
|
+
|
|
75
|
+
for (const wsPkgPath of wsPkgs) {
|
|
76
|
+
try {
|
|
77
|
+
const wsPkg = JSON.parse(readFileSync(wsPkgPath, 'utf8'))
|
|
78
|
+
const wsDeps = { ...wsPkg.dependencies, ...wsPkg.devDependencies }
|
|
79
|
+
|
|
80
|
+
if (wsDeps['uniwind'] || wsDeps['uniwind-pro']) {
|
|
81
|
+
return wsPkg.name
|
|
82
|
+
}
|
|
83
|
+
} catch {}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Fallback to root package name
|
|
88
|
+
return pkg.name
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
current = dirname(current)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
throw new Error('Could not find project package.json')
|
|
39
96
|
}
|
|
40
97
|
|
|
41
98
|
export const downloadFromCI = async (licenseUUID) => {
|
|
@@ -54,9 +111,9 @@ export const downloadFromCLI = async ({ account: handle, password: token }) => {
|
|
|
54
111
|
const packageVersion = getVersion()
|
|
55
112
|
const projectName = getProjectName()
|
|
56
113
|
|
|
57
|
-
console.log(chalk.
|
|
114
|
+
console.log(chalk.gray(`Fetching v${packageVersion} for project "${projectName}"...\n`))
|
|
58
115
|
|
|
59
|
-
const cdnUrl = `${INSTALLATION_URL}/cli/${handle}/${projectName}/${packageVersion}/${token}`
|
|
116
|
+
const cdnUrl = `${INSTALLATION_URL}/cli/${handle}/${encodeURIComponent(projectName)}/${packageVersion}/${token}`
|
|
60
117
|
const response = await fetch(cdnUrl)
|
|
61
118
|
|
|
62
119
|
if (response.ok) {
|
|
@@ -64,6 +121,7 @@ export const downloadFromCLI = async ({ account: handle, password: token }) => {
|
|
|
64
121
|
}
|
|
65
122
|
|
|
66
123
|
if (response.status === 401) {
|
|
124
|
+
const { keyring } = await import('@zowe/secrets-for-zowe-sdk')
|
|
67
125
|
await keyring.deleteCredentials(SERVICE)
|
|
68
126
|
}
|
|
69
127
|
|