From dbb734ff6408e7198b9484a18d41a0f0ecce60d2 Mon Sep 17 00:00:00 2001 From: Giacomo Debidda Date: Thu, 7 Jul 2022 14:32:59 +0200 Subject: [PATCH] chore(demo-site): lock dependencies --- package-lock.json | 53 +++++++------------------- packages/demo-site/config/eleventy.cjs | 43 +++++++++++++++++---- packages/demo-site/package.json | 4 +- 3 files changed, 51 insertions(+), 49 deletions(-) diff --git a/package-lock.json b/package-lock.json index a482cf52..e30b7f9f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -124,7 +124,6 @@ "version": "0.3.3", "resolved": "https://registry.npmjs.org/@11ty/eleventy-navigation/-/eleventy-navigation-0.3.3.tgz", "integrity": "sha512-O5C/NbDeTBnHQvDYZDr0Va6a7mEzifPUL1XRiqyKIAQqXZJsX/2K13PFLhX7t6kQRT1w6D0TSQyiT8skXbgWKA==", - "dev": true, "dependencies": { "dependency-graph": "^0.11.0" }, @@ -6268,7 +6267,6 @@ "version": "0.2.2", "resolved": "https://registry.npmjs.org/eleventy-plugin-helmet/-/eleventy-plugin-helmet-0.2.2.tgz", "integrity": "sha512-gbRgv1cbj1nJGol/Clc+ZYNuTjusCz1iLyunBZfMMq01rrWpuh/H+72qj6tQT1xmy3woRQIKv9WXDlFyRNOHng==", - "dev": true, "dependencies": { "posthtml": "^0.13.1" }, @@ -15339,7 +15337,6 @@ "version": "0.13.4", "resolved": "https://registry.npmjs.org/posthtml/-/posthtml-0.13.4.tgz", "integrity": "sha512-i2oTo/+dwXGC6zaAQSF6WZEQSbEqu10hsvg01DWzGAfZmy31Iiy9ktPh9nnXDfZiYytjxTIvxoK4TI0uk4QWpw==", - "dev": true, "dependencies": { "posthtml-parser": "^0.5.0", "posthtml-render": "^1.2.3" @@ -15352,7 +15349,6 @@ "version": "0.5.3", "resolved": "https://registry.npmjs.org/posthtml-parser/-/posthtml-parser-0.5.3.tgz", "integrity": "sha512-uHosRn0y+1wbnlYKrqMjBPoo/kK5LPYImLtiETszNFYfFwAD3cQdD1R2E13Mh5icBxkHj+yKtlIHozCsmVWD/Q==", - "dev": true, "dependencies": { "htmlparser2": "^3.9.2" }, @@ -15368,7 +15364,6 @@ "version": "0.2.2", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", "integrity": "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==", - "dev": true, "dependencies": { "domelementtype": "^2.0.1", "entities": "^2.0.0" @@ -15378,7 +15373,6 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", - "dev": true, "funding": [ { "type": "github", @@ -15390,7 +15384,6 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", - "dev": true, "funding": { "url": "https://github.com/fb55/entities?sponsor=1" } @@ -15398,14 +15391,12 @@ "node_modules/posthtml-parser/node_modules/domelementtype": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", - "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", - "dev": true + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==" }, "node_modules/posthtml-parser/node_modules/domhandler": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", - "dev": true, "dependencies": { "domelementtype": "1" } @@ -15414,7 +15405,6 @@ "version": "1.7.0", "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", - "dev": true, "dependencies": { "dom-serializer": "0", "domelementtype": "1" @@ -15423,14 +15413,12 @@ "node_modules/posthtml-parser/node_modules/entities": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", - "dev": true + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" }, "node_modules/posthtml-parser/node_modules/htmlparser2": { "version": "3.10.1", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", - "dev": true, "dependencies": { "domelementtype": "^1.3.1", "domhandler": "^2.3.0", @@ -15444,7 +15432,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/posthtml-render/-/posthtml-render-1.4.0.tgz", "integrity": "sha512-W1779iVHGfq0Fvh2PROhCe2QhB8mEErgqzo1wpIt36tCgChafP+hbXIhLDOM8ePJrZcFs0vkNEtdibEWVqChqw==", - "dev": true, "engines": { "node": ">=10" } @@ -19134,13 +19121,14 @@ "packages/demo-site": { "name": "@jackdbd/demo-site", "version": "0.0.1", - "devDependencies": { + "dependencies": { "@11ty/eleventy": "^1.0.1", "@11ty/eleventy-navigation": "^0.3.3", - "@jackdbd/eleventy-plugin-telegram": "*", - "@jackdbd/eleventy-plugin-text-to-speech": "*", + "@jackdbd/eleventy-plugin-telegram": "1.0.0-alpha.1", + "@jackdbd/eleventy-plugin-text-to-speech": "1.0.0-alpha.2", "eleventy-plugin-helmet": "^0.2.2" }, + "devDependencies": {}, "engines": { "node": ">=16.0.0" } @@ -19166,7 +19154,7 @@ }, "packages/eleventy-plugin-text-to-speech": { "name": "@jackdbd/eleventy-plugin-text-to-speech", - "version": "1.0.0-alpha.1", + "version": "1.0.0-alpha.2", "license": "MIT", "dependencies": { "@google-cloud/storage": "^6.2.2", @@ -19250,7 +19238,6 @@ "version": "0.3.3", "resolved": "https://registry.npmjs.org/@11ty/eleventy-navigation/-/eleventy-navigation-0.3.3.tgz", "integrity": "sha512-O5C/NbDeTBnHQvDYZDr0Va6a7mEzifPUL1XRiqyKIAQqXZJsX/2K13PFLhX7t6kQRT1w6D0TSQyiT8skXbgWKA==", - "dev": true, "requires": { "dependency-graph": "^0.11.0" } @@ -20214,8 +20201,8 @@ "requires": { "@11ty/eleventy": "^1.0.1", "@11ty/eleventy-navigation": "^0.3.3", - "@jackdbd/eleventy-plugin-telegram": "*", - "@jackdbd/eleventy-plugin-text-to-speech": "*", + "@jackdbd/eleventy-plugin-telegram": "1.0.0-alpha.1", + "@jackdbd/eleventy-plugin-text-to-speech": "1.0.0-alpha.2", "eleventy-plugin-helmet": "^0.2.2" } }, @@ -24086,7 +24073,6 @@ "version": "0.2.2", "resolved": "https://registry.npmjs.org/eleventy-plugin-helmet/-/eleventy-plugin-helmet-0.2.2.tgz", "integrity": "sha512-gbRgv1cbj1nJGol/Clc+ZYNuTjusCz1iLyunBZfMMq01rrWpuh/H+72qj6tQT1xmy3woRQIKv9WXDlFyRNOHng==", - "dev": true, "requires": { "posthtml": "^0.13.1" } @@ -30749,7 +30735,6 @@ "version": "0.13.4", "resolved": "https://registry.npmjs.org/posthtml/-/posthtml-0.13.4.tgz", "integrity": "sha512-i2oTo/+dwXGC6zaAQSF6WZEQSbEqu10hsvg01DWzGAfZmy31Iiy9ktPh9nnXDfZiYytjxTIvxoK4TI0uk4QWpw==", - "dev": true, "requires": { "posthtml-parser": "^0.5.0", "posthtml-render": "^1.2.3" @@ -30759,7 +30744,6 @@ "version": "0.5.3", "resolved": "https://registry.npmjs.org/posthtml-parser/-/posthtml-parser-0.5.3.tgz", "integrity": "sha512-uHosRn0y+1wbnlYKrqMjBPoo/kK5LPYImLtiETszNFYfFwAD3cQdD1R2E13Mh5icBxkHj+yKtlIHozCsmVWD/Q==", - "dev": true, "requires": { "htmlparser2": "^3.9.2" }, @@ -30768,7 +30752,6 @@ "version": "0.2.2", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", "integrity": "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==", - "dev": true, "requires": { "domelementtype": "^2.0.1", "entities": "^2.0.0" @@ -30777,28 +30760,24 @@ "domelementtype": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", - "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", - "dev": true + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==" }, "entities": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", - "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", - "dev": true + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==" } } }, "domelementtype": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", - "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", - "dev": true + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==" }, "domhandler": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", - "dev": true, "requires": { "domelementtype": "1" } @@ -30807,7 +30786,6 @@ "version": "1.7.0", "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", - "dev": true, "requires": { "dom-serializer": "0", "domelementtype": "1" @@ -30816,14 +30794,12 @@ "entities": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", - "dev": true + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" }, "htmlparser2": { "version": "3.10.1", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", - "dev": true, "requires": { "domelementtype": "^1.3.1", "domhandler": "^2.3.0", @@ -30838,8 +30814,7 @@ "posthtml-render": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/posthtml-render/-/posthtml-render-1.4.0.tgz", - "integrity": "sha512-W1779iVHGfq0Fvh2PROhCe2QhB8mEErgqzo1wpIt36tCgChafP+hbXIhLDOM8ePJrZcFs0vkNEtdibEWVqChqw==", - "dev": true + "integrity": "sha512-W1779iVHGfq0Fvh2PROhCe2QhB8mEErgqzo1wpIt36tCgChafP+hbXIhLDOM8ePJrZcFs0vkNEtdibEWVqChqw==" }, "prelude-ls": { "version": "1.2.1", diff --git a/packages/demo-site/config/eleventy.cjs b/packages/demo-site/config/eleventy.cjs index a25b6443..322652df 100644 --- a/packages/demo-site/config/eleventy.cjs +++ b/packages/demo-site/config/eleventy.cjs @@ -1,4 +1,5 @@ -// const path = require('node:path') +const fs = require('node:fs') +const path = require('node:path') const slugify = require('slugify') const navigation = require('@11ty/eleventy-navigation') const { telegramPlugin } = require('@jackdbd/eleventy-plugin-telegram') @@ -8,8 +9,6 @@ const { const helmet = require('eleventy-plugin-helmet') const shortcodes = require('../src/shortcodes') -const isProduction = () => process.env.NODE_ENV === 'production' - // add a dev server as soon as it is available in Eleventy 2.0 // https://www.11ty.dev/docs/watch-serve/ @@ -54,21 +53,49 @@ module.exports = function (eleventyConfig) { textAfterBuild: `demo-site build FINISHED` }) - // const ELEVENTY_ENV = process.env.ELEVENTY_ENV + // https://developers.cloudflare.com/pages/platform/build-configuration/#environment-variables + console.log('=== ENVIRONMENT ===', { + CF_PAGES: process.env.CF_PAGES, + CF_PAGES_BRANCH: process.env.CF_PAGES_BRANCH, + CF_PAGES_COMMIT_SHA: process.env.CF_PAGES_COMMIT_SHA, + CF_PAGES_URL: process.env.CF_PAGES_URL, + ELEVENTY_ENV: process.env.ELEVENTY_ENV, + NODE_ENV: process.env.NODE_ENV + }) + + let keyFilename + if (process.env.CF_PAGES) { + keyFilename = 'sa-storage-uploader.json' + // on Cloudflare Pages, GOOGLE_APPLICATION_CREDENTIALS is a JSON string, so + // we need to write it to a file. I think this works automatically on GitHub + // actions (using a GitHub secret), but I tried and it seems it is not + // working automatically on Cloudflare Pages. + fs.writeFile( + keyFilename, + process.env.GOOGLE_APPLICATION_CREDENTIALS, + (err) => { + if (err) { + console.log(`=== ERROR ===${err.message}`) + } + } + ) + } else { + // on my laptop, GOOGLE_APPLICATION_CREDENTIALS is a filepath + keyFilename = process.env.GOOGLE_APPLICATION_CREDENTIALS + } - const audioHost = isProduction() - ? 'https://undici.pages.dev' + const audioHost = process.env.CF_PAGES_URL + ? process.env.CF_PAGES_URL : 'http://localhost:8090' eleventyConfig.addPlugin(textToSpeechPlugin, { audioAssetsDir: 'assets/audio', audioEncoding: 'MP3', - // audioEncoding: 'LINEAR16', audioHost, cloudStorageBucket: 'bkt-eleventy-plugin-text-to-speech-audio-files', cssSelector: 'div.audio-demos', // regexPattern: '.*/posts/.*.html$', - keyFilename: process.env.GOOGLE_APPLICATION_CREDENTIALS, + keyFilename, voice: { languageCode: 'en-GB', name: 'en-GB-Wavenet-C' } }) diff --git a/packages/demo-site/package.json b/packages/demo-site/package.json index 83a01d66..0fe9ee80 100644 --- a/packages/demo-site/package.json +++ b/packages/demo-site/package.json @@ -31,8 +31,8 @@ "dependencies": { "@11ty/eleventy": "^1.0.1", "@11ty/eleventy-navigation": "^0.3.3", - "@jackdbd/eleventy-plugin-telegram": "*", - "@jackdbd/eleventy-plugin-text-to-speech": "*", + "@jackdbd/eleventy-plugin-telegram": "1.0.0-alpha.1", + "@jackdbd/eleventy-plugin-text-to-speech": "1.0.0-alpha.2", "eleventy-plugin-helmet": "^0.2.2" }, "peerDependencies": {},