odoro 1.0.8 → 2.0.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.
Files changed (85) hide show
  1. package/README.md +94 -0
  2. package/client.d.ts +90 -16
  3. package/dist/build-LZAUDJST.js +5 -0
  4. package/dist/{chunk-34RGOZFA.js → chunk-4D56Z7G3.js} +49 -50
  5. package/dist/{chunk-JMEHF3KN.js → chunk-7ZB5MAM6.js} +4 -4
  6. package/dist/{chunk-LHZGX5ML.js → chunk-OMHEQVIW.js} +295 -160
  7. package/dist/{chunk-3SZIN6VG.js → chunk-P3DJITWE.js} +10 -10
  8. package/dist/{chunk-ZVL7EXJO.js → chunk-PRWVZ2SM.js} +22 -14
  9. package/dist/chunk-Q2KCMTB5.js +741 -0
  10. package/dist/chunk-QOVBLN7A.js +241 -0
  11. package/dist/chunk-WWTDEV4Y.js +604 -0
  12. package/dist/cli.d.ts +12 -13
  13. package/dist/cli.js +84 -63
  14. package/dist/{commands-4JRBD55Z.js → commands-EUGVLQWL.js} +44 -45
  15. package/dist/{commands-AHMXBWQQ.js → commands-GYA7NTCX.js} +124 -124
  16. package/dist/{create-CDKS7KZ3.js → create-QX5LEWMS.js} +158 -154
  17. package/dist/index.d.ts +603 -151
  18. package/dist/index.js +6 -6
  19. package/dist/{package-NBP5NDX6.js → package-T4Z7OBOH.js} +5 -5
  20. package/dist/preview-P4WY5GEY.js +4 -0
  21. package/dist/registry/index.d.ts +75 -76
  22. package/dist/registry/index.js +1 -1
  23. package/dist/{server-4UGN3SFS.js → server-2WP562EV.js} +3 -3
  24. package/package.json +5 -5
  25. package/templates/react-ts/README.md +71 -35
  26. package/templates/react-ts/_env.example +9 -0
  27. package/templates/react-ts/_variants/with-engine/src/background.tsx +118 -0
  28. package/templates/react-ts/_variants/without-libs/src/App.tsx +380 -0
  29. package/templates/react-ts/_variants/without-libs/src/background.tsx +24 -0
  30. package/templates/react-ts/_variants/without-libs/src/entry-server.tsx +39 -0
  31. package/templates/react-ts/_variants/without-libs/src/main.tsx +26 -0
  32. package/templates/{react-ts-server/_variantes/sans-libs/client → react-ts/_variants/without-libs}/src/styles.css +137 -137
  33. package/templates/react-ts/{_variantes/sans-routeur → _variants/without-router}/src/App.tsx +141 -141
  34. package/templates/react-ts/_variants/without-router/src/entry-server.tsx +39 -0
  35. package/templates/react-ts/index.html +4 -4
  36. package/templates/react-ts/odoro.config.ts +5 -0
  37. package/templates/react-ts/src/App.tsx +219 -209
  38. package/templates/react-ts/src/background.tsx +66 -0
  39. package/templates/react-ts/src/entry-server.tsx +85 -0
  40. package/templates/react-ts/src/main.tsx +13 -4
  41. package/templates/react-ts/src/router.tsx +65 -45
  42. package/templates/react-ts/src/styles.css +5 -5
  43. package/templates/react-ts-server/Dockerfile +9 -9
  44. package/templates/react-ts-server/README.md +97 -45
  45. package/templates/react-ts-server/_env.example +31 -33
  46. package/templates/react-ts-server/_variants/with-engine/client/src/background.tsx +118 -0
  47. package/templates/react-ts-server/_variants/without-libs/client/src/App.tsx +380 -0
  48. package/templates/react-ts-server/_variants/without-libs/client/src/background.tsx +24 -0
  49. package/templates/react-ts-server/_variants/without-libs/client/src/entry-server.tsx +39 -0
  50. package/templates/react-ts-server/_variants/without-libs/client/src/main.tsx +26 -0
  51. package/templates/{react-ts/_variantes/sans-libs → react-ts-server/_variants/without-libs/client}/src/styles.css +137 -137
  52. package/templates/react-ts-server/{_variantes/sans-routeur → _variants/without-router}/client/src/App.tsx +141 -141
  53. package/templates/react-ts-server/_variants/without-router/client/src/entry-server.tsx +39 -0
  54. package/templates/react-ts-server/client/index.html +4 -4
  55. package/templates/react-ts-server/client/src/App.tsx +228 -210
  56. package/templates/react-ts-server/client/src/account.tsx +267 -0
  57. package/templates/react-ts-server/client/src/auth.tsx +139 -0
  58. package/templates/react-ts-server/client/src/background.tsx +66 -0
  59. package/templates/react-ts-server/client/src/entry-server.tsx +92 -0
  60. package/templates/react-ts-server/client/src/main.tsx +17 -5
  61. package/templates/react-ts-server/client/src/router.tsx +77 -45
  62. package/templates/react-ts-server/client/src/styles.css +5 -5
  63. package/templates/react-ts-server/odoro.config.ts +7 -4
  64. package/templates/react-ts-server/package.json +2 -0
  65. package/templates/react-ts-server/scripts/dev.mjs +14 -14
  66. package/templates/react-ts-server/server/src/main.ts +119 -45
  67. package/templates/react-ts-server/server/src/modules/auth/index.ts +238 -0
  68. package/templates/react-ts-server/server/src/modules/auth/password.ts +122 -0
  69. package/templates/react-ts-server/server/src/modules/auth/store.ts +193 -0
  70. package/templates/react-ts-server/server/src/modules/health/index.ts +45 -46
  71. package/dist/build-JFQHODAT.js +0 -5
  72. package/dist/chunk-22KJTV2R.js +0 -380
  73. package/dist/chunk-DL3NPC4H.js +0 -113
  74. package/dist/chunk-TQUJ3MFS.js +0 -268
  75. package/dist/preview-7DKEAQOQ.js +0 -4
  76. package/templates/react-ts/_variantes/avec-moteur/src/fond.tsx +0 -118
  77. package/templates/react-ts/_variantes/sans-libs/src/App.tsx +0 -382
  78. package/templates/react-ts/_variantes/sans-libs/src/fond.tsx +0 -23
  79. package/templates/react-ts/_variantes/sans-libs/src/main.tsx +0 -17
  80. package/templates/react-ts/src/fond.tsx +0 -42
  81. package/templates/react-ts-server/_variantes/avec-moteur/client/src/fond.tsx +0 -118
  82. package/templates/react-ts-server/_variantes/sans-libs/client/src/App.tsx +0 -382
  83. package/templates/react-ts-server/_variantes/sans-libs/client/src/fond.tsx +0 -23
  84. package/templates/react-ts-server/_variantes/sans-libs/client/src/main.tsx +0 -17
  85. package/templates/react-ts-server/client/src/fond.tsx +0 -42
@@ -5,22 +5,22 @@ import { join } from 'path';
5
5
 
6
6
  function checkDatabaseUrl(value) {
7
7
  const url = value.trim();
8
- if (url.length === 0) return "L'URL ne peut pas etre vide.";
8
+ if (url.length === 0) return "The URL cannot be empty.";
9
9
  if (!/^postgres(ql)?:\/\//i.test(url)) {
10
- return "Une URL PostgreSQL commence par postgres:// ou postgresql://";
10
+ return "A PostgreSQL URL starts with postgres:// or postgresql://";
11
11
  }
12
12
  let parsed;
13
13
  try {
14
14
  parsed = new URL(url);
15
15
  } catch {
16
- return "Cette chaine n'est pas une URL valide.";
16
+ return "This string is not a valid URL.";
17
17
  }
18
- if (parsed.hostname.length === 0) return "Aucun hote dans cette URL.";
18
+ if (parsed.hostname.length === 0) return "No host in this URL.";
19
19
  if (parsed.pathname.replace(/^\//, "").length === 0) {
20
- return "Aucun nom de base : ajoutez-le apres le port, par exemple /mon_projet";
20
+ return "No database name: add it after the port, for example /my_project";
21
21
  }
22
22
  if (!/^(localhost|127\.0\.0\.1|\[::1\])$/i.test(parsed.hostname) && parsed.searchParams.get("sslmode") === "disable") {
23
- return "sslmode=disable sur une base distante : le trafic passerait en clair.";
23
+ return "sslmode=disable on a remote database: the traffic would go in the clear.";
24
24
  }
25
25
  return void 0;
26
26
  }
@@ -45,20 +45,20 @@ async function writeDatabaseUrl(target, url) {
45
45
  async function assertEnvIgnored(target) {
46
46
  const path = join(target, ".gitignore");
47
47
  if (!existsSync(path)) {
48
- return "Aucun .gitignore : le fichier .env risque d'etre versionne.";
48
+ return "No .gitignore: the .env file risks being versioned.";
49
49
  }
50
50
  const content = await readFile(path, "utf8");
51
51
  const ignored = content.split("\n").map((line) => line.trim()).some((line) => line === ".env" || line === ".env*" || line === "*.env");
52
- return ignored ? void 0 : ".env ne figure pas dans le .gitignore : vos identifiants risquent d etre versionnes.";
52
+ return ignored ? void 0 : ".env does not appear in the .gitignore: your credentials risk being versioned.";
53
53
  }
54
54
  var PROVIDER_PENDING = [
55
- "Le provisionnement passe par @odoro-cli/cloud-sdk, installe a part :",
55
+ "Provisioning goes through @odoro-cli/cloud-sdk, installed separately:",
56
56
  "",
57
57
  " npm install --save-dev @odoro-cli/cloud-sdk",
58
58
  " odoro db:login",
59
59
  " odoro db:create --env production",
60
60
  "",
61
- "Il ne vient pas avec odoro : ce binaire est telecharge a chaque creation de projet, et la plupart emploient leur propre base."
61
+ "It does not ship with odoro: this binary is downloaded on every project creation, and most projects use their own database."
62
62
  ].join("\n");
63
63
 
64
64
  export { PROVIDER_PENDING, assertEnvIgnored, checkDatabaseUrl, writeDatabaseUrl };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { estUneRessource, ecouter } from './chunk-TQUJ3MFS.js';
3
- import { warn, success, info, colors } from './chunk-JMEHF3KN.js';
2
+ import { isAssetRequest, listen, openBrowser } from './chunk-WWTDEV4Y.js';
3
+ import { warn, success, info, colors } from './chunk-7ZB5MAM6.js';
4
4
  import { existsSync, statSync, createReadStream } from 'fs';
5
5
  import { createServer } from 'http';
6
6
  import { normalize, join, extname } from 'path';
@@ -23,23 +23,23 @@ var MIME = {
23
23
  };
24
24
  async function startPreviewServer(config, port = config.server.port + 1) {
25
25
  if (!existsSync(config.outDir)) {
26
- throw new Error(`[odoro] Rien a previsualiser : lancez "odoro build" d'abord.`);
26
+ throw new Error(`[odoro] Nothing to preview: run "odoro build" first.`);
27
27
  }
28
28
  const server = createServer((incoming, response) => {
29
29
  const path = (incoming.url ?? "/").split("?")[0] ?? "/";
30
30
  const relativePath = normalize(decodeURIComponent(path)).split(/[\\/]/).filter(Boolean).join("/");
31
31
  const candidate = join(config.outDir, relativePath);
32
- const dansLeDossier = ["index.html", "index.md"].map((nom) => join(candidate, nom)).find((chemin) => existsSync(chemin) && statSync(chemin).isFile());
33
- const existant = existsSync(candidate) && statSync(candidate).isFile() ? candidate : dansLeDossier;
34
- if (existant === void 0 && (extname(relativePath) !== "" || estUneRessource(incoming.headers))) {
32
+ const inDirectory = ["index.html", "index.md"].map((name) => join(candidate, name)).find((path2) => existsSync(path2) && statSync(path2).isFile());
33
+ const existing = existsSync(candidate) && statSync(candidate).isFile() ? candidate : inDirectory;
34
+ if (existing === void 0 && (extname(relativePath) !== "" || isAssetRequest(incoming.headers))) {
35
35
  response.writeHead(404, { "Content-Type": "text/plain; charset=utf-8" });
36
- response.end(`Introuvable : /${relativePath}`);
36
+ response.end(`Not found: /${relativePath}`);
37
37
  return;
38
38
  }
39
- const file = existant ?? join(config.outDir, "index.html");
39
+ const file = existing ?? join(config.outDir, "index.html");
40
40
  if (!file.startsWith(config.outDir)) {
41
41
  response.writeHead(403, { "Content-Type": "text/plain" });
42
- response.end("Interdit");
42
+ response.end("Forbidden");
43
43
  return;
44
44
  }
45
45
  const type = MIME[extname(file).toLowerCase()] ?? "application/octet-stream";
@@ -50,13 +50,21 @@ async function startPreviewServer(config, port = config.server.port + 1) {
50
50
  });
51
51
  createReadStream(file).pipe(response);
52
52
  });
53
- const { port: obtenu, demande } = await ecouter(server, port, config.server.host);
54
- if (demande !== void 0) {
55
- warn(`port ${String(demande)} occupe \u2014 l apercu ecoute sur ${String(obtenu)}`);
53
+ const { port: obtained, requested } = await listen(
54
+ server,
55
+ port,
56
+ config.server.host,
57
+ config.server.strictPort ? 1 : void 0
58
+ );
59
+ if (requested !== void 0) {
60
+ warn(
61
+ `port ${String(requested)} in use \u2014 preview listening on ${String(obtained)}`
62
+ );
56
63
  }
57
- const url = `http://${config.server.host}:${String(obtenu)}${config.base}`;
58
- success("previsualisation du build de production");
64
+ const url = `http://${config.server.host}:${String(obtained)}${config.base}`;
65
+ success("preview of the production build");
59
66
  info(` ${colors.cyan(url)}`);
67
+ if (config.server.open) openBrowser(url);
60
68
  return {
61
69
  url,
62
70
  close: () => new Promise((done) => server.close(() => done()))