@volcanicminds/backend 0.9.2 → 0.9.3
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 +2 -2
- package/combine.js +124 -0
- package/dist/package.json +3 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -268,11 +268,11 @@ module.exports = {
|
|
|
268
268
|
version: false, // swagger
|
|
269
269
|
response: {
|
|
270
270
|
200: {
|
|
271
|
-
description: 'Successful response',
|
|
271
|
+
$description: 'Successful response',
|
|
272
272
|
type: 'object',
|
|
273
273
|
properties: {
|
|
274
274
|
id: { type: 'number' }
|
|
275
|
-
}
|
|
275
|
+
}$
|
|
276
276
|
}
|
|
277
277
|
} // swagger
|
|
278
278
|
}
|
package/combine.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
|
|
4
|
+
const MAIN_DIRECTORY = './'
|
|
5
|
+
const INCLUDE_FILES = ['package.json', 'tsconfig.json', 'README.md', '.nvmrc', 'index.ts', 'index.d.ts']
|
|
6
|
+
const SUB_DIRECTORIES = ['lib', 'types']
|
|
7
|
+
const OUTPUT_FILE = 'OUTPUT.md'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Recursively collects .js and .ts files from a given directory.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} directory - _The directory to scan recursively._
|
|
13
|
+
* @returns {Array<{ relativePath: string }>} - _List of file objects with relative paths._
|
|
14
|
+
*/
|
|
15
|
+
const getFilesFromDirectory = (directory) => {
|
|
16
|
+
let filesList = []
|
|
17
|
+
const items = fs.readdirSync(directory)
|
|
18
|
+
|
|
19
|
+
items.forEach((item) => {
|
|
20
|
+
const itemPath = path.join(directory, item)
|
|
21
|
+
const stats = fs.statSync(itemPath)
|
|
22
|
+
|
|
23
|
+
if (stats.isDirectory()) {
|
|
24
|
+
filesList = filesList.concat(getFilesFromDirectory(itemPath))
|
|
25
|
+
} else if (
|
|
26
|
+
item.endsWith('.html') ||
|
|
27
|
+
item.endsWith('.vue') ||
|
|
28
|
+
item.endsWith('.css') ||
|
|
29
|
+
item.endsWith('.json') ||
|
|
30
|
+
item.endsWith('.js') ||
|
|
31
|
+
item.endsWith('.ts') ||
|
|
32
|
+
item.endsWith('.md')
|
|
33
|
+
) {
|
|
34
|
+
filesList.push({ relativePath: path.relative(MAIN_DIRECTORY, itemPath) })
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
return filesList
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Retrieves files from the specified subdirectories.
|
|
43
|
+
*
|
|
44
|
+
* @returns {Object} - _Object containing individual subdirectory files and a combined list._
|
|
45
|
+
*/
|
|
46
|
+
const getFilesFromSubDirectories = () => {
|
|
47
|
+
const subDirectoryFiles = {}
|
|
48
|
+
let combinedFiles = []
|
|
49
|
+
|
|
50
|
+
SUB_DIRECTORIES.forEach((dir) => {
|
|
51
|
+
const files = getFilesFromDirectory(dir)
|
|
52
|
+
subDirectoryFiles[dir] = files
|
|
53
|
+
combinedFiles = combinedFiles.concat(files)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
return { subDirectoryFiles, combinedFiles }
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function generateMarkdown() {
|
|
60
|
+
const rootFiles = fs
|
|
61
|
+
.readdirSync(MAIN_DIRECTORY)
|
|
62
|
+
.filter(
|
|
63
|
+
(file) =>
|
|
64
|
+
file.endsWith('.html') ||
|
|
65
|
+
(file.endsWith('.ts') && file !== 'combine.ts') ||
|
|
66
|
+
(file.endsWith('.js') && file !== 'combine.js') ||
|
|
67
|
+
INCLUDE_FILES.includes(file)
|
|
68
|
+
)
|
|
69
|
+
.map((file) => ({ relativePath: file }))
|
|
70
|
+
|
|
71
|
+
const { subDirectoryFiles, combinedFiles } = getFilesFromSubDirectories()
|
|
72
|
+
const allFiles = [...rootFiles, ...combinedFiles]
|
|
73
|
+
const currentISOString = new Date().toISOString()
|
|
74
|
+
|
|
75
|
+
const markdownLines = []
|
|
76
|
+
markdownLines.push('# Full Project - Updated At ' + currentISOString, '')
|
|
77
|
+
markdownLines.push('Below are all the files, materials and documentation of the project to analyze.', '')
|
|
78
|
+
markdownLines.push('```bash')
|
|
79
|
+
markdownLines.push('./')
|
|
80
|
+
|
|
81
|
+
rootFiles.forEach((file) => {
|
|
82
|
+
markdownLines.push(`├── ${file.relativePath}`)
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
if (SUB_DIRECTORIES.length > 0) {
|
|
86
|
+
SUB_DIRECTORIES.forEach((dir) => {
|
|
87
|
+
markdownLines.push(`├── ${dir}`)
|
|
88
|
+
|
|
89
|
+
const sortedSubFiles = subDirectoryFiles[dir].sort((a, b) => a.relativePath.localeCompare(b.relativePath))
|
|
90
|
+
sortedSubFiles.forEach((file) => {
|
|
91
|
+
const displayPath = file.relativePath.replace(new RegExp(`^(${SUB_DIRECTORIES.join('|')})[\\\\/]`), '')
|
|
92
|
+
markdownLines.push(` ├── ${displayPath}`)
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
markdownLines.push('```', '')
|
|
97
|
+
|
|
98
|
+
markdownLines.push('## Source Files Index', '')
|
|
99
|
+
allFiles.forEach((file) => {
|
|
100
|
+
const filePath = file.relativePath
|
|
101
|
+
|
|
102
|
+
const slug = filePath.replace(/[\/.]/g, '-')
|
|
103
|
+
markdownLines.push(`- [${filePath}](#file-${slug})`)
|
|
104
|
+
})
|
|
105
|
+
markdownLines.push('')
|
|
106
|
+
|
|
107
|
+
for (const file of allFiles) {
|
|
108
|
+
const filePath = file.relativePath
|
|
109
|
+
const fullPath = path.join(MAIN_DIRECTORY, filePath)
|
|
110
|
+
|
|
111
|
+
const language = filePath.endsWith('.md') ? 'markdown' : filePath.endsWith('.ts') ? 'typescript' : 'javascript'
|
|
112
|
+
|
|
113
|
+
const fileContent = fs.readFileSync(fullPath, 'utf-8')
|
|
114
|
+
markdownLines.push(`## File: ${filePath}`, '')
|
|
115
|
+
markdownLines.push('```' + language)
|
|
116
|
+
markdownLines.push(fileContent)
|
|
117
|
+
markdownLines.push('```', '')
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
fs.writeFileSync(OUTPUT_FILE, markdownLines.join('\n'))
|
|
121
|
+
console.log(`Markdown file generated: ${OUTPUT_FILE}`)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
generateMarkdown()
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volcanicminds/backend",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"codename": "turin",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "The volcanic (minds) backend",
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"test:full": "cross-env PORT=2231 NODE_ENV=memory BROWSER=false mocha ./test/index.spec.ts -t 100000",
|
|
49
49
|
"reset": "yarn && yarn up && yarn compile",
|
|
50
50
|
"upgrade-deps": "yarn upgrade-interactive",
|
|
51
|
-
"upgrade-pkg": "yarn npm-upgrade"
|
|
51
|
+
"upgrade-pkg": "yarn npm-upgrade",
|
|
52
|
+
"combine": "node combine.js"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
55
|
"@apollo/server": "^4.11.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volcanicminds/backend",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"codename": "turin",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "The volcanic (minds) backend",
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"test:full": "cross-env PORT=2231 NODE_ENV=memory BROWSER=false mocha ./test/index.spec.ts -t 100000",
|
|
49
49
|
"reset": "yarn && yarn up && yarn compile",
|
|
50
50
|
"upgrade-deps": "yarn upgrade-interactive",
|
|
51
|
-
"upgrade-pkg": "yarn npm-upgrade"
|
|
51
|
+
"upgrade-pkg": "yarn npm-upgrade",
|
|
52
|
+
"combine": "node combine.js"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
55
|
"@apollo/server": "^4.11.0",
|