@yannosay/sinth 0.8.1 → 0.10.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 +20 -2
- package/bin/sinth.js +4 -4
- package/package.json +44 -44
- package/src/cli.ts +339 -0
- package/src/core/compiler.ts +1615 -0
- package/src/core/expr.ts +65 -0
- package/src/core/lexer.ts +272 -0
- package/src/core/parser.ts +1078 -0
- package/src/core/runtime.ts +399 -0
- package/src/core/types.ts +179 -0
- package/src/resolver.ts +150 -0
- package/src/server.ts +129 -0
- package/src/utils.ts +38 -0
- package/tsconfig.json +6 -2
- package/src/sinth.ts +0 -3699
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Sinth
|
|
2
2
|
|
|
3
3
|
The language that fixes HTML. Declarative. Reactive. Compiles to pure HTML.
|
|
4
|
+
Find out more: https://www.youtube.com/watch?v=W0tOMTiIF0Q
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
[](https://www.npmjs.com/package/@yannosay/sinth)
|
|
@@ -24,6 +25,21 @@ Button(onClick: "deletePost()") { "Delete" }
|
|
|
24
25
|
}
|
|
25
26
|
```
|
|
26
27
|
|
|
28
|
+
#### Functions - easy as you know it
|
|
29
|
+
```ts
|
|
30
|
+
page
|
|
31
|
+
|
|
32
|
+
title = "Function test"
|
|
33
|
+
|
|
34
|
+
function greet(str name) -> str { -- New! (0.10.0)
|
|
35
|
+
"Hello, " + name
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
Div {
|
|
39
|
+
(greet("Sinth")) + " - welcome!"
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
27
43
|
No JSX ternaries. No v-if. No separate script tags. Mixed logic. Clean.
|
|
28
44
|
|
|
29
45
|
#### Animations that make sense.
|
|
@@ -61,8 +77,9 @@ npm install -g @yannosay/sinth
|
|
|
61
77
|
|
|
62
78
|
|
|
63
79
|
## Quick Start
|
|
64
|
-
sinth init
|
|
65
|
-
|
|
80
|
+
`sinth init`
|
|
81
|
+
|
|
82
|
+
`sinth dev pages/index.sinth`
|
|
66
83
|
|
|
67
84
|
|
|
68
85
|
|
|
@@ -135,6 +152,7 @@ Sinth's reactive runtime does not use eval(). Every expression is pre-compiled i
|
|
|
135
152
|
- GitHub: [Official Sinth Repo](https://github.com/yannosay/sinth)
|
|
136
153
|
- Website: [Sinth](https://sinth.yannosay.com) (not active at this moment)
|
|
137
154
|
- Discord: [Join here!](https://discord.gg/SUvcrafTQm)
|
|
155
|
+
- VS Code Extension: [Download here](https://marketplace.visualstudio.com/items?itemName=YannosayProductions.sinth-vscode)
|
|
138
156
|
|
|
139
157
|
|
|
140
158
|
|
package/bin/sinth.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const tsSource = path.join(__dirname, '..', 'src', '
|
|
4
|
-
require('ts-node').register({ project: path.join(__dirname, '..', 'tsconfig.json') });
|
|
5
|
-
require(tsSource);
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const tsSource = path.join(__dirname, '..', 'src', 'cli.ts');
|
|
4
|
+
require('ts-node').register({ project: path.join(__dirname, '..', 'tsconfig.json') });
|
|
5
|
+
require(tsSource);
|
package/package.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
2
|
+
"name": "@yannosay/sinth",
|
|
3
|
+
"version": "0.10.0",
|
|
4
|
+
"description": "A declarative language that compiles to pure HTML, CSS, and JavaScript.",
|
|
5
|
+
"author": "Yannosay Productions",
|
|
6
|
+
"license": "AGPL-3.0",
|
|
7
|
+
"homepage": "https://sinth.yannosay.com",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/yannosay/sinth.git"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"html",
|
|
14
|
+
"css",
|
|
15
|
+
"javascript",
|
|
16
|
+
"compiler",
|
|
17
|
+
"declarative",
|
|
18
|
+
"web",
|
|
19
|
+
"components",
|
|
20
|
+
"scss",
|
|
21
|
+
"reactive"
|
|
22
|
+
],
|
|
23
|
+
"bin": {
|
|
24
|
+
"sinth": "bin/sinth.js"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"bin/",
|
|
28
|
+
"src/",
|
|
29
|
+
"assets/",
|
|
30
|
+
"tsconfig.json",
|
|
31
|
+
"README.md",
|
|
32
|
+
"LICENSE"
|
|
33
|
+
],
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"sass": "^1.70.0",
|
|
36
|
+
"ts-node": "^10.9.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "^20.19.40",
|
|
40
|
+
"typescript": "^5.3.0"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=18.0.0"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/src/cli.ts
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
import { SinthWarning } from "./core/types.ts";
|
|
5
|
+
import { compileFile, CompileOptions, findSinthPages, copyDir } from "./core/compiler.ts";
|
|
6
|
+
import { startDevServer } from "./server.ts";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
function loadConfig(root: string): Record<string, unknown> {
|
|
11
|
+
const cfgPath = path.join(root, "sinth.config.json");
|
|
12
|
+
if (fs.existsSync(cfgPath)) {
|
|
13
|
+
try { return JSON.parse(fs.readFileSync(cfgPath, "utf-8")) as Record<string, unknown>; }
|
|
14
|
+
catch { SinthWarning.emit("Could not parse sinth.config.json"); }
|
|
15
|
+
}
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function main(): Promise<void> {
|
|
20
|
+
const [,, command, ...args] = process.argv;
|
|
21
|
+
const cwd = process.cwd();
|
|
22
|
+
const cfg = loadConfig(cwd);
|
|
23
|
+
|
|
24
|
+
const outDirIdx = args.indexOf("--out");
|
|
25
|
+
const outDir = outDirIdx !== -1 ? args[outDirIdx + 1] : (cfg.outDir as string | undefined) ?? path.join(cwd, "dist");
|
|
26
|
+
const portIdx = args.indexOf("--port");
|
|
27
|
+
const port = portIdx !== -1 ? parseInt(args[portIdx + 1], 10) : (cfg.port as number | undefined) ?? 3000;
|
|
28
|
+
const minify = args.includes("--prod") || Boolean(cfg.minify);
|
|
29
|
+
const sharedRuntime = args.includes("--shared-runtime") || Boolean(cfg.sharedRuntime);
|
|
30
|
+
const libraryPaths = (cfg.libraryPaths as string[] | undefined) ?? [path.join(cwd, "libraries")];
|
|
31
|
+
|
|
32
|
+
const flagValues = new Set<string>();
|
|
33
|
+
if (outDirIdx !== -1) flagValues.add(args[outDirIdx + 1]);
|
|
34
|
+
if (portIdx !== -1) flagValues.add(args[portIdx + 1]);
|
|
35
|
+
const cleanArgs = args.filter(a => !a.startsWith("--") && !flagValues.has(a));
|
|
36
|
+
|
|
37
|
+
const opts: CompileOptions = { projectRoot: cwd, outDir, libraryPaths, minify, checkOnly: false, sharedRuntime };
|
|
38
|
+
|
|
39
|
+
switch (command) {
|
|
40
|
+
case "build": {
|
|
41
|
+
const nonSinth = cleanArgs.filter(a => !a.endsWith(".sinth"));
|
|
42
|
+
if (nonSinth.length > 0) process.stdout.write(`\x1b[33mSkipping non-.sinth files:\x1b[0m ${nonSinth.join(", ")}\n`);
|
|
43
|
+
|
|
44
|
+
const fileArgs = cleanArgs.filter(a => a.endsWith(".sinth"));
|
|
45
|
+
const pages = fileArgs.length > 0
|
|
46
|
+
? fileArgs.map(f => path.resolve(cwd, f)).filter(f => fs.existsSync(f))
|
|
47
|
+
: findSinthPages(cwd, outDir);
|
|
48
|
+
|
|
49
|
+
if (pages.length === 0) { process.stdout.write("No .sinth files found.\n"); process.exit(0); }
|
|
50
|
+
|
|
51
|
+
let hadError = false, built = 0;
|
|
52
|
+
|
|
53
|
+
const sharedRuntimes: string[] = [];
|
|
54
|
+
for (const p of pages) {
|
|
55
|
+
try {
|
|
56
|
+
const result = compileFile(p, opts);
|
|
57
|
+
if (!result) continue;
|
|
58
|
+
const html = result.html;
|
|
59
|
+
if (result.shared) {
|
|
60
|
+
sharedRuntimes.push(result.shared);
|
|
61
|
+
}
|
|
62
|
+
const rel = path.relative(cwd, p).replace(/\.sinth$/, ".html");
|
|
63
|
+
const out = path.join(outDir, rel);
|
|
64
|
+
fs.mkdirSync(path.dirname(out), { recursive: true });
|
|
65
|
+
fs.writeFileSync(out, html);
|
|
66
|
+
process.stdout.write(` \x1b[32m✓\x1b[0m ${rel}\n`);
|
|
67
|
+
built++;
|
|
68
|
+
} catch (e: unknown) {
|
|
69
|
+
process.stderr.write(` \x1b[31m✗\x1b[0m ${path.relative(cwd, p)}\n${(e as Error).message}\n`);
|
|
70
|
+
hadError = true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (sharedRuntimes.length > 0) {
|
|
75
|
+
const combined = sharedRuntimes.join("\n");
|
|
76
|
+
fs.writeFileSync(path.join(outDir, "sinth-runtime.js"), combined);
|
|
77
|
+
process.stdout.write(` \x1b[32m✓\x1b[0m sinth-runtime.js (shared)\n`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// copies to output
|
|
81
|
+
const assetsIn = path.join(cwd, "assets"), assetsOut = path.join(outDir, "assets");
|
|
82
|
+
if (fs.existsSync(assetsIn)) {
|
|
83
|
+
copyDir(assetsIn, assetsOut);
|
|
84
|
+
process.stdout.write(` \x1b[32m✓\x1b[0m assets/ → ${path.relative(cwd, assetsOut)}/\n`);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const libIn = path.join(cwd, "libraries"), libOut = path.join(outDir, "libraries");
|
|
88
|
+
if (fs.existsSync(libIn)) {
|
|
89
|
+
copyDir(libIn, libOut);
|
|
90
|
+
const libFiles = fs.readdirSync(libOut, { recursive: true }) as string[];
|
|
91
|
+
for (const f of libFiles) {
|
|
92
|
+
if (f.endsWith(".sinth") || f.endsWith(".html")) {
|
|
93
|
+
try { fs.unlinkSync(path.join(libOut, f)); } catch {}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
process.stdout.write(` \x1b[32m✓\x1b[0m libraries/ → ${path.relative(cwd, libOut)}/\n`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
process.stdout.write(`\n\x1b[1mBuilt ${built} page(s)\x1b[0m${hadError ? " with errors" : ""}\n`);
|
|
100
|
+
process.exit(hadError ? 1 : 0);
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
case "dev": {
|
|
105
|
+
const fileArgs = cleanArgs.filter(a => a.endsWith(".sinth"));
|
|
106
|
+
const files = fileArgs.length > 0
|
|
107
|
+
? fileArgs.map(f => path.resolve(cwd, f)).filter(f => fs.existsSync(f))
|
|
108
|
+
: undefined;
|
|
109
|
+
await startDevServer({ ...opts, port, files });
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
case "check": {
|
|
114
|
+
opts.checkOnly = true;
|
|
115
|
+
const pages = findSinthPages(cwd, outDir);
|
|
116
|
+
let hadError = false;
|
|
117
|
+
for (const p of pages) {
|
|
118
|
+
try {
|
|
119
|
+
compileFile(p, opts);
|
|
120
|
+
process.stdout.write(` \x1b[32m✓\x1b[0m ${path.relative(cwd, p)}\n`);
|
|
121
|
+
} catch (e: unknown) {
|
|
122
|
+
process.stderr.write(` \x1b[31m✗\x1b[0m ${path.relative(cwd, p)}\n${(e as Error).message}\n`);
|
|
123
|
+
hadError = true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
process.exit(hadError ? 1 : 0);
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
case "version":
|
|
131
|
+
case "--version":
|
|
132
|
+
case "-v": {
|
|
133
|
+
const pkgPath = path.join(__dirname, "..", "package.json");
|
|
134
|
+
if (fs.existsSync(pkgPath)) {
|
|
135
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
136
|
+
process.stdout.write(`Sinth Compiler v${pkg.version}\n`);
|
|
137
|
+
} else {
|
|
138
|
+
process.stdout.write("Sinth Compiler v1.0.0\n");
|
|
139
|
+
}
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
case "init": {
|
|
144
|
+
const projectName = cleanArgs[0] || "my-sinth-project";
|
|
145
|
+
scaffoldProject(path.resolve(cwd, projectName));
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
default: {
|
|
150
|
+
let version = "1.0.0";
|
|
151
|
+
const paths = [
|
|
152
|
+
path.resolve(__dirname, "..", "package.json"),
|
|
153
|
+
path.resolve(__dirname, "package.json"),
|
|
154
|
+
path.resolve(process.cwd(), "package.json"),
|
|
155
|
+
path.resolve(process.cwd(), "..", "package.json"),
|
|
156
|
+
];
|
|
157
|
+
for (const p of paths) {
|
|
158
|
+
if (fs.existsSync(p)) {
|
|
159
|
+
try {
|
|
160
|
+
const pkg = JSON.parse(fs.readFileSync(p, "utf-8"));
|
|
161
|
+
version = pkg.version;
|
|
162
|
+
break;
|
|
163
|
+
} catch {}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
process.stdout.write(`
|
|
167
|
+
\x1b[1mSinth Compiler v${version}\x1b[0m
|
|
168
|
+
|
|
169
|
+
\x1b[1mCommands:\x1b[0m
|
|
170
|
+
sinth build [files] [--out ./dist] [--prod] Compile .sinth pages
|
|
171
|
+
sinth dev [files] [--port 3000] Live-reload dev server
|
|
172
|
+
sinth check Lint without emitting
|
|
173
|
+
sinth init [name] Scaffold a new project
|
|
174
|
+
sinth version Print version
|
|
175
|
+
`);
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// project scaffholding
|
|
182
|
+
|
|
183
|
+
function scaffoldProject(root: string): void {
|
|
184
|
+
for (const d of ["pages", "components", "styles", "libraries", "assets"]) {
|
|
185
|
+
fs.mkdirSync(path.join(root, d), { recursive: true });
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
fs.writeFileSync(path.join(root, "pages", "index.sinth"), `-- My Sinth Site
|
|
189
|
+
page
|
|
190
|
+
|
|
191
|
+
import "../components/Navbar.sinth"
|
|
192
|
+
import css "../styles/reset.css"
|
|
193
|
+
|
|
194
|
+
title = "My Site"
|
|
195
|
+
fav = "assets/favicon.ico"
|
|
196
|
+
descr = "Built with Sinth v1.0.0."
|
|
197
|
+
|
|
198
|
+
var int score = 0
|
|
199
|
+
var str message = "Click to begin"
|
|
200
|
+
|
|
201
|
+
Navbar
|
|
202
|
+
|
|
203
|
+
Hero {
|
|
204
|
+
Heading(level: 1) { "Welcome to Sinth" }
|
|
205
|
+
Paragraph { "A declarative, component-based web UI language." }
|
|
206
|
+
Button(onClick: "handleClick") { "Get Started" }
|
|
207
|
+
Paragraph(id: "score-display") { message }
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
Main {
|
|
211
|
+
Section {
|
|
212
|
+
Heading(level: 2) { "Features" }
|
|
213
|
+
CardGrid {
|
|
214
|
+
-- Add Card components here
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
style {
|
|
220
|
+
section.hero {
|
|
221
|
+
padding: "4rem 2rem"
|
|
222
|
+
textAlign: "center"
|
|
223
|
+
backgroundColor: "#f0f4ff"
|
|
224
|
+
}
|
|
225
|
+
main {
|
|
226
|
+
maxWidth: "1100px"
|
|
227
|
+
margin: "0 auto"
|
|
228
|
+
padding: "2rem"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
script {
|
|
233
|
+
function handleClick() {
|
|
234
|
+
score += 1
|
|
235
|
+
message = "Score: " + score
|
|
236
|
+
sinthRender()
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
`);
|
|
240
|
+
|
|
241
|
+
fs.writeFileSync(path.join(root, "components", "Navbar.sinth"), `-- Navbar component
|
|
242
|
+
|
|
243
|
+
component Navbar {
|
|
244
|
+
Header {
|
|
245
|
+
Nav {
|
|
246
|
+
Link(href: "/", class: "logo") { "MySite" }
|
|
247
|
+
Div(class: "nav-links") {
|
|
248
|
+
NavLink(href: "/") { "Home" }
|
|
249
|
+
NavLink(href: "/about") { "About" }
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
style {
|
|
255
|
+
header {
|
|
256
|
+
display: "flex"
|
|
257
|
+
alignItems: "center"
|
|
258
|
+
padding: "1rem 2rem"
|
|
259
|
+
backgroundColor: "#1a1a2e"
|
|
260
|
+
color: "white"
|
|
261
|
+
}
|
|
262
|
+
.logo {
|
|
263
|
+
fontSize: "1.5rem"
|
|
264
|
+
fontWeight: "700"
|
|
265
|
+
color: "white"
|
|
266
|
+
textDecoration: "none"
|
|
267
|
+
}
|
|
268
|
+
.nav-links {
|
|
269
|
+
marginLeft: "auto"
|
|
270
|
+
display: "flex"
|
|
271
|
+
gap: "1.5rem"
|
|
272
|
+
}
|
|
273
|
+
.nav-links a {
|
|
274
|
+
color: "rgba(255,255,255,0.8)"
|
|
275
|
+
textDecoration: "none"
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
`);
|
|
280
|
+
|
|
281
|
+
fs.writeFileSync(path.join(root, "components", "Card.sinth"), `-- Card component
|
|
282
|
+
|
|
283
|
+
component Card(title, color = "blue") {
|
|
284
|
+
Div(class: "card") {
|
|
285
|
+
Heading(level: 3) { "$title" }
|
|
286
|
+
Div(class: "card-body") { "$slot" }
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
style {
|
|
290
|
+
.card {
|
|
291
|
+
backgroundColor: "#f7f7f7"
|
|
292
|
+
borderRadius: "1rem"
|
|
293
|
+
padding: "1.5rem"
|
|
294
|
+
marginBottom: "1rem"
|
|
295
|
+
}
|
|
296
|
+
.card:hover {
|
|
297
|
+
boxShadow: "0 4px 16px rgba(0,0,0,0.1)"
|
|
298
|
+
}
|
|
299
|
+
.card-body {
|
|
300
|
+
marginTop: "0.75rem"
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
`);
|
|
305
|
+
|
|
306
|
+
fs.writeFileSync(path.join(root, "styles", "reset.css"),
|
|
307
|
+
`*, *::before, *::after { box-sizing: border-box; }\nbody { margin: 0; font-family: system-ui, sans-serif; line-height: 1.6; }\nimg { max-width: 100%; display: block; }\n`
|
|
308
|
+
);
|
|
309
|
+
|
|
310
|
+
fs.writeFileSync(path.join(root, "sinth.config.json"),
|
|
311
|
+
JSON.stringify({ outDir: "./dist", libraryPaths: ["./libraries"], minify: false }, null, 2)
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
fs.writeFileSync(path.join(root, ".gitignore"), "dist/\nnode_modules/\n");
|
|
315
|
+
|
|
316
|
+
fs.writeFileSync(path.join(root, "package.json"), JSON.stringify({
|
|
317
|
+
name: path.basename(root).toLowerCase().replace(/\s+/g, "-"),
|
|
318
|
+
version: "1.0.0",
|
|
319
|
+
scripts: { build: "sinth build", dev: "sinth dev" },
|
|
320
|
+
devDependencies: { "ts-node": "^10.0.0", typescript: "^5.0.0", sass: "^1.70.0" },
|
|
321
|
+
}, null, 2));
|
|
322
|
+
|
|
323
|
+
process.stdout.write(`
|
|
324
|
+
\x1b[32m✓ Sinth project scaffolded at ${path.basename(root)}/\x1b[0m
|
|
325
|
+
|
|
326
|
+
\x1b[1mNext steps:\x1b[0m
|
|
327
|
+
cd ${path.basename(root)}
|
|
328
|
+
sinth dev
|
|
329
|
+
sinth build
|
|
330
|
+
`);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
main().catch(e => {
|
|
337
|
+
process.stderr.write(`\x1b[31m${(e as Error).message}\x1b[0m\n`);
|
|
338
|
+
process.exit(1);
|
|
339
|
+
});
|