@evjs/create-app 0.0.6 → 0.0.8
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 +41 -0
- package/dist/index.js +6 -5
- package/package.json +1 -3
- package/templates/basic-csr/package.json +3 -3
- package/templates/basic-server-fns/package.json +3 -3
- package/templates/basic-server-routes/package.json +3 -3
- package/templates/complex-routing/package.json +3 -3
- package/templates/complex-routing/src/api/data.server.ts +1 -1
- package/templates/configured-server-fns/ev.config.ts +30 -33
- package/templates/configured-server-fns/package.json +3 -3
- package/templates/with-tailwind/ev.config.ts +7 -18
- package/templates/with-tailwind/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @evjs/create-app
|
|
2
|
+
|
|
3
|
+
> Scaffolding tool for the **evjs** fullstack framework.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
### `create-evjs-app`
|
|
8
|
+
|
|
9
|
+
The primary interactive CLI for creating new projects.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx create-evjs-app [name] [options]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Options
|
|
16
|
+
|
|
17
|
+
- `[name]` (string): Project name and directory.
|
|
18
|
+
- `--template <name>`: Specify a template (see [Templates](#templates)).
|
|
19
|
+
- `--help`: Show usage info.
|
|
20
|
+
|
|
21
|
+
## Templates
|
|
22
|
+
|
|
23
|
+
| Name | Description |
|
|
24
|
+
|------|-------------|
|
|
25
|
+
| **`basic-csr`** | Client-side only (React + TanStack Router). |
|
|
26
|
+
| **`basic-server-fns`** | Basic full-stack with server functions. |
|
|
27
|
+
| **`configured-server-fns`** | Full-stack with `@evjs/create-app` + `ev.config.ts`. |
|
|
28
|
+
| **`complex-routing`** | Nested layouts, loaders, and search params. |
|
|
29
|
+
| **`with-tailwind`** | Ready-to-go Tailwind CSS integration. |
|
|
30
|
+
|
|
31
|
+
## Quick Start via npx
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx create-evjs-app my-new-app
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Follow the interactive prompts to select your features and get started in seconds.
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
MIT
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import fs from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { fileURLToPath } from "node:url";
|
|
4
5
|
import { Command } from "commander";
|
|
5
|
-
import fs from "fs-extra";
|
|
6
6
|
import pc from "picocolors";
|
|
7
7
|
import prompts from "prompts";
|
|
8
8
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
-
const pkg = fs.
|
|
9
|
+
const pkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, "../package.json"), "utf-8"));
|
|
10
10
|
const program = new Command();
|
|
11
11
|
program
|
|
12
12
|
.name("create-evjs-app")
|
|
@@ -65,7 +65,8 @@ program
|
|
|
65
65
|
process.exit(1);
|
|
66
66
|
}
|
|
67
67
|
console.log(pc.cyan(`⚡ Scaffolding project in ${targetDir}...`));
|
|
68
|
-
|
|
68
|
+
fs.cpSync(templateDir, targetDir, {
|
|
69
|
+
recursive: true,
|
|
69
70
|
dereference: true,
|
|
70
71
|
filter: (src) => {
|
|
71
72
|
const basename = path.basename(src);
|
|
@@ -75,7 +76,7 @@ program
|
|
|
75
76
|
// Post-process package.json: sync @evjs/* versions and set project name
|
|
76
77
|
const pkgPath = path.join(targetDir, "package.json");
|
|
77
78
|
if (fs.existsSync(pkgPath)) {
|
|
78
|
-
const projPkg =
|
|
79
|
+
const projPkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
79
80
|
projPkg.name = projectName;
|
|
80
81
|
delete projPkg.private; // Templates shouldn't be private by default
|
|
81
82
|
const updateDeps = (deps) => {
|
|
@@ -91,7 +92,7 @@ program
|
|
|
91
92
|
};
|
|
92
93
|
updateDeps(projPkg.dependencies);
|
|
93
94
|
updateDeps(projPkg.devDependencies);
|
|
94
|
-
await fs.
|
|
95
|
+
await fs.writeFileSync(pkgPath, JSON.stringify(projPkg, null, 2));
|
|
95
96
|
}
|
|
96
97
|
console.log(pc.green("✔ Done! Now run:"));
|
|
97
98
|
console.log(` cd ${projectName}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evjs/create-app",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "Scaffold a new evjs project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,12 +23,10 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"commander": "^12.1.0",
|
|
26
|
-
"fs-extra": "^11.3.4",
|
|
27
26
|
"picocolors": "^1.1.1",
|
|
28
27
|
"prompts": "^2.4.2"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
|
-
"@types/fs-extra": "^11.0.4",
|
|
32
30
|
"@types/node": "^22.19.15",
|
|
33
31
|
"@types/prompts": "^2.4.9",
|
|
34
32
|
"typescript": "^6.0.2"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "example-basic-csr",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"dev": "ev dev",
|
|
7
|
-
"build": "ev build",
|
|
6
|
+
"dev": "npx ev dev",
|
|
7
|
+
"build": "npx ev build",
|
|
8
8
|
"check-types": "tsc --noEmit"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "example-basic-server-fns",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"dev": "ev dev",
|
|
7
|
-
"build": "ev build",
|
|
6
|
+
"dev": "npx ev dev",
|
|
7
|
+
"build": "npx ev build",
|
|
8
8
|
"check-types": "tsc --noEmit"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "example-basic-server-routes",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"dev": "ev dev",
|
|
7
|
-
"build": "ev build",
|
|
6
|
+
"dev": "npx ev dev",
|
|
7
|
+
"build": "npx ev build",
|
|
8
8
|
"check-types": "tsc --noEmit"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "example-complex-routing",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"dev": "ev dev",
|
|
7
|
-
"build": "ev build",
|
|
6
|
+
"dev": "npx ev dev",
|
|
7
|
+
"build": "npx ev build",
|
|
8
8
|
"check-types": "tsc --noEmit"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
@@ -7,44 +7,24 @@ import { defineConfig } from "@evjs/cli";
|
|
|
7
7
|
* All fields are optional — evjs works out of the box.
|
|
8
8
|
*/
|
|
9
9
|
export default defineConfig({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
entry: "./src/main.tsx",
|
|
13
|
-
|
|
14
|
-
// HTML template (default: "./index.html")
|
|
15
|
-
html: "./index.html",
|
|
16
|
-
|
|
17
|
-
// Build plugins
|
|
18
|
-
plugins: [
|
|
19
|
-
{
|
|
20
|
-
name: "example-txt-plugin",
|
|
21
|
-
module: {
|
|
22
|
-
rules: [
|
|
23
|
-
{
|
|
24
|
-
test: /\.txt$/,
|
|
25
|
-
use: "raw-loader",
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
],
|
|
10
|
+
// Client entry point (default: "./src/main.tsx")
|
|
11
|
+
entry: "./src/main.tsx",
|
|
31
12
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// Dev server port (default: 3000)
|
|
35
|
-
port: 4000,
|
|
13
|
+
// HTML template (default: "./index.html")
|
|
14
|
+
html: "./index.html",
|
|
36
15
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
16
|
+
// Dev server options (merged with built-in defaults)
|
|
17
|
+
dev: {
|
|
18
|
+
// Dev server port (default: 3000)
|
|
19
|
+
port: 4000,
|
|
20
|
+
|
|
21
|
+
// Any dev server options can be added here:
|
|
22
|
+
// https: true,
|
|
40
23
|
},
|
|
41
24
|
|
|
42
25
|
server: {
|
|
43
|
-
// Server function
|
|
44
|
-
|
|
45
|
-
// Server function endpoint path (default: "/api/fn")
|
|
46
|
-
endpoint: "/api/fn",
|
|
47
|
-
},
|
|
26
|
+
// Server function endpoint path (default: "/api/fn")
|
|
27
|
+
endpoint: "/api/fn",
|
|
48
28
|
|
|
49
29
|
// Server backend command (default: "node")
|
|
50
30
|
// Supports: "node", "bun", "deno run --allow-net", etc.
|
|
@@ -56,4 +36,21 @@ export default defineConfig({
|
|
|
56
36
|
port: 4001,
|
|
57
37
|
},
|
|
58
38
|
},
|
|
39
|
+
|
|
40
|
+
// Build-time plugins (can also use the `bundler` escape hatch directly)
|
|
41
|
+
plugins: [
|
|
42
|
+
{
|
|
43
|
+
name: "example-txt-plugin",
|
|
44
|
+
bundler(bundlerConfig, ctx) {
|
|
45
|
+
// Direct access to the bundler (e.g. Webpack) configuration
|
|
46
|
+
if (ctx.config.bundler.name === "webpack") {
|
|
47
|
+
const webpackConfig = bundlerConfig as any;
|
|
48
|
+
webpackConfig.module.rules.push({
|
|
49
|
+
test: /\.txt$/,
|
|
50
|
+
use: "raw-loader",
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
],
|
|
59
56
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "example-configured-server-fns",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"dev": "ev dev",
|
|
7
|
-
"build": "ev build",
|
|
6
|
+
"dev": "npx ev dev",
|
|
7
|
+
"build": "npx ev build",
|
|
8
8
|
"check-types": "tsc --noEmit"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import { defineConfig } from "@evjs/cli";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Example: Using
|
|
4
|
+
* Example: Using Tailwind CSS.
|
|
5
|
+
*
|
|
6
|
+
* Tailwind is supported out-of-the-box by the framework.
|
|
7
|
+
* Because a `postcss.config.js` file exists in this directory,
|
|
8
|
+
* `evjs` automatically applies `postcss-loader` alongside `css-loader`.
|
|
9
|
+
* No custom loaders or `bundler` hooks are needed!
|
|
5
10
|
*/
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
client: {
|
|
8
|
-
plugins: [
|
|
9
|
-
{
|
|
10
|
-
name: "tailwind",
|
|
11
|
-
module: {
|
|
12
|
-
rules: [
|
|
13
|
-
{
|
|
14
|
-
test: /\.css$/,
|
|
15
|
-
use: ["style-loader", "css-loader", "postcss-loader"],
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
},
|
|
22
|
-
});
|
|
11
|
+
export default defineConfig({});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "example-with-tailwind",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"dev": "ev dev",
|
|
7
|
-
"build": "ev build",
|
|
6
|
+
"dev": "npx ev dev",
|
|
7
|
+
"build": "npx ev build",
|
|
8
8
|
"check-types": "tsc --noEmit"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|