Skip to content

Commit

Permalink
Fix/ppdsc 2113 prodtealium not being served (#194)
Browse files Browse the repository at this point in the history
* docs(PPDSC-0000): testing permissions

* docs(PPDSC-0000): removing test changed from readme

* fix(PPDSC-2113): testing vars

* fix(PPDSC-2113): updated name

* fix(PPDSC-2113): trying to make test job work

* fix(PPDSC-2113): changing context to test

* fix(PPDSC-2113): remove comments hoping t works

* fix(PPDSC-2113): removed console.log

* fix(PPDSC-2113): removed echo

* fix(PPDSC-2113): testing

* fix(PPDSC-2113): consologging stuff

* fix(PPDSC-2113): debugging

* fix(PPDSC-2113): static to initial props

* fix(PPDSC-2113): nested props into props obj

* fix(PPDSC-2113): to getStaticProps

* fix(PPDSC-2113): console logging stuff

* fix(PPDSC-2113): tealium with props and clog

* fix(PPDSC-2113): removed static props -  get var from process

* fix(PPDSC-2113): cleaned _document file

* fix(PPDSC-2113): added new line

* fix(PPDSC-2113): added back pr env for job

* fix(PPDSC-2113): improved naming var
  • Loading branch information
Vanals authored May 17, 2022
1 parent bbc6b84 commit 0fa4c83
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 28 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -934,9 +934,9 @@ workflows:
pull_request:
when:
matches:
# Supporting Pr branches starting with feat/, docs/, fix/, chore/, style/, refactor/, perf/, test/, etc.
pattern: '^build\/.*|chore\/.*|ci\/.*|docs\/.*|feat\/.*|fix\/.*|improvement\/.*|perf\/.*|refactor\/.*|revert\/.*|style\/.*|test\/.*|^dependabot\/.*'
value: << pipeline.git.branch >>
# Supporting Pr branches starting with feat/, docs/, fix/, chore/, style/, refactor/, perf/, test/, etc.
pattern: '^build\/.*|chore\/.*|ci\/.*|docs\/.*|feat\/.*|fix\/.*|improvement\/.*|perf\/.*|refactor\/.*|revert\/.*|style\/.*|test\/.*|^dependabot\/.*'
value: << pipeline.git.branch >>
jobs:
- install_deps
- install_cypress
Expand Down
29 changes: 4 additions & 25 deletions site/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
/* eslint react/no-array-index-key: 0 */

import * as React from 'react';
import Document, {
Head,
Main,
NextScript,
Html,
DocumentContext,
} from 'next/document';
import Document, {Head, Main, NextScript, Html} from 'next/document';
import {Consent, Global, css, Tealium} from 'newskit';
import Helmet from 'react-helmet';
import {HTMLMeta} from '../components/html-meta';

interface Props {
production: boolean;
productionSiteEnv: boolean;
}

// Is added so relative paths work when we are on a sub dir e.g. s-3.com/ppdsc-123-foo/
const baseHref =
process.env.SITE_ENV && process.env.SITE_ENV === 'pr'
Expand All @@ -25,19 +14,9 @@ const baseHref =

const Base = () => <base href={baseHref} />;

export default class MyDocument extends Document<Props> {
static async getStaticProps(ctx: DocumentContext) {
const {html} = await ctx.renderPage();
return {
html,
// Are we in local dev mode or "built and served"?
production: process.env.NODE_ENV === 'production',
// Are we production "newskit.co.uk" or not?
productionSiteEnv: process.env.SITE_ENV === 'production',
};
}

export default class MyDocument extends Document {
render() {
const isSiteEnvProduction = process.env.SITE_ENV === 'production';
const helmet = Helmet.rewind();
return (
<Html lang="en">
Expand Down Expand Up @@ -257,7 +236,7 @@ export default class MyDocument extends Document<Props> {
<Tealium
accountId="newsinternational"
profileId="thetimes.newskit"
env={this.props.productionSiteEnv ? 'prod' : 'dev'}
env={isSiteEnvProduction ? 'prod' : 'dev'}
/>
<Main />
<NextScript />
Expand Down

0 comments on commit 0fa4c83

Please sign in to comment.