From 713c2b800a106f59463faf6fc7dac31abf856088 Mon Sep 17 00:00:00 2001 From: Illia Kovalenko <23364749+illiakovalenko@users.noreply.github.com> Date: Tue, 13 Aug 2024 08:21:49 +0300 Subject: [PATCH] [Angular] Adjust config generation messages order (#1885) --- CHANGELOG.md | 4 ++-- .../templates/angular/scripts/generate-config.ts | 14 +++++++++++--- .../scripts/update-graphql-fragment-data.ts | 3 +-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67f4473e69..0851fa42c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,12 +19,12 @@ Our versioning strategy is as follows: * `[create-sitecore-jss]` Introduced "node-xmcloud-proxy" addon ([#1863](https://github.com/Sitecore/jss/pull/1863)) * `[create-sitecore-jss]` `[template/angular]` `[template/angular-sxp]` `[template/angular-xmcloud]` Introduced "angular-sxp", "angular-xmcloud" addons ([#1838](https://github.com/Sitecore/jss/pull/1838))([#1845](https://github.com/Sitecore/jss/pull/1845))([#1858](https://github.com/Sitecore/jss/pull/1858))([#1865](https://github.com/Sitecore/jss/pull/1865)): - * The Angular app should now be initialized by providing both templates (or using CLI prompts): + * The Angular app should now be initialized by providing both templates (or using CLI prompts): * SXP-based: 'angular,angular-sxp' * XMCloud-based: 'angular,angular-xmcloud' * Rework Angular initializer to support XMCloud and SXP journeys; * Add SXA styles to xmcloud addon -* `[create-sitecore-jss]` `[template/angular]` `[template/angular-xmcloud]` `[template/node-xmcloud-proxy]` Edge Proxy / Context Id support ([#1875](https://github.com/Sitecore/jss/pull/1875)) +* `[create-sitecore-jss]` `[template/angular]` `[template/angular-xmcloud]` `[template/node-xmcloud-proxy]` Edge Proxy / Context Id support ([#1875](https://github.com/Sitecore/jss/pull/1875))([#1885](https://github.com/Sitecore/jss/pull/1885)) * `[create-sitecore-jss]` Rework Angular initializer to support XMCloud and SXP journeys ([#1845](https://github.com/Sitecore/jss/pull/1845))([#1858](https://github.com/Sitecore/jss/pull/1858))([#1868](https://github.com/Sitecore/jss/pull/1868))([#1881](https://github.com/Sitecore/jss/pull/1881))([#1882](https://github.com/Sitecore/jss/pull/1882)) * `[create-sitecore-jss]` Allow node-xmcloud-proxy app to be installed alongside Angular SPA application diff --git a/packages/create-sitecore-jss/src/templates/angular/scripts/generate-config.ts b/packages/create-sitecore-jss/src/templates/angular/scripts/generate-config.ts index b0f75cfa8e..390129c3c7 100644 --- a/packages/create-sitecore-jss/src/templates/angular/scripts/generate-config.ts +++ b/packages/create-sitecore-jss/src/templates/angular/scripts/generate-config.ts @@ -24,8 +24,16 @@ const defaultConfigValue: JssConfig = { defaultServerRoute: '/', }; -generateConfig('src/environments/environment.js', defaultConfigValue, { production: false }); -generateConfig('src/environments/environment.prod.js', defaultConfigValue, { production: true }); +async function main() { + await generateConfig('src/environments/environment.js', defaultConfigValue, { + production: false, + }); + await generateConfig('src/environments/environment.prod.js', defaultConfigValue, { + production: true, + }); +} + +main(); /** * Generates the JSS config based on config plugins (under ./config/plugins) @@ -47,7 +55,7 @@ export function generateConfig( }; }, {}); - jssConfigFactory + return jssConfigFactory .create(defaultConfig) .then((config) => { writeConfig(Object.assign(config, configOverrides), outputPath); diff --git a/packages/create-sitecore-jss/src/templates/angular/scripts/update-graphql-fragment-data.ts b/packages/create-sitecore-jss/src/templates/angular/scripts/update-graphql-fragment-data.ts index 00791acd00..17076cc8a5 100644 --- a/packages/create-sitecore-jss/src/templates/angular/scripts/update-graphql-fragment-data.ts +++ b/packages/create-sitecore-jss/src/templates/angular/scripts/update-graphql-fragment-data.ts @@ -1,5 +1,4 @@ import * as fs from 'fs'; -import { generateConfig } from './generate-config'; import clientFactory from 'lib/graphql-client-factory'; import { getGraphQLClientFactoryConfig } from 'lib/graphql-client-factory/config'; @@ -10,7 +9,7 @@ import { getGraphQLClientFactoryConfig } from 'lib/graphql-client-factory/config // // The `jss graphql:update` command should be executed when Sitecore templates related to the site are altered. -generateConfig('src/environments/environment.js'); +import './generate-config'; const clientFactoryConfig = getGraphQLClientFactoryConfig();