create-teko 1.4.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 +21 -0
- package/README.md +7 -0
- package/bin/create-teko.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +31 -0
- package/dist/src/cli.d.ts +1 -0
- package/package.json +90 -0
- package/templates/basic-node/README.md +7 -0
- package/templates/basic-node/package.json +36 -0
- package/templates/basic-node/src/client/main.ts +1 -0
- package/templates/basic-node/src/client/styles/app.css +5 -0
- package/templates/basic-node/src/server/app.js +18 -0
- package/templates/basic-node/src/views/components/ui/button.teko +4 -0
- package/templates/basic-node/src/views/layouts/app.teko +13 -0
- package/templates/basic-node/src/views/pages/home.teko +25 -0
- package/templates/basic-node/teko.config.ts +3 -0
- package/templates/basic-node/tsconfig.json +7 -0
- package/templates/basic-node/vite.config.ts +6 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Teko
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/cli.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// src/cli.ts
|
|
2
|
+
import { mkdir, writeFile, cp } from "fs/promises";
|
|
3
|
+
import { existsSync } from "fs";
|
|
4
|
+
import { dirname, join, resolve } from "path";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
async function main() {
|
|
8
|
+
const projectName = process.argv[2] || "my-teko-app";
|
|
9
|
+
const targetDir = resolve(process.cwd(), projectName);
|
|
10
|
+
if (existsSync(targetDir)) {
|
|
11
|
+
console.error(`A pasta "${projectName}" j\xE1 existe.`);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
await mkdir(targetDir, { recursive: true });
|
|
15
|
+
const templatesDir = resolve(__dirname, "../templates/basic-node");
|
|
16
|
+
await cp(templatesDir, targetDir, { recursive: true });
|
|
17
|
+
const pkgPath = join(targetDir, "package.json");
|
|
18
|
+
const pkgRaw = await (await import("fs/promises")).readFile(pkgPath, "utf8");
|
|
19
|
+
const pkg = JSON.parse(pkgRaw);
|
|
20
|
+
pkg.name = projectName;
|
|
21
|
+
await writeFile(pkgPath, JSON.stringify(pkg, null, 2) + "\n", "utf8");
|
|
22
|
+
console.log(`Projeto Teko criado em: ${targetDir}`);
|
|
23
|
+
console.log("Pr\xF3ximos passos:");
|
|
24
|
+
console.log(` cd ${projectName}`);
|
|
25
|
+
console.log(" npm install");
|
|
26
|
+
console.log(" npm run dev");
|
|
27
|
+
}
|
|
28
|
+
main().catch((error) => {
|
|
29
|
+
console.error(error);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-teko",
|
|
3
|
+
"version": "1.4.0",
|
|
4
|
+
"description": "Scaffold a new Teko app",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-teko": "./bin/create-teko.js"
|
|
8
|
+
},
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=18.0.0"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"bin",
|
|
15
|
+
"templates",
|
|
16
|
+
"!dist/tests",
|
|
17
|
+
"!dist/**/*.test.*",
|
|
18
|
+
"dist/**/*.d.ts",
|
|
19
|
+
"dist/**/*.js"
|
|
20
|
+
],
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/tekojs/create-teko.git"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/tekojs/create-teko#readme",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/tekojs/create-teko/issues"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"pretest": "npm run lint",
|
|
31
|
+
"test": "c8 npm run quick:test",
|
|
32
|
+
"lint": "eslint .",
|
|
33
|
+
"format": "prettier --write .",
|
|
34
|
+
"typecheck": "tsc --noEmit",
|
|
35
|
+
"clean": "del-cli dist",
|
|
36
|
+
"precompile": "npm run lint && npm run clean",
|
|
37
|
+
"compile": "tsup-node && tsc --emitDeclarationOnly --declaration",
|
|
38
|
+
"build": "npm run compile",
|
|
39
|
+
"version": "npm run build",
|
|
40
|
+
"prepublishOnly": "npm run build",
|
|
41
|
+
"quick:test": "node --import=ts-node-maintained/register/esm --enable-source-maps bin/test.ts",
|
|
42
|
+
"prepare": "husky",
|
|
43
|
+
"commitlint": "commitlint --edit",
|
|
44
|
+
"commit": "cz"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@arapucajs/tsconfig": "^1.0.0",
|
|
48
|
+
"@commitlint/cli": "^20.5.0",
|
|
49
|
+
"@commitlint/config-conventional": "^20.5.0",
|
|
50
|
+
"@types/node": "^25.5.2",
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "^8.29.0",
|
|
52
|
+
"@typescript-eslint/parser": "^8.29.0",
|
|
53
|
+
"c8": "^11.0.0",
|
|
54
|
+
"commitizen": "^4.3.1",
|
|
55
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
56
|
+
"del-cli": "^7.0.0",
|
|
57
|
+
"eslint": "^9.23.0",
|
|
58
|
+
"eslint-config-prettier": "^10.1.1",
|
|
59
|
+
"husky": "^9.1.7",
|
|
60
|
+
"prettier": "^3.5.2",
|
|
61
|
+
"qs": "^6.15.0",
|
|
62
|
+
"tsdown": "^0.21.7",
|
|
63
|
+
"tsup": "^8.5.1",
|
|
64
|
+
"typescript": "^6.0.2"
|
|
65
|
+
},
|
|
66
|
+
"keywords": [
|
|
67
|
+
"teko",
|
|
68
|
+
"create-teko",
|
|
69
|
+
"templates",
|
|
70
|
+
"frontend"
|
|
71
|
+
],
|
|
72
|
+
"author": "Jefte Costa <jefteamorim@gmail.com>",
|
|
73
|
+
"license": "MIT",
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public",
|
|
76
|
+
"provenance": true
|
|
77
|
+
},
|
|
78
|
+
"tsup": {
|
|
79
|
+
"entry": [
|
|
80
|
+
"./index.ts",
|
|
81
|
+
"./src/types.ts"
|
|
82
|
+
],
|
|
83
|
+
"outDir": "./dist",
|
|
84
|
+
"clean": true,
|
|
85
|
+
"format": "esm",
|
|
86
|
+
"dts": false,
|
|
87
|
+
"sourcemap": false,
|
|
88
|
+
"target": "esnext"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "my-teko-app",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "node --watch src/server/app.js",
|
|
7
|
+
"build": "echo \"build ainda ser\u00e1 refinado\"",
|
|
8
|
+
"start": "node src/server/app.js"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@tekojs/ssr": "^1.0.0",
|
|
12
|
+
"@tekojs/http": "^1.0.0"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@tekojs/vite-plugin": "^1.2.0",
|
|
16
|
+
"vite": "^7.0.0",
|
|
17
|
+
"@arapucajs/tsconfig": "^1.0.0",
|
|
18
|
+
"@commitlint/cli": "^20.5.0",
|
|
19
|
+
"@commitlint/config-conventional": "^20.5.0",
|
|
20
|
+
"@types/node": "^25.5.2",
|
|
21
|
+
"@typescript-eslint/eslint-plugin": "^8.29.0",
|
|
22
|
+
"@typescript-eslint/parser": "^8.29.0",
|
|
23
|
+
"c8": "^11.0.0",
|
|
24
|
+
"commitizen": "^4.3.1",
|
|
25
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
26
|
+
"del-cli": "^7.0.0",
|
|
27
|
+
"eslint": "^9.23.0",
|
|
28
|
+
"eslint-config-prettier": "^10.1.1",
|
|
29
|
+
"husky": "^9.1.7",
|
|
30
|
+
"prettier": "^3.5.2",
|
|
31
|
+
"qs": "^6.15.0",
|
|
32
|
+
"tsdown": "^0.21.7",
|
|
33
|
+
"tsup": "^8.5.1",
|
|
34
|
+
"typescript": "^6.0.2"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log('Teko client bundle carregado');
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import http from 'node:http';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { TekoRenderer } from '@tekojs/ssr';
|
|
5
|
+
import { createNodeTekoHandler } from '@tekojs/http';
|
|
6
|
+
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
|
|
10
|
+
const renderer = new TekoRenderer({
|
|
11
|
+
viewsPath: path.resolve(__dirname, '../views')
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const server = http.createServer(createNodeTekoHandler(renderer));
|
|
15
|
+
|
|
16
|
+
server.listen(3333, () => {
|
|
17
|
+
console.log('Teko app rodando em http://localhost:3333');
|
|
18
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@layouts.app({ title: 'Home' })
|
|
2
|
+
@slot('meta')
|
|
3
|
+
<meta name="description" content="Página inicial do Teko">
|
|
4
|
+
@end
|
|
5
|
+
|
|
6
|
+
@slot('main')
|
|
7
|
+
<h1>Olá, {{ user.name }}</h1>
|
|
8
|
+
|
|
9
|
+
@if(user.loggedIn)
|
|
10
|
+
<p>Bem-vindo ao Teko.</p>
|
|
11
|
+
@else
|
|
12
|
+
<p>Faça login para continuar.</p>
|
|
13
|
+
@end
|
|
14
|
+
|
|
15
|
+
<ul>
|
|
16
|
+
@each(post in posts)
|
|
17
|
+
<li>{{ post }}</li>
|
|
18
|
+
@end
|
|
19
|
+
</ul>
|
|
20
|
+
|
|
21
|
+
@ui.button({})
|
|
22
|
+
Entrar
|
|
23
|
+
@end
|
|
24
|
+
@end
|
|
25
|
+
@end
|