duto 0.260906.0 → 0.260915.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 +34 -12
- package/package.json +9 -3
- package/src/cli.ts +10 -7
- package/src/commands/new.ts +147 -0
- package/src/commands/templates/base/.editorconfig +21 -0
- package/src/commands/templates/base/.env.dev.example +2 -0
- package/src/commands/templates/base/.env.prod.example +2 -0
- package/src/commands/templates/base/README.md +29 -0
- package/src/commands/templates/base/_gitignore +100 -0
- package/src/commands/templates/base/actions/blog/index.get.ts +9 -0
- package/src/commands/templates/base/actions/blog/post/[id].get.ts +9 -0
- package/src/commands/templates/base/actions/index.get.ts +5 -0
- package/src/commands/templates/base/configs/duto.ts +11 -0
- package/src/commands/templates/base/configs/roles.ts +5 -0
- package/src/commands/templates/base/package.json +24 -0
- package/src/commands/templates/base/tsconfig.json +42 -0
- package/src/commands/templates/workerd/wrangler.toml +47 -0
- package/src/commands/upgrade.ts +30 -0
- package/src/index.ts +7 -2
- package/src/pages/{commands → cli/commands}/build.ts +13 -7
- package/src/pages/{commands → cli/commands}/dev.ts +11 -4
- package/src/pages/{commands → cli/commands}/preview.ts +6 -4
- package/src/pages/cli/index.ts +10 -0
- package/src/pages/cli/utils.ts +145 -0
- package/src/pages/client/app.tsx +1 -1
- package/src/pages/client/router.ts +1 -1
- package/src/pages/compiler/file.ts +1 -1
- package/src/pages/compiler/index.ts +2 -4
- package/src/pages/compiler/meta.ts +2 -2
- package/src/pages/compiler/routes.ts +1 -1
- package/src/pages/compiler/types.ts +10 -0
- package/src/pages/compiler/vite-plugin.ts +19 -44
- package/src/pages/i18n/client.ts +1 -1
- package/src/pages/i18n/element.ts +1 -1
- package/src/pages/i18n/server.ts +1 -1
- package/src/pages/preact/server.ts +1 -1
- package/src/server/app.ts +5 -10
- package/src/server/auth/ability.ts +1 -1
- package/src/server/auth/token.ts +5 -5
- package/src/server/cli/commands/build.ts +2 -2
- package/src/server/cli/commands/deploy.ts +1 -2
- package/src/server/cli/commands/dev.ts +6 -4
- package/src/server/cli/commands/routes.ts +0 -1
- package/src/server/cli/utils.ts +2 -8
- package/src/server/config.ts +18 -3
- package/src/server/entry.ts +3 -3
- package/src/server/open-api/register.ts +3 -3
- package/src/server/open-api/spec.ts +11 -4
- package/src/server/request.ts +46 -14
- package/src/server/routes.ts +5 -6
- package/src/server/utils.ts +25 -0
- package/src/utils.ts +12 -2
- package/src/pages/commands/dev-old.ts +0 -213
- package/src/pages/compiler/utils.ts +0 -5
- package/src/server/http.ts +0 -23
package/README.md
CHANGED
|
@@ -1,25 +1,47 @@
|
|
|
1
|
-
<h1 align="left">
|
|
1
|
+
<h1 align="left">
|
|
2
|
+
🛢 Duto
|
|
3
|
+
<a href="https://npmjs.com/package/duto"><img src="https://img.shields.io/npm/v/duto.svg" alt="npm package"></a>
|
|
4
|
+
<br/>
|
|
5
|
+
<a href="https://pr.new/attla/duto"><img align="right" src="https://developer.stackblitz.com/img/start_pr_dark_small.svg" alt="Start new PR in StackBlitz Codeflow"></a>
|
|
6
|
+
</h1>
|
|
2
7
|
|
|
3
8
|
> ⚠️ Duto is under ALFA development — expect updates, rough edges, and occasional breack changes.
|
|
4
9
|
<br/>
|
|
5
10
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
Duto is minimalist framework, focused on client-side pages and serverless APIs.
|
|
12
|
+
|
|
13
|
+
Principles:
|
|
14
|
+
- No vendor lock-in! Deploy anywhere with: `duto deploy`
|
|
15
|
+
- Developer happiness as a design constraint
|
|
16
|
+
- Optimized by default!
|
|
17
|
+
|
|
18
|
+
Pages features:
|
|
19
|
+
- Static pages `/blog.tsx` `getStaticProps()`
|
|
20
|
+
- Prerendered dynamic pages `/blog/[slug].tsx` `getStaticProps()`
|
|
21
|
+
- Dynamic pages on client-side `/blog/[slug].tsx` `getProps()`
|
|
22
|
+
- Not found page on client-side `/blog/not-found.tsx`
|
|
23
|
+
- Efficient route hierarchy `/not-found.tsx`
|
|
24
|
+
- Catch-all page whitout SSR! `/blog/[...slug].tsx`
|
|
25
|
+
- Optional catch-all routes whitout SSR! `/blog/[[...slug]].tsx`
|
|
26
|
+
- Simple internationalization (i18n) integration `tˋfeaturesˋ`
|
|
27
|
+
|
|
28
|
+
Server features:
|
|
29
|
+
- Instant server and cold starts
|
|
30
|
+
- Optimized build, greater efficiency in less bundle size
|
|
31
|
+
- Built-in core shims for compatibility with custom runtimes
|
|
32
|
+
- Fully typed OpenAPI documentation
|
|
33
|
+
- Powerful request validations
|
|
34
|
+
- Fine-grained authentication
|
|
35
|
+
|
|
36
|
+
[Read the Docs to Learn More](https://hub.bi/docs/duto)
|
|
13
37
|
|
|
14
38
|
## Ecosystem Packages
|
|
15
39
|
|
|
16
40
|
| Package | Version | Description |
|
|
17
41
|
| -: | :- | :- |
|
|
18
|
-
| [
|
|
19
|
-
| [create-rajt](https://github.com/attla/create-rajt) | [](https://npm.im/create-rajt) | 📁 CLI tool for create new Rajt projects, from starter templates. |
|
|
20
|
-
| [forj](https://github.com/attla/forj) | [](https://npm.im/forj) | 🗂️ Just another query builder in typescript |
|
|
21
|
-
| [t0n](https://github.com/attla/t0n) | [](https://npm.im/t0n) | 🧰 Collection of elegant typescript resources for web artisans. |
|
|
42
|
+
| [forj](https://github.com/attla/forj) | [](https://npm.im/forj) | 🗂️ Fast and lightweight query builder in typescript |
|
|
22
43
|
| [cripta](https://github.com/attla/cripta) | [](https://npm.im/cripta) | 🧛 A layer of encryption a little too judicious. |
|
|
44
|
+
| [t0n](https://github.com/attla/t0n) | [](https://npm.im/t0n) | 🧰 Collection of elegant typescript resources for web artisans. |
|
|
23
45
|
|
|
24
46
|
## License
|
|
25
47
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "duto",
|
|
3
3
|
"description": "All-in-one serverless framework for web artisans",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.260915.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
7
7
|
"types": "./src/index.d.ts",
|
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
"./length": "./src/server/utils/length.ts"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
+
"@inquirer/confirm": "^5.1.8",
|
|
29
|
+
"@inquirer/input": "^4.1.8",
|
|
30
|
+
"@inquirer/select": "^4.1.0",
|
|
31
|
+
"nanospinner": "^1.2.2",
|
|
28
32
|
"@hono/node-server": "^1.19.11",
|
|
29
33
|
"@hono/standard-validator": "^0.2.2",
|
|
30
34
|
"@hono/zod-validator": "^0.7.6",
|
|
@@ -38,7 +42,6 @@
|
|
|
38
42
|
"cripta": "0.x",
|
|
39
43
|
"dotenv": "^16.5.0",
|
|
40
44
|
"esbuild": "^0.25.2",
|
|
41
|
-
"filesize": "^11.0",
|
|
42
45
|
"forj": "0.x",
|
|
43
46
|
"hono": "^4.13.7",
|
|
44
47
|
"hono-openapi": "^1.3.0",
|
|
@@ -50,6 +53,7 @@
|
|
|
50
53
|
"preact-render-to-string": "^6.6.6",
|
|
51
54
|
"quansync": "^0.2.11",
|
|
52
55
|
"t0n": "0.x",
|
|
56
|
+
"vite": "^8.0.0",
|
|
53
57
|
"wouter-preact": "^3.10.0",
|
|
54
58
|
"wrangler": "^4.128.0",
|
|
55
59
|
"zod": "^4.3.6",
|
|
@@ -57,7 +61,9 @@
|
|
|
57
61
|
},
|
|
58
62
|
"devDependencies": {
|
|
59
63
|
"@cloudflare/workers-types": "^4.20260113.0",
|
|
60
|
-
"@
|
|
64
|
+
"@minify-html/node": "^0.18.1",
|
|
65
|
+
"@preact/preset-vite": "^2.10.5",
|
|
66
|
+
"@tailwindcss/vite": "^4.3.1",
|
|
61
67
|
"bun-types": "^1.4.0",
|
|
62
68
|
"typescript": "^5.9.3"
|
|
63
69
|
},
|
package/src/cli.ts
CHANGED
|
@@ -16,21 +16,20 @@ global.__st = performance.now()
|
|
|
16
16
|
|
|
17
17
|
import { join } from 'pathe'
|
|
18
18
|
import { cli } from 't0n/cli'
|
|
19
|
-
import {
|
|
19
|
+
import { setEnv } from 't0n'
|
|
20
20
|
import { version } from '!/package.json'
|
|
21
21
|
import { _root, _duto } from './utils'
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// upgrade:
|
|
26
|
-
}
|
|
23
|
+
const cmd = (c: string) => join(import.meta.dirname, 'commands', c)
|
|
24
|
+
|
|
27
25
|
let pkg
|
|
26
|
+
let commands = {}
|
|
28
27
|
try {
|
|
29
28
|
pkg = await import(join(_root, 'package.json'))
|
|
30
29
|
if (!pkg || !pkg.duto || !pkg?.duto?.type || !['pages', 'server'].includes(pkg.duto.type))
|
|
31
30
|
exit('Error: invalid app type.')
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
setEnv('duto', pkg.duto)
|
|
34
33
|
commands = (await import(join(_duto, pkg.duto.type, 'cli')))?.default
|
|
35
34
|
} catch {}
|
|
36
35
|
|
|
@@ -38,5 +37,9 @@ cli({
|
|
|
38
37
|
name: 'duto',
|
|
39
38
|
description: 'Duto',
|
|
40
39
|
version,
|
|
41
|
-
commands
|
|
40
|
+
commands: {
|
|
41
|
+
new: cmd('new'),
|
|
42
|
+
upgrade: cmd('upgrade'),
|
|
43
|
+
...commands,
|
|
44
|
+
},
|
|
42
45
|
})
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { basename, join, relative, resolve } from 'pathe'
|
|
2
|
+
import { command } from 't0n/cli'
|
|
3
|
+
import { bold, dim, green, red } from 't0n/color'
|
|
4
|
+
import { event, error, step, log, rn } from 't0n/log'
|
|
5
|
+
import { _root } from '@/utils'
|
|
6
|
+
|
|
7
|
+
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs'
|
|
8
|
+
import confirm from '@inquirer/confirm'
|
|
9
|
+
import input from '@inquirer/input'
|
|
10
|
+
import select from '@inquirer/select'
|
|
11
|
+
import { createSpinner } from 'nanospinner'
|
|
12
|
+
import { exit } from 'node:process'
|
|
13
|
+
|
|
14
|
+
const templates = [
|
|
15
|
+
'aws',
|
|
16
|
+
'workerd',
|
|
17
|
+
'vercel',
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
const renameFiles: Record<string, string | undefined> = {
|
|
21
|
+
_gitignore: '.gitignore',
|
|
22
|
+
_gitkeep: '.gitkeep',
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
function mkdirp(dir: string) {
|
|
27
|
+
try {
|
|
28
|
+
mkdirSync(dir, { recursive: true })
|
|
29
|
+
} catch (e) {
|
|
30
|
+
if (e instanceof Error) {
|
|
31
|
+
if ('code' in e && e.code === 'EEXIST') {
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
throw e
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function copy(src: string, dest: string) {
|
|
40
|
+
const stat = statSync(src)
|
|
41
|
+
stat.isDirectory()
|
|
42
|
+
? copyDir(src, dest)
|
|
43
|
+
: copyFileSync(src, dest)
|
|
44
|
+
}
|
|
45
|
+
function copyDir(srcDir: string, destDir: string) {
|
|
46
|
+
mkdirSync(destDir, { recursive: true })
|
|
47
|
+
for (const file of readdirSync(srcDir)) {
|
|
48
|
+
const srcFile = resolve(srcDir, file)
|
|
49
|
+
const destFile = resolve(destDir, file)
|
|
50
|
+
copy(srcFile, destFile)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default command({
|
|
55
|
+
meta: {
|
|
56
|
+
name: 'new',
|
|
57
|
+
description: '📄 Create new project with duto\n',
|
|
58
|
+
},
|
|
59
|
+
args: {
|
|
60
|
+
install: {
|
|
61
|
+
alias: 'i',
|
|
62
|
+
description: 'Install dependencies',
|
|
63
|
+
type: 'boolean',
|
|
64
|
+
default: false,
|
|
65
|
+
},
|
|
66
|
+
template: {
|
|
67
|
+
alias: 't',
|
|
68
|
+
description: 'Template to use',
|
|
69
|
+
type: 'enum',
|
|
70
|
+
options: templates,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
async run({ args }) { // @ts-ignore
|
|
74
|
+
const root = process.cwd() || process.env?.PWD || process.stdin?.path
|
|
75
|
+
let dir = args._[0]
|
|
76
|
+
if (dir) {
|
|
77
|
+
step(bold('Using target directory: '+ dim('/'+ dir.replace(/^\//, ''))))
|
|
78
|
+
} else {
|
|
79
|
+
dir = await input({ message: 'Target directory', default: root })
|
|
80
|
+
if (!dir.startsWith(root))
|
|
81
|
+
dir = join(root, dir)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const name = basename(/^(\.\/|\.\\|\.)$/.test(dir) ? root : dir)
|
|
85
|
+
const template = args.template || (await select({
|
|
86
|
+
loop: true,
|
|
87
|
+
message: 'Which template do you want to use?',
|
|
88
|
+
choices: templates.map(v => ({ title: v, value: v})),
|
|
89
|
+
default: 'workerd',
|
|
90
|
+
}))
|
|
91
|
+
|
|
92
|
+
if (!template)
|
|
93
|
+
throw new Error('No template selected')
|
|
94
|
+
|
|
95
|
+
if (!templates.includes(template))
|
|
96
|
+
throw new Error(`Invalid template selected: ${template}`)
|
|
97
|
+
|
|
98
|
+
if (existsSync(dir) && readdirSync(dir).length > 0) {
|
|
99
|
+
const response = await confirm({ message: 'Directory not empty. Continue?', default: false })
|
|
100
|
+
if (!response) process.exit(1)
|
|
101
|
+
} else {
|
|
102
|
+
mkdirp(dir)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const spinner = createSpinner('Cloning the template').start()
|
|
106
|
+
for (const t of ['base', template]) {
|
|
107
|
+
const templateDir = resolve(import.meta.dir, './templates/'+ t)
|
|
108
|
+
const files = readdirSync(templateDir)
|
|
109
|
+
for (const file of files.filter(f => f !== 'package.json'))
|
|
110
|
+
copy(join(templateDir, file), join(dir, renameFiles[file] ?? file))
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
spinner.success()
|
|
114
|
+
|
|
115
|
+
const pkgPath = resolve(__dirname, `./templates/base/package.json`)
|
|
116
|
+
if (existsSync(pkgPath)) {
|
|
117
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'))
|
|
118
|
+
pkg.name = name
|
|
119
|
+
writeFileSync(join(dir, 'package.json'), JSON.stringify(pkg, null, 2))
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (args?.install) {
|
|
123
|
+
const spinner2 = createSpinner('Installing project dependencies').start()
|
|
124
|
+
const proc = Bun.spawn(['bun', 'i'], { stdout: 'ignore', stderr: 'inherit' })
|
|
125
|
+
const procExit = await proc.exited
|
|
126
|
+
|
|
127
|
+
if (procExit === 0) {
|
|
128
|
+
spinner2.success()
|
|
129
|
+
} else {
|
|
130
|
+
spinner2.stop({
|
|
131
|
+
mark: red('×'),
|
|
132
|
+
text: 'Failed to install project dependencies',
|
|
133
|
+
})
|
|
134
|
+
exit(procExit)
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
event('New project successfully created')
|
|
139
|
+
if (dir != root) {
|
|
140
|
+
rn()
|
|
141
|
+
console.log(
|
|
142
|
+
dim('Get started with:'),
|
|
143
|
+
bold(`cd ${name}`),
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
charset = utf-8
|
|
5
|
+
end_of_line = lf
|
|
6
|
+
insert_final_newline = true
|
|
7
|
+
trim_trailing_whitespace = true
|
|
8
|
+
indent_style = space
|
|
9
|
+
indent_size = 2
|
|
10
|
+
|
|
11
|
+
# [*.{js,jsx,ts,tsx,json,yaml,yml}]
|
|
12
|
+
# Inherits all settings from [*] and applies to these extensions
|
|
13
|
+
|
|
14
|
+
[*.{json,jsonc}]
|
|
15
|
+
insert_final_newline = false
|
|
16
|
+
|
|
17
|
+
[*.md]
|
|
18
|
+
trim_trailing_whitespace = false
|
|
19
|
+
|
|
20
|
+
[Dockerfile]
|
|
21
|
+
indent_size = 4
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Duto - Starter Template
|
|
2
|
+
|
|
3
|
+
This template should help get you started developing.
|
|
4
|
+
|
|
5
|
+
## Install dependencies
|
|
6
|
+
|
|
7
|
+
To install, run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun i
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Tests
|
|
14
|
+
|
|
15
|
+
To perform the tests, run:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
bun test
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Development environment
|
|
22
|
+
|
|
23
|
+
Test the application locally in an environment identical to production using the command:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
duto dev
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
[Read the Full Docs to Learn More](https://hub.bi/docs/duto)
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
+
|
|
3
|
+
## custom
|
|
4
|
+
.duto/
|
|
5
|
+
.trash
|
|
6
|
+
.trash*
|
|
7
|
+
.aws-sam
|
|
8
|
+
lambda.zip
|
|
9
|
+
packaged.yaml
|
|
10
|
+
|
|
11
|
+
# dependencies
|
|
12
|
+
.wrangler/
|
|
13
|
+
node_modules
|
|
14
|
+
dist/
|
|
15
|
+
out/
|
|
16
|
+
dist-ssr
|
|
17
|
+
|
|
18
|
+
# production
|
|
19
|
+
/build
|
|
20
|
+
|
|
21
|
+
# misc
|
|
22
|
+
*.pem
|
|
23
|
+
|
|
24
|
+
# debug
|
|
25
|
+
logs
|
|
26
|
+
*.log
|
|
27
|
+
npm-debug.log*
|
|
28
|
+
yarn-debug.log*
|
|
29
|
+
yarn-error.log*
|
|
30
|
+
pnpm-debug.log*
|
|
31
|
+
lerna-debug.log*
|
|
32
|
+
|
|
33
|
+
# local env files
|
|
34
|
+
.env*.local
|
|
35
|
+
*.local
|
|
36
|
+
# .env
|
|
37
|
+
|
|
38
|
+
# vercel
|
|
39
|
+
.vercel
|
|
40
|
+
|
|
41
|
+
# tinybird
|
|
42
|
+
.venv
|
|
43
|
+
.tinyb
|
|
44
|
+
|
|
45
|
+
# typescript
|
|
46
|
+
*.tsbuildinfo
|
|
47
|
+
|
|
48
|
+
# miscellaneous
|
|
49
|
+
/pages/api/scripts*
|
|
50
|
+
apps/docs/openapi.json
|
|
51
|
+
packages/stripe-app/.build/*
|
|
52
|
+
.react-email
|
|
53
|
+
.contentlayer
|
|
54
|
+
.vscode
|
|
55
|
+
!.vscode/extensions.json
|
|
56
|
+
.idea
|
|
57
|
+
*.suo
|
|
58
|
+
*.ntvs*
|
|
59
|
+
*.njsproj
|
|
60
|
+
*.sln
|
|
61
|
+
*.sw?
|
|
62
|
+
*.csv
|
|
63
|
+
*.ndjson
|
|
64
|
+
.vitest
|
|
65
|
+
|
|
66
|
+
# tests
|
|
67
|
+
coverage
|
|
68
|
+
/cypress/videos/
|
|
69
|
+
/cypress/screenshots/
|
|
70
|
+
|
|
71
|
+
### macOS ###
|
|
72
|
+
# General
|
|
73
|
+
.DS_Store
|
|
74
|
+
.AppleDouble
|
|
75
|
+
.LSOverride
|
|
76
|
+
|
|
77
|
+
# Thumbnails
|
|
78
|
+
._*
|
|
79
|
+
|
|
80
|
+
# Files that might appear in the root of a volume
|
|
81
|
+
.DocumentRevisions-V100
|
|
82
|
+
.fseventsd
|
|
83
|
+
.Spotlight-V100
|
|
84
|
+
.TemporaryItems
|
|
85
|
+
.Trashes
|
|
86
|
+
.VolumeIcon.icns
|
|
87
|
+
.com.apple.timemachine.donotpresent
|
|
88
|
+
|
|
89
|
+
# Directories potentially created on remote AFP share
|
|
90
|
+
.AppleDB
|
|
91
|
+
.AppleDesktop
|
|
92
|
+
Network Trash Folder
|
|
93
|
+
Temporary Items
|
|
94
|
+
.apdisk
|
|
95
|
+
|
|
96
|
+
### macOS Patch ###
|
|
97
|
+
# iCloud generated files
|
|
98
|
+
*.icloud
|
|
99
|
+
# Localflare generated files
|
|
100
|
+
.localflare/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "$NAME",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"main": ".duto/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"cripta": "0.x",
|
|
9
|
+
"t0n": "0.x"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"bun-types": "catalog:",
|
|
13
|
+
"duto": "workspace:*",
|
|
14
|
+
"typescript": "catalog:",
|
|
15
|
+
"wrangler": "catalog:"
|
|
16
|
+
},
|
|
17
|
+
"duto": {
|
|
18
|
+
"type": "server",
|
|
19
|
+
"platform": "workerd",
|
|
20
|
+
"dev": {
|
|
21
|
+
"port": 3000
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"noEmit": true,
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"lib": ["ES2022"],
|
|
8
|
+
"types": ["duto"],
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"allowSyntheticDefaultImports": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"allowJs": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"experimentalDecorators": true,
|
|
16
|
+
"emitDecoratorMetadata": true,
|
|
17
|
+
"useDefineForClassFields": false,
|
|
18
|
+
"rootDir": "./",
|
|
19
|
+
"paths": {
|
|
20
|
+
"@/*": [
|
|
21
|
+
"./*"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"include": [
|
|
26
|
+
"actions",
|
|
27
|
+
"features",
|
|
28
|
+
"routes",
|
|
29
|
+
"configs",
|
|
30
|
+
"enums",
|
|
31
|
+
"libs",
|
|
32
|
+
"locales",
|
|
33
|
+
"middlewares",
|
|
34
|
+
"models",
|
|
35
|
+
"utils",
|
|
36
|
+
"tests/**/*"
|
|
37
|
+
],
|
|
38
|
+
"exclude": [
|
|
39
|
+
".duto",
|
|
40
|
+
"node_modules"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name = "duto-api"
|
|
2
|
+
main = ".duto/index.js"
|
|
3
|
+
compatibility_date = "2026-08-06"
|
|
4
|
+
|
|
5
|
+
# workers_dev = false
|
|
6
|
+
# preview_urls = false
|
|
7
|
+
no_bundle = true
|
|
8
|
+
send_metrics = false
|
|
9
|
+
compatibility_flags = [ "no_nodejs_compat", "no_nodejs_compat_v2" ]
|
|
10
|
+
|
|
11
|
+
# route = "example.com"
|
|
12
|
+
# route = { pattern = "api.example.com", custom_domain = true }
|
|
13
|
+
|
|
14
|
+
# [[routes]]
|
|
15
|
+
# pattern = "api.example.com/*"
|
|
16
|
+
# zone_name = "example.com"
|
|
17
|
+
# [[routes]]
|
|
18
|
+
# pattern = "api.example.com"
|
|
19
|
+
# custom_domain = true
|
|
20
|
+
|
|
21
|
+
# [observability]
|
|
22
|
+
# enabled = true
|
|
23
|
+
# head_sampling_rate = 0.1 # 10% of requests are logged
|
|
24
|
+
|
|
25
|
+
# PAID
|
|
26
|
+
# [limits]
|
|
27
|
+
# # The maximum CPU time allowed per invocation, in milliseconds
|
|
28
|
+
# cpu_ms = 100
|
|
29
|
+
|
|
30
|
+
# Bindings (KV, D1, R2..)
|
|
31
|
+
# kv_namespaces = []
|
|
32
|
+
# d1_databases = []
|
|
33
|
+
|
|
34
|
+
# [[d1_databases]]
|
|
35
|
+
# binding = "SCRIPT_NAME"
|
|
36
|
+
# database_name = "DB_NAME"
|
|
37
|
+
# database_id = "DB_UUID"
|
|
38
|
+
# preview_database_id = "PREVIEW_UUID"
|
|
39
|
+
# migrations_table = "MIGRATION_TABLE_NAME"
|
|
40
|
+
# migrations_dir = "migrations/sql"
|
|
41
|
+
# persist_to = "./.wrangler/state"
|
|
42
|
+
|
|
43
|
+
# [env.production]
|
|
44
|
+
# name = "rajt-api-prod"
|
|
45
|
+
|
|
46
|
+
# [vars]
|
|
47
|
+
# API_HOST = "api.example.com"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { command } from 't0n/cli'
|
|
2
|
+
import { dim, green } from 't0n/color'
|
|
3
|
+
import { event, error, step, log, rn } from 't0n/log'
|
|
4
|
+
import { _root } from '@/utils'
|
|
5
|
+
import { version } from '!/package.json'
|
|
6
|
+
|
|
7
|
+
import { createSpinner } from 'nanospinner'
|
|
8
|
+
|
|
9
|
+
export default command({
|
|
10
|
+
meta: {
|
|
11
|
+
name: 'upgrade',
|
|
12
|
+
description: '📄 Upgrade to latest version of Duto\n',
|
|
13
|
+
},
|
|
14
|
+
async run({ args }) { // @ts-ignore
|
|
15
|
+
const spinner = createSpinner('Upgrading...').start()
|
|
16
|
+
|
|
17
|
+
const proc = Bun.spawn(['bun', 'update', '-g', 'duto'], { stdout: 'ignore', stderr: 'ignore' })
|
|
18
|
+
const exitCode = await proc.exited
|
|
19
|
+
|
|
20
|
+
if (exitCode === 0) {
|
|
21
|
+
spinner.success({ text: 'Upgraded' })
|
|
22
|
+
} else {
|
|
23
|
+
spinner.error({ text: `Falha ao atualizar duto (exit ${exitCode})` })
|
|
24
|
+
process.exit(exitCode)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
event(green('Congrats!') + ` You're already on the latest version of Duto.`)
|
|
28
|
+
// event(green('Congrats!') + ` You're already on the latest version of Duto ${dim(`(which is v${version})`)}`)
|
|
29
|
+
},
|
|
30
|
+
})
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
export * from './pages'
|
|
2
|
+
|
|
1
3
|
export { default as Response } from './server/response'
|
|
2
|
-
export
|
|
4
|
+
export * from './server/config'
|
|
3
5
|
|
|
4
|
-
export {
|
|
6
|
+
export {
|
|
7
|
+
Enum,
|
|
8
|
+
Envir, hasEnv, getEnv, setEnv, addEnv, removeEnv
|
|
9
|
+
} from 't0n'
|
|
5
10
|
export type { EnumStatic, EnumValue, EnumType } from 't0n'
|
|
6
11
|
|
|
7
12
|
export type {
|