🎾 vue-tennis | μ„œμšΈ ν…Œλ‹ˆμŠ€ 클럽 μ›Ήμ•± : Development Log

protect-meΒ·2021λ…„ 9μ›” 17일
0
post-thumbnail

🎾 μ„œμšΈ ν…Œλ‹ˆμŠ€ 클럽 μ›Ήμ•±

μ£Όλ³€ ν…Œλ‹ˆμŠ€μž₯ μ°ΎκΈ° & 게슀트 λͺ¨μ§‘ ν”Œλž«νΌ μ›Ήμ•± 개발

Link : https://tennis9in.netlify.app
Github : https://github.com/protect-me/vue-tennis
Project Summary : https://velog.io/@protect-me/vue-tennis-summary
Development Log : https://velog.io/@protect-me/vue-tennis-log (Current)

1. ν”„λ‘œμ νŠΈ ν™˜κ²½μ„€μ •

1-1. ν”„λ‘œμ νŠΈ 생성

  • $ vue create vue-tennis : vue-tennisλΌλŠ” μ΄λ¦„μœΌλ‘œ vue ν”„λ‘œμ νŠΈ 생성
Vue CLI v4.5.13
? Please pick a preset: Manually select features
? Check the features needed for your project: Choose Vue version, Babel, Router, Vuex, Lint
er
? Choose a version of Vue.js that you want to start the project with 2.x
? Use history mode for router? (Requires proper server setup for index fallback in producti
on) Yes
? Pick a linter / formatter config: Basic
? Pick additional lint features: Lint on save
? Where do you prefer placing config for Babel, ESLint, etc.? In package.json
? Save this as a preset for future projects? No

1-2. 경둜 이동 및 μ„œλ²„ ν…ŒμŠ€νŠΈ μ‹€ν–‰

  • $ cd vue-tennis : 경둜 이동
  • $ yarn serve : μ„œλ²„ μ‹€ν–‰
  • http://localhost:8080/ : LOCAL URL
  • $ Control + C : μ„œλ²„ 내리기
  • editor(VScode)λ₯Ό ν•΄λ‹Ή 경둜둜 λ‹€μ‹œ μ—΄κΈ°

1-3. Vuetify μ„€μΉ˜

$ vue add vuetify
(ν•΄λ‹Ή ν”„λ‘œμ νŠΈ λ‚΄λΆ€μ—μ„œ λͺ…λ Ήμ–΄ μž…λ ₯)

? Choose a preset: Configure (advanced)
? Use a pre-made template? (will replace App.vue and HelloWorld.vue) Yes
? Use custom theme? No
? Use custom properties (CSS variables)? No
? Select icon font Material Design Icons
? Use fonts as a dependency (for Electron or offline)? No
? Use a-la-carte components? Yes
? Select locale English

1-4. .gitignore 파일 μˆ˜μ •

.DS_Store
node_modules
/dist


# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
node_modules

2. Firebase μ„€μ •

Firebase

  • firebase ꡬ글 둜그인
  • ν”„λ‘œμ νŠΈ μΆ”κ°€

Authentication

  • 이메일/λΉ„λ°€λ²ˆν˜Έ: μ‚¬μš© μ„€μ •
  • Google: μ‚¬μš© μ„€μ •

Firestore Database

  • Database에 적합
  • Cloud Firestore의 λ³΄μ•ˆ κ·œμΉ™: ν…ŒμŠ€νŠΈ λͺ¨λ“œ
  • Cloud Firestore μœ„μΉ˜ μ„€μ •: asia-northeast3(Seoul)

Realtime Database

  • 섀정값에 적합
  • 미ꡭ으둜 μ„€μ •(μ°¨ν›„ κ°€κΉŒμš΄ 지역이 λ‚˜μ˜€λ©΄ κ·Έμͺ½μœΌλ‘œ μ„€μ •)
  • ν…ŒμŠ€νŠΈλͺ¨λ“œλ‘œ μ„€μ •

ν”„λ‘œμ νŠΈ μ„€μ •

  • 일반 > λ‚΄ ν”„λ‘œμ νŠΈ >곡개 μ„€μ • > 지원 이메일 μ„€μ •
  • 일반 > λ‚΄ μ•± > ν”Œλž«νΌ 선택: μ›Ή(</>)
    : μ›Ή 앱에 Firebase μΆ”κ°€ > μ•± 등둝

Firebase μ„€μΉ˜

  • $ Firebase login
  • $ Firebase init
firebase init

     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  /Users/***/Documents/Develope/vue-tennis

? Which Firebase CLI features do you want to set up for this folder? Press Space to select 
features, then Enter to confirm your choices. Database: Configure Firebase Realtime Databas
e and deploy rules, Firestore: Deploy rules and create indexes for Firestore, Functions: Co
nfigure and deploy Cloud Functions, Hosting: Configure and deploy Firebase Hosting sites, S
torage: Deploy Cloud Storage security rules

=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add, 
but for now we'll just set up a default project.

? Please select an option: Use an existing project
? Select a default Firebase project for this directory: vue-tennis (vue-tennis)
i  Using project vue-tennis (vue-tennis)

=== Database Setup
i  database: ensuring required API firebasedatabase.googleapis.com is enabled...
βœ”  database: required API firebasedatabase.googleapis.com is enabled


Firebase Realtime Database Security Rules allow you to define how your data should be
structured and when your data can be read from and written to.

? What file should be used for Realtime Database Security Rules? database.rules.json
βœ”  Database Rules for vue-tennis-default-rtdb have been written to database.rules.json.
Future modifications to database.rules.json will update Realtime Database Security Rules when you run
firebase deploy.

=== Firestore Setup

Firestore Security Rules allow you to define how and when to allow
requests. You can keep these rules in your project directory
and publish them with firebase deploy.

? What file should be used for Firestore Rules? firestore.rules

Firestore indexes allow you to perform complex queries while
maintaining performance that scales with the size of the result
set. You can keep index definitions in your project directory
and publish them with firebase deploy.

? What file should be used for Firestore indexes? firestore.indexes.json

=== Functions Setup

A functions directory will be created in your project with a Node.js
package pre-configured. Functions can be deployed with firebase deploy.

? What language would you like to use to write Cloud Functions? JavaScript
? Do you want to use ESLint to catch probable bugs and enforce style? No
βœ”  Wrote functions/package.json
βœ”  Wrote functions/index.js
βœ”  Wrote functions/.gitignore
? Do you want to install dependencies with npm now? Yes

> protobufjs@6.11.2 postinstall /Users/***/Documents/Develope/vue-tennis/functions/node_modules/protobufjs
> node scripts/postinstall

npm notice created a lockfile as package-lock.json. You should commit this file.
added 227 packages from 204 contributors and audited 227 packages in 6.657s

8 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


=== Hosting Setup

Your public directory is the folder (relative to your project directory) that
will contain Hosting assets to be uploaded with firebase deploy. If you
have a build process for your assets, use your build's output directory.

? What do you want to use as your public directory? dist
? Configure as a single-page app (rewrite all urls to /index.html)? Yes
? Set up automatic builds and deploys with GitHub? No
βœ”  Wrote dist/index.html

=== Storage Setup

Firebase Storage Security Rules allow you to define how and when to allow
uploads and downloads. You can keep these rules in your project directory
and publish them with firebase deploy.

? What file should be used for Storage Rules? storage.rules

i  Writing configuration info to firebase.json...
i  Writing project information to .firebaserc...

βœ”  Firebase initialization complete!
  • $ yarn add firebase@8.2.3

λ²„μ „λ³„λ‘œ importν•˜λŠ” 방식이 λ‹€λ₯΄κ²Œ λ‚˜μ™€μ„œ κ½€λ‚˜ ν˜Όλž€μŠ€λŸ¬μ›€.
v8둜 μ„€μΉ˜ μ‹œ, λ³Έ λΈ”λ‘œκ·Έ κΈ€μ˜ λ‚΄μš©κ³Ό 같이 importκ°€ κ°€λŠ₯ν•˜λ‚˜,
v7 μ΄ν•˜ ν˜Ήμ€ v9 μ΄μƒμ—μ„œλŠ”
import * as firebase from 'firebase/app'κ³Ό 같이 import
=> μžμ„Έν•œ 사항은 firebase Document μ°Έκ³ 

firebase μ—°κ²°

main.js

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import vuetify from './plugins/vuetify'
import './plugins/firebase.js' // plugin μ„€μ •

Vue.config.productionTip = false

new Vue({
  router,
  store,
  vuetify,
  render: (h) => h(App),
}).$mount('#app')

plugins/firebase.js

import Vue from 'vue'
import firebase from 'firebase/app'
import firebaseConfig from '../../firebaseConfig'
import 'firebase/auth'
import 'firebase/firebase-firestore'

firebase.initializeApp(firebaseConfig)
Vue.prototype.$firebase = firebase

App.js

<script> 
  (...)
  mounted() {
    console.log('here', this.$firebase)
  },
  (...)

.env μ„€μ •

$ npm install dotenv

  • .env 파일 생성
    : firebaseConfig.js의 λ‚΄μš©μ„ κΈ°μž…
VUE_APP_apiKey=''
VUE_APP_authDomain=''
VUE_APP_databaseURL=''
VUE_APP_projectId=''
VUE_APP_storageBucket=''
VUE_APP_messagingSenderId=''
VUE_APP_appId=''
VUE_APP_measurementId=''
  • firebaseConfig.js λ‚΄μš© μˆ˜μ •
export default {
  apiKey: process.env.VUE_APP_apiKey,
  authDomain: process.env.VUE_APP_authDomain,
  databaseURL: process.env.VUE_APP_databaseURL,
  projectId: process.env.VUE_APP_projectId,
  storageBucket: process.env.VUE_APP_storageBucket,
  messagingSenderId: process.env.VUE_APP_messagingSenderId,
  appId: process.env.VUE_APP_appId,
  measurementId: process.env.VUE_APP_measurementId,
}

.gitignore μΆ”κ°€

.env

3. Netlify 배포

Netlify deploy

New site from Git > Github > 둜그인 및 κΆŒν•œ μ„€μ • > ν•΄λ‹Ή repository 선택 > κΈ°λ³Έ μ„€μ • μœ μ§€, Deploy site

ν™˜κ²½λ³€μˆ˜ μ„€μ •

site Settings > Build & deploy > Environment > Environment variables > .env의 ν™˜κ²½λ³€μˆ˜ κΈ°μž…

functions bundling error

2. Functions bundling                                         
11:16:27 PM: ────────────────────────────────────────────────────────────────
11:16:27 PM: ​
11:16:27 PM: Packaging Functions from functions directory:
11:16:27 PM:  - index.js
11:16:27 PM: ​
11:16:27 PM: ​
11:16:27 PM: ────────────────────────────────────────────────────────────────
11:16:27 PM:   Dependencies installation error                               
11:16:27 PM: ────────────────────────────────────────────────────────────────
11:16:27 PM: ​
11:16:27 PM:   Error message
11:16:27 PM:   A Netlify Function is using "firebase-functions" but that dependency has not been installed yet.

μœ„μ™€ 같은 μ—λŸ¬λ₯Ό λ§Œλ‚œ 경우

  • 원인 : Netlify와 firebase의 각각의 funtionsκ°€ μžˆλŠ”λ°,
    Netlifyκ°€ 배포할 λ•Œ fireabase의 funtions 폴더λ₯Ό μ°Ύμ•„λ“€μ–΄κ°€μ„œ ν•¨μˆ˜λ₯Ό μ°ΎκΈ° λ•Œλ¬Έμ— μ—λŸ¬κ°€ λ°œμƒ.
  • ν•΄κ²° : μ΅œμƒμœ„ κ²½λ‘œμ— netlify.toml 파일 생성 ν›„ μ•„λž˜μ™€ 같이 μž‘μ„±
[build]
  functions="NetlifyFunctions"

즉, Netlify 배포 μ‹œ, netlify의 funtionsλŠ” NetlifyFunctions κ²½λ‘œμ— λ“€μ–΄κ°€μ„œ 찾도둝 섀정함.
λ¬Όλ‘  폴더가 μ—†κ±°λ‚˜ λ§Œλ“€λ”λΌλ„ 빈 폴더이기 λ•Œλ¬Έμ— μ•„λž˜μ™€ 같은 logλ₯Ό 남기고 λ„˜μ–΄κ°ˆ 수 있음
(μΆ”κ°€λ‘œ netlify funtionsλ₯Ό μž‘μ„±ν•œ 경우 μ œμ™Έ)
The Netlify Functions setting targets a non-existing directory: NetlifyFunctions

4. KakaoMap μ„€μ •

kakao developers

μ•± ν‚€ μ„€μ •

  • μ• ν”Œλ¦¬μΌ€μ΄μ…˜ μΆ”κ°€ > μ•± ν‚€ 확인
    : REST API ν‚€
    : JavaScript ν‚€

  • .env νŒŒμΌμ— λ‚΄μš© μΆ”κ°€

VUE_APP_KAKAO_ADDRESS_REST_API_KEY=''
VUE_APP_KAKAO_MAP_JAVASCRIPT_KEY=''

ν”Œλž«νΌ μ„€μ •

: ν”Œλž«νΌ > web > Netlifyμ—μ„œ λ°°ν¬ν•œ μ£Όμ†Œ μΆ”κ°€

ERROR

Mixed Content

profile
protect me from what i want

0개의 λŒ“κΈ€