odoro 0.1.0 → 0.1.2
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/cli.js
CHANGED
|
@@ -130,7 +130,7 @@ function rootFrom(flags, positional) {
|
|
|
130
130
|
async function run(argv) {
|
|
131
131
|
const { command, positional, flags } = parseArgs(argv);
|
|
132
132
|
if (flags["version"] === true) {
|
|
133
|
-
const manifest = await import('./package-
|
|
133
|
+
const manifest = await import('./package-E26GKHFT.js');
|
|
134
134
|
console.log(manifest.default.version);
|
|
135
135
|
return 0;
|
|
136
136
|
}
|
|
@@ -141,7 +141,7 @@ async function run(argv) {
|
|
|
141
141
|
switch (command) {
|
|
142
142
|
case "create":
|
|
143
143
|
case "new": {
|
|
144
|
-
const { createCommand } = await import('./create-
|
|
144
|
+
const { createCommand } = await import('./create-Z3TSGBE6.js');
|
|
145
145
|
const options = {};
|
|
146
146
|
if (positional[0] !== void 0) options.name = positional[0];
|
|
147
147
|
if (typeof flags["template"] === "string") options.template = flags["template"];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { writeDatabaseUrl, assertEnvIgnored, PROVIDER_PENDING, checkDatabaseUrl } from './chunk-PEMYUK2D.js';
|
|
3
3
|
import { execSync } from 'child_process';
|
|
4
|
-
import { existsSync, statSync, readdirSync } from 'fs';
|
|
4
|
+
import { existsSync, statSync, readdirSync, readFileSync } from 'fs';
|
|
5
5
|
import { resolve, basename, dirname, join } from 'path';
|
|
6
6
|
import * as prompts from '@clack/prompts';
|
|
7
7
|
import colors from 'picocolors';
|
|
@@ -56,6 +56,15 @@ function availableTemplates(root = templatesRoot()) {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// src/scaffold/scaffold.ts
|
|
59
|
+
function cliVersion() {
|
|
60
|
+
try {
|
|
61
|
+
const manifeste = join(dirname(templatesRoot()), "package.json");
|
|
62
|
+
const { version } = JSON.parse(readFileSync(manifeste, "utf8"));
|
|
63
|
+
return version;
|
|
64
|
+
} catch {
|
|
65
|
+
return "latest";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
59
68
|
async function copyDirectory(from, to, written, prefix = "") {
|
|
60
69
|
await mkdir(to, { recursive: true });
|
|
61
70
|
for (const entry of await readdir(from, { withFileTypes: true })) {
|
|
@@ -71,11 +80,27 @@ async function copyDirectory(from, to, written, prefix = "") {
|
|
|
71
80
|
written.push(relativePath);
|
|
72
81
|
}
|
|
73
82
|
}
|
|
74
|
-
|
|
83
|
+
function isOdoroPackage(name) {
|
|
84
|
+
return name === "odoro" || name.startsWith("@odoro-cli/");
|
|
85
|
+
}
|
|
86
|
+
function alignOdoroVersions(manifest, version) {
|
|
87
|
+
const aligned = { ...manifest };
|
|
88
|
+
for (const field of ["dependencies", "devDependencies", "peerDependencies"]) {
|
|
89
|
+
const deps = aligned[field];
|
|
90
|
+
if (typeof deps !== "object" || deps === null) continue;
|
|
91
|
+
const next = {};
|
|
92
|
+
for (const [name, range] of Object.entries(deps)) {
|
|
93
|
+
next[name] = isOdoroPackage(name) ? version === "latest" ? "latest" : `^${version}` : range;
|
|
94
|
+
}
|
|
95
|
+
aligned[field] = next;
|
|
96
|
+
}
|
|
97
|
+
return aligned;
|
|
98
|
+
}
|
|
99
|
+
async function renamePackage(target, packageName, version) {
|
|
75
100
|
const file = join(target, "package.json");
|
|
76
101
|
if (!existsSync(file)) return;
|
|
77
102
|
const manifest = JSON.parse(await readFile(file, "utf8"));
|
|
78
|
-
const renamed = { ...manifest, name: packageName };
|
|
103
|
+
const renamed = alignOdoroVersions({ ...manifest, name: packageName }, version);
|
|
79
104
|
await writeFile(file, `${JSON.stringify(renamed, null, 2)}
|
|
80
105
|
`, "utf8");
|
|
81
106
|
}
|
|
@@ -93,7 +118,11 @@ async function scaffold(options) {
|
|
|
93
118
|
}
|
|
94
119
|
const files = [];
|
|
95
120
|
await copyDirectory(source, options.target, files);
|
|
96
|
-
await renamePackage(
|
|
121
|
+
await renamePackage(
|
|
122
|
+
options.target,
|
|
123
|
+
options.packageName,
|
|
124
|
+
options.version ?? cliVersion()
|
|
125
|
+
);
|
|
97
126
|
return { files };
|
|
98
127
|
}
|
|
99
128
|
|
package/package.json
CHANGED
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"typecheck": "tsc --noEmit"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@odoro-cli/libs": "
|
|
13
|
+
"@odoro-cli/libs": "latest",
|
|
14
14
|
"react": "^19.2.0",
|
|
15
15
|
"react-dom": "^19.2.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/react": "^19.2.2",
|
|
19
19
|
"@types/react-dom": "^19.2.1",
|
|
20
|
-
"odoro": "
|
|
20
|
+
"odoro": "latest",
|
|
21
21
|
"typescript": "^5.9.3"
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"typecheck": "tsc --noEmit && tsc --noEmit -p server/tsconfig.json"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@odoro-cli/libs": "
|
|
17
|
-
"@odoro-cli/server": "
|
|
16
|
+
"@odoro-cli/libs": "latest",
|
|
17
|
+
"@odoro-cli/server": "latest",
|
|
18
18
|
"express": "^5.1.0",
|
|
19
19
|
"react": "^19.2.0",
|
|
20
20
|
"react-dom": "^19.2.0",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@types/node": "^22.18.8",
|
|
26
26
|
"@types/react": "^19.2.2",
|
|
27
27
|
"@types/react-dom": "^19.2.1",
|
|
28
|
-
"odoro": "
|
|
28
|
+
"odoro": "latest",
|
|
29
29
|
"pino-pretty": "^13.0.0",
|
|
30
30
|
"tsx": "^4.20.6",
|
|
31
31
|
"typescript": "^5.9.3"
|