@nometria-ai/nom 0.2.8 → 0.2.9
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 +1 -1
- package/src/lib/config.js +1 -1
- package/src/lib/detect.js +28 -5
- package/src/lib/tar.js +7 -0
package/package.json
CHANGED
package/src/lib/config.js
CHANGED
|
@@ -7,7 +7,7 @@ import { join } from 'node:path';
|
|
|
7
7
|
const CONFIG_FILE = 'nometria.json';
|
|
8
8
|
|
|
9
9
|
const VALID_PLATFORMS = ['aws', 'gcp', 'azure', 'digitalocean', 'hetzner', 'vercel', 'render'];
|
|
10
|
-
const VALID_FRAMEWORKS = ['vite', 'nextjs', 'remix', 'static', 'node', 'deno'];
|
|
10
|
+
const VALID_FRAMEWORKS = ['vite', 'nextjs', 'remix', 'static', 'node', 'deno', 'expo', 'python'];
|
|
11
11
|
const VALID_INSTANCE_TYPES = ['2gb', '4gb', '8gb', '16gb', '32gb'];
|
|
12
12
|
|
|
13
13
|
export function readConfig(dir = process.cwd()) {
|
package/src/lib/detect.js
CHANGED
|
@@ -15,6 +15,13 @@ const DETECTORS = [
|
|
|
15
15
|
files: ['remix.config.js', 'remix.config.ts'],
|
|
16
16
|
build: { command: 'npm run build', output: 'build' },
|
|
17
17
|
},
|
|
18
|
+
{
|
|
19
|
+
framework: 'expo',
|
|
20
|
+
files: ['app.json', 'app.config.js', 'app.config.ts'],
|
|
21
|
+
build: { command: 'npx expo export --platform web', output: 'dist' },
|
|
22
|
+
// Only match if expo dependency is present (app.json is too generic)
|
|
23
|
+
requireDep: 'expo',
|
|
24
|
+
},
|
|
18
25
|
{
|
|
19
26
|
framework: 'vite',
|
|
20
27
|
files: ['vite.config.js', 'vite.config.ts', 'vite.config.mjs'],
|
|
@@ -37,13 +44,23 @@ export function detectFramework(dir = process.cwd()) {
|
|
|
37
44
|
} catch { /* ignore */ }
|
|
38
45
|
}
|
|
39
46
|
|
|
47
|
+
const deps = pkg ? { ...pkg.dependencies, ...pkg.devDependencies } : {};
|
|
48
|
+
const hasBuildScript = !!pkg?.scripts?.build;
|
|
49
|
+
|
|
40
50
|
// Check for framework config files
|
|
41
51
|
for (const detector of DETECTORS) {
|
|
52
|
+
// Skip detectors that require a specific dependency
|
|
53
|
+
if (detector.requireDep && !deps[detector.requireDep]) continue;
|
|
42
54
|
for (const file of detector.files) {
|
|
43
55
|
if (existsSync(join(dir, file))) {
|
|
56
|
+
const buildCmd = detector.build.command;
|
|
44
57
|
return {
|
|
45
58
|
framework: detector.framework,
|
|
46
|
-
build: {
|
|
59
|
+
build: {
|
|
60
|
+
// If build command is 'npm run build', verify the script actually exists
|
|
61
|
+
command: (buildCmd === 'npm run build' && !hasBuildScript) ? null : buildCmd,
|
|
62
|
+
output: detector.build.output,
|
|
63
|
+
},
|
|
47
64
|
};
|
|
48
65
|
}
|
|
49
66
|
}
|
|
@@ -51,10 +68,10 @@ export function detectFramework(dir = process.cwd()) {
|
|
|
51
68
|
|
|
52
69
|
// Check package.json dependencies
|
|
53
70
|
if (pkg) {
|
|
54
|
-
|
|
55
|
-
if (deps['
|
|
56
|
-
if (deps['
|
|
57
|
-
if (deps['vite']) return { framework: 'vite', build: { command: 'npm run build', output: 'dist' } };
|
|
71
|
+
if (deps['next']) return { framework: 'nextjs', build: { command: hasBuildScript ? 'npm run build' : null, output: '.next' } };
|
|
72
|
+
if (deps['@remix-run/node']) return { framework: 'remix', build: { command: hasBuildScript ? 'npm run build' : null, output: 'build' } };
|
|
73
|
+
if (deps['expo']) return { framework: 'expo', build: { command: 'npx expo export --platform web', output: 'dist' } };
|
|
74
|
+
if (deps['vite']) return { framework: 'vite', build: { command: hasBuildScript ? 'npm run build' : null, output: 'dist' } };
|
|
58
75
|
}
|
|
59
76
|
|
|
60
77
|
// Check if it looks like a Node.js project
|
|
@@ -62,6 +79,12 @@ export function detectFramework(dir = process.cwd()) {
|
|
|
62
79
|
return { framework: 'node', build: { command: null, output: '.' } };
|
|
63
80
|
}
|
|
64
81
|
|
|
82
|
+
// Check for Python projects
|
|
83
|
+
const pythonFiles = ['requirements.txt', 'pyproject.toml', 'Pipfile', 'setup.py', 'manage.py'];
|
|
84
|
+
if (pythonFiles.some(f => existsSync(join(dir, f)))) {
|
|
85
|
+
return { framework: 'python', build: { command: null, output: '.' } };
|
|
86
|
+
}
|
|
87
|
+
|
|
65
88
|
return { framework: 'static', build: { command: null, output: '.' } };
|
|
66
89
|
}
|
|
67
90
|
|
package/src/lib/tar.js
CHANGED