@superblocksteam/ai-service-templates 2.0.26-next.0 → 2.0.26-next.10

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.
Files changed (2) hide show
  1. package/package.json +3 -4
  2. package/scripts/build.js +48 -54
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@superblocksteam/ai-service-templates",
3
- "version": "2.0.26-next.0",
3
+ "version": "2.0.26-next.10",
4
4
  "type": "module",
5
- "dependencies": {},
6
5
  "exports": {
7
6
  "./reify-template": {
8
7
  "types": "./reify-template.d.ts",
@@ -20,8 +19,8 @@
20
19
  ],
21
20
  "devDependencies": {
22
21
  "@types/node": "^22.15.17",
23
- "vitest": "^3.2.0",
24
- "vite": "^6.2.3"
22
+ "vite": "^6.2.3",
23
+ "vitest": "^3.2.0"
25
24
  },
26
25
  "publishConfig": {
27
26
  "registry": "https://registry.npmjs.org"
package/scripts/build.js CHANGED
@@ -1,25 +1,17 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import { fileURLToPath } from 'url';
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { fileURLToPath } from "url";
4
4
 
5
5
  const __filename = fileURLToPath(import.meta.url);
6
6
  const __dirname = path.dirname(__filename);
7
7
 
8
- const packageDir = path.join(__dirname, '..');
9
- const outputFile = path.join(packageDir, 'templates.js');
8
+ const packageDir = path.join(__dirname, "..");
9
+ const outputFile = path.join(packageDir, "templates.js");
10
10
  const subdirectoriesData = {};
11
11
 
12
- const deniedSubdirectories = [
13
- "node_modules",
14
- "scripts",
15
- "test",
16
- ];
12
+ const deniedSubdirectories = ["node_modules", "scripts", "test"];
17
13
 
18
- const deniedFileExtensions = [
19
- ".test.ts",
20
- ".gitkeep",
21
- ".md"
22
- ];
14
+ const deniedFileExtensions = [".test.ts", ".gitkeep", ".md"];
23
15
 
24
16
  /**
25
17
  * Recursively collects files and their content from a directory.
@@ -28,56 +20,58 @@ const deniedFileExtensions = [
28
20
  * @param {object} filesMap - The object to store file paths and content.
29
21
  */
30
22
  function collectFiles(currentDirPath, basePathForRelative, filesMap) {
31
- const entries = fs.readdirSync(currentDirPath);
32
- for (const entry of entries) {
33
- const fullPath = path.join(currentDirPath, entry);
34
- const stat = fs.statSync(fullPath);
23
+ const entries = fs.readdirSync(currentDirPath);
24
+ for (const entry of entries) {
25
+ const fullPath = path.join(currentDirPath, entry);
26
+ const stat = fs.statSync(fullPath);
35
27
 
36
- if (stat.isFile()) {
37
- // Skip thebuild script itself or the output file.
38
- if (fullPath === __filename || fullPath === outputFile) {
39
- continue;
40
- }
41
- // Skip files with denied extensions.
42
- if (deniedFileExtensions.some(ext => entry.endsWith(ext))) {
43
- continue;
44
- }
45
- // Store paths relative to the subdirectory's root.
46
- const relativePath = path.relative(basePathForRelative, fullPath);
47
- const content = fs.readFileSync(fullPath, 'utf8');
48
- filesMap[relativePath] = content;
49
- } else if (stat.isDirectory()) {
50
- // Standard directories to ignore during recursion.
51
- if (deniedSubdirectories.includes(entry) || entry.startsWith('.')) {
52
- continue;
53
- }
54
- collectFiles(fullPath, basePathForRelative, filesMap); // Recurse
55
- }
28
+ if (stat.isFile()) {
29
+ // Skip thebuild script itself or the output file.
30
+ if (fullPath === __filename || fullPath === outputFile) {
31
+ continue;
32
+ }
33
+ // Skip files with denied extensions.
34
+ if (deniedFileExtensions.some((ext) => entry.endsWith(ext))) {
35
+ continue;
36
+ }
37
+ // Store paths relative to the subdirectory's root.
38
+ const relativePath = path.relative(basePathForRelative, fullPath);
39
+ const content = fs.readFileSync(fullPath, "utf8");
40
+ filesMap[relativePath] = content;
41
+ } else if (stat.isDirectory()) {
42
+ // Standard directories to ignore during recursion.
43
+ if (deniedSubdirectories.includes(entry) || entry.startsWith(".")) {
44
+ continue;
45
+ }
46
+ collectFiles(fullPath, basePathForRelative, filesMap); // Recurse
56
47
  }
48
+ }
57
49
  }
58
50
 
59
51
  // Iterate over items in the package directory to find subdirectories.
60
52
  const topLevelEntries = fs.readdirSync(packageDir);
61
53
  for (const entryName of topLevelEntries) {
62
- const entryPath = path.join(packageDir, entryName);
63
- const stat = fs.statSync(entryPath);
54
+ const entryPath = path.join(packageDir, entryName);
55
+ const stat = fs.statSync(entryPath);
64
56
 
65
- // Process only directories, ignoring hidden ones,
66
- // AND check against the denylist.
67
- if (
68
- stat.isDirectory() &&
69
- !entryName.startsWith('.') &&
70
- !deniedSubdirectories.includes(entryName)
71
- ) {
72
- subdirectoriesData[entryName] = {};
73
- // The base for relative paths is the subdirectory itself.
74
- collectFiles(entryPath, entryPath, subdirectoriesData[entryName]);
75
- }
57
+ // Process only directories, ignoring hidden ones,
58
+ // AND check against the denylist.
59
+ if (
60
+ stat.isDirectory() &&
61
+ !entryName.startsWith(".") &&
62
+ !deniedSubdirectories.includes(entryName)
63
+ ) {
64
+ subdirectoriesData[entryName] = {};
65
+ // The base for relative paths is the subdirectory itself.
66
+ collectFiles(entryPath, entryPath, subdirectoriesData[entryName]);
67
+ }
76
68
  }
77
69
 
78
70
  const outputContent = `// This file is auto-generated by the build script. Do not edit directly.
79
71
  export const templates = ${JSON.stringify(subdirectoriesData, null, 2)};
80
72
  `;
81
73
 
82
- fs.writeFileSync(outputFile, outputContent, 'utf8');
83
- console.log(`Successfully generated ${path.relative(process.cwd(), outputFile)}`);
74
+ fs.writeFileSync(outputFile, outputContent, "utf8");
75
+ console.log(
76
+ `Successfully generated ${path.relative(process.cwd(), outputFile)}`,
77
+ );