@nuxtus/nuxtus 1.0.2 → 1.0.6

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 CHANGED
@@ -1,11 +1,19 @@
1
1
  # Nuxtus
2
2
 
3
- A website w/ CMS boilerplate using [Directus](https://directus.io) for backend CMS and [Nuxt](https://nuxtjs.org) (w/ Tailwind CSS) for frontend.
3
+ A website w/ CMS boilerplate using [Directus](https://directus.io) for backend CMS and [Nuxt](https://nuxtjs.org) (w/ Tailwind CSS) for frontend that can also **automagically** create pages when you create Directus collections.
4
+
5
+
6
+ https://user-images.githubusercontent.com/324026/175020548-57ee94b3-dee4-4b12-a8c8-6c0f1a94fab4.mov
7
+
4
8
 
5
9
  The purpose of this template is to be a quick-start for developing a website with Nuxt.js using Directus as the backend. The end result can be a static website or dynamically pull data from Directus depending on your preference.
6
10
 
7
11
  It also includes [nuxtus/cli]("https://github.com/nuxtus/cli") which provides a command line interface for quickly creating multiple index/detail pages from any Directus collections.
8
12
 
13
+ https://user-images.githubusercontent.com/324026/175452950-46bd51a6-3fd9-441d-80fd-c6bbfaa01929.mp4
14
+
15
+ ## Features
16
+
9
17
  - [Directus](https://directus.io)
10
18
  - [Nuxt](https://nuxtjs.org)
11
19
  - [Tailwind CSS](https://tailwindcss.nuxtjs.org/)
@@ -18,24 +26,63 @@ It also includes [nuxtus/cli]("https://github.com/nuxtus/cli") which provides a
18
26
 
19
27
  ```bash
20
28
  $ npx create-nuxtus app-name
21
- $ cd app-name
22
29
  ```
23
30
 
24
31
  > Replace `app-name` with the name of your website or application.
25
32
 
26
- Your project will contain 2 folders server (Directus) and client (Nuxt). Run them as normal from within each folder:
33
+ Nuxtus will automatically migrate the Directus DB if you are using SQLite. Otherwise follow the directions below to manually configure your database and get started.
34
+
35
+ Your project will contain 2 folders server (Directus) and client (Nuxt).
36
+
37
+ ### Directus
38
+
39
+ By default Nuxtus uses an SQLite database. If you wish to use an alternative database simply edit the `server/.env` file as suggested in the [Directus documentation](https://docs.directus.io/configuration/config-options/#database) then follow the steps below.
40
+
41
+ ```bash
42
+ $ cd server
43
+
44
+ # From within the root of the project
45
+ $ npm run cli bootstrap
46
+ ```
47
+
48
+ ### Nuxt
49
+
50
+ No set up for Nuxt is required.
51
+
52
+ ### Starting Nuxtus
53
+
54
+ From inside your project folder:
27
55
 
28
56
  ```bash
29
- ~/server $ npx directus start
30
- ~/client $ npm run dev
57
+ $ npm start
31
58
  ```
32
59
 
33
- ### Creating pages
60
+ ### Automatically creating pages
61
+
62
+ **Nuxtus automagically creates Nuxt pages as soon as you create a new Directus collection!**
63
+
64
+ Nuxtus includes a POST endpoint located /api/directus/collection that will run in development. If you used `npx create-nuxtus` to create your Nuxtus project and selected "yes" to automatically creating pages from Directus then this is already configured in Directus for you.
65
+
66
+ If not, create a new Flow in Directus as follows:
67
+
68
+ #### Trigger
69
+
70
+ Type: action
71
+ Scope: items.create
72
+ Collections: directus_collections
73
+
74
+ #### Webhook / Request URL
75
+
76
+ URL: http://localhost:3000/api/directus/collection
77
+ Method: POST
78
+ Request Body: `{{$last.payload}}`
79
+
80
+ ### Manually creating pages
34
81
 
35
82
  Nuxtus includes Nuxtus CLI which will automatically generate listing and view pages of any Directus collections. To use it:
36
83
 
37
84
  1. Log in to Directus ([http://0.0.0.0:8055/admin/login](http://0.0.0.0:8055/admin/login)) and [create a collection](https://docs.directus.io/configuration/data-model/#creating-a-collection)
38
- 2. From the client folder `cd client` run `nuxtus create` and follow the prompts
85
+ 2. From the client folder (`cd client`) run `nuxtus create` and follow the prompts
39
86
 
40
87
  Pages will be created for each collection you select in `clients/pages`. These are a starting point for you to customise.
41
88
 
@@ -45,25 +92,11 @@ For more details on [Nuxtus CLI](https://github.com/nuxtus/cli) click [here](htt
45
92
 
46
93
  By default Directus is configured to accept CORS from any origin. Nuxtus suggests modifying this for your production deployment.
47
94
 
48
- ## Manual setup
49
-
50
- Clone this repo onto your local machine, remove the remote git origin and add a new one.
95
+ If you chose to install, remove the Nuxtus hook extension by deleting the folder `server/extensions/hooks/nuxtus-hook` from your project.
51
96
 
52
- ### Server (Directus) Setup
53
-
54
- ```bash
55
- $ cd server
56
- $ npm i
57
- $ npx directus start
58
- ```
59
-
60
- ### Client (Nuxt) Setup
97
+ ## Manual setup
61
98
 
62
- ```bash
63
- $ cd client
64
- $ npm i
65
- $ npm run dev
66
- ```
99
+ Clone this repo onto your local machine, remove the remote git origin and add a new one. Then follow the [manual install instructions](#directus).
67
100
 
68
101
  > For further instructions visit `[http://localhost:3000](http://localhost:3000)`
69
102
 
package/TODO CHANGED
@@ -1,4 +1,17 @@
1
1
 
2
2
  Todo:
3
3
  ☐ Handle fetch failures
4
+ ✔ Update docs.vue to use nuxtus-cli instead @done(22-06-12 20:57)
5
+ ✔ Fix code for singleton page in .vue template @done(22-06-13 19:06)
4
6
  ✔ Make a CLI for creating index/listing pages for Directus API @done(22-06-10 20:42)
7
+ ✔ Set up [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) @done(22-06-16 20:23)
8
+ ☐ Setup [semantic release](https://github.com/semantic-release/semantic-release)
9
+ ✔ Add interactive/pretty CLI for create-app.js @done(22-06-16 20:23)
10
+ ✔ Query database use (via interactive shell) in create-app.js @done(22-06-21 20:26)
11
+ ✔ Check node version for compatibility in create-app.js @done(22-06-16 22:07)
12
+ ☐ Look at https://renovatebot.com/
13
+ ☐ Documentation: https://docusaurus.io/ or https://vuepress.vuejs.org/
14
+ ✔ Create Directus flow via Directus API @done(22-07-04 17:46)
15
+ ☐ Add ability to automatically update .env for none SQLite databases
16
+ ☐ Can I HMR when adding new pages/routes?
17
+ ☐ Add all questions in create-app to start of process for better user flow
package/changelog.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Nuxtus
2
2
 
3
+ ## 1.0.6
4
+
5
+ - Add server api endpoint to be used as Directus webhook
6
+ - Update to Directus 9.13.0
7
+ - Update readme with details on using Collections hook
8
+
9
+ ## 1.0.5
10
+
11
+ - Update nuxtus-cli to v1.0.3
12
+
13
+ ## 1.0.4
14
+
15
+ - Hard delete the data.db file
16
+ - Update @nuxtus-cli to 1.0.2
17
+ - Update Nuxt to 3.0.0-rc.4
18
+ - Add client, server and start npm scripts
19
+
20
+ ## 1.0.3
21
+
22
+ - Add Directus CLI to package.json so `npm run cli` works
23
+ - Update getting started instructions to include database migrations
24
+ - Do not upload the sqlite database, create a new one
25
+ - Add default user/password to Directus .env
26
+ - Add @nuxtus/cli to dev dependencies
27
+ - Update `pages/docs.vue` with details on using @nuxtus/cli
28
+
3
29
  ## 1.0.2
4
30
 
5
31
  - Separate create-nuxt command
package/client/.env CHANGED
@@ -3,5 +3,5 @@ DIRECTUS_URL=http://localhost:8055
3
3
  # Nuxtus values
4
4
  # For now using email and password as nuxt-directus does not support token auth
5
5
  # NUXT_PUBLIC_DIRECTUS_TOKEN=UNSECURE_ACCESS_TOKEN
6
- NUXT_PUBLIC_DIRECTUS_EMAIL=admin@test.com
6
+ NUXT_PUBLIC_DIRECTUS_EMAIL=admin@example.com
7
7
  NUXT_PUBLIC_DIRECTUS_PASSWORD=password
@@ -9,11 +9,13 @@
9
9
  "devDependencies": {
10
10
  "@nuxtjs/google-fonts": "^1.3.0",
11
11
  "@nuxtjs/tailwindcss": "^5.0.4",
12
- "nuxt": "3.0.0-rc.1"
12
+ "@nuxtus/cli": "^1.0.5",
13
+ "@nuxtus/generator": "1.0.0",
14
+ "nuxt": "3.0.0-rc.4"
13
15
  },
14
16
  "dependencies": {
15
17
  "@headlessui/vue": "^1.6.1",
16
18
  "@heroicons/vue": "^1.0.6",
17
- "nuxt-directus": "^2.0.1"
19
+ "nuxt-directus": "^2.1.0"
18
20
  }
19
21
  }
@@ -0,0 +1,12 @@
1
+ import { createPage } from "@nuxtus/generator"
2
+
3
+ export default defineEventHandler(async (event) => {
4
+ if (process.env.NODE_ENV !== "production") {
5
+ const body = await useBody(event)
6
+ // TODO: Wrap in try/catch and return HTTP error if errors
7
+ createPage(body.collection, body.singleton)
8
+ return {
9
+ api: "ok",
10
+ }
11
+ }
12
+ })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxtus/nuxtus",
3
3
  "description": "Directus/Nuxt boilerplate with Tailwind CSS.",
4
- "version": "1.0.2",
4
+ "version": "1.0.6",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/nuxtus/nuxtus.git"
@@ -22,5 +22,13 @@
22
22
  "publishConfig": {
23
23
  "access": "public",
24
24
  "registry": "https://registry.npmjs.org/"
25
+ },
26
+ "scripts": {
27
+ "client": "cd client && npm run dev",
28
+ "server": "cd server && npx directus start",
29
+ "start": "concurrently \"npm run client\" \"npm run server\""
30
+ },
31
+ "devDependencies": {
32
+ "concurrently": "^7.2.2"
25
33
  }
26
- }
34
+ }
package/server/.env CHANGED
@@ -64,3 +64,8 @@ EMAIL_FROM="no-reply@craigharman.com"
64
64
  EMAIL_TRANSPORT="sendmail"
65
65
  EMAIL_SENDMAIL_NEW_LINE="unix"
66
66
  EMAIL_SENDMAIL_PATH="/usr/sbin/sendmail"
67
+
68
+ ####################################################################################################
69
+ ## Default User
70
+ ADMIN_EMAIL="admin@example.com"
71
+ ADMIN_PASSWORD="password"
@@ -4,13 +4,14 @@
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
+ "cli": "directus",
7
8
  "test": "echo \"Error: no test specified\" && exit 1"
8
9
  },
9
10
  "keywords": [],
10
11
  "author": "",
11
12
  "license": "ISC",
12
13
  "dependencies": {
13
- "directus": "^9.10.0",
14
+ "directus": "^9.13.0",
14
15
  "sqlite3": "^5.0.8"
15
16
  }
16
17
  }
package/server/data.db DELETED
Binary file