@nuxtus/nuxtus 1.0.6 → 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.
@@ -0,0 +1,24 @@
1
+ name: Release npm package
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ release:
10
+ name: Release
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@main
14
+ - uses: actions/setup-node@v1
15
+ with:
16
+ node-version: "16.x"
17
+ - run: npm install --save-dev @semantic-release/release-notes-generator @semantic-release/changelog@6 @semantic-release/git@10 @semantic-release/github@8 semantic-release@19
18
+ # - run: npm ci
19
+ # - run: npm run build --if-present
20
+ # - run: npm test
21
+ - run: npx semantic-release
22
+ env:
23
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,4 +1,25 @@
1
- # Nuxtus
1
+ Changelog
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
+
10
+ ## [1.1.1](https://github.com/nuxtus/nuxtus/compare/v1.1.0...v1.1.1) (2022-07-11)
11
+
12
+
13
+ ### Bug Fixes
14
+
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
2
23
 
3
24
  ## 1.0.6
4
25
 
@@ -48,4 +69,4 @@
48
69
 
49
70
  ## 0.0.1
50
71
 
51
- Initial alpha release.
72
+ Initial alpha release.
package/README.md CHANGED
@@ -21,6 +21,7 @@ https://user-images.githubusercontent.com/324026/175452950-46bd51a6-3fd9-441d-80
21
21
  - [HeroIcons](https://heroicons.com/)
22
22
  - [Google Fonts](https://github.com/nuxt-community/google-fonts-module)
23
23
  - [Nuxtus CLI](https://github.com/nuxtus/cli)
24
+ - Typescript types
24
25
 
25
26
  ## Quickstart (preferred)
26
27
 
@@ -45,10 +46,14 @@ $ cd server
45
46
  $ npm run cli bootstrap
46
47
  ```
47
48
 
49
+ > If using Nuxt is not using `http://localhost:3000` update NUXT_SERVER in the `server/.env` file.
50
+
48
51
  ### Nuxt
49
52
 
50
53
  No set up for Nuxt is required.
51
54
 
55
+ > If Directus is not using `http://localhost:8055` update DIRECTUS_SERVER in the `client/.env` file.
56
+
52
57
  ### Starting Nuxtus
53
58
 
54
59
  From inside your project folder:
@@ -63,23 +68,20 @@ $ npm start
63
68
 
64
69
  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
70
 
66
- If not, create a new Flow in Directus as follows:
67
-
68
- #### Trigger
71
+ Collections are also typed automatically, simply prepend "Items" to the collection name as per below:
69
72
 
70
- Type: action
71
- Scope: items.create
72
- Collections: directus_collections
73
-
74
- #### Webhook / Request URL
73
+ ```typescript
74
+ <script setup lang="ts">
75
+ import { components } from "../interfaces/nuxtus";
76
+ type Test = components["schemas"]["ItemsTest"];
77
+ </script>
78
+ ```
75
79
 
76
- URL: http://localhost:3000/api/directus/collection
77
- Method: POST
78
- Request Body: `{{$last.payload}}`
80
+ > Because OpenAPI schemas may have invalid TypeScript characters as names, the square brackets are a safe way to access every property.
79
81
 
80
82
  ### Manually creating pages
81
83
 
82
- Nuxtus includes Nuxtus CLI which will automatically generate listing and view pages of any Directus collections. To use it:
84
+ Nuxtus includes Nuxtus CLI which will generate listing and view pages of any Directus collection on demand. To use it:
83
85
 
84
86
  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)
85
87
  2. From the client folder (`cd client`) run `nuxtus create` and follow the prompts
@@ -98,6 +100,13 @@ If you chose to install, remove the Nuxtus hook extension by deleting the folder
98
100
 
99
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).
100
102
 
101
- > For further instructions visit `[http://localhost:3000](http://localhost:3000)`
103
+ > For further instructions post install, visit `[http://localhost:3000](http://localhost:3000)`
104
+
105
+ ## Acknowledgements
102
106
 
107
+ Nuxtus wouldn't be possible without the following amazing technologies:
103
108
 
109
+ [Directus](https://directus.io)
110
+ [Nuxt](https://nuxt.js.org)
111
+ [Nuxt-Directus](https://nuxt-directus.netlify.app/)
112
+ [OpenApi Typescript](https://www.npmjs.com/package/openapi-typescript)
package/TODO CHANGED
@@ -5,7 +5,7 @@ Todo:
5
5
  ✔ Fix code for singleton page in .vue template @done(22-06-13 19:06)
6
6
  ✔ Make a CLI for creating index/listing pages for Directus API @done(22-06-10 20:42)
7
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)
8
+ Setup [semantic release](https://github.com/semantic-release/semantic-release) @done(22-07-11 15:57)
9
9
  ✔ Add interactive/pretty CLI for create-app.js @done(22-06-16 20:23)
10
10
  ✔ Query database use (via interactive shell) in create-app.js @done(22-06-21 20:26)
11
11
  ✔ Check node version for compatibility in create-app.js @done(22-06-16 22:07)
@@ -13,5 +13,19 @@ Todo:
13
13
  ☐ Documentation: https://docusaurus.io/ or https://vuepress.vuejs.org/
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
- ☐ Can I HMR when adding new pages/routes?
17
- Add all questions in create-app to start of process for better user flow
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 @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
22
+ ☐ Make sure separate packages can be used without Nuxt Boilerplate if required
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)
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.
26
+ ✔ interfaces/nuxtus.ts should not be in .gitignore other than during my development (remove in create-nuxtus?) @done(22-07-11 12:52)
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,13 +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.5",
13
- "@nuxtus/generator": "1.0.0",
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
+ "openapi-typescript": "^5.4.1"
15
16
  },
16
17
  "dependencies": {
18
+ "@directus/sdk": "^10.1.1",
17
19
  "@headlessui/vue": "^1.6.1",
18
20
  "@heroicons/vue": "^1.0.6",
19
- "nuxt-directus": "^2.1.0"
21
+ "nuxt-directus": "^2.2.0"
20
22
  }
21
23
  }
@@ -1,7 +1,7 @@
1
1
  export default defineNuxtPlugin(async (nuxtApp) => {
2
- const config = useRuntimeConfig()
3
- const { login } = useDirectusAuth()
4
2
  try {
3
+ const config = useRuntimeConfig()
4
+ const { login } = useDirectusAuth()
5
5
  await login({
6
6
  email: config.public.directusEmail,
7
7
  password: config.public.directusPassword,
@@ -1,10 +1,16 @@
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
- // TODO: Wrap in try/catch and return HTTP error if errors
7
- createPage(body.collection, body.singleton)
6
+ const nuxtus = new Generator()
7
+ try {
8
+ const collection = body.collection
9
+ nuxtus.createPage(collection, body.singleton)
10
+ } catch (err) {
11
+ console.error(err.message)
12
+ throw new Error("Unable to create page: " + err.message)
13
+ }
8
14
  return {
9
15
  api: "ok",
10
16
  }
@@ -0,0 +1,11 @@
1
+ import Generator from "@nuxtus/generator"
2
+
3
+ export default defineEventHandler(async (event) => {
4
+ if (process.env.NODE_ENV !== "production") {
5
+ const nuxtus = new Generator()
6
+ await nuxtus.createTypes()
7
+ return {
8
+ api: "ok",
9
+ }
10
+ }
11
+ })
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.6",
4
+ "version": "1.2.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/nuxtus/nuxtus.git"
@@ -24,11 +24,46 @@
24
24
  "registry": "https://registry.npmjs.org/"
25
25
  },
26
26
  "scripts": {
27
- "client": "cd client && npm run dev",
27
+ "client": "cd client && npm run dev -- -o",
28
28
  "server": "cd server && npx directus start",
29
29
  "start": "concurrently \"npm run client\" \"npm run server\""
30
30
  },
31
31
  "devDependencies": {
32
- "concurrently": "^7.2.2"
32
+ "@semantic-release/changelog": "^6.0.1",
33
+ "@semantic-release/git": "^10.0.1",
34
+ "@semantic-release/github": "^8.0.5",
35
+ "@semantic-release/release-notes-generator": "^10.0.3",
36
+ "concurrently": "^7.2.2",
37
+ "semantic-release": "^19.0.3"
38
+ },
39
+ "release": {
40
+ "branches": "main",
41
+ "plugins": [
42
+ [
43
+ "@semantic-release/commit-analyzer",
44
+ {
45
+ "releaseRules": [
46
+ {
47
+ "type": "revert",
48
+ "release": "patch"
49
+ },
50
+ {
51
+ "type": "refactor",
52
+ "release": "minor"
53
+ }
54
+ ]
55
+ }
56
+ ],
57
+ "@semantic-release/release-notes-generator",
58
+ [
59
+ "@semantic-release/changelog",
60
+ {
61
+ "changelogTitle": "Changelog"
62
+ }
63
+ ],
64
+ "@semantic-release/npm",
65
+ "@semantic-release/git",
66
+ "@semantic-release/github"
67
+ ]
33
68
  }
34
69
  }
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"
@@ -11,7 +11,7 @@
11
11
  "author": "",
12
12
  "license": "ISC",
13
13
  "dependencies": {
14
- "directus": "^9.13.0",
14
+ "directus": "^9.14.1",
15
15
  "sqlite3": "^5.0.8"
16
16
  }
17
17
  }