@xrystal/core 3.6.1 → 3.6.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 CHANGED
@@ -1 +1,14 @@
1
- ## **DOCUMENT**
1
+ ## **DOCUMENT**
2
+
3
+ # LOG Schema
4
+ '
5
+ service: this.serviceName,
6
+ level,
7
+
8
+ message,
9
+ ...rest,
10
+ timestamp: new Date().toISOString(),
11
+
12
+ id: id || null,
13
+ env: this.environment
14
+ '
@@ -2,7 +2,7 @@ import path from 'path'
2
2
 
3
3
  import { __filename, __dirname } from '../helpers/index.mjs'
4
4
 
5
- export const packageName = 'tmp-project-tool'
5
+ export const packageName = '@xrystal/core'
6
6
 
7
7
  export const tmpFileDefaultMainFolderName = 'x'
8
8
  export const tmpFileDefaultName = 'tmp'
package/bin/main-cli.js CHANGED
@@ -25,12 +25,21 @@ const packageManager = isBun ? "bun" : "npm"
25
25
  const setupCLI = async () => {
26
26
  const cli = new Command()
27
27
 
28
- let ownerTmpFilePath = findFileRecursively(".", tmpFileDefaultName, tmpFileDefaultExt)
29
-
30
28
  try {
29
+ let ownerTmpFilePath = findFileRecursively(".", tmpFileDefaultName, tmpFileDefaultExt)
30
+
31
31
  if (!ownerTmpFilePath) {
32
+ if (!defaultTmpFilePath || !fs.existsSync(defaultTmpFilePath)) {
33
+ throw new Error("Default template configuration file not found in package")
34
+ }
35
+
32
36
  const tmpFilePathBuffer = fs.readFileSync(defaultTmpFilePath)
33
- fs.mkdirSync(path.resolve(tmpFileDefaultMainFolderName), { recursive: true })
37
+ const folderPath = path.resolve(tmpFileDefaultMainFolderName || ".xrystal")
38
+
39
+ if (!fs.existsSync(folderPath)) {
40
+ fs.mkdirSync(folderPath, { recursive: true })
41
+ }
42
+
34
43
  fs.writeFileSync(defaultOwnerTmpFilePath, tmpFilePathBuffer)
35
44
  ownerTmpFilePath = defaultOwnerTmpFilePath
36
45
  }
@@ -38,7 +47,9 @@ const setupCLI = async () => {
38
47
  const ownerTmpFile = fs.readFileSync(ownerTmpFilePath, "utf8")
39
48
  const parsedTmpObject = yaml.parse(ownerTmpFile)
40
49
  const resolvedTmpObject = resolveObjWithHandlebars(parsedTmpObject, parsedTmpObject)
41
- const projectMainFolderPath = path.resolve(resolvedTmpObject.configs.mainFolderPath)
50
+
51
+ const mainPath = resolvedTmpObject?.configs?.mainFolderPath || "./source"
52
+ const projectMainFolderPath = path.resolve(mainPath)
42
53
 
43
54
  if (!fs.existsSync(projectMainFolderPath)) {
44
55
  fs.mkdirSync(projectMainFolderPath, { recursive: true })
@@ -48,6 +59,11 @@ const setupCLI = async () => {
48
59
  .command("create <project-name>")
49
60
  .description("Clone template from GitHub (Private/Public)")
50
61
  .action(async (projectName) => {
62
+ if (!projectName) {
63
+ console.log(chalk.red("❌ Error: Project name is required"))
64
+ process.exit(1)
65
+ }
66
+
51
67
  const targetPath = path.join(process.cwd(), projectName)
52
68
 
53
69
  if (fs.existsSync(targetPath)) {
@@ -86,7 +102,7 @@ const setupCLI = async () => {
86
102
  cli.parse(process.argv)
87
103
 
88
104
  } catch (error) {
89
- console.error(`${packageName} Initialization Error:`, error?.message)
105
+ console.error(`${packageName || "CLI"} Initialization Error:`, error?.message)
90
106
  }
91
107
  }
92
108
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Yusuf Yasir KAYGUSUZ",
3
3
  "name": "@xrystal/core",
4
- "version": "3.6.1",
4
+ "version": "3.6.5",
5
5
  "description": "Project core for xrystal",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -69,7 +69,8 @@ export default class LoggerService {
69
69
  winston = winston.createLogger({
70
70
  level: "debug",
71
71
  levels: customLevels,
72
- transports: [new winston.transports.Console({ format: this.getConsoleFormat() })]
72
+ format: this.getConsoleFormat(),
73
+ transports: [new winston.transports.Console()]
73
74
  });
74
75
  constructor() {
75
76
  winston.addColors(customColors);
@@ -118,7 +119,9 @@ export default class LoggerService {
118
119
  const tracing = this.getTracingFormat();
119
120
  const jsonFileFormat = combine(tracing, timestamp({ format: "YYYY-MM-DD HH:mm:ss" }), errors({ stack: true }), json({ replacer: this.safeReplacer }));
120
121
  const transports = [
121
- new winston.transports.Console({ format: this.getConsoleFormat() }),
122
+ new winston.transports.Console({
123
+ format: this.getConsoleFormat()
124
+ }),
122
125
  new winston.transports.DailyRotateFile({
123
126
  filename: path.resolve(loadPath, "error", "%DATE%_error.log"),
124
127
  level: "error",
@@ -140,6 +143,7 @@ export default class LoggerService {
140
143
  this.winston = winston.createLogger({
141
144
  level: loggerLevel,
142
145
  levels: customLevels,
146
+ format: tracing,
143
147
  transports
144
148
  });
145
149
  return this.winston;
@@ -153,13 +157,13 @@ export default class LoggerService {
153
157
  topic: this.kafkaTopic,
154
158
  messages: [{
155
159
  value: JSON.stringify({
156
- id: id || null,
157
- timestamp: new Date().toISOString(),
158
160
  service: this.serviceName,
159
- env: this.environment,
160
161
  level,
161
162
  message,
162
- ...rest
163
+ ...rest,
164
+ timestamp: new Date().toISOString(),
165
+ id: id || null,
166
+ env: this.environment
163
167
  }, this.safeReplacer)
164
168
  }]
165
169
  });
@@ -1,25 +0,0 @@
1
- FROM oven/bun:1.1-alpine AS builder
2
-
3
- WORKDIR /app
4
-
5
- COPY package.json bun.lockb* ./
6
- RUN bun install --frozen-lockfile
7
-
8
- COPY . .
9
-
10
- RUN bun run build:prod
11
-
12
- FROM oven/bun:1.1-alpine
13
-
14
- ENV NODE_ENV=production
15
-
16
- WORKDIR /lib/xrystal-core
17
-
18
- COPY --from=builder /app/source ./source
19
- COPY --from=builder /app/bin ./bin
20
- COPY --from=builder /app/x ./x
21
- RUN rm -rf ./x/dist && ls -la ./x
22
- COPY --from=builder /app/package.json ./package.json
23
- COPY --from=builder /app/bun.lockb* ./
24
-
25
- RUN bun install --production
File without changes
File without changes