From 98bc213ac4fb4b6e1132f5b1b7c62c42368d944b Mon Sep 17 00:00:00 2001 From: Dylan Kelly Date: Tue, 18 Jul 2023 18:31:21 +1000 Subject: [PATCH] feat(@dpc-sdp/nuxt-ripple-cli): :sparkles: add ability to set .env values from cli --- .../commands/init/_templates/site/latest/env.t | 7 +++++-- .../init/_templates/site/latest/nuxt.config.ts.t | 16 +--------------- .../commands/init/_templates/site/latest/nvmrc.t | 3 +-- .../nuxt-ripple-cli/src/commands/init/index.ts | 6 ++++++ 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/packages/nuxt-ripple-cli/src/commands/init/_templates/site/latest/env.t b/packages/nuxt-ripple-cli/src/commands/init/_templates/site/latest/env.t index 8c0bd12cb6..0e8c34902b 100644 --- a/packages/nuxt-ripple-cli/src/commands/init/_templates/site/latest/env.t +++ b/packages/nuxt-ripple-cli/src/commands/init/_templates/site/latest/env.t @@ -1,10 +1,13 @@ --- to: .env --- +# The values in this file are FOR DEVELOPMENT ONLY - none of these values are read in the production build! +# If your site needs a new environment variable please log an issue with SDP support so it can be added via the config management database + # Tide Drupal CMS URL - change this to the project CMS as required -NUXT_PUBLIC_TIDE_BASE_URL=https://develop.content.reference.sdp.vic.gov.au/ +NUXT_PUBLIC_TIDE_BASE_URL=<%= tideBaseUrl %> # Tide site taxonomy id - change this to the project site ID as required -NUXT_PUBLIC_TIDE_SITE=8888 +NUXT_PUBLIC_TIDE_SITE=<%= tideSite %> # SDP common GTM container - this should be common to all SDP sites utilising WoVG analytics NUXT_PUBLIC_TIDE_ANALYTICS_GTM=G-J386JGDPXW # Production site URL (used for OAuth and logging) - this should be the production url eg: https://www.YOURPROJECT.vic.gov.au/ diff --git a/packages/nuxt-ripple-cli/src/commands/init/_templates/site/latest/nuxt.config.ts.t b/packages/nuxt-ripple-cli/src/commands/init/_templates/site/latest/nuxt.config.ts.t index 8631d29a61..97884437d0 100644 --- a/packages/nuxt-ripple-cli/src/commands/init/_templates/site/latest/nuxt.config.ts.t +++ b/packages/nuxt-ripple-cli/src/commands/init/_templates/site/latest/nuxt.config.ts.t @@ -2,21 +2,7 @@ to: nuxt.config.ts --- export default defineNuxtConfig({ - // These can be overridden via environment variables eg: NUXT_PUBLIC_TIDE_BASE_URL - // Check the layer readme files for the available runtimeConfig options - // See https://nuxt.com/docs/api/configuration/nuxt-config#runtimeconfig for more info - runtimeConfig: { - public: { - siteUrl: '', - apiUrl: '', - tide: { - baseUrl: '', - site: '', - menuEndpoint: '' - } - } - }, - // See https://nuxt.com/docs/getting-started/layers - each content type is added as a Nuxt layer + // See https://nuxt.com/docs/getting-started/layers - please add custom layers after the //custom layers comment extends: [ // Core layers '@dpc-sdp/nuxt-ripple', diff --git a/packages/nuxt-ripple-cli/src/commands/init/_templates/site/latest/nvmrc.t b/packages/nuxt-ripple-cli/src/commands/init/_templates/site/latest/nvmrc.t index 8c176550ca..1a9be571da 100644 --- a/packages/nuxt-ripple-cli/src/commands/init/_templates/site/latest/nvmrc.t +++ b/packages/nuxt-ripple-cli/src/commands/init/_templates/site/latest/nvmrc.t @@ -1,5 +1,4 @@ --- to: .nvmrc --- - -lts/gallium +lts/hydrogen diff --git a/packages/nuxt-ripple-cli/src/commands/init/index.ts b/packages/nuxt-ripple-cli/src/commands/init/index.ts index aec767838d..6847c50762 100644 --- a/packages/nuxt-ripple-cli/src/commands/init/index.ts +++ b/packages/nuxt-ripple-cli/src/commands/init/index.ts @@ -23,6 +23,12 @@ export default function rplInitCommand() { `The ripple version to use: eg: 2.1.0, default is most up to date version`, LIB_VERSION ) + .option('--tideSite [tideSite]', `Tide Site ID, defaults to 4`, '4') + .option( + '--tideBaseUrl [tideBaseUrl]', + `Tide base URL for .env. Defaults to reference site backend`, + 'https://develop.content.reference.sdp.vic.gov.au/' + ) .action((template, directory, options) => { init(template, directory, options) console.info(`