@digicroz/node-backend-kit 1.0.0 → 1.0.1
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/b2fPortalV3/b2fPortal.js +12 -10
- package/dist/types.d.ts +1 -0
- package/dist/utils/loadConfig.js +7 -0
- package/package.json +2 -2
|
@@ -125,14 +125,16 @@ export const b2fPortalInit = async (b2fPortalProjects) => {
|
|
|
125
125
|
});
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
|
-
const
|
|
129
|
-
if (!fs.existsSync(
|
|
128
|
+
const repositoryBackedPortalDirPath = join(repositoryPath, section.repository.dirPath || "b2fPortal");
|
|
129
|
+
if (!fs.existsSync(repositoryBackedPortalDirPath)) {
|
|
130
130
|
console.log("repositoryBackedPortalPath does not exist");
|
|
131
|
-
console.log({
|
|
131
|
+
console.log({
|
|
132
|
+
repositoryBackedPortalPath: repositoryBackedPortalDirPath,
|
|
133
|
+
});
|
|
132
134
|
return;
|
|
133
135
|
}
|
|
134
|
-
const repositoryDistTrpcApiPath = join(
|
|
135
|
-
const repositoryPrismaClientPath = join(
|
|
136
|
+
const repositoryDistTrpcApiPath = join(repositoryBackedPortalDirPath, sectionDistTrpcApiPath.replace(clientRootDirPath, ""));
|
|
137
|
+
const repositoryPrismaClientPath = join(repositoryBackedPortalDirPath, projectPrismaClientPath.replace(clientRootDirPath, ""));
|
|
136
138
|
createModuleFiles(sectionSrcTrpcApiModulePath);
|
|
137
139
|
// create zod files
|
|
138
140
|
createZodFiles(sectionSrcTrpcApiModulePath);
|
|
@@ -145,25 +147,25 @@ export const b2fPortalInit = async (b2fPortalProjects) => {
|
|
|
145
147
|
console.warn(error);
|
|
146
148
|
}
|
|
147
149
|
// sync serverB2f
|
|
148
|
-
const repositoryServerB2fPath = join(
|
|
150
|
+
const repositoryServerB2fPath = join(repositoryBackedPortalDirPath, "serverB2f");
|
|
149
151
|
await syncFilesAndFolders({
|
|
150
152
|
sourceDirPath: serverB2fPath,
|
|
151
153
|
targetDirPath: repositoryServerB2fPath,
|
|
152
154
|
});
|
|
153
155
|
// sync projectB2f
|
|
154
|
-
const repositoryProjectB2fPath = join(
|
|
156
|
+
const repositoryProjectB2fPath = join(repositoryBackedPortalDirPath, "projectB2f");
|
|
155
157
|
await syncFilesAndFolders({
|
|
156
158
|
sourceDirPath: projectB2fPath,
|
|
157
159
|
targetDirPath: repositoryProjectB2fPath,
|
|
158
160
|
});
|
|
159
161
|
// sync section common
|
|
160
|
-
const repositorySectionB2fPath = join(
|
|
162
|
+
const repositorySectionB2fPath = join(repositoryBackedPortalDirPath, section.sectionName, "sectionB2f");
|
|
161
163
|
await syncFilesAndFolders({
|
|
162
164
|
sourceDirPath: sectionB2fPath,
|
|
163
165
|
targetDirPath: repositorySectionB2fPath,
|
|
164
166
|
});
|
|
165
167
|
// sync zod schemas
|
|
166
|
-
const repositoryTrpcApiPath = join(
|
|
168
|
+
const repositoryTrpcApiPath = join(repositoryBackedPortalDirPath, section.sectionName, "trpcApi");
|
|
167
169
|
await syncFilesAndFolders({
|
|
168
170
|
sourceDirPath: sectionSrcTrpcApiPath,
|
|
169
171
|
targetDirPath: repositoryTrpcApiPath,
|
|
@@ -187,7 +189,7 @@ export const b2fPortalInit = async (b2fPortalProjects) => {
|
|
|
187
189
|
});
|
|
188
190
|
if (section.needNextJsPatch) {
|
|
189
191
|
// console.log("Next Js Patch started");
|
|
190
|
-
const tsFiles = getTsFiles(
|
|
192
|
+
const tsFiles = getTsFiles(repositoryBackedPortalDirPath);
|
|
191
193
|
tsFiles.forEach((filePath) => {
|
|
192
194
|
updateImports(filePath);
|
|
193
195
|
});
|
package/dist/types.d.ts
CHANGED
package/dist/utils/loadConfig.js
CHANGED
|
@@ -186,6 +186,13 @@ function validateSection(section, projectName, index) {
|
|
|
186
186
|
if (!section.repository.path) {
|
|
187
187
|
throw new Error(`Section "${section.sectionName}" in project "${projectName}" has repository missing "path"`);
|
|
188
188
|
}
|
|
189
|
+
// Optional fields with defaults
|
|
190
|
+
if (!section.repository.dirPath) {
|
|
191
|
+
section.repository.dirPath = "b2fPortal";
|
|
192
|
+
}
|
|
193
|
+
else if (typeof section.repository.dirPath !== "string") {
|
|
194
|
+
throw new Error(`Section "${section.sectionName}" in project "${projectName}" has invalid "dirPath" in repository. Must be a string.`);
|
|
195
|
+
}
|
|
189
196
|
if (!section.localPath) {
|
|
190
197
|
throw new Error(`Section "${section.sectionName}" in project "${projectName}" is missing "localPath"`);
|
|
191
198
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digicroz/node-backend-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "NodeJS Backend Kit - A powerful TypeScript utility for managing backend projects with features like B2F Portal integration, cross-project validation, and Next.js support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -77,4 +77,4 @@
|
|
|
77
77
|
"rimraf": "^6.0.1",
|
|
78
78
|
"simple-git": "^3.27.0"
|
|
79
79
|
}
|
|
80
|
-
}
|
|
80
|
+
}
|