From d4aa3699f2c2943ade62d48f24a852630692b3ef Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Sun, 10 May 2020 12:10:17 +0530 Subject: [PATCH 1/6] :zap: dotenv --- .env.example | 15 +++++++++++++++ functions/fb.js | 16 ++++++++-------- nuxt.config.js | 20 ++++++++++---------- package-lock.json | 16 ++++++++++++++++ package.json | 1 + 5 files changed, 50 insertions(+), 18 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 000000000..ead263bd8 --- /dev/null +++ b/.env.example @@ -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 diff --git a/functions/fb.js b/functions/fb.js index 77d50bc29..2a6bc3a3e 100644 --- a/functions/fb.js +++ b/functions/fb.js @@ -4,14 +4,14 @@ import "firebase/auth" // Initialize Firebase, copied from cloud console const firebaseConfig = { - apiKey: "AIzaSyCMsFreESs58-hRxTtiqQrIcimh4i1wbsM", - authDomain: "postwoman-api.firebaseapp.com", - databaseURL: "https://postwoman-api.firebaseio.com", - projectId: "postwoman-api", - storageBucket: "postwoman-api.appspot.com", - messagingSenderId: "421993993223", - appId: "1:421993993223:web:ec0baa8ee8c02ffa1fc6a2", - measurementId: "G-ERJ6025CEB", + apiKey: process.env.API_KEY, + authDomain: process.env.AUTH_DOMAIN, + databaseURL: process.env.DATABASE_URL, + projectId: process.env.PROJECT_ID, + storageBucket: process.env.STORAGE_BUCKET, + messagingSenderId: process.env.MESSAGING_SENDER_ID, + appId: process.env.APP_ID, + measurementId: process.env.MEASUREMENT_ID, } firebase.initializeApp(firebaseConfig) diff --git a/nuxt.config.js b/nuxt.config.js index f6b259da5..1f36720df 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -1,3 +1,4 @@ +require("dotenv").config() // Some helpful application constants. // TODO: Use these when rendering the pages (rather than just for head/meta tags...) export const options = { @@ -147,19 +148,18 @@ export default { /* ** Nuxt.js dev-modules */ - buildModules: ["@nuxtjs/gtm"], + buildModules: ["@nuxtjs/gtm", "@nuxtjs/dotenv", "@nuxtjs/google-analytics"], /* ** Nuxt.js modules */ modules: [ // See https://goo.gl/OOhYW5 - ["@nuxtjs/pwa"], - ["@nuxtjs/axios"], - ["@nuxtjs/toast"], - ["@nuxtjs/google-analytics"], - ["@nuxtjs/sitemap"], - ["@nuxtjs/robots"], - ["nuxt-i18n"], + "@nuxtjs/pwa", + "@nuxtjs/axios", + "@nuxtjs/toast", + "@nuxtjs/sitemap", + "@nuxtjs/robots", + "nuxt-i18n", ], pwa: { manifest: { @@ -188,10 +188,10 @@ export default { keepOnHover: true, }, googleAnalytics: { - id: process.env.GA_ID || "UA-61422507-2", + id: process.env.GA_ID, }, gtm: { - id: process.env.GTM_ID || "GTM-MXWD8NQ", + id: process.env.GTM_ID, }, sitemap: { hostname: "https://postwoman.io", diff --git a/package-lock.json b/package-lock.json index e1b4dd04a..c43858aeb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2198,6 +2198,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": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/@nuxtjs/google-analytics/-/google-analytics-2.2.3.tgz", @@ -5239,6 +5249,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": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", diff --git a/package.json b/package.json index 970e5350c..8c13cab04 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "yargs-parser": "^18.1.3" }, "devDependencies": { + "@nuxtjs/dotenv": "^1.4.1", "@nuxtjs/google-analytics": "^2.2.3", "cypress": "^4.5.0", "eslint": "^6.8.0", From e3fb11cce0f212ed88bf903d9c9d3706049f25c9 Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Sun, 10 May 2020 12:17:25 +0530 Subject: [PATCH 2/6] :zap: dotenv --- functions/fb.js | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/fb.js b/functions/fb.js index 2a6bc3a3e..3881cff1d 100644 --- a/functions/fb.js +++ b/functions/fb.js @@ -1,6 +1,7 @@ import firebase from "firebase/app" import "firebase/firestore" import "firebase/auth" +require("dotenv").config() // Initialize Firebase, copied from cloud console const firebaseConfig = { From b598d846bbda9f13f575d11ba78ddccb4ec35618 Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Sun, 10 May 2020 12:36:40 +0530 Subject: [PATCH 3/6] :zap: dotenv --- nuxt.config.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nuxt.config.js b/nuxt.config.js index 1f36720df..bd892d9f4 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -297,7 +297,11 @@ export default { /* ** You can extend webpack config here */ - extend(config, ctx) {}, + extend(config, ctx) { + config.node = { + fs: "empty", + } + }, }, /* ** Generate configuration From 6f034ad878c0e22ffc19c78aeb0481cadbf70070 Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Sun, 10 May 2020 13:18:40 +0530 Subject: [PATCH 4/6] :zap: dotenv --- functions/fb.js | 1 - 1 file changed, 1 deletion(-) diff --git a/functions/fb.js b/functions/fb.js index 3881cff1d..2a6bc3a3e 100644 --- a/functions/fb.js +++ b/functions/fb.js @@ -1,7 +1,6 @@ import firebase from "firebase/app" import "firebase/firestore" import "firebase/auth" -require("dotenv").config() // Initialize Firebase, copied from cloud console const firebaseConfig = { From c285217ed2e4db032ad487e33a3a8981588531dc Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Tue, 12 May 2020 08:27:58 +0530 Subject: [PATCH 5/6] :package: Updating compiled files or packages --- nuxt.config.js | 22 +++++++++++++++++----- package-lock.json | 38 +++++++++++++++++++++++++++----------- package.json | 2 +- 3 files changed, 45 insertions(+), 17 deletions(-) diff --git a/nuxt.config.js b/nuxt.config.js index bd892d9f4..93cd42e21 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -148,18 +148,30 @@ export default { /* ** Nuxt.js dev-modules */ - buildModules: ["@nuxtjs/gtm", "@nuxtjs/dotenv", "@nuxtjs/google-analytics"], + 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 */ modules: [ - // See https://goo.gl/OOhYW5 - "@nuxtjs/pwa", + // Doc: https://axios.nuxtjs.org/usage "@nuxtjs/axios", + // https://github.com/nuxt-community/modules/tree/master/packages/toast "@nuxtjs/toast", - "@nuxtjs/sitemap", - "@nuxtjs/robots", + // Doc: https://github.com/nuxt-community/nuxt-i18n "nuxt-i18n", + // Doc: https://github.com/nuxt-community/sitemap-module + "@nuxtjs/sitemap", + // Doc: https://github.com/nuxt-community/robots-module + "@nuxtjs/robots", ], pwa: { manifest: { diff --git a/package-lock.json b/package-lock.json index e6434acbd..d38a8816c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2245,6 +2245,7 @@ "version": "3.0.0-beta.20", "resolved": "https://registry.npmjs.org/@nuxtjs/pwa/-/pwa-3.0.0-beta.20.tgz", "integrity": "sha512-pZhGBqRvTCItvAdZ6PSZtqJUKT6ybphXCykfHh95KzW0cGf10QH/ETPci2AMDEzfx4jW2hImGSmLBToVWOV7Uw==", + "dev": true, "requires": { "defu": "^1.0.0", "execa": "^1.0.0", @@ -4688,6 +4689,7 @@ "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, "requires": { "nice-try": "^1.0.4", "path-key": "^2.0.1", @@ -5829,6 +5831,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, "requires": { "cross-spawn": "^6.0.0", "get-stream": "^4.0.0", @@ -7122,6 +7125,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, "requires": { "pump": "^3.0.0" } @@ -7454,9 +7458,10 @@ } }, "hasha": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.1.0.tgz", - "integrity": "sha512-OFPDWmzPN1l7atOV1TgBVmNtBxaIysToK6Ve9DK+vT6pYuklw/nPNT+HJbZi0KDcI6vWB+9tgvZ5YD7fA3CXcA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.0.tgz", + "integrity": "sha512-2W+jKdQbAdSIrggA8Q35Br8qKadTrqCTC8+XZvBWepKDK6m9XkX6Iz1a2yh2KP01kzAR/dpuMeUnocoLYDcskw==", + "dev": true, "requires": { "is-stream": "^2.0.0", "type-fest": "^0.8.0" @@ -7465,7 +7470,8 @@ "is-stream": { "version": "2.0.0", "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 } } }, @@ -8367,7 +8373,8 @@ "jimp-compact": { "version": "0.8.5", "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": { "version": "2.5.2", @@ -9328,7 +9335,8 @@ "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true }, "no-case": { "version": "2.3.2", @@ -9615,6 +9623,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, "requires": { "path-key": "^2.0.0" } @@ -9884,7 +9893,8 @@ "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true }, "p-limit": { "version": "2.2.1", @@ -10076,7 +10086,8 @@ "path-key": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true }, "path-parse": { "version": "1.0.6", @@ -12261,6 +12272,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, "requires": { "shebang-regex": "^1.0.0" } @@ -12268,7 +12280,8 @@ "shebang-regex": { "version": "1.0.0", "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": { "version": "1.7.2", @@ -13018,7 +13031,8 @@ "strip-eof": { "version": "1.0.0", "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": { "version": "2.0.0", @@ -14475,6 +14489,7 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, "requires": { "isexe": "^2.0.0" } @@ -14547,7 +14562,8 @@ "workbox-cdn": { "version": "4.3.1", "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": { "version": "1.7.0", diff --git a/package.json b/package.json index 5b1e055a2..9dd81754b 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,6 @@ "dependencies": { "@nuxtjs/axios": "^5.10.3", "@nuxtjs/gtm": "^2.2.3", - "@nuxtjs/pwa": "^3.0.0-beta.20", "@nuxtjs/robots": "^2.4.2", "@nuxtjs/sitemap": "^2.2.1", "@nuxtjs/toast": "^3.3.0", @@ -55,6 +54,7 @@ "devDependencies": { "@nuxtjs/dotenv": "^1.4.1", "@nuxtjs/google-analytics": "^2.2.3", + "@nuxtjs/pwa": "^3.0.0-beta.20", "cypress": "^4.5.0", "eslint": "^6.8.0", "eslint-plugin-vue": "^6.2.2", From 2ffb6d6a9dfad9ab60107a9cf8cd04458619a8cd Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Tue, 12 May 2020 13:29:02 +0530 Subject: [PATCH 6/6] dotenv --- nuxt.config.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nuxt.config.js b/nuxt.config.js index 93cd42e21..32fde3def 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -214,6 +214,16 @@ export default { Allow: "/", 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: { locales: [ {