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..32fde3def 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,30 @@ export default { /* ** 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 */ modules: [ - // See https://goo.gl/OOhYW5 - ["@nuxtjs/pwa"], - ["@nuxtjs/axios"], - ["@nuxtjs/toast"], - ["@nuxtjs/google-analytics"], - ["@nuxtjs/sitemap"], - ["@nuxtjs/robots"], - ["nuxt-i18n"], + // Doc: https://axios.nuxtjs.org/usage + "@nuxtjs/axios", + // https://github.com/nuxt-community/modules/tree/master/packages/toast + "@nuxtjs/toast", + // 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: { @@ -188,10 +200,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", @@ -202,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: [ { @@ -297,7 +319,11 @@ export default { /* ** You can extend webpack config here */ - extend(config, ctx) {}, + extend(config, ctx) { + config.node = { + fs: "empty", + } + }, }, /* ** Generate configuration diff --git a/package-lock.json b/package-lock.json index 10d1a34be..40924ae1e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/@nuxtjs/google-analytics/-/google-analytics-2.2.3.tgz", @@ -2235,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", @@ -4678,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", @@ -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": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", @@ -5813,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", @@ -7106,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" } @@ -7438,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" @@ -7449,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 } } }, @@ -8351,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", @@ -9312,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", @@ -9599,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" } @@ -9868,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", @@ -10060,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", @@ -12245,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" } @@ -12252,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", @@ -13002,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", @@ -14459,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" } @@ -14531,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 1359fbd44..a85eed453 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.3.0", "@nuxtjs/toast": "^3.3.0", @@ -53,7 +52,9 @@ "yargs-parser": "^18.1.3" }, "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",