@nuxtus/nuxtus 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Craig Harman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # Nuxtus
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.
4
+
5
+ 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
+
7
+ 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
+
9
+ - [Directus](https://directus.io)
10
+ - [Nuxt](https://nuxtjs.org)
11
+ - [Tailwind CSS](https://tailwindcss.nuxtjs.org/)
12
+ - [Headless UI](https://headlessui.dev/)
13
+ - [HeroIcons](https://heroicons.com/)
14
+ - [Google Fonts](https://github.com/nuxt-community/google-fonts-module)
15
+ - [Nuxtus CLI]("https://github.com/nuxtus/cli")
16
+
17
+ ## Quickstart (preferred)
18
+
19
+ ```bash
20
+ $ npx create-nuxtus app-name
21
+ $ cd app-name
22
+ ```
23
+
24
+ > Replace `app-name` with the name of your website or application.
25
+
26
+ Your project will contain 2 folders server (Directus) and client (Nuxt). Run them as normal from within each folder:
27
+
28
+ ```bash
29
+ ~/server $ npx directus start
30
+ ~/client $ npm run dev
31
+ ```
32
+
33
+ ## Production deployment
34
+
35
+ By default Directus is configured to accept CORS from any origin. Nuxtus suggests modifying this for your production deployment.
36
+
37
+ ## Manual setup
38
+
39
+ Clone this repo onto your local machine, remove the remote git origin and add a new one.
40
+
41
+ ### Server (Directus) Setup
42
+
43
+ ```bash
44
+ $ cd server
45
+ $ npm i
46
+ $ npx directus start
47
+ ```
48
+
49
+ ### Client (Nuxt) Setup
50
+
51
+ ```bash
52
+ $ cd client
53
+ $ npm i
54
+ $ npm run dev
55
+ ```
56
+
57
+ > For further instructions visit `[http://localhost:3000](http://localhost:3000)`
58
+
59
+
package/TODO ADDED
@@ -0,0 +1,4 @@
1
+
2
+ Todo:
3
+ ☐ Handle fetch failures
4
+ ✔ Make a CLI for creating index/listing pages for Directus API @done(22-06-10 20:42)
package/changelog.md ADDED
@@ -0,0 +1,15 @@
1
+ # Nuxtus
2
+
3
+ ## 1.0.0
4
+
5
+ - Add `npx nuxtus-create` command
6
+
7
+ ## 0.0.2
8
+
9
+ - Move to using [nuxt-directus package](https://nuxt-directus.netlify.app/)
10
+ - Add @nuxtus/cli
11
+ - Add .DS_Store to gitignore
12
+
13
+ ## 0.0.1
14
+
15
+ Initial alpha release.
package/client/.env ADDED
@@ -0,0 +1,7 @@
1
+ # Nuxt directus required values
2
+ DIRECTUS_URL=http://localhost:8055
3
+ # Nuxtus values
4
+ # For now using email and password as nuxt-directus does not support token auth
5
+ # NUXT_PUBLIC_DIRECTUS_TOKEN=UNSECURE_ACCESS_TOKEN
6
+ NUXT_PUBLIC_DIRECTUS_EMAIL=admin@test.com
7
+ NUXT_PUBLIC_DIRECTUS_PASSWORD=password
@@ -0,0 +1,42 @@
1
+ # Nuxt 3 Minimal Starter
2
+
3
+ Look at the [nuxt 3 documentation](https://v3.nuxtjs.org) to learn more.
4
+
5
+ ## Setup
6
+
7
+ Make sure to install the dependencies:
8
+
9
+ ```bash
10
+ # yarn
11
+ yarn install
12
+
13
+ # npm
14
+ npm install
15
+
16
+ # pnpm
17
+ pnpm install --shamefully-hoist
18
+ ```
19
+
20
+ ## Development Server
21
+
22
+ Start the development server on http://localhost:3000
23
+
24
+ ```bash
25
+ npm run dev
26
+ ```
27
+
28
+ ## Production
29
+
30
+ Build the application for production:
31
+
32
+ ```bash
33
+ npm run build
34
+ ```
35
+
36
+ Locally preview production build:
37
+
38
+ ```bash
39
+ npm run preview
40
+ ```
41
+
42
+ Checkout the [deployment documentation](https://v3.nuxtjs.org/docs/deployment) for more information.
package/client/app.vue ADDED
@@ -0,0 +1,6 @@
1
+ <template>
2
+ <!-- Root layout, if you have multiple layouts create a layouts/ folder and delete this file -->
3
+ <div>
4
+ <NuxtPage />
5
+ </div>
6
+ </template>
@@ -0,0 +1,3 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
@@ -0,0 +1,29 @@
1
+ import { defineNuxtConfig } from 'nuxt'
2
+
3
+ // https://v3.nuxtjs.org/api/configuration/nuxt.config
4
+ export default defineNuxtConfig({
5
+ buildModules: [
6
+ [
7
+ "@nuxtjs/google-fonts",
8
+ {
9
+ /* module options */
10
+ },
11
+ ],
12
+ "@nuxtjs/tailwindcss",
13
+ ],
14
+ modules: ["nuxt-directus"],
15
+ googleFonts: {
16
+ families: {
17
+ Inter: true,
18
+ },
19
+ },
20
+ tailwindcss: {
21
+ // Options
22
+ jit: true,
23
+ },
24
+ directus: {},
25
+ publicRuntimeConfig: {
26
+ directusEmail: "",
27
+ directusPassword: "",
28
+ },
29
+ })
@@ -0,0 +1,19 @@
1
+ {
2
+ "private": true,
3
+ "scripts": {
4
+ "build": "nuxt build",
5
+ "dev": "nuxt dev",
6
+ "generate": "nuxt generate",
7
+ "preview": "nuxt preview"
8
+ },
9
+ "devDependencies": {
10
+ "@nuxtjs/google-fonts": "^1.3.0",
11
+ "@nuxtjs/tailwindcss": "^5.0.4",
12
+ "nuxt": "3.0.0-rc.1"
13
+ },
14
+ "dependencies": {
15
+ "@headlessui/vue": "^1.6.1",
16
+ "@heroicons/vue": "^1.0.6",
17
+ "nuxt-directus": "^2.0.1"
18
+ }
19
+ }
@@ -0,0 +1,12 @@
1
+ export default defineNuxtPlugin(async (nuxtApp) => {
2
+ const config = useRuntimeConfig()
3
+ const { login } = useDirectusAuth()
4
+ try {
5
+ await login({
6
+ email: config.public.directusEmail,
7
+ password: config.public.directusPassword,
8
+ })
9
+ } catch (error) {
10
+ console.error(error)
11
+ }
12
+ })
@@ -0,0 +1,21 @@
1
+ const defaultTheme = require("tailwindcss/defaultTheme")
2
+
3
+ module.exports = {
4
+ content: [
5
+ `components/**/*.{vue,js}`,
6
+ `layouts/**/*.vue`,
7
+ `pages/**/*.vue`,
8
+ `composables/**/*.{js,ts}`,
9
+ `plugins/**/*.{js,ts}`,
10
+ `App.{js,ts,vue}`,
11
+ `app.{js,ts,vue}`,
12
+ ],
13
+ theme: {
14
+ extend: {
15
+ fontFamily: {
16
+ sans: ["Inter var", ...defaultTheme.fontFamily.sans],
17
+ },
18
+ },
19
+ },
20
+ plugins: [],
21
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ // https://v3.nuxtjs.org/concepts/typescript
3
+ "extends": "./.nuxt/tsconfig.json"
4
+ }
package/create-app.js ADDED
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require("child_process")
4
+ const path = require("path")
5
+ const fs = require("fs")
6
+
7
+ if (process.argv.length < 3) {
8
+ console.log("You have to provide a name for your app.")
9
+ console.log("For example :")
10
+ console.log(" npx create-nuxtus my-app")
11
+ process.exit(1)
12
+ }
13
+
14
+ const projectName = process.argv[2]
15
+ const currentPath = process.cwd()
16
+ const projectPath = path.join(currentPath, projectName)
17
+ const git_repo = "https://github.com/nuxtus/nuxtus"
18
+
19
+ try {
20
+ fs.mkdirSync(projectPath)
21
+ } catch (err) {
22
+ if (err.code === "EEXIST") {
23
+ console.log(
24
+ `The folder ${projectName} already exist in the current directory, please try another name.`
25
+ )
26
+ } else {
27
+ console.log(error)
28
+ }
29
+ process.exit(1)
30
+ }
31
+
32
+ async function main() {
33
+ try {
34
+ console.log("Downloading files...")
35
+ execSync(`git clone --depth 1 ${git_repo} ${projectPath}`)
36
+
37
+ process.chdir(projectPath)
38
+
39
+ console.log("Installing dependencies...")
40
+ execSync("cd server && npm install")
41
+ execSync("cd client && npm install")
42
+
43
+ console.log("Removing unused files...")
44
+ execSync(
45
+ "npx rimraf ./.git ./create-app.js ./package.json ./package-lock.json ./TODO ./node_modules"
46
+ )
47
+ fs.rmdirSync(path.join(projectPath, "bin"), { recursive: true })
48
+ fs.appendFile(
49
+ ".gitignore",
50
+ path.join("server", ".env") + "\n" + path.join("client", ".env"),
51
+ function (err) {
52
+ if (err) throw err
53
+ console.log("Saved!")
54
+ }
55
+ )
56
+
57
+ console.log(
58
+ "Nuxtus site is ready for use! Edit server/.env then start Directus."
59
+ )
60
+ } catch (error) {
61
+ console.log(error)
62
+ }
63
+ }
64
+ main()
package/data.db ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@nuxtus/nuxtus",
3
+ "description": "Directus/Nuxt boilerplate with Tailwind CSS.",
4
+ "version": "1.0.0",
5
+ "main": "create-app.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/nuxtus/nuxtus.git"
9
+ },
10
+ "keywords": [
11
+ "Directus",
12
+ "Nuxt",
13
+ "boilerplate",
14
+ "Tailwind",
15
+ "Tailwindcss"
16
+ ],
17
+ "author": "Craig Harman",
18
+ "license": "MIT",
19
+ "bugs": {
20
+ "url": "https://github.com/nuxtus/nuxtus/issues"
21
+ },
22
+ "homepage": "https://github.com/nuxtus/nuxtus#readme",
23
+ "bin": {
24
+ "create-nuxtus": "./create-app.js"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public",
28
+ "registry": "https://registry.npmjs.org/"
29
+ },
30
+ "dependencies": {
31
+ "rimraf": "^3.0.2"
32
+ }
33
+ }
package/server/.env ADDED
@@ -0,0 +1,66 @@
1
+ ####################################################################################################
2
+ ## General
3
+
4
+ HOST="0.0.0.0"
5
+ PORT=8055
6
+ PUBLIC_URL="/"
7
+ CORS_ENABLED=true
8
+ CORS_ORIGIN=true
9
+
10
+ ####################################################################################################
11
+ ## Database
12
+
13
+ DB_CLIENT="sqlite3"
14
+ DB_FILENAME="./data.db"
15
+
16
+
17
+ ####################################################################################################
18
+ ## Rate Limiting
19
+
20
+ RATE_LIMITER_ENABLED=false
21
+ RATE_LIMITER_STORE=memory
22
+ RATE_LIMITER_POINTS=25
23
+ RATE_LIMITER_DURATION=1
24
+
25
+ ####################################################################################################
26
+ ## Cache
27
+
28
+ CACHE_ENABLED=false
29
+
30
+ ####################################################################################################
31
+ ## File Storage
32
+
33
+ STORAGE_LOCATIONS="local"
34
+ STORAGE_LOCAL_DRIVER="local"
35
+ STORAGE_LOCAL_ROOT="./uploads"
36
+
37
+ ####################################################################################################
38
+ ## Security
39
+
40
+ KEY="3339424d-bc49-44dc-ac6c-5eed140f7b4d"
41
+ SECRET="-3fcEkSym7BkfA5eLBOLb4EbMLpNF79E"
42
+
43
+
44
+ ACCESS_TOKEN_TTL="15m"
45
+ REFRESH_TOKEN_TTL="7d"
46
+ REFRESH_TOKEN_COOKIE_SECURE=false
47
+ REFRESH_TOKEN_COOKIE_SAME_SITE="lax"
48
+ REFRESH_TOKEN_COOKIE_NAME="directus_refresh_token"
49
+
50
+ ####################################################################################################
51
+ ## Auth Providers
52
+
53
+ AUTH_PROVIDERS=""
54
+
55
+ ####################################################################################################
56
+ ## Extensions
57
+
58
+ EXTENSIONS_PATH="./extensions"
59
+
60
+ ####################################################################################################
61
+ ## Email
62
+
63
+ EMAIL_FROM="no-reply@craigharman.com"
64
+ EMAIL_TRANSPORT="sendmail"
65
+ EMAIL_SENDMAIL_NEW_LINE="unix"
66
+ EMAIL_SENDMAIL_PATH="/usr/sbin/sendmail"
package/server/data.db ADDED
Binary file
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "nuxtus-server",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "directus": "^9.10.0",
14
+ "sqlite3": "^5.0.8"
15
+ }
16
+ }
@@ -0,0 +1,9 @@
1
+ module.exports = {
2
+ projects: [
3
+ {
4
+ root: "./client", // root of your vue project (should contain package.json)
5
+ package: "./client/package.json", // Relative to root property, don't change this.
6
+ tsconfig: "./client/tsconfig.json", // Relative to root property, don't change this.
7
+ },
8
+ ],
9
+ }