@launchframe/cli 1.0.3 → 1.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/package.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
const MODULE_CONFIG = {
|
|
3
3
|
ai: {
|
|
4
4
|
backend: {
|
|
5
|
-
files: ['src/
|
|
5
|
+
files: ['src/domain/ai'],
|
|
6
6
|
sections: {
|
|
7
|
-
'src/
|
|
7
|
+
'src/core/app/app.module.ts': ['EXTRA_MODULE_IMPORT', 'EXTRA_MODULE'],
|
|
8
8
|
},
|
|
9
9
|
dependencies: {
|
|
10
10
|
'@anthropic-ai/sdk': '^0.39.0',
|
|
@@ -20,30 +20,30 @@ const VARIANT_CONFIG = {
|
|
|
20
20
|
'multi-tenant': {
|
|
21
21
|
// Complete files/folders to copy
|
|
22
22
|
files: [
|
|
23
|
-
'src/
|
|
24
|
-
'src/guards/project-ownership.guard.ts', // Project ownership guard (header-based)
|
|
25
|
-
'src/guards/project-param.guard.ts', // Project param guard (route-based)
|
|
26
|
-
'src/
|
|
27
|
-
'src/
|
|
28
|
-
'src/
|
|
23
|
+
'src/domain/projects', // Entire projects module
|
|
24
|
+
'src/core/guards/project-ownership.guard.ts', // Project ownership guard (header-based)
|
|
25
|
+
'src/core/guards/project-param.guard.ts', // Project param guard (route-based)
|
|
26
|
+
'src/core/users/users.service.ts', // Users service with multi-tenant support
|
|
27
|
+
'src/core/users/users.controller.ts', // Users controller with multi-tenant support
|
|
28
|
+
'src/core/users/create-user.dto.ts' // CreateUserDto with businessId
|
|
29
29
|
],
|
|
30
30
|
|
|
31
31
|
// Code sections to insert into base template files
|
|
32
32
|
// Note: main.ts uses PRIMARY_DOMAIN env var for dynamic CORS - no sections needed
|
|
33
33
|
sections: {
|
|
34
|
-
'src/
|
|
34
|
+
'src/core/app/app.module.ts': [
|
|
35
35
|
'PROJECTS_MODULE_IMPORT', // Add ProjectsModule import
|
|
36
36
|
'PROJECTS_MODULE' // Add ProjectsModule to imports array
|
|
37
37
|
],
|
|
38
|
-
'src/
|
|
38
|
+
'src/core/auth/auth.module.ts': [
|
|
39
39
|
'MULTI_TENANT_IMPORTS', // Add Project entity import
|
|
40
40
|
'MULTI_TENANT_TYPEORM' // Add Project to TypeOrmModule
|
|
41
41
|
],
|
|
42
|
-
'src/
|
|
42
|
+
'src/core/users/user.entity.ts': [
|
|
43
43
|
'PROJECTS_RELATIONSHIP_IMPORT', // Add Project entity import
|
|
44
44
|
'PROJECTS_RELATIONSHIP' // Add projects relationship
|
|
45
45
|
],
|
|
46
|
-
'src/
|
|
46
|
+
'src/core/users/users.module.ts': [
|
|
47
47
|
'MULTI_TENANT_IMPORTS', // Add Projects-related imports
|
|
48
48
|
'MULTI_TENANT_ENTITIES', // Add Project entities to TypeORM
|
|
49
49
|
'MULTI_TENANT_MODULE_IMPORTS', // Add ProjectsModule to imports
|
|
@@ -56,25 +56,25 @@ const VARIANT_CONFIG = {
|
|
|
56
56
|
'b2b2c': {
|
|
57
57
|
// Complete files to copy
|
|
58
58
|
files: [
|
|
59
|
-
'src/
|
|
60
|
-
'src/
|
|
61
|
-
'src/
|
|
62
|
-
'src/
|
|
63
|
-
'src/
|
|
59
|
+
'src/core/users/user-business.entity.ts', // Business-to-user linking entity
|
|
60
|
+
'src/core/auth/auth-customer.ts', // Customer auth config (regular_user, customer_ cookie)
|
|
61
|
+
'src/core/auth/better-auth-customer.controller.ts', // Customer auth controller (/api/auth/customer)
|
|
62
|
+
'src/core/auth/auth.module.ts', // Auth module with customer controller
|
|
63
|
+
'src/core/auth/better-auth.guard.ts', // Guard handling both auth instances
|
|
64
64
|
],
|
|
65
65
|
|
|
66
66
|
// Code sections to insert
|
|
67
67
|
sections: {
|
|
68
|
-
'src/
|
|
68
|
+
'src/core/users/user.entity.ts': [
|
|
69
69
|
'B2B2C_IMPORTS', // Add UserBusiness import
|
|
70
70
|
'B2B2C_USER_ROLE', // Add REGULAR_USER enum value
|
|
71
71
|
'B2B2C_RELATIONSHIPS' // Add userBusinesses relationship
|
|
72
72
|
],
|
|
73
|
-
'src/
|
|
73
|
+
'src/core/users/users.module.ts': [
|
|
74
74
|
'B2B2C_IMPORTS', // Add UserBusiness import
|
|
75
75
|
'B2B2C_ENTITIES' // Add UserBusiness to TypeORM
|
|
76
76
|
],
|
|
77
|
-
'src/database/migrations/1764300000001-CreateSessionsTable.ts': [
|
|
77
|
+
'src/core/database/migrations/1764300000001-CreateSessionsTable.ts': [
|
|
78
78
|
'B2B2C_TENANT_COLUMN' // Add tenant_id column for session scoping
|
|
79
79
|
]
|
|
80
80
|
}
|
|
@@ -84,36 +84,28 @@ const VARIANT_CONFIG = {
|
|
|
84
84
|
'b2b2c_single-tenant': {
|
|
85
85
|
// Complete files to copy (B2B2C features without multi-tenant projects)
|
|
86
86
|
files: [
|
|
87
|
-
'src/guards/business-scoping.guard.ts', // Business scoping guard
|
|
88
|
-
'src/
|
|
89
|
-
'src/
|
|
90
|
-
'src/
|
|
91
|
-
'src/
|
|
92
|
-
'src/
|
|
93
|
-
'src/
|
|
94
|
-
'src/database/migrations/1766688416362-CreateBusinessesTable.ts', // Businesses table migration
|
|
95
|
-
'src/
|
|
96
|
-
'src/
|
|
97
|
-
'src/
|
|
98
|
-
'src/
|
|
99
|
-
'src/
|
|
100
|
-
'src/
|
|
101
|
-
'src/modules/auth/auth.controller.ts', // Auth controller with magic-link (B2B2C)
|
|
102
|
-
'src/modules/auth/auth.service.ts', // Auth service with magic-link (B2B2C)
|
|
103
|
-
'src/modules/auth/jwt-auth.guard.ts', // JWT authentication guard
|
|
104
|
-
'src/modules/users/user-business.entity.ts', // Business-to-user linking entity
|
|
105
|
-
'src/modules/users/users.module.ts', // Users module with Business entity
|
|
106
|
-
'src/modules/users/users.controller.ts', // Users controller (B2B2C)
|
|
107
|
-
'src/modules/users/users.service.ts', // Users service (B2B2C)
|
|
108
|
-
'src/modules/users/create-user.dto.ts' // CreateUserDto with businessId
|
|
87
|
+
'src/core/guards/business-scoping.guard.ts', // Business scoping guard
|
|
88
|
+
'src/domain/business/business.controller.ts', // Business lookup controller
|
|
89
|
+
'src/domain/business/business.service.ts', // Business lookup service
|
|
90
|
+
'src/domain/business/business.module.ts', // Business module
|
|
91
|
+
'src/domain/business/entities/business.entity.ts', // Business entity
|
|
92
|
+
'src/domain/business/dto/business-response.dto.ts', // Business response DTO
|
|
93
|
+
'src/domain/business/dto/create-business.dto.ts', // Business create DTO
|
|
94
|
+
'src/core/database/migrations/1766688416362-CreateBusinessesTable.ts', // Businesses table migration
|
|
95
|
+
'src/core/auth/auth.ts', // Better Auth config with Business entity
|
|
96
|
+
'src/core/users/user-business.entity.ts', // Business-to-user linking entity
|
|
97
|
+
'src/core/users/users.module.ts', // Users module with Business entity
|
|
98
|
+
'src/core/users/users.controller.ts', // Users controller (B2B2C)
|
|
99
|
+
'src/core/users/users.service.ts', // Users service (B2B2C)
|
|
100
|
+
'src/core/users/create-user.dto.ts' // CreateUserDto with businessId
|
|
109
101
|
],
|
|
110
102
|
|
|
111
103
|
sections: {
|
|
112
|
-
'src/
|
|
104
|
+
'src/core/app/app.module.ts': [
|
|
113
105
|
'BUSINESS_MODULE_IMPORT', // Import BusinessModule
|
|
114
106
|
'BUSINESS_MODULE' // Add BusinessModule to imports
|
|
115
107
|
],
|
|
116
|
-
'src/
|
|
108
|
+
'src/core/users/user.entity.ts': [
|
|
117
109
|
'BUSINESS_RELATIONSHIP_IMPORT', // Import Business entity
|
|
118
110
|
'BUSINESS_RELATIONSHIP' // Add business relationship
|
|
119
111
|
]
|
|
@@ -124,11 +116,11 @@ const VARIANT_CONFIG = {
|
|
|
124
116
|
'b2b2c_multi-tenant': {
|
|
125
117
|
// Complete files to copy (has both multi-tenant and B2B2C features)
|
|
126
118
|
files: [
|
|
127
|
-
'src/
|
|
128
|
-
'src/
|
|
129
|
-
'src/
|
|
130
|
-
'src/
|
|
131
|
-
'src/
|
|
119
|
+
'src/core/users/user-business.entity.ts', // Business-to-user linking entity
|
|
120
|
+
'src/core/auth/auth.ts', // Combined Better Auth config
|
|
121
|
+
'src/core/users/users.service.ts', // Combined users service
|
|
122
|
+
'src/core/users/users.controller.ts', // Combined users controller
|
|
123
|
+
'src/domain/projects/projects.module.ts' // Projects module with UserBusiness
|
|
132
124
|
],
|
|
133
125
|
|
|
134
126
|
// No sections needed - complete files already have all features
|
|
@@ -18,7 +18,7 @@ async function installModule(moduleName, moduleConfig) {
|
|
|
18
18
|
const serviceDir = path.join(cwd, serviceName);
|
|
19
19
|
|
|
20
20
|
// Copy files
|
|
21
|
-
for (const filePath of config.files) {
|
|
21
|
+
for (const filePath of (config.files || [])) {
|
|
22
22
|
const src = path.join(moduleFilesDir, filePath);
|
|
23
23
|
const dest = path.join(serviceDir, filePath);
|
|
24
24
|
console.log(` Adding ${filePath}`);
|
|
@@ -26,7 +26,7 @@ async function installModule(moduleName, moduleConfig) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
// Inject sections
|
|
29
|
-
for (const [targetFile, markerNames] of Object.entries(config.sections)) {
|
|
29
|
+
for (const [targetFile, markerNames] of Object.entries(config.sections || {})) {
|
|
30
30
|
const targetFilePath = path.join(serviceDir, targetFile);
|
|
31
31
|
const targetBasename = path.basename(targetFile);
|
|
32
32
|
|
|
@@ -34,7 +34,11 @@ async function installModule(moduleName, moduleConfig) {
|
|
|
34
34
|
const sectionFile = path.join(moduleSectionsDir, `${targetBasename}.${markerName}`);
|
|
35
35
|
console.log(` Injecting ${markerName} into ${targetFile}`);
|
|
36
36
|
const sectionContent = await fs.readFile(sectionFile, 'utf8');
|
|
37
|
-
|
|
37
|
+
try {
|
|
38
|
+
await replaceSection(targetFilePath, markerName, sectionContent);
|
|
39
|
+
} catch (err) {
|
|
40
|
+
console.warn(` ⚠ Skipping ${markerName} in ${targetFile}: ${err.message}`);
|
|
41
|
+
}
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
44
|
|