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.
- package/README.md +94 -0
- package/client.d.ts +90 -16
- package/dist/build-LZAUDJST.js +5 -0
- package/dist/{chunk-34RGOZFA.js → chunk-4D56Z7G3.js} +49 -50
- package/dist/{chunk-JMEHF3KN.js → chunk-7ZB5MAM6.js} +4 -4
- package/dist/{chunk-LHZGX5ML.js → chunk-OMHEQVIW.js} +295 -160
- package/dist/{chunk-3SZIN6VG.js → chunk-P3DJITWE.js} +10 -10
- package/dist/{chunk-ZVL7EXJO.js → chunk-PRWVZ2SM.js} +22 -14
- package/dist/chunk-Q2KCMTB5.js +741 -0
- package/dist/chunk-QOVBLN7A.js +241 -0
- package/dist/chunk-WWTDEV4Y.js +604 -0
- package/dist/cli.d.ts +12 -13
- package/dist/cli.js +84 -63
- package/dist/{commands-4JRBD55Z.js → commands-EUGVLQWL.js} +44 -45
- package/dist/{commands-AHMXBWQQ.js → commands-GYA7NTCX.js} +124 -124
- package/dist/{create-CDKS7KZ3.js → create-QX5LEWMS.js} +158 -154
- package/dist/index.d.ts +603 -151
- package/dist/index.js +6 -6
- package/dist/{package-NBP5NDX6.js → package-T4Z7OBOH.js} +5 -5
- package/dist/preview-P4WY5GEY.js +4 -0
- package/dist/registry/index.d.ts +75 -76
- package/dist/registry/index.js +1 -1
- package/dist/{server-4UGN3SFS.js → server-2WP562EV.js} +3 -3
- package/package.json +5 -5
- package/templates/react-ts/README.md +71 -35
- package/templates/react-ts/_env.example +9 -0
- package/templates/react-ts/_variants/with-engine/src/background.tsx +118 -0
- package/templates/react-ts/_variants/without-libs/src/App.tsx +380 -0
- package/templates/react-ts/_variants/without-libs/src/background.tsx +24 -0
- package/templates/react-ts/_variants/without-libs/src/entry-server.tsx +39 -0
- package/templates/react-ts/_variants/without-libs/src/main.tsx +26 -0
- package/templates/{react-ts-server/_variantes/sans-libs/client → react-ts/_variants/without-libs}/src/styles.css +137 -137
- package/templates/react-ts/{_variantes/sans-routeur → _variants/without-router}/src/App.tsx +141 -141
- package/templates/react-ts/_variants/without-router/src/entry-server.tsx +39 -0
- package/templates/react-ts/index.html +4 -4
- package/templates/react-ts/odoro.config.ts +5 -0
- package/templates/react-ts/src/App.tsx +219 -209
- package/templates/react-ts/src/background.tsx +66 -0
- package/templates/react-ts/src/entry-server.tsx +85 -0
- package/templates/react-ts/src/main.tsx +13 -4
- package/templates/react-ts/src/router.tsx +65 -45
- package/templates/react-ts/src/styles.css +5 -5
- package/templates/react-ts-server/Dockerfile +9 -9
- package/templates/react-ts-server/README.md +97 -45
- package/templates/react-ts-server/_env.example +31 -33
- package/templates/react-ts-server/_variants/with-engine/client/src/background.tsx +118 -0
- package/templates/react-ts-server/_variants/without-libs/client/src/App.tsx +380 -0
- package/templates/react-ts-server/_variants/without-libs/client/src/background.tsx +24 -0
- package/templates/react-ts-server/_variants/without-libs/client/src/entry-server.tsx +39 -0
- package/templates/react-ts-server/_variants/without-libs/client/src/main.tsx +26 -0
- package/templates/{react-ts/_variantes/sans-libs → react-ts-server/_variants/without-libs/client}/src/styles.css +137 -137
- package/templates/react-ts-server/{_variantes/sans-routeur → _variants/without-router}/client/src/App.tsx +141 -141
- package/templates/react-ts-server/_variants/without-router/client/src/entry-server.tsx +39 -0
- package/templates/react-ts-server/client/index.html +4 -4
- package/templates/react-ts-server/client/src/App.tsx +228 -210
- package/templates/react-ts-server/client/src/account.tsx +267 -0
- package/templates/react-ts-server/client/src/auth.tsx +139 -0
- package/templates/react-ts-server/client/src/background.tsx +66 -0
- package/templates/react-ts-server/client/src/entry-server.tsx +92 -0
- package/templates/react-ts-server/client/src/main.tsx +17 -5
- package/templates/react-ts-server/client/src/router.tsx +77 -45
- package/templates/react-ts-server/client/src/styles.css +5 -5
- package/templates/react-ts-server/odoro.config.ts +7 -4
- package/templates/react-ts-server/package.json +2 -0
- package/templates/react-ts-server/scripts/dev.mjs +14 -14
- package/templates/react-ts-server/server/src/main.ts +119 -45
- package/templates/react-ts-server/server/src/modules/auth/index.ts +238 -0
- package/templates/react-ts-server/server/src/modules/auth/password.ts +122 -0
- package/templates/react-ts-server/server/src/modules/auth/store.ts +193 -0
- package/templates/react-ts-server/server/src/modules/health/index.ts +45 -46
- package/dist/build-JFQHODAT.js +0 -5
- package/dist/chunk-22KJTV2R.js +0 -380
- package/dist/chunk-DL3NPC4H.js +0 -113
- package/dist/chunk-TQUJ3MFS.js +0 -268
- package/dist/preview-7DKEAQOQ.js +0 -4
- package/templates/react-ts/_variantes/avec-moteur/src/fond.tsx +0 -118
- package/templates/react-ts/_variantes/sans-libs/src/App.tsx +0 -382
- package/templates/react-ts/_variantes/sans-libs/src/fond.tsx +0 -23
- package/templates/react-ts/_variantes/sans-libs/src/main.tsx +0 -17
- package/templates/react-ts/src/fond.tsx +0 -42
- package/templates/react-ts-server/_variantes/avec-moteur/client/src/fond.tsx +0 -118
- package/templates/react-ts-server/_variantes/sans-libs/client/src/App.tsx +0 -382
- package/templates/react-ts-server/_variantes/sans-libs/client/src/fond.tsx +0 -23
- package/templates/react-ts-server/_variantes/sans-libs/client/src/main.tsx +0 -17
- 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 "
|
|
8
|
+
if (url.length === 0) return "The URL cannot be empty.";
|
|
9
9
|
if (!/^postgres(ql)?:\/\//i.test(url)) {
|
|
10
|
-
return "
|
|
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 "
|
|
16
|
+
return "This string is not a valid URL.";
|
|
17
17
|
}
|
|
18
|
-
if (parsed.hostname.length === 0) return "
|
|
18
|
+
if (parsed.hostname.length === 0) return "No host in this URL.";
|
|
19
19
|
if (parsed.pathname.replace(/^\//, "").length === 0) {
|
|
20
|
-
return "
|
|
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
|
|
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 "
|
|
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
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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 {
|
|
3
|
-
import { warn, success, info, colors } from './chunk-
|
|
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]
|
|
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
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
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(`
|
|
36
|
+
response.end(`Not found: /${relativePath}`);
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
const file =
|
|
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("
|
|
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:
|
|
54
|
-
|
|
55
|
-
|
|
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(
|
|
58
|
-
success("
|
|
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()))
|