create-nevela 0.5.0 → 0.5.1
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 +16 -15
- package/index.mjs +14 -4
- package/package.json +1 -1
- package/template/laravel/README.md +6 -4
- package/template/laravel/src/Nevela.php +1 -1
- package/template/web/app/page.tsx +3 -9
- package/template/web/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# create-nevela
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `nevela` command. It creates a new [Nevela](https://nevela-docs.vercel.app) app, a Laravel API and a Next.js dashboard generated from one resource description, and runs everything inside one.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install -g create-nevela # once
|
|
7
|
+
nevela new my-app
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Or without installing anything:
|
|
4
11
|
|
|
5
12
|
```sh
|
|
6
13
|
pnpm create nevela my-app
|
|
@@ -16,41 +23,35 @@ You need PHP 8.3 or newer, Composer, and Node.js 20 or newer.
|
|
|
16
23
|
my-app/
|
|
17
24
|
├─ apps/api/ a Laravel app with Sanctum and Nevela installed
|
|
18
25
|
├─ apps/web/ the Next.js dashboard, pointed at the API
|
|
19
|
-
└─ nevela
|
|
26
|
+
└─ nevela the app's own launcher: php nevela does what nevela does
|
|
20
27
|
```
|
|
21
28
|
|
|
22
29
|
Then:
|
|
23
30
|
|
|
24
31
|
```sh
|
|
25
32
|
cd my-app
|
|
26
|
-
|
|
33
|
+
nevela dev
|
|
27
34
|
```
|
|
28
35
|
|
|
29
|
-
Open http://localhost:3000/sign-in and sign in as `admin@example.com` with the password `password`. That starter account is in your local database only; add your own with `
|
|
36
|
+
Open http://localhost:3000/sign-in and sign in as `admin@example.com` with the password `password`. That starter account is in your local database only; add your own with `nevela user`.
|
|
30
37
|
|
|
31
38
|
The app starts with an administrator and ten sample users (two editors, eight users), in your local database only, so its Users and Roles screens have something to show. Leave the samples out with `--no-sample-users`.
|
|
32
39
|
|
|
33
40
|
Add your first resource, from the same folder:
|
|
34
41
|
|
|
35
42
|
```sh
|
|
36
|
-
|
|
43
|
+
nevela resource Product --fields="name:string, sku:string!, price:money"
|
|
37
44
|
```
|
|
38
45
|
|
|
39
|
-
That writes the Laravel code and the dashboard pages, and creates the table. `
|
|
46
|
+
That writes the Laravel code and the dashboard pages, and creates the table. `nevela` on its own lists everything else.
|
|
40
47
|
|
|
41
|
-
##
|
|
42
|
-
|
|
43
|
-
Install this package once and you have a `nevela` command, in every shell:
|
|
44
|
-
|
|
45
|
-
```sh
|
|
46
|
-
npm install -g create-nevela
|
|
47
|
-
```
|
|
48
|
+
## Every command
|
|
48
49
|
|
|
49
50
|
```sh
|
|
50
51
|
nevela # anywhere: everything it can do
|
|
51
52
|
nevela new my-app # anywhere: create an app (leave the name off and it asks)
|
|
52
53
|
nevela update # anywhere: update the nevela command itself
|
|
53
|
-
nevela version
|
|
54
|
+
nevela --version # anywhere: the command's version, and the app's when in one
|
|
54
55
|
nevela dev # inside an app: run the API and the dashboard
|
|
55
56
|
nevela upgrade # inside an app: bring it to the latest Nevela
|
|
56
57
|
```
|
|
@@ -79,7 +80,7 @@ Without the command installed, `npx create-nevela upgrade` does the same, in any
|
|
|
79
80
|
| `--bundled-package` | Use the copy of `nevela/laravel` inside this installer instead of the release on Packagist. |
|
|
80
81
|
| `-y`, `--yes` | Ask nothing. Only the app name is ever asked for. |
|
|
81
82
|
|
|
82
|
-
|
|
83
|
+
Through npm's `create`, put options after `--`: `npm create nevela@latest my-app -- --no-install`.
|
|
83
84
|
|
|
84
85
|
## How it installs the Laravel package
|
|
85
86
|
|
package/index.mjs
CHANGED
|
@@ -68,14 +68,14 @@ const HELP = ` Create a new Nevela app: a Laravel API and a Next.js dashboard.
|
|
|
68
68
|
nevela new [name] [options] Create an app. It asks for the name if you leave it off.
|
|
69
69
|
Without the command: pnpm create nevela <name>
|
|
70
70
|
nevela update Update the nevela command itself to the latest version
|
|
71
|
-
nevela version
|
|
71
|
+
nevela --version Which version the nevela command is, and this app when in one
|
|
72
72
|
|
|
73
73
|
${bold('Inside an app')}
|
|
74
74
|
nevela upgrade Bring this app to the latest Nevela: the package and the dashboard
|
|
75
75
|
nevela dev Run the API and the dashboard
|
|
76
76
|
nevela status Check versions, migrations, users and the dashboard
|
|
77
77
|
nevela resource <Name> --fields="…" [--seed]
|
|
78
|
-
nevela seed | user | generate |
|
|
78
|
+
nevela seed | user | generate | migrate | artisan <command>
|
|
79
79
|
|
|
80
80
|
${bold('Options')}
|
|
81
81
|
--pm <pnpm|npm|yarn|bun> Package manager for the dashboard. Default: the one you ran this with.
|
|
@@ -89,7 +89,7 @@ const HELP = ` Create a new Nevela app: a Laravel API and a Next.js dashboard.
|
|
|
89
89
|
instead of the release on Packagist.
|
|
90
90
|
-y, --yes Ask nothing. (Only the app name is ever asked for.)
|
|
91
91
|
-h, --help Show this.
|
|
92
|
-
-v, --version Show the version.
|
|
92
|
+
-v, --version Show the version. Piped or captured, the number alone.
|
|
93
93
|
|
|
94
94
|
${bold('Needs')} PHP 8.3+, Composer, Node.js 20+
|
|
95
95
|
${bold('Docs')} ${DOCS}
|
|
@@ -445,7 +445,10 @@ function appVersion(project) {
|
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
447
|
|
|
448
|
-
/**
|
|
448
|
+
/**
|
|
449
|
+
* `nevela --version`, from anywhere: the command's version, and the app's when in one.
|
|
450
|
+
* `nevela version` is the same thing by its older name.
|
|
451
|
+
*/
|
|
449
452
|
function showVersion() {
|
|
450
453
|
const project = findProject(process.cwd());
|
|
451
454
|
const install = installed();
|
|
@@ -574,6 +577,13 @@ async function main() {
|
|
|
574
577
|
if (argv[0] === 'new') argv.shift();
|
|
575
578
|
else if (argv[0] === 'update') return updateTool(argv.slice(1));
|
|
576
579
|
else if (argv[0] === 'version') return showVersion();
|
|
580
|
+
else if ((argv[0] === '--version' || argv[0] === '-v') && argv.length === 1) {
|
|
581
|
+
// To a person, the whole answer. To a script (and to `nevela update`, which asks
|
|
582
|
+
// this of the installed command to check its work), the number and nothing else.
|
|
583
|
+
if (process.stdout.isTTY) return showVersion();
|
|
584
|
+
console.log(VERSION);
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
577
587
|
else if (COMMANDS.includes(argv[0])) await inProject(argv[0], argv.slice(1));
|
|
578
588
|
else if (argv[0] === 'help' || (startedAsNevela && argv.length === 0)) {
|
|
579
589
|
// `nevela` on its own says what it can do. `pnpm create nevela` on its own starts an
|
package/package.json
CHANGED
|
@@ -3,18 +3,20 @@
|
|
|
3
3
|
The Laravel side of [Nevela](https://nevela-docs.vercel.app): describe a resource once and get its model, migration, validation, policy and REST API, plus the Next.js dashboard screens for it.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
|
|
7
|
-
php artisan migrate
|
|
6
|
+
nevela resource Product --fields="name:string, sku:string!, price:money, kind:enum(stock|digital), notes:text?"
|
|
8
7
|
```
|
|
9
8
|
|
|
10
9
|
## Start a new app
|
|
11
10
|
|
|
12
|
-
The quickest way is the
|
|
11
|
+
The quickest way is the `nevela` command, which sets up Laravel, this package and the dashboard together:
|
|
13
12
|
|
|
14
13
|
```sh
|
|
15
|
-
|
|
14
|
+
npm install -g create-nevela # once
|
|
15
|
+
nevela new my-app
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
Without installing it, `pnpm create nevela my-app` does the same.
|
|
19
|
+
|
|
18
20
|
## Add it to an existing Laravel app
|
|
19
21
|
|
|
20
22
|
```sh
|
|
@@ -18,7 +18,7 @@ use Nevela\Laravel\Support\Naming;
|
|
|
18
18
|
final class Nevela
|
|
19
19
|
{
|
|
20
20
|
/** Written by `pnpm release`; the same number as the repository's git tag. */
|
|
21
|
-
public const VERSION = '0.5.
|
|
21
|
+
public const VERSION = '0.5.1';
|
|
22
22
|
|
|
23
23
|
/** @var array<string, Descriptor> */
|
|
24
24
|
private static array $descriptors = [];
|
|
@@ -114,15 +114,9 @@ export default function Home() {
|
|
|
114
114
|
<p>
|
|
115
115
|
© {new Date().getFullYear()} {site.name}
|
|
116
116
|
</p>
|
|
117
|
-
{/* Delete this line when the app is your own
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
href="https://flare-docs.codetotech.com/guides/costs/"
|
|
121
|
-
target="_blank"
|
|
122
|
-
rel="noreferrer"
|
|
123
|
-
className="hover:text-foreground"
|
|
124
|
-
>
|
|
125
|
-
Built with Flare · what it costs to run
|
|
117
|
+
{/* Delete this line when the app is your own. */}
|
|
118
|
+
<a href="https://nevela-docs.vercel.app" target="_blank" rel="noreferrer" className="hover:text-foreground">
|
|
119
|
+
Built with Nevela (Next.js + Laravel)
|
|
126
120
|
</a>
|
|
127
121
|
<nav aria-label="Footer" className="flex gap-6">
|
|
128
122
|
<Link href={site.links.terms} className="hover:text-foreground">
|