@teamvortexsoftware/vortex-nextjs-15-sdk 0.0.3 → 0.0.5
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 +3 -3
- package/bin/vortex-setup.js +37 -18
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ lib/
|
|
|
38
38
|
|
|
39
39
|
Each route file is just 3 lines:
|
|
40
40
|
```typescript
|
|
41
|
-
import 'lib/vortex-config';
|
|
41
|
+
import '@/lib/vortex-config';
|
|
42
42
|
import { createVortexRoutes } from '@teamvortexsoftware/vortex-nextjs-15-sdk';
|
|
43
43
|
|
|
44
44
|
export const { GET, DELETE } = createVortexRoutes().invitation;
|
|
@@ -170,7 +170,7 @@ Need custom logic? Create your own routes:
|
|
|
170
170
|
|
|
171
171
|
```typescript
|
|
172
172
|
// app/api/custom-invitation/route.ts
|
|
173
|
-
import 'lib/vortex-config';
|
|
173
|
+
import '@/lib/vortex-config';
|
|
174
174
|
import { handleGetInvitation, createErrorResponse } from '@teamvortexsoftware/vortex-nextjs-15-sdk';
|
|
175
175
|
|
|
176
176
|
export async function GET(request: NextRequest) {
|
|
@@ -189,7 +189,7 @@ export async function GET(request: NextRequest) {
|
|
|
189
189
|
|
|
190
190
|
### Build Errors
|
|
191
191
|
If you see configuration errors during build:
|
|
192
|
-
- Make sure you're importing `'lib/vortex-config'` in your layout
|
|
192
|
+
- Make sure you're importing `'@/lib/vortex-config'` (or `'../lib/vortex-config'`) in your layout
|
|
193
193
|
- Check that your `.env.local` has `VORTEX_API_KEY`
|
|
194
194
|
- Ensure you're using lazy initialization (`configureVortexLazy`)
|
|
195
195
|
|
package/bin/vortex-setup.js
CHANGED
|
@@ -12,43 +12,47 @@ const VORTEX_ROUTES = [
|
|
|
12
12
|
'invitations/[invitationId]/reinvite/route.ts'
|
|
13
13
|
];
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
'
|
|
15
|
+
function createRouteTemplates(baseDir) {
|
|
16
|
+
const configImport = baseDir ? '@/lib/vortex-config' : '@/lib/vortex-config';
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
'jwt/route.ts': `import '${configImport}';
|
|
17
20
|
import { createVortexRoutes } from '@teamvortexsoftware/vortex-nextjs-15-sdk';
|
|
18
21
|
|
|
19
22
|
export const { POST } = createVortexRoutes().jwt;
|
|
20
23
|
`,
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
'invitations/route.ts': `import '${configImport}';
|
|
23
26
|
import { createVortexRoutes } from '@teamvortexsoftware/vortex-nextjs-15-sdk';
|
|
24
27
|
|
|
25
28
|
export const { GET } = createVortexRoutes().invitations;
|
|
26
29
|
`,
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
'invitations/[invitationId]/route.ts': `import '${configImport}';
|
|
29
32
|
import { createVortexRoutes } from '@teamvortexsoftware/vortex-nextjs-15-sdk';
|
|
30
33
|
|
|
31
34
|
export const { GET, DELETE } = createVortexRoutes().invitation;
|
|
32
35
|
`,
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
'invitations/accept/route.ts': `import '${configImport}';
|
|
35
38
|
import { createVortexRoutes } from '@teamvortexsoftware/vortex-nextjs-15-sdk';
|
|
36
39
|
|
|
37
40
|
export const { POST } = createVortexRoutes().invitationsAccept;
|
|
38
41
|
`,
|
|
39
42
|
|
|
40
|
-
|
|
43
|
+
'invitations/by-group/[groupType]/[groupId]/route.ts': `import '${configImport}';
|
|
41
44
|
import { createVortexRoutes } from '@teamvortexsoftware/vortex-nextjs-15-sdk';
|
|
42
45
|
|
|
43
46
|
export const { GET, DELETE } = createVortexRoutes().invitationsByGroup;
|
|
44
47
|
`,
|
|
45
48
|
|
|
46
|
-
|
|
49
|
+
'invitations/[invitationId]/reinvite/route.ts': `import '${configImport}';
|
|
47
50
|
import { createVortexRoutes } from '@teamvortexsoftware/vortex-nextjs-15-sdk';
|
|
48
51
|
|
|
49
52
|
export const { POST } = createVortexRoutes().invitationReinvite;
|
|
50
53
|
`
|
|
51
|
-
};
|
|
54
|
+
};
|
|
55
|
+
}
|
|
52
56
|
|
|
53
57
|
const CONFIG_TEMPLATE = `import {
|
|
54
58
|
configureVortexLazy,
|
|
@@ -124,32 +128,42 @@ function main() {
|
|
|
124
128
|
process.exit(1);
|
|
125
129
|
}
|
|
126
130
|
|
|
127
|
-
// Check for app directory
|
|
128
|
-
|
|
129
|
-
|
|
131
|
+
// Check for app directory - support both root app/ and src/app/
|
|
132
|
+
let baseDir = '';
|
|
133
|
+
if (fs.existsSync('app')) {
|
|
134
|
+
baseDir = '';
|
|
135
|
+
console.log('✓ Found app directory at project root');
|
|
136
|
+
} else if (fs.existsSync('src/app')) {
|
|
137
|
+
baseDir = 'src';
|
|
138
|
+
console.log('✓ Found app directory in src/');
|
|
139
|
+
} else {
|
|
140
|
+
console.error('❌ This setup requires Next.js App Router. Please ensure you have an "app" or "src/app" directory.');
|
|
130
141
|
process.exit(1);
|
|
131
142
|
}
|
|
132
143
|
|
|
133
144
|
let filesCreated = 0;
|
|
134
145
|
|
|
135
146
|
// Create API routes
|
|
136
|
-
const apiDir = path.join('app', 'api', 'vortex');
|
|
147
|
+
const apiDir = path.join(baseDir, 'app', 'api', 'vortex');
|
|
137
148
|
createDirectory(apiDir);
|
|
138
149
|
|
|
150
|
+
const routeTemplates = createRouteTemplates(baseDir);
|
|
151
|
+
|
|
139
152
|
VORTEX_ROUTES.forEach(route => {
|
|
140
153
|
const filePath = path.join(apiDir, route);
|
|
141
154
|
const dirPath = path.dirname(filePath);
|
|
142
155
|
|
|
143
156
|
createDirectory(dirPath);
|
|
144
157
|
|
|
145
|
-
if (writeFileIfNotExists(filePath,
|
|
158
|
+
if (writeFileIfNotExists(filePath, routeTemplates[route])) {
|
|
146
159
|
filesCreated++;
|
|
147
160
|
}
|
|
148
161
|
});
|
|
149
162
|
|
|
150
163
|
// Create lib directory and config file
|
|
151
|
-
|
|
152
|
-
|
|
164
|
+
const libDir = baseDir ? path.join(baseDir, 'lib') : 'lib';
|
|
165
|
+
createDirectory(libDir);
|
|
166
|
+
const configPath = path.join(libDir, 'vortex-config.ts');
|
|
153
167
|
|
|
154
168
|
if (writeFileIfNotExists(configPath, CONFIG_TEMPLATE)) {
|
|
155
169
|
filesCreated++;
|
|
@@ -159,9 +173,14 @@ function main() {
|
|
|
159
173
|
console.log('\n📋 Next steps:');
|
|
160
174
|
console.log('1. Add your VORTEX_API_KEY to .env.local:');
|
|
161
175
|
console.log(' VORTEX_API_KEY=your_api_key_here');
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
176
|
+
|
|
177
|
+
const layoutPath = baseDir ? `${baseDir}/app/layout.tsx` : 'app/layout.tsx';
|
|
178
|
+
const configImportPath = baseDir ? '../lib/vortex-config' : '../lib/vortex-config';
|
|
179
|
+
const configFilePath = baseDir ? `${baseDir}/lib/vortex-config.ts` : 'lib/vortex-config.ts';
|
|
180
|
+
|
|
181
|
+
console.log(`2. Import the config in your ${layoutPath}:`);
|
|
182
|
+
console.log(` import '${configImportPath}';`);
|
|
183
|
+
console.log(`3. Implement the authenticateUser function in ${configFilePath}`);
|
|
165
184
|
console.log('4. Wrap your app in VortexProvider:');
|
|
166
185
|
console.log(' <VortexProvider config={{ apiBaseUrl: \'/api/vortex\' }}>');
|
|
167
186
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@teamvortexsoftware/vortex-nextjs-15-sdk",
|
|
3
3
|
"description": "Drop-in Next.js module for Vortex API integration",
|
|
4
4
|
"author": "@teamvortexsoftware",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.5",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"bin": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dev": "",
|
|
33
33
|
"test": "jest",
|
|
34
34
|
"package": "pnpm run build && cd dist/vortex-nextjs-15-sdk && npm pack",
|
|
35
|
-
"build": "tsc -b tsconfig.json"
|
|
35
|
+
"build": "cd ../vortex-node-22-sdk && pnpm run build && cd ../vortex-nextjs-15-sdk && tsc -b tsconfig.json"
|
|
36
36
|
},
|
|
37
37
|
"jest": {
|
|
38
38
|
"rootDir": "__tests__",
|