From fa50a3662a63f17398e74aa1e6737dbd75662051 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Tue, 28 Dec 2021 01:12:59 -0600 Subject: [PATCH] Reformat again --- .eslintrc.js | 19 +++-- .gitignore | 2 + .prettierignore | 1 + .prettierrc.json5 | 6 +- api/index.js | 0 api/index.ts | 15 ++++ components/Card.vue | 20 ++--- components/Tutorial.vue | 2 +- layouts/default.vue | 22 ++--- nuxt.config.js | 44 +++++----- package-lock.json | 81 ++++++++++++++++++- package.json | 6 +- pages/index.vue | 10 +-- pages/inspire.vue | 2 +- .../20211228070433_initial/migration.sql | 9 +++ prisma/migrations/migration_lock.toml | 3 + prisma/schema.prisma | 5 +- 17 files changed, 180 insertions(+), 67 deletions(-) delete mode 100644 api/index.js create mode 100644 api/index.ts create mode 100644 prisma/migrations/20211228070433_initial/migration.sql create mode 100644 prisma/migrations/migration_lock.toml diff --git a/.eslintrc.js b/.eslintrc.js index 5cb786e..cec57c4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,11 +1,14 @@ module.exports = { - root: true, - env: { - browser: true, - node: true + "root": true, + "env": { + "browser": true, + "node": true, + }, + "extends": ["@nuxtjs/eslint-config-typescript", "plugin:nuxt/recommended", "prettier"], + "plugins": [], + "rules": { + "quote-props": ["error", "always"], + "no-unused-vars": ["off"], + "@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }], }, - extends: ['@nuxtjs/eslint-config-typescript', 'plugin:nuxt/recommended', 'prettier'], - plugins: [], - // add your custom rules here - rules: {} }; diff --git a/.gitignore b/.gitignore index e8f682b..0f7f253 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +test.db* + # Created by .ignore support plugin (hsz.mobi) ### Node template # Logs diff --git a/.prettierignore b/.prettierignore index 1ec6ab6..3a329aa 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,6 +3,7 @@ ### # .gitignore content is duplicated here due to https://github.com/prettier/prettier/issues/8506 +package-lock.json # Created by .ignore support plugin (hsz.mobi) ### Node template diff --git a/.prettierrc.json5 b/.prettierrc.json5 index c378988..85ca632 100644 --- a/.prettierrc.json5 +++ b/.prettierrc.json5 @@ -1,7 +1,7 @@ { useTabs: false, tabWidth: 2, - singleQuote: true, - trailingComma: 'none', - printWidth: 100 + singleQuote: false, + trailingComma: "all", + printWidth: 100, } diff --git a/api/index.js b/api/index.js deleted file mode 100644 index e69de29..0000000 diff --git a/api/index.ts b/api/index.ts new file mode 100644 index 0000000..7a62f62 --- /dev/null +++ b/api/index.ts @@ -0,0 +1,15 @@ +import express from "express"; +import { PrismaClient } from "@prisma/client"; + +const _prisma = new PrismaClient(); +const app = express(); + +app.use(express.json()); + +/** + * logic for our api will go here + */ +export default { + "path": "/api", + "handler": app, +}; diff --git a/components/Card.vue b/components/Card.vue index dcb8fa6..e1468e5 100644 --- a/components/Card.vue +++ b/components/Card.vue @@ -24,16 +24,16 @@ diff --git a/components/Tutorial.vue b/components/Tutorial.vue index 763f8fa..627eded 100644 --- a/components/Tutorial.vue +++ b/components/Tutorial.vue @@ -106,6 +106,6 @@ diff --git a/layouts/default.vue b/layouts/default.vue index e0c067f..83cbdb0 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -37,22 +37,22 @@ diff --git a/nuxt.config.js b/nuxt.config.js index 894aba4..ea8dcbb 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -1,50 +1,50 @@ export default { // Global page headers: https://go.nuxtjs.dev/config-head - head: { - title: 'eduproj', - htmlAttrs: { - lang: 'en' + "head": { + "title": "eduproj", + "htmlAttrs": { + "lang": "en", }, - meta: [ - { charset: 'utf-8' }, - { name: 'viewport', content: 'width=device-width, initial-scale=1' }, - { hid: 'description', name: 'description', content: '' }, - { name: 'format-detection', content: 'telephone=no' } + "meta": [ + { "charset": "utf-8" }, + { "name": "viewport", "content": "width=device-width, initial-scale=1" }, + { "hid": "description", "name": "description", "content": "" }, + { "name": "format-detection", "content": "telephone=no" }, ], - link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }] + "link": [{ "rel": "icon", "type": "image/x-icon", "href": "/favicon.ico" }], }, // Global CSS: https://go.nuxtjs.dev/config-css - css: [], + "css": [], // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins - plugins: [], + "plugins": [], // Auto import components: https://go.nuxtjs.dev/config-components - components: true, + "components": true, // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules - buildModules: [ + "buildModules": [ // https://go.nuxtjs.dev/typescript - '@nuxt/typescript-build' + "@nuxt/typescript-build", ], // Modules: https://go.nuxtjs.dev/config-modules - modules: [ + "modules": [ // https://go.nuxtjs.dev/buefy - 'nuxt-buefy', + "nuxt-buefy", // https://go.nuxtjs.dev/axios - '@nuxtjs/axios' + "@nuxtjs/axios", ], // Axios module configuration: https://go.nuxtjs.dev/config-axios - axios: { + "axios": { // Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308 - baseURL: '/' + "baseURL": "/", }, // Build Configuration: https://go.nuxtjs.dev/config-build - build: {}, + "build": {}, - serverMiddleware: [{ path: '/api', handler: '~/api' }] + "serverMiddleware": [{ "path": "/api", "handler": "~/api" }], }; diff --git a/package-lock.json b/package-lock.json index b961f11..a9125cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "dependencies": { "@nuxtjs/axios": "^5.13.6", + "@prisma/client": "^3.7.0", "core-js": "^3.19.3", "nuxt": "^2.15.8", "nuxt-buefy": "^0.4.13", @@ -27,7 +28,8 @@ "eslint-config-prettier": "^8.3.0", "eslint-plugin-nuxt": "^3.1.0", "eslint-plugin-vue": "^8.2.0", - "prettier": "^2.5.1" + "prettier": "^2.5.1", + "prisma": "^3.7.0" } }, "node_modules/@babel/code-frame": { @@ -2780,6 +2782,38 @@ "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.21.tgz", "integrity": "sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==" }, + "node_modules/@prisma/client": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-3.7.0.tgz", + "integrity": "sha512-fUJMvBOX5C7JPc0e3CJD6Gbelbu4dMJB4ScYpiht8HMUnRShw20ULOipTopjNtl6ekHQJ4muI7pXlQxWS9nMbw==", + "hasInstallScript": true, + "dependencies": { + "@prisma/engines-version": "3.7.0-31.8746e055198f517658c08a0c426c7eec87f5a85f" + }, + "engines": { + "node": ">=12.6" + }, + "peerDependencies": { + "prisma": "*" + }, + "peerDependenciesMeta": { + "prisma": { + "optional": true + } + } + }, + "node_modules/@prisma/engines": { + "version": "3.7.0-31.8746e055198f517658c08a0c426c7eec87f5a85f", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-3.7.0-31.8746e055198f517658c08a0c426c7eec87f5a85f.tgz", + "integrity": "sha512-W549ub5NlgexNhR8EFstA/UwAWq3Zq0w9aNkraqsozVCt2CsX+lK4TK7IW5OZVSnxHwRjrgEAt3r9yPy8nZQRg==", + "devOptional": true, + "hasInstallScript": true + }, + "node_modules/@prisma/engines-version": { + "version": "3.7.0-31.8746e055198f517658c08a0c426c7eec87f5a85f", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-3.7.0-31.8746e055198f517658c08a0c426c7eec87f5a85f.tgz", + "integrity": "sha512-+qx2b+HK7BKF4VCa0LZ/t1QCXsu6SmvhUQyJkOD2aPpmOzket4fEnSKQZSB0i5tl7rwCDsvAiSeK8o7rf+yvwg==" + }, "node_modules/@types/anymatch": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/anymatch/-/anymatch-3.0.0.tgz", @@ -12274,6 +12308,23 @@ "node": ">=4" } }, + "node_modules/prisma": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-3.7.0.tgz", + "integrity": "sha512-pzgc95msPLcCHqOli7Hnabu/GRfSGSUWl5s2P6N13T/rgMB+NNeKbxCmzQiZT2yLOeLEPivV6YrW1oeQIwJxcg==", + "devOptional": true, + "hasInstallScript": true, + "dependencies": { + "@prisma/engines": "3.7.0-31.8746e055198f517658c08a0c426c7eec87f5a85f" + }, + "bin": { + "prisma": "build/index.js", + "prisma2": "build/index.js" + }, + "engines": { + "node": ">=12.6" + } + }, "node_modules/process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -18608,6 +18659,25 @@ "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.21.tgz", "integrity": "sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==" }, + "@prisma/client": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-3.7.0.tgz", + "integrity": "sha512-fUJMvBOX5C7JPc0e3CJD6Gbelbu4dMJB4ScYpiht8HMUnRShw20ULOipTopjNtl6ekHQJ4muI7pXlQxWS9nMbw==", + "requires": { + "@prisma/engines-version": "3.7.0-31.8746e055198f517658c08a0c426c7eec87f5a85f" + } + }, + "@prisma/engines": { + "version": "3.7.0-31.8746e055198f517658c08a0c426c7eec87f5a85f", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-3.7.0-31.8746e055198f517658c08a0c426c7eec87f5a85f.tgz", + "integrity": "sha512-W549ub5NlgexNhR8EFstA/UwAWq3Zq0w9aNkraqsozVCt2CsX+lK4TK7IW5OZVSnxHwRjrgEAt3r9yPy8nZQRg==", + "devOptional": true + }, + "@prisma/engines-version": { + "version": "3.7.0-31.8746e055198f517658c08a0c426c7eec87f5a85f", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-3.7.0-31.8746e055198f517658c08a0c426c7eec87f5a85f.tgz", + "integrity": "sha512-+qx2b+HK7BKF4VCa0LZ/t1QCXsu6SmvhUQyJkOD2aPpmOzket4fEnSKQZSB0i5tl7rwCDsvAiSeK8o7rf+yvwg==" + }, "@types/anymatch": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/anymatch/-/anymatch-3.0.0.tgz", @@ -26014,6 +26084,15 @@ "resolved": "https://registry.npmjs.org/pretty-time/-/pretty-time-1.1.0.tgz", "integrity": "sha512-28iF6xPQrP8Oa6uxE6a1biz+lWeTOAPKggvjB8HAs6nVMKZwf5bG++632Dx614hIWgUPkgivRfG+a8uAXGTIbA==" }, + "prisma": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-3.7.0.tgz", + "integrity": "sha512-pzgc95msPLcCHqOli7Hnabu/GRfSGSUWl5s2P6N13T/rgMB+NNeKbxCmzQiZT2yLOeLEPivV6YrW1oeQIwJxcg==", + "devOptional": true, + "requires": { + "@prisma/engines": "3.7.0-31.8746e055198f517658c08a0c426c7eec87f5a85f" + } + }, "process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", diff --git a/package.json b/package.json index da7b262..3d3ace6 100644 --- a/package.json +++ b/package.json @@ -11,10 +11,11 @@ "lint:prettier": "prettier --check .", "lint": "npm run lint:js && npm run lint:prettier", "lintfix": "prettier --write --list-different . && npm run lint:js -- --fix", - "migrate": "prisma migrate" + "migrate": "prisma migrate dev" }, "dependencies": { "@nuxtjs/axios": "^5.13.6", + "@prisma/client": "^3.7.0", "core-js": "^3.19.3", "nuxt": "^2.15.8", "nuxt-buefy": "^0.4.13", @@ -33,6 +34,7 @@ "eslint-config-prettier": "^8.3.0", "eslint-plugin-nuxt": "^3.1.0", "eslint-plugin-vue": "^8.2.0", - "prettier": "^2.5.1" + "prettier": "^2.5.1", + "prisma": "^3.7.0" } } diff --git a/pages/index.vue b/pages/index.vue index eee7984..8f7c41e 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -20,12 +20,12 @@ diff --git a/pages/inspire.vue b/pages/inspire.vue index b5bcade..00c6820 100644 --- a/pages/inspire.vue +++ b/pages/inspire.vue @@ -9,6 +9,6 @@ diff --git a/prisma/migrations/20211228070433_initial/migration.sql b/prisma/migrations/20211228070433_initial/migration.sql new file mode 100644 index 0000000..a826aa4 --- /dev/null +++ b/prisma/migrations/20211228070433_initial/migration.sql @@ -0,0 +1,9 @@ +-- CreateTable +CREATE TABLE "User" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "email" TEXT NOT NULL, + "name" TEXT +); + +-- CreateIndex +CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); diff --git a/prisma/migrations/migration_lock.toml b/prisma/migrations/migration_lock.toml new file mode 100644 index 0000000..e5e5c47 --- /dev/null +++ b/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (i.e. Git) +provider = "sqlite" \ No newline at end of file diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 66ba0da..602e66f 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -6,13 +6,12 @@ generator client { } datasource db { - provider = "postgresql" - url = env("DATABASE_URL") + provider = "sqlite" + url = "file:./test.db" } model User { id Int @id @default(autoincrement()) email String @unique name String? - posts Post[] }