@taruvi/navkit 0.0.30 → 0.0.32
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/.github/workflows/publish.yml +65 -0
- package/package.json +4 -2
- package/src/App.tsx +7 -6
- package/src/NavkitContext.tsx +2 -2
- package/src/dummy.test.ts +5 -0
- package/src/types.ts +2 -0
- package/.claude/settings.local.json +0 -12
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- beta
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
with:
|
|
17
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
18
|
+
|
|
19
|
+
- uses: actions/setup-node@v4
|
|
20
|
+
with:
|
|
21
|
+
node-version: '20'
|
|
22
|
+
registry-url: 'https://registry.npmjs.org'
|
|
23
|
+
|
|
24
|
+
- run: npm ci
|
|
25
|
+
|
|
26
|
+
- run: npm test
|
|
27
|
+
|
|
28
|
+
- run: npm run build
|
|
29
|
+
|
|
30
|
+
- name: Create and push git tag
|
|
31
|
+
if: github.ref == 'refs/heads/main'
|
|
32
|
+
run: |
|
|
33
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
34
|
+
git config user.name "github-actions"
|
|
35
|
+
git config user.email "github-actions@github.com"
|
|
36
|
+
if git ls-remote --tags origin | grep -q "refs/tags/v$VERSION"; then
|
|
37
|
+
echo "Tag v$VERSION already exists, skipping."
|
|
38
|
+
else
|
|
39
|
+
git tag "v$VERSION"
|
|
40
|
+
git push origin "v$VERSION"
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
- name: Publish (latest)
|
|
44
|
+
if: github.ref == 'refs/heads/main'
|
|
45
|
+
run: |
|
|
46
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
47
|
+
if npm view "@taruvi/navkit@$VERSION" version 2>/dev/null | grep -q "$VERSION"; then
|
|
48
|
+
echo "Version $VERSION already published, skipping."
|
|
49
|
+
else
|
|
50
|
+
npm publish --access public
|
|
51
|
+
fi
|
|
52
|
+
env:
|
|
53
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
54
|
+
|
|
55
|
+
- name: Publish (beta)
|
|
56
|
+
if: github.ref == 'refs/heads/beta'
|
|
57
|
+
run: |
|
|
58
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
59
|
+
if npm view "@taruvi/navkit@$VERSION" version 2>/dev/null | grep -q "$VERSION"; then
|
|
60
|
+
echo "Version $VERSION already published, skipping."
|
|
61
|
+
else
|
|
62
|
+
npm publish --access public --tag beta
|
|
63
|
+
fi
|
|
64
|
+
env:
|
|
65
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taruvi/navkit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"main": "src/App.tsx",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
8
|
"build": "tsc -b && vite build",
|
|
9
|
+
"test": "vitest run",
|
|
9
10
|
"lint": "eslint .",
|
|
10
11
|
"preview": "vite preview"
|
|
11
12
|
},
|
|
@@ -43,7 +44,8 @@
|
|
|
43
44
|
"react-dom": "^19.2.3",
|
|
44
45
|
"typescript": "~5.9.3",
|
|
45
46
|
"typescript-eslint": "^8.45.0",
|
|
46
|
-
"vite": "^7.1.7"
|
|
47
|
+
"vite": "^7.1.7",
|
|
48
|
+
"vitest": "^4.0.18"
|
|
47
49
|
},
|
|
48
50
|
"dependencies": {
|
|
49
51
|
"@taruvi/sdk": "^1.3.4-beta.0"
|
package/src/App.tsx
CHANGED
|
@@ -11,7 +11,7 @@ import taruviLogo from "./assets/taruvi-logo.png";
|
|
|
11
11
|
import type { Client } from "@taruvi/sdk"
|
|
12
12
|
|
|
13
13
|
const NavkitContent = () => {
|
|
14
|
-
const { isUserAuthenticated, siteSettings, appSettings,
|
|
14
|
+
const { isUserAuthenticated, siteSettings, appSettings, appName, userData, jwtToken, themeMode } = useNavigation();
|
|
15
15
|
const styles = getAppStyles(themeMode)
|
|
16
16
|
const [showAppLauncher, setShowAppLauncher] = useState<boolean>(false)
|
|
17
17
|
const [showProfileMenu, setShowProfileMenu] = useState<boolean>(false)
|
|
@@ -35,9 +35,9 @@ const NavkitContent = () => {
|
|
|
35
35
|
<Toolbar sx={styles.toolbar}>
|
|
36
36
|
<Box component={"a"} href="/" sx={styles.leftSection}>
|
|
37
37
|
{appSettings?.icon ? <Box component="img" src={appSettings?.icon} sx={styles.logo} /> : <></>}
|
|
38
|
-
{appSettings?.displayName &&
|
|
39
|
-
<Typography sx={styles.appName}>
|
|
40
|
-
{appSettings
|
|
38
|
+
{(appName || appSettings?.displayName) &&
|
|
39
|
+
<Typography sx={styles.appName} onClick={() => (window.location.href = "/")}>
|
|
40
|
+
{(() => { const name = appName || appSettings!.displayName!; return name.length > 40 ? `${name.substring(0, 40)}...` : name })()}
|
|
41
41
|
</Typography>
|
|
42
42
|
}
|
|
43
43
|
</Box>
|
|
@@ -111,12 +111,13 @@ const NavkitContent = () => {
|
|
|
111
111
|
|
|
112
112
|
interface NavkitProps {
|
|
113
113
|
client: Client
|
|
114
|
+
appName?: string
|
|
114
115
|
getTheme?: (theme: 'light' | 'dark') => void
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
const Navkit = ({ client, getTheme }: NavkitProps) => {
|
|
118
|
+
const Navkit = ({ client, getTheme, appName }: NavkitProps) => {
|
|
118
119
|
return (
|
|
119
|
-
<NavkitProvider client={client} onThemeChange={getTheme}>
|
|
120
|
+
<NavkitProvider client={client} onThemeChange={getTheme} appName={appName}>
|
|
120
121
|
<NavkitContent />
|
|
121
122
|
</NavkitProvider>
|
|
122
123
|
)
|
package/src/NavkitContext.tsx
CHANGED
|
@@ -19,7 +19,7 @@ const getInitialTheme = (): ThemeMode => {
|
|
|
19
19
|
|
|
20
20
|
export const NavigationContext = createContext<NavigationContextType | undefined>(undefined)
|
|
21
21
|
|
|
22
|
-
export const NavkitProvider = ({ children, client, onThemeChange }: NavkitProviderProps) => {
|
|
22
|
+
export const NavkitProvider = ({ children, client, onThemeChange, appName }: NavkitProviderProps) => {
|
|
23
23
|
const auth = new Auth(client)
|
|
24
24
|
|
|
25
25
|
const user = useRef<any>(null)
|
|
@@ -161,7 +161,7 @@ export const NavkitProvider = ({ children, client, onThemeChange }: NavkitProvid
|
|
|
161
161
|
}, [themeMode, onThemeChange])
|
|
162
162
|
|
|
163
163
|
return (
|
|
164
|
-
<NavigationContext.Provider value={{ navigateToUrl, isDesk, appsList, userData, siteSettings: siteSettings.current, appSettings: appSettings.current, jwtToken, isUserAuthenticated, client, auth, themeMode, toggleTheme }}>
|
|
164
|
+
<NavigationContext.Provider value={{ navigateToUrl, isDesk, appsList, userData, siteSettings: siteSettings.current, appSettings: appSettings.current, appName, jwtToken, isUserAuthenticated, client, auth, themeMode, toggleTheme }}>
|
|
165
165
|
{children}
|
|
166
166
|
</NavigationContext.Provider>
|
|
167
167
|
)
|
package/src/types.ts
CHANGED
|
@@ -60,6 +60,7 @@ export interface NavigationContextType {
|
|
|
60
60
|
userData: UserData | null
|
|
61
61
|
siteSettings: SiteSettings
|
|
62
62
|
appSettings: AppSettings
|
|
63
|
+
appName?: string
|
|
63
64
|
jwtToken: string
|
|
64
65
|
isUserAuthenticated: boolean
|
|
65
66
|
client: Client
|
|
@@ -72,4 +73,5 @@ export interface NavkitProviderProps {
|
|
|
72
73
|
children: ReactNode
|
|
73
74
|
client: Client
|
|
74
75
|
onThemeChange?: (theme: ThemeMode) => void
|
|
76
|
+
appName?: string
|
|
75
77
|
}
|