Merge pull request #856 from liyasthomas/feat/dotenv

This commit is contained in:
Liyas Thomas
2020-05-12 15:14:34 +05:30
committed by GitHub
5 changed files with 106 additions and 32 deletions

15
.env.example Normal file
View File

@@ -0,0 +1,15 @@
# Google Analytics
GA_ID=UA-XXXXXXXX-X
# Google Tag Manager
GTM_ID=GTM-XXXXXXX
# Firebase
API_KEY=api-key
AUTH_DOMAIN=project-id.firebaseapp.com
DATABASE_URL=https://project-id.firebaseio.com
PROJECT_ID=project-id
STORAGE_BUCKET=project-id.appspot.com
MESSAGING_SENDER_ID=sender-id
APP_ID=app-id
MEASUREMENT_ID=G-measurement-id

View File

@@ -4,14 +4,14 @@ import "firebase/auth"
// Initialize Firebase, copied from cloud console // Initialize Firebase, copied from cloud console
const firebaseConfig = { const firebaseConfig = {
apiKey: "AIzaSyCMsFreESs58-hRxTtiqQrIcimh4i1wbsM", apiKey: process.env.API_KEY,
authDomain: "postwoman-api.firebaseapp.com", authDomain: process.env.AUTH_DOMAIN,
databaseURL: "https://postwoman-api.firebaseio.com", databaseURL: process.env.DATABASE_URL,
projectId: "postwoman-api", projectId: process.env.PROJECT_ID,
storageBucket: "postwoman-api.appspot.com", storageBucket: process.env.STORAGE_BUCKET,
messagingSenderId: "421993993223", messagingSenderId: process.env.MESSAGING_SENDER_ID,
appId: "1:421993993223:web:ec0baa8ee8c02ffa1fc6a2", appId: process.env.APP_ID,
measurementId: "G-ERJ6025CEB", measurementId: process.env.MEASUREMENT_ID,
} }
firebase.initializeApp(firebaseConfig) firebase.initializeApp(firebaseConfig)

View File

@@ -1,3 +1,4 @@
require("dotenv").config()
// Some helpful application constants. // Some helpful application constants.
// TODO: Use these when rendering the pages (rather than just for head/meta tags...) // TODO: Use these when rendering the pages (rather than just for head/meta tags...)
export const options = { export const options = {
@@ -147,19 +148,30 @@ export default {
/* /*
** Nuxt.js dev-modules ** Nuxt.js dev-modules
*/ */
buildModules: ["@nuxtjs/gtm"], buildModules: [
// See https://goo.gl/OOhYW5
"@nuxtjs/pwa",
// Doc: https://github.com/nuxt-community/dotenv-module
"@nuxtjs/dotenv",
// Doc: https://github.com/nuxt-community/analytics-module
"@nuxtjs/google-analytics",
// Doc: https://github.com/nuxt-community/gtm-module
"@nuxtjs/gtm",
],
/* /*
** Nuxt.js modules ** Nuxt.js modules
*/ */
modules: [ modules: [
// See https://goo.gl/OOhYW5 // Doc: https://axios.nuxtjs.org/usage
["@nuxtjs/pwa"], "@nuxtjs/axios",
["@nuxtjs/axios"], // https://github.com/nuxt-community/modules/tree/master/packages/toast
["@nuxtjs/toast"], "@nuxtjs/toast",
["@nuxtjs/google-analytics"], // Doc: https://github.com/nuxt-community/nuxt-i18n
["@nuxtjs/sitemap"], "nuxt-i18n",
["@nuxtjs/robots"], // Doc: https://github.com/nuxt-community/sitemap-module
["nuxt-i18n"], "@nuxtjs/sitemap",
// Doc: https://github.com/nuxt-community/robots-module
"@nuxtjs/robots",
], ],
pwa: { pwa: {
manifest: { manifest: {
@@ -188,10 +200,10 @@ export default {
keepOnHover: true, keepOnHover: true,
}, },
googleAnalytics: { googleAnalytics: {
id: process.env.GA_ID || "UA-61422507-2", id: process.env.GA_ID,
}, },
gtm: { gtm: {
id: process.env.GTM_ID || "GTM-MXWD8NQ", id: process.env.GTM_ID,
}, },
sitemap: { sitemap: {
hostname: "https://postwoman.io", hostname: "https://postwoman.io",
@@ -202,6 +214,16 @@ export default {
Allow: "/", Allow: "/",
Sitemap: "https://postwoman.io/sitemap.xml", Sitemap: "https://postwoman.io/sitemap.xml",
}, },
env: {
API_KEY: process.env.API_KEY,
AUTH_DOMAIN: process.env.AUTH_DOMAIN,
DATABASE_URL: process.env.DATABASE_URL,
PROJECT_ID: process.env.PROJECT_ID,
STORAGE_BUCKET: process.env.STORAGE_BUCKET,
MESSAGING_SENDER_ID: process.env.MESSAGING_SENDER_ID,
APP_ID: process.env.APP_ID,
MEASUREMENT_ID: process.env.MEASUREMENT_ID,
},
i18n: { i18n: {
locales: [ locales: [
{ {
@@ -297,7 +319,11 @@ export default {
/* /*
** You can extend webpack config here ** You can extend webpack config here
*/ */
extend(config, ctx) {}, extend(config, ctx) {
config.node = {
fs: "empty",
}
},
}, },
/* /*
** Generate configuration ** Generate configuration

54
package-lock.json generated
View File

@@ -2208,6 +2208,16 @@
} }
} }
}, },
"@nuxtjs/dotenv": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/@nuxtjs/dotenv/-/dotenv-1.4.1.tgz",
"integrity": "sha512-DpdObsvRwC8d89I9mzz6pBg6e/PEXHazDM57DOI1mmML2ZjHfQ/DvkjlSzUL7T+TnW3b/a4Ks5wQx08DqFBmeQ==",
"dev": true,
"requires": {
"consola": "^2.10.1",
"dotenv": "^8.1.0"
}
},
"@nuxtjs/google-analytics": { "@nuxtjs/google-analytics": {
"version": "2.2.3", "version": "2.2.3",
"resolved": "https://registry.npmjs.org/@nuxtjs/google-analytics/-/google-analytics-2.2.3.tgz", "resolved": "https://registry.npmjs.org/@nuxtjs/google-analytics/-/google-analytics-2.2.3.tgz",
@@ -2235,6 +2245,7 @@
"version": "3.0.0-beta.20", "version": "3.0.0-beta.20",
"resolved": "https://registry.npmjs.org/@nuxtjs/pwa/-/pwa-3.0.0-beta.20.tgz", "resolved": "https://registry.npmjs.org/@nuxtjs/pwa/-/pwa-3.0.0-beta.20.tgz",
"integrity": "sha512-pZhGBqRvTCItvAdZ6PSZtqJUKT6ybphXCykfHh95KzW0cGf10QH/ETPci2AMDEzfx4jW2hImGSmLBToVWOV7Uw==", "integrity": "sha512-pZhGBqRvTCItvAdZ6PSZtqJUKT6ybphXCykfHh95KzW0cGf10QH/ETPci2AMDEzfx4jW2hImGSmLBToVWOV7Uw==",
"dev": true,
"requires": { "requires": {
"defu": "^1.0.0", "defu": "^1.0.0",
"execa": "^1.0.0", "execa": "^1.0.0",
@@ -4678,6 +4689,7 @@
"version": "6.0.5", "version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
"integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
"dev": true,
"requires": { "requires": {
"nice-try": "^1.0.4", "nice-try": "^1.0.4",
"path-key": "^2.0.1", "path-key": "^2.0.1",
@@ -5249,6 +5261,12 @@
} }
} }
}, },
"dotenv": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==",
"dev": true
},
"duplexer": { "duplexer": {
"version": "0.1.1", "version": "0.1.1",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
@@ -5813,6 +5831,7 @@
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
"integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
"dev": true,
"requires": { "requires": {
"cross-spawn": "^6.0.0", "cross-spawn": "^6.0.0",
"get-stream": "^4.0.0", "get-stream": "^4.0.0",
@@ -7106,6 +7125,7 @@
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
"integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
"dev": true,
"requires": { "requires": {
"pump": "^3.0.0" "pump": "^3.0.0"
} }
@@ -7438,9 +7458,10 @@
} }
}, },
"hasha": { "hasha": {
"version": "5.1.0", "version": "5.2.0",
"resolved": "https://registry.npmjs.org/hasha/-/hasha-5.1.0.tgz", "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.0.tgz",
"integrity": "sha512-OFPDWmzPN1l7atOV1TgBVmNtBxaIysToK6Ve9DK+vT6pYuklw/nPNT+HJbZi0KDcI6vWB+9tgvZ5YD7fA3CXcA==", "integrity": "sha512-2W+jKdQbAdSIrggA8Q35Br8qKadTrqCTC8+XZvBWepKDK6m9XkX6Iz1a2yh2KP01kzAR/dpuMeUnocoLYDcskw==",
"dev": true,
"requires": { "requires": {
"is-stream": "^2.0.0", "is-stream": "^2.0.0",
"type-fest": "^0.8.0" "type-fest": "^0.8.0"
@@ -7449,7 +7470,8 @@
"is-stream": { "is-stream": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz",
"integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==",
"dev": true
} }
} }
}, },
@@ -8351,7 +8373,8 @@
"jimp-compact": { "jimp-compact": {
"version": "0.8.5", "version": "0.8.5",
"resolved": "https://registry.npmjs.org/jimp-compact/-/jimp-compact-0.8.5.tgz", "resolved": "https://registry.npmjs.org/jimp-compact/-/jimp-compact-0.8.5.tgz",
"integrity": "sha512-BkpiX6jZyDVLU+CleO/6yF8SFHnyZXiElPryNjZx58AK1vy+bqSFvhKeFS680TISSr8IWqHlIAwDMMA0DTQkMw==" "integrity": "sha512-BkpiX6jZyDVLU+CleO/6yF8SFHnyZXiElPryNjZx58AK1vy+bqSFvhKeFS680TISSr8IWqHlIAwDMMA0DTQkMw==",
"dev": true
}, },
"js-base64": { "js-base64": {
"version": "2.5.2", "version": "2.5.2",
@@ -9312,7 +9335,8 @@
"nice-try": { "nice-try": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
"dev": true
}, },
"no-case": { "no-case": {
"version": "2.3.2", "version": "2.3.2",
@@ -9599,6 +9623,7 @@
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
"integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=",
"dev": true,
"requires": { "requires": {
"path-key": "^2.0.0" "path-key": "^2.0.0"
} }
@@ -9868,7 +9893,8 @@
"p-finally": { "p-finally": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
"integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=",
"dev": true
}, },
"p-limit": { "p-limit": {
"version": "2.2.1", "version": "2.2.1",
@@ -10060,7 +10086,8 @@
"path-key": { "path-key": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
"integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",
"dev": true
}, },
"path-parse": { "path-parse": {
"version": "1.0.6", "version": "1.0.6",
@@ -12245,6 +12272,7 @@
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
"integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
"dev": true,
"requires": { "requires": {
"shebang-regex": "^1.0.0" "shebang-regex": "^1.0.0"
} }
@@ -12252,7 +12280,8 @@
"shebang-regex": { "shebang-regex": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
"integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
"dev": true
}, },
"shell-quote": { "shell-quote": {
"version": "1.7.2", "version": "1.7.2",
@@ -13002,7 +13031,8 @@
"strip-eof": { "strip-eof": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
"dev": true
}, },
"strip-final-newline": { "strip-final-newline": {
"version": "2.0.0", "version": "2.0.0",
@@ -14459,6 +14489,7 @@
"version": "1.3.1", "version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
"dev": true,
"requires": { "requires": {
"isexe": "^2.0.0" "isexe": "^2.0.0"
} }
@@ -14531,7 +14562,8 @@
"workbox-cdn": { "workbox-cdn": {
"version": "4.3.1", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/workbox-cdn/-/workbox-cdn-4.3.1.tgz", "resolved": "https://registry.npmjs.org/workbox-cdn/-/workbox-cdn-4.3.1.tgz",
"integrity": "sha512-Adkgo+/7S+bBsDTzdeH0xxQCrfBM1EiyZlvu1tMh0cJ/ipC6TtA8KDr12PBREdbL0zO9hG+7OSzvi2NLchPAEg==" "integrity": "sha512-Adkgo+/7S+bBsDTzdeH0xxQCrfBM1EiyZlvu1tMh0cJ/ipC6TtA8KDr12PBREdbL0zO9hG+7OSzvi2NLchPAEg==",
"dev": true
}, },
"worker-farm": { "worker-farm": {
"version": "1.7.0", "version": "1.7.0",

View File

@@ -32,7 +32,6 @@
"dependencies": { "dependencies": {
"@nuxtjs/axios": "^5.10.3", "@nuxtjs/axios": "^5.10.3",
"@nuxtjs/gtm": "^2.2.3", "@nuxtjs/gtm": "^2.2.3",
"@nuxtjs/pwa": "^3.0.0-beta.20",
"@nuxtjs/robots": "^2.4.2", "@nuxtjs/robots": "^2.4.2",
"@nuxtjs/sitemap": "^2.3.0", "@nuxtjs/sitemap": "^2.3.0",
"@nuxtjs/toast": "^3.3.0", "@nuxtjs/toast": "^3.3.0",
@@ -53,7 +52,9 @@
"yargs-parser": "^18.1.3" "yargs-parser": "^18.1.3"
}, },
"devDependencies": { "devDependencies": {
"@nuxtjs/dotenv": "^1.4.1",
"@nuxtjs/google-analytics": "^2.2.3", "@nuxtjs/google-analytics": "^2.2.3",
"@nuxtjs/pwa": "^3.0.0-beta.20",
"cypress": "^4.5.0", "cypress": "^4.5.0",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"eslint-plugin-vue": "^6.2.2", "eslint-plugin-vue": "^6.2.2",