odoro 0.1.0
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/LICENSE +12 -0
- package/client.d.ts +84 -0
- package/dist/build-SNTGJH2J.js +4 -0
- package/dist/chunk-2YDI5NKV.js +55 -0
- package/dist/chunk-G2WW7N4C.js +1872 -0
- package/dist/chunk-G5QXVBYT.js +1139 -0
- package/dist/chunk-JMEHF3KN.js +35 -0
- package/dist/chunk-PEMYUK2D.js +64 -0
- package/dist/chunk-T42X2NJN.js +98 -0
- package/dist/chunk-T6RLHSCW.js +123 -0
- package/dist/chunk-UGRSODHU.js +154 -0
- package/dist/cli.d.ts +40 -0
- package/dist/cli.js +236 -0
- package/dist/commands-FVAHVVVN.js +793 -0
- package/dist/commands-V44Y5G4F.js +245 -0
- package/dist/create-SH2M722Y.js +288 -0
- package/dist/index.d.ts +354 -0
- package/dist/index.js +7 -0
- package/dist/package-AUINPBEX.js +62 -0
- package/dist/preview-LOAO5Y6V.js +3 -0
- package/dist/registry/index.d.ts +316 -0
- package/dist/registry/index.js +2 -0
- package/dist/server-MZ76LPAG.js +3 -0
- package/package.json +57 -0
- package/templates/react-ts/README.md +52 -0
- package/templates/react-ts/_gitignore +8 -0
- package/templates/react-ts/index.html +13 -0
- package/templates/react-ts/odoro.config.ts +10 -0
- package/templates/react-ts/package.json +23 -0
- package/templates/react-ts/public/favicon.svg +4 -0
- package/templates/react-ts/src/App.tsx +66 -0
- package/templates/react-ts/src/main.tsx +18 -0
- package/templates/react-ts/src/odoro-env.d.ts +1 -0
- package/templates/react-ts/src/routes/About.tsx +19 -0
- package/templates/react-ts/src/routes/Home.tsx +80 -0
- package/templates/react-ts/src/routes/NotFound.tsx +14 -0
- package/templates/react-ts/src/styles.css +13 -0
- package/templates/react-ts/tsconfig.json +25 -0
- package/templates/react-ts-server/Dockerfile +51 -0
- package/templates/react-ts-server/README.md +87 -0
- package/templates/react-ts-server/_dockerignore +8 -0
- package/templates/react-ts-server/_env.example +78 -0
- package/templates/react-ts-server/_gitignore +8 -0
- package/templates/react-ts-server/client/index.html +13 -0
- package/templates/react-ts-server/client/public/favicon.svg +4 -0
- package/templates/react-ts-server/client/src/App.tsx +66 -0
- package/templates/react-ts-server/client/src/main.tsx +18 -0
- package/templates/react-ts-server/client/src/odoro-env.d.ts +1 -0
- package/templates/react-ts-server/client/src/routes/About.tsx +19 -0
- package/templates/react-ts-server/client/src/routes/Home.tsx +148 -0
- package/templates/react-ts-server/client/src/routes/NotFound.tsx +14 -0
- package/templates/react-ts-server/client/src/styles.css +13 -0
- package/templates/react-ts-server/odoro.config.ts +21 -0
- package/templates/react-ts-server/package.json +33 -0
- package/templates/react-ts-server/scripts/dev.mjs +74 -0
- package/templates/react-ts-server/server/src/main.ts +131 -0
- package/templates/react-ts-server/server/src/modules/health/index.ts +144 -0
- package/templates/react-ts-server/server/tsconfig.json +23 -0
- package/templates/react-ts-server/tsconfig.json +27 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { loadConfig } from './chunk-T42X2NJN.js';
|
|
3
|
+
import './chunk-T6RLHSCW.js';
|
|
4
|
+
import { error } from './chunk-JMEHF3KN.js';
|
|
5
|
+
import { realpathSync } from 'fs';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
import colors from 'picocolors';
|
|
8
|
+
|
|
9
|
+
function parseArgs(argv) {
|
|
10
|
+
const positional = [];
|
|
11
|
+
const flags = {};
|
|
12
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
13
|
+
const token = argv[index];
|
|
14
|
+
if (token === void 0) continue;
|
|
15
|
+
if (!token.startsWith("-")) {
|
|
16
|
+
positional.push(token);
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (token === "-h") {
|
|
20
|
+
flags["help"] = true;
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
if (token === "-v") {
|
|
24
|
+
flags["version"] = true;
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
const name = token.replace(/^--?/, "");
|
|
28
|
+
if (name.includes("=")) {
|
|
29
|
+
const [key, ...rest] = name.split("=");
|
|
30
|
+
if (key !== void 0) flags[key] = rest.join("=");
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (name.startsWith("no-")) {
|
|
34
|
+
flags[name.slice(3)] = false;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const next = argv[index + 1];
|
|
38
|
+
if (next !== void 0 && !next.startsWith("-")) {
|
|
39
|
+
flags[name] = next;
|
|
40
|
+
index += 1;
|
|
41
|
+
} else {
|
|
42
|
+
flags[name] = true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const command = positional.shift() ?? "";
|
|
46
|
+
return { command, positional, flags };
|
|
47
|
+
}
|
|
48
|
+
var HELP = `
|
|
49
|
+
${colors.bold(colors.magenta("odoro"))} \u2014 moteur de developpement et echafaudage
|
|
50
|
+
|
|
51
|
+
${colors.bold("Utilisation")}
|
|
52
|
+
odoro <commande> [options]
|
|
53
|
+
|
|
54
|
+
${colors.bold("Commandes")}
|
|
55
|
+
create [nom] Cree un projet a partir d'un template
|
|
56
|
+
dev Demarre le serveur de developpement
|
|
57
|
+
build Compile le projet pour la production
|
|
58
|
+
preview Sert le resultat de la compilation
|
|
59
|
+
|
|
60
|
+
${colors.bold("Registre de composants")}
|
|
61
|
+
init Prepare le projet a recevoir des composants
|
|
62
|
+
add <nom...> Copie un composant et ses dependances
|
|
63
|
+
list Affiche le catalogue
|
|
64
|
+
diff Compare l'installe a ce que le registre sert
|
|
65
|
+
doctor Verifie que le projet est en etat
|
|
66
|
+
|
|
67
|
+
${colors.bold("Base de donnees")}
|
|
68
|
+
db:login Enregistre un jeton de plateforme
|
|
69
|
+
db:status Liste les bases du projet
|
|
70
|
+
db:create Provisionne une base et ecrit .env
|
|
71
|
+
db:branch Cree une previsualisation par branche
|
|
72
|
+
${colors.dim("Ces commandes demandent @odoro/cloud-sdk, installe a part :")}
|
|
73
|
+
${colors.dim("il ne vient pas avec, ce binaire etant telecharge a chaque")}
|
|
74
|
+
${colors.dim("creation de projet.")}
|
|
75
|
+
|
|
76
|
+
${colors.bold("Options du registre")}
|
|
77
|
+
--registry <src> URL ou dossier local, au lieu de celui du projet
|
|
78
|
+
--yes N'attend aucune confirmation
|
|
79
|
+
|
|
80
|
+
${colors.bold("Options de create")}
|
|
81
|
+
--template <nom> Template a utiliser
|
|
82
|
+
--pm <nom> Gestionnaire de paquets (pnpm, npm, yarn, bun)
|
|
83
|
+
--no-git N'initialise pas de depot git
|
|
84
|
+
--no-install N'installe pas les dependances
|
|
85
|
+
--overwrite Vide le dossier cible avant de creer
|
|
86
|
+
--merge Ecrit par-dessus le contenu existant
|
|
87
|
+
--yes Accepte toutes les valeurs par defaut
|
|
88
|
+
|
|
89
|
+
${colors.bold("Options de base de donnees")}
|
|
90
|
+
--env <nom> Environnement vise (production, staging, preview-42)
|
|
91
|
+
--from <env> Environnement dont brancher
|
|
92
|
+
--name <nom> Nom de la branche
|
|
93
|
+
--api <url> Racine de l'API, au lieu de celle par defaut
|
|
94
|
+
|
|
95
|
+
${colors.bold("Options de dev et preview")}
|
|
96
|
+
--port <numero> Port d'ecoute
|
|
97
|
+
--host <adresse> Interface d'ecoute
|
|
98
|
+
|
|
99
|
+
${colors.bold("Options de build")}
|
|
100
|
+
--outdir <chemin> Dossier de sortie
|
|
101
|
+
--no-minify Ne minifie pas
|
|
102
|
+
--no-sourcemap N'emet pas de cartes de source
|
|
103
|
+
|
|
104
|
+
${colors.bold("Options generales")}
|
|
105
|
+
--root <chemin> Racine du projet
|
|
106
|
+
-h, --help Affiche cette aide
|
|
107
|
+
-v, --version Affiche la version
|
|
108
|
+
`;
|
|
109
|
+
function numberFlag(flags, name) {
|
|
110
|
+
const value = flags[name];
|
|
111
|
+
if (typeof value !== "string") return void 0;
|
|
112
|
+
const parsed = Number(value);
|
|
113
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
114
|
+
}
|
|
115
|
+
function overridesFrom(flags) {
|
|
116
|
+
const server = {};
|
|
117
|
+
const port = numberFlag(flags, "port");
|
|
118
|
+
if (port !== void 0) server.port = port;
|
|
119
|
+
if (typeof flags["host"] === "string") server.host = flags["host"];
|
|
120
|
+
const build = {};
|
|
121
|
+
if (typeof flags["outdir"] === "string") build.outDir = flags["outdir"];
|
|
122
|
+
if (flags["minify"] === false) build.minify = false;
|
|
123
|
+
if (flags["sourcemap"] === false) build.sourcemap = false;
|
|
124
|
+
return { server, build };
|
|
125
|
+
}
|
|
126
|
+
function rootFrom(flags, positional) {
|
|
127
|
+
if (typeof flags["root"] === "string") return flags["root"];
|
|
128
|
+
return positional[0] ?? process.cwd();
|
|
129
|
+
}
|
|
130
|
+
async function run(argv) {
|
|
131
|
+
const { command, positional, flags } = parseArgs(argv);
|
|
132
|
+
if (flags["version"] === true) {
|
|
133
|
+
const manifest = await import('./package-AUINPBEX.js');
|
|
134
|
+
console.log(manifest.default.version);
|
|
135
|
+
return 0;
|
|
136
|
+
}
|
|
137
|
+
if (command === "" || command === "help" || flags["help"] === true) {
|
|
138
|
+
console.log(HELP);
|
|
139
|
+
return 0;
|
|
140
|
+
}
|
|
141
|
+
switch (command) {
|
|
142
|
+
case "create":
|
|
143
|
+
case "new": {
|
|
144
|
+
const { createCommand } = await import('./create-SH2M722Y.js');
|
|
145
|
+
const options = {};
|
|
146
|
+
if (positional[0] !== void 0) options.name = positional[0];
|
|
147
|
+
if (typeof flags["template"] === "string") options.template = flags["template"];
|
|
148
|
+
if (typeof flags["pm"] === "string") options.pm = flags["pm"];
|
|
149
|
+
if (typeof flags["git"] === "boolean") options.git = flags["git"];
|
|
150
|
+
if (typeof flags["install"] === "boolean") options.install = flags["install"];
|
|
151
|
+
if (flags["yes"] === true) options.yes = true;
|
|
152
|
+
if (flags["overwrite"] === true) options.overwrite = "ecraser";
|
|
153
|
+
if (flags["merge"] === true) options.overwrite = "fusionner";
|
|
154
|
+
return createCommand(options);
|
|
155
|
+
}
|
|
156
|
+
case "dev": {
|
|
157
|
+
const { startDevServer } = await import('./server-MZ76LPAG.js');
|
|
158
|
+
const config = await loadConfig(rootFrom(flags, positional), overridesFrom(flags));
|
|
159
|
+
await startDevServer(config);
|
|
160
|
+
return new Promise(() => void 0);
|
|
161
|
+
}
|
|
162
|
+
case "build": {
|
|
163
|
+
const { buildProject, reportBuild } = await import('./build-SNTGJH2J.js');
|
|
164
|
+
const config = await loadConfig(rootFrom(flags, positional), overridesFrom(flags));
|
|
165
|
+
const output = await buildProject(config);
|
|
166
|
+
reportBuild(output, process.cwd());
|
|
167
|
+
return 0;
|
|
168
|
+
}
|
|
169
|
+
case "preview": {
|
|
170
|
+
const { startPreviewServer } = await import('./preview-LOAO5Y6V.js');
|
|
171
|
+
const config = await loadConfig(rootFrom(flags, positional), overridesFrom(flags));
|
|
172
|
+
const port = numberFlag(flags, "port");
|
|
173
|
+
await startPreviewServer(config, port);
|
|
174
|
+
return new Promise(() => void 0);
|
|
175
|
+
}
|
|
176
|
+
case "init":
|
|
177
|
+
case "add":
|
|
178
|
+
case "list":
|
|
179
|
+
case "diff":
|
|
180
|
+
case "doctor": {
|
|
181
|
+
const registry = await import('./commands-FVAHVVVN.js');
|
|
182
|
+
const options = {
|
|
183
|
+
root: typeof flags["root"] === "string" ? flags["root"] : process.cwd(),
|
|
184
|
+
registry: typeof flags["registry"] === "string" ? flags["registry"] : void 0,
|
|
185
|
+
yes: flags["yes"] === true
|
|
186
|
+
};
|
|
187
|
+
if (command === "add") return registry.addCommand(options, positional);
|
|
188
|
+
if (command === "init") return registry.initCommand(options);
|
|
189
|
+
if (command === "list") return registry.listCommand(options);
|
|
190
|
+
if (command === "diff") return registry.diffCommand(options);
|
|
191
|
+
return registry.doctorCommand(options);
|
|
192
|
+
}
|
|
193
|
+
case "db:login":
|
|
194
|
+
case "db:status":
|
|
195
|
+
case "db:create":
|
|
196
|
+
case "db:branch": {
|
|
197
|
+
const db = await import('./commands-V44Y5G4F.js');
|
|
198
|
+
const options = {
|
|
199
|
+
root: typeof flags["root"] === "string" ? flags["root"] : process.cwd(),
|
|
200
|
+
...typeof flags["api"] === "string" ? { apiUrl: flags["api"] } : {},
|
|
201
|
+
...typeof flags["env"] === "string" ? { env: flags["env"] } : {},
|
|
202
|
+
yes: flags["yes"] === true
|
|
203
|
+
};
|
|
204
|
+
if (command === "db:login") return db.loginCommand(options);
|
|
205
|
+
if (command === "db:status") return db.statusCommand(options);
|
|
206
|
+
if (command === "db:create") return db.createCommand(options);
|
|
207
|
+
return db.branchCommand({
|
|
208
|
+
...options,
|
|
209
|
+
...typeof flags["from"] === "string" ? { from: flags["from"] } : {},
|
|
210
|
+
...typeof flags["name"] === "string" ? { name: flags["name"] } : {}
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
default:
|
|
214
|
+
error(`Commande inconnue : "${command}". Essayez "odoro help".`);
|
|
215
|
+
return 1;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
function isEntryPoint() {
|
|
219
|
+
const entry = process.argv[1];
|
|
220
|
+
if (entry === void 0) return false;
|
|
221
|
+
try {
|
|
222
|
+
return realpathSync(entry) === realpathSync(fileURLToPath(import.meta.url));
|
|
223
|
+
} catch {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (isEntryPoint()) {
|
|
228
|
+
run(process.argv.slice(2)).then((code) => {
|
|
229
|
+
if (code !== 0) process.exitCode = code;
|
|
230
|
+
}).catch((cause) => {
|
|
231
|
+
error("echec de la commande", cause);
|
|
232
|
+
process.exitCode = 1;
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export { parseArgs, run };
|