@nuxtus/nuxtus 1.1.1 → 1.2.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/CHANGELOG.md CHANGED
@@ -1,8 +1,72 @@
1
1
  Changelog
2
2
 
3
+ # [1.2.0](https://github.com/nuxtus/nuxtus/compare/v1.1.1...v1.2.0) (2022-07-21)
4
+
5
+
6
+ ### Features
7
+
8
+ * :zap: directus and nuxt server and port are now configurable ([96bda8b](https://github.com/nuxtus/nuxtus/commit/96bda8bfdd03f2cdca5994b5814070480121e904))
9
+
3
10
  ## [1.1.1](https://github.com/nuxtus/nuxtus/compare/v1.1.0...v1.1.1) (2022-07-11)
4
11
 
5
12
 
6
13
  ### Bug Fixes
7
14
 
8
15
  * :bug: update @nuxtus/generator to 1.1.2 ([fa02fba](https://github.com/nuxtus/nuxtus/commit/fa02fbae0e00b4dc6c59f3336cb321b43e0d7227))
16
+
17
+
18
+ ## 1.1.0
19
+
20
+ - Automatically generate types from collections
21
+ - Tidy up server end point
22
+ - Automatically open browser window on Nuxt start
23
+
24
+ ## 1.0.6
25
+
26
+ - Add server api endpoint to be used as Directus webhook
27
+ - Update to Directus 9.13.0
28
+ - Update readme with details on using Collections hook
29
+
30
+ ## 1.0.5
31
+
32
+ - Update nuxtus-cli to v1.0.3
33
+
34
+ ## 1.0.4
35
+
36
+ - Hard delete the data.db file
37
+ - Update @nuxtus-cli to 1.0.2
38
+ - Update Nuxt to 3.0.0-rc.4
39
+ - Add client, server and start npm scripts
40
+
41
+ ## 1.0.3
42
+
43
+ - Add Directus CLI to package.json so `npm run cli` works
44
+ - Update getting started instructions to include database migrations
45
+ - Do not upload the sqlite database, create a new one
46
+ - Add default user/password to Directus .env
47
+ - Add @nuxtus/cli to dev dependencies
48
+ - Update `pages/docs.vue` with details on using @nuxtus/cli
49
+
50
+ ## 1.0.2
51
+
52
+ - Separate create-nuxt command
53
+
54
+ ## 1.0.1
55
+
56
+ - Correct create command in readme
57
+ - Add details on using Nuxtus CLI
58
+ - Update feedback when installing dependencies
59
+
60
+ ## 1.0.0
61
+
62
+ - Add `npx nuxtus-create` command
63
+
64
+ ## 0.0.2
65
+
66
+ - Move to using [nuxt-directus package](https://nuxt-directus.netlify.app/)
67
+ - Add @nuxtus/cli
68
+ - Add .DS_Store to gitignore
69
+
70
+ ## 0.0.1
71
+
72
+ Initial alpha release.
package/README.md CHANGED
@@ -46,10 +46,14 @@ $ cd server
46
46
  $ npm run cli bootstrap
47
47
  ```
48
48
 
49
+ > If using Nuxt is not using `http://localhost:3000` update NUXT_SERVER in the `server/.env` file.
50
+
49
51
  ### Nuxt
50
52
 
51
53
  No set up for Nuxt is required.
52
54
 
55
+ > If Directus is not using `http://localhost:8055` update DIRECTUS_SERVER in the `client/.env` file.
56
+
53
57
  ### Starting Nuxtus
54
58
 
55
59
  From inside your project folder:
@@ -67,8 +71,10 @@ Nuxtus includes a POST endpoint located /api/directus/collection that will run i
67
71
  Collections are also typed automatically, simply prepend "Items" to the collection name as per below:
68
72
 
69
73
  ```typescript
70
- import { components } from "../interfaces/nuxtus";
71
- type Test = components["schemas"]["ItemsTest"];
74
+ <script setup lang="ts">
75
+ import { components } from "../interfaces/nuxtus";
76
+ type Test = components["schemas"]["ItemsTest"];
77
+ </script>
72
78
  ```
73
79
 
74
80
  > Because OpenAPI schemas may have invalid TypeScript characters as names, the square brackets are a safe way to access every property.
@@ -94,7 +100,7 @@ If you chose to install, remove the Nuxtus hook extension by deleting the folder
94
100
 
95
101
  Clone this repo onto your local machine, remove the remote git origin and add a new one. Then follow the [manual install instructions](#directus).
96
102
 
97
- > For further instructions visit `[http://localhost:3000](http://localhost:3000)`
103
+ > For further instructions post install, visit `[http://localhost:3000](http://localhost:3000)`
98
104
 
99
105
  ## Acknowledgements
100
106
 
package/TODO CHANGED
@@ -14,12 +14,18 @@ Todo:
14
14
  ✔ Create Directus flow via Directus API @done(22-07-04 17:46)
15
15
  ☐ Add ability to automatically update .env for none SQLite databases
16
16
  ☐ Can I HMR when adding new pages/routes? - requires Nuxt to fix bug
17
- Add all questions in create-app to start of process for better user flow
18
- Allow use of different ports/URLs for Directus and Nuxt (currently hard-coded)
19
- Add "types" to cli to update types from Directus when not using hook
20
- ☐ Make opening browser window on start optional using npm run start
17
+ Add all questions in create-app to start of process for better user flow @done(22-07-13 19:15)
18
+ Allow use of different ports/URLs for Directus and Nuxt (currently hard-coded) @done(22-07-13 20:42)
19
+ Add "types" to cli to update types from Directus when not using hook - use @directus/sdk for /oas now on all apps @done(22-07-18 17:01)
20
+ ☐ Make opening browser window on start optional using npm run start (not possible)
21
+ ☐ Look at moving login and server/api stuff to a Nuxt module
21
22
  ☐ Make sure separate packages can be used without Nuxt Boilerplate if required
22
- Console.log messages from directus extension should be formatted like other directus messages
23
+ Console.log messages from directus extension should be formatted like other directus messages @done(22-07-19 20:46)
24
+ ✔ Add default Directus login to end of create-nuxtus script @done(22-07-19 17:30)
23
25
  ☐ When adding a new collection the new page triggers a nuxt restart then directus tries to send a field.create which fails. We get around this by getting the create field first but Directus still returns a 404 for the second request.
24
26
  ✔ interfaces/nuxtus.ts should not be in .gitignore other than during my development (remove in create-nuxtus?) @done(22-07-11 12:52)
25
- Add test coverage (done: generator, nuxtus-cli) @started(22-07-11 17:19)
27
+ Add test coverage (done: generator, nuxtus-cli) @started(22-07-11 17:19) @done(22-07-14 08:03) @lasted(2d14h44m55s)
28
+ ☐ GraphQL?
29
+ ☐ Websockets (https://github.com/br41nslug/directus-websocket-subscribe)
30
+ ✔ Upgrade nuxt-directus @done(22-07-17 11:32)
31
+ ☐ Add ability to use Directus static token instead of login (once https://github.com/Intevel/nuxt-directus/pull/54#pullrequestreview-1045062132 completed)
@@ -9,14 +9,15 @@
9
9
  "devDependencies": {
10
10
  "@nuxtjs/google-fonts": "^1.3.0",
11
11
  "@nuxtjs/tailwindcss": "^5.0.4",
12
- "@nuxtus/cli": "^1.0.7",
13
- "@nuxtus/generator": "1.1.2",
14
- "nuxt": "3.0.0-rc.4",
12
+ "@nuxtus/cli": "^1.1.0",
13
+ "@nuxtus/generator": "1.2.0",
14
+ "nuxt": "^3.0.0-rc.6",
15
15
  "openapi-typescript": "^5.4.1"
16
16
  },
17
17
  "dependencies": {
18
+ "@directus/sdk": "^10.1.1",
18
19
  "@headlessui/vue": "^1.6.1",
19
20
  "@heroicons/vue": "^1.0.6",
20
- "nuxt-directus": "^2.1.0"
21
+ "nuxt-directus": "^2.2.0"
21
22
  }
22
23
  }
@@ -1,11 +1,12 @@
1
- import { createPage } from "@nuxtus/generator"
1
+ import Generator from "@nuxtus/generator"
2
2
 
3
3
  export default defineEventHandler(async (event) => {
4
4
  if (process.env.NODE_ENV !== "production") {
5
5
  const body = await useBody(event)
6
+ const nuxtus = new Generator()
6
7
  try {
7
8
  const collection = body.collection
8
- createPage(collection, body.singleton)
9
+ nuxtus.createPage(collection, body.singleton)
9
10
  } catch (err) {
10
11
  console.error(err.message)
11
12
  throw new Error("Unable to create page: " + err.message)
@@ -1,30 +1,9 @@
1
- import axios from "axios"
2
- import fs from "fs"
3
- import openapiTS from "openapi-typescript"
1
+ import Generator from "@nuxtus/generator"
4
2
 
5
3
  export default defineEventHandler(async (event) => {
6
4
  if (process.env.NODE_ENV !== "production") {
7
- const config = useRuntimeConfig()
8
- // TODO: Can't seem to share login from directusLogin (currently client only plugin)
9
- try {
10
- const { data } = await axios.post("http://localhost:8055/auth/login", {
11
- email: config.public.directusEmail,
12
- password: config.public.directusPassword,
13
- })
14
- axios.defaults.headers.common[
15
- "Authorization"
16
- ] = `Bearer ${data.data.access_token}`
17
- } catch (err) {
18
- console.error("Failed to login to Directus: " + err.message)
19
- throw err
20
- }
21
- const openapi = await axios.get("http://localhost:8055/server/specs/oas")
22
- // console.log(JSON.stringify(openapi.data.components.schemas))
23
- const types = await openapiTS(openapi.data)
24
- if (!fs.existsSync("interfaces")) {
25
- fs.mkdirSync("interfaces")
26
- }
27
- fs.writeFileSync("interfaces/nuxtus.ts", types)
5
+ const nuxtus = new Generator()
6
+ await nuxtus.createTypes()
28
7
  return {
29
8
  api: "ok",
30
9
  }
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.1.1",
4
+ "version": "1.2.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/nuxtus/nuxtus.git"
package/server/.env CHANGED
@@ -69,3 +69,7 @@ EMAIL_SENDMAIL_PATH="/usr/sbin/sendmail"
69
69
  ## Default User
70
70
  ADMIN_EMAIL="admin@example.com"
71
71
  ADMIN_PASSWORD="password"
72
+
73
+ ####################################################################################################
74
+ ## NUXT SERVER
75
+ NUXT_SERVER="http://localhost:3000"
package/changelog.md DELETED
@@ -1,57 +0,0 @@
1
- # Changelog
2
-
3
- ## 1.1.0
4
-
5
- - Automatically generate types from collections
6
- - Tidy up server end point
7
- - Automatically open browser window on Nuxt start
8
-
9
- ## 1.0.6
10
-
11
- - Add server api endpoint to be used as Directus webhook
12
- - Update to Directus 9.13.0
13
- - Update readme with details on using Collections hook
14
-
15
- ## 1.0.5
16
-
17
- - Update nuxtus-cli to v1.0.3
18
-
19
- ## 1.0.4
20
-
21
- - Hard delete the data.db file
22
- - Update @nuxtus-cli to 1.0.2
23
- - Update Nuxt to 3.0.0-rc.4
24
- - Add client, server and start npm scripts
25
-
26
- ## 1.0.3
27
-
28
- - Add Directus CLI to package.json so `npm run cli` works
29
- - Update getting started instructions to include database migrations
30
- - Do not upload the sqlite database, create a new one
31
- - Add default user/password to Directus .env
32
- - Add @nuxtus/cli to dev dependencies
33
- - Update `pages/docs.vue` with details on using @nuxtus/cli
34
-
35
- ## 1.0.2
36
-
37
- - Separate create-nuxt command
38
-
39
- ## 1.0.1
40
-
41
- - Correct create command in readme
42
- - Add details on using Nuxtus CLI
43
- - Update feedback when installing dependencies
44
-
45
- ## 1.0.0
46
-
47
- - Add `npx nuxtus-create` command
48
-
49
- ## 0.0.2
50
-
51
- - Move to using [nuxt-directus package](https://nuxt-directus.netlify.app/)
52
- - Add @nuxtus/cli
53
- - Add .DS_Store to gitignore
54
-
55
- ## 0.0.1
56
-
57
- Initial alpha release.