@cobinar/dalus 0.1.8 → 0.1.11
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 +10 -36
- package/bin/{dalus.js → dalus.mjs} +5 -14
- package/convert_to_mjs.py +59 -0
- package/fix_requires.py +57 -0
- package/package.json +4 -4
- package/publish-dalus.bat +1 -1
- package/src/{api-client.js → api-client.mjs} +67 -67
- package/src/commands/{forge.js → forge.mjs} +104 -104
- package/src/commands/{init.js → init.mjs} +53 -53
- package/src/{forgers/login.js → commands/login.mjs} +288 -288
- package/src/{config.js → config.mjs} +147 -147
- package/src/cors.mjs +19 -0
- package/src/forgers/{database.js → database.mjs} +34 -34
- package/src/forgers/{pages.js → pages.mjs} +35 -35
- package/src/forgers/storage.mjs +39 -0
- package/src/forgers/{vault.js → vault.mjs} +27 -27
- package/src/forgers/{workers.js → workers.mjs} +85 -85
- package/src/{fs-utils.js → fs-utils.mjs} +36 -36
- package/src/handlers/login-callback.mjs +143 -0
- package/src/handlers/services.mjs +45 -0
- package/src/index.mjs +36 -0
- package/src/auth.js +0 -78
- package/src/commands/auth.js +0 -78
- package/src/commands/cors.js +0 -34
- package/src/commands/index.js +0 -115
- package/src/commands/login.js +0 -288
- package/src/commands/storage.js +0 -72
- package/src/commands/utils.js +0 -7
- package/src/commands/validators.js +0 -101
- package/src/cors.js +0 -34
- package/src/forgers/auth.js +0 -78
- package/src/forgers/cors.js +0 -34
- package/src/forgers/index.js +0 -115
- package/src/forgers/storage.js +0 -72
- package/src/forgers/utils.js +0 -7
- package/src/forgers/validators.js +0 -101
- package/src/index.js +0 -115
- package/src/login.js +0 -288
- package/src/storage.js +0 -72
- package/src/utils.js +0 -7
- package/src/validators.js +0 -101
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const TEMPLATE = `{
|
|
6
|
-
// dalus config — see https://github.com/ (your Cobinar docs link here)
|
|
7
|
-
// for the full field reference. Paths below are relative to this file.
|
|
8
|
-
|
|
9
|
-
// Optional — if omitted, dalus uses whatever worker URL you logged in
|
|
10
|
-
// with ("dalus login"). Set this when a project should always deploy
|
|
11
|
-
// to a specific worker regardless of who's running "dalus forge".
|
|
12
|
-
// "apiBase": "https://worker.lobby.cobinar.com",
|
|
13
|
-
|
|
14
|
-
"workers": [
|
|
15
|
-
// { "name": "my-api", "main": "./worker.js",
|
|
16
|
-
// "bindings": [
|
|
17
|
-
// { "name": "MY_BUCKET", "type": "storage", "resource": "my-bucket" }
|
|
18
|
-
// ],
|
|
19
|
-
// "secrets": ["SOME_API_KEY"] }
|
|
20
|
-
],
|
|
21
|
-
"pages": [
|
|
22
|
-
// { "name": "my-site", "dir": "./public" }
|
|
23
|
-
],
|
|
24
|
-
"storage": [
|
|
25
|
-
// { "name": "my-bucket", "dir": "./assets", "public": true }
|
|
26
|
-
],
|
|
27
|
-
"database": [
|
|
28
|
-
// { "name": "my_collection", "seed": "./seed.json" }
|
|
29
|
-
],
|
|
30
|
-
"vault": [
|
|
31
|
-
// { "name": "my-vault", "rules": "./rules.txt" }
|
|
32
|
-
]
|
|
33
|
-
|
|
34
|
-
// Named environments (optional) — "dalus forge --env staging" uses
|
|
35
|
-
// these instead of the top-level lists above, per resource kind:
|
|
36
|
-
// "env": {
|
|
37
|
-
// "staging": { "workers": [ { "name": "my-api-staging", "main": "./worker.js" } ] }
|
|
38
|
-
// }
|
|
39
|
-
}
|
|
40
|
-
`;
|
|
41
|
-
|
|
42
|
-
function initCommand(args) {
|
|
43
|
-
const target = path.join(process.cwd(), 'dalus.jsonc');
|
|
44
|
-
if (fs.existsSync(target) && !args.includes('--force')) {
|
|
45
|
-
console.error(`${target} already exists — pass --force to overwrite.`);
|
|
46
|
-
process.exitCode = 1;
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
fs.writeFileSync(target, TEMPLATE);
|
|
50
|
-
console.log(`Created ${target}. Fill in the resources you want, then run "dalus forge".`);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
|
|
5
|
+
const TEMPLATE = `{
|
|
6
|
+
// dalus config — see https://github.com/ (your Cobinar docs link here)
|
|
7
|
+
// for the full field reference. Paths below are relative to this file.
|
|
8
|
+
|
|
9
|
+
// Optional — if omitted, dalus uses whatever worker URL you logged in
|
|
10
|
+
// with ("dalus login"). Set this when a project should always deploy
|
|
11
|
+
// to a specific worker regardless of who's running "dalus forge".
|
|
12
|
+
// "apiBase": "https://worker.lobby.cobinar.com",
|
|
13
|
+
|
|
14
|
+
"workers": [
|
|
15
|
+
// { "name": "my-api", "main": "./worker.js",
|
|
16
|
+
// "bindings": [
|
|
17
|
+
// { "name": "MY_BUCKET", "type": "storage", "resource": "my-bucket" }
|
|
18
|
+
// ],
|
|
19
|
+
// "secrets": ["SOME_API_KEY"] }
|
|
20
|
+
],
|
|
21
|
+
"pages": [
|
|
22
|
+
// { "name": "my-site", "dir": "./public" }
|
|
23
|
+
],
|
|
24
|
+
"storage": [
|
|
25
|
+
// { "name": "my-bucket", "dir": "./assets", "public": true }
|
|
26
|
+
],
|
|
27
|
+
"database": [
|
|
28
|
+
// { "name": "my_collection", "seed": "./seed.json" }
|
|
29
|
+
],
|
|
30
|
+
"vault": [
|
|
31
|
+
// { "name": "my-vault", "rules": "./rules.txt" }
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
// Named environments (optional) — "dalus forge --env staging" uses
|
|
35
|
+
// these instead of the top-level lists above, per resource kind:
|
|
36
|
+
// "env": {
|
|
37
|
+
// "staging": { "workers": [ { "name": "my-api-staging", "main": "./worker.js" } ] }
|
|
38
|
+
// }
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
function initCommand(args) {
|
|
43
|
+
const target = path.join(process.cwd(), 'dalus.jsonc');
|
|
44
|
+
if (fs.existsSync(target) && !args.includes('--force')) {
|
|
45
|
+
console.error(`${target} already exists — pass --force to overwrite.`);
|
|
46
|
+
process.exitCode = 1;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
fs.writeFileSync(target, TEMPLATE);
|
|
50
|
+
console.log(`Created ${target}. Fill in the resources you want, then run "dalus forge".`);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { initCommand };
|