@financial-times/n-conversion-forms 30.0.1 → 31.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/.circleci/config.yml +97 -150
  2. package/.toolkitrc.yml +19 -0
  3. package/.toolkitstate/ci.json +6 -0
  4. package/README.md +2 -2
  5. package/components/__snapshots__/package-change.spec.js.snap +15 -0
  6. package/components/accept-terms-subscription.jsx +50 -0
  7. package/components/index.jsx +1 -0
  8. package/components/package-change.jsx +13 -9
  9. package/components/package-change.spec.js +17 -0
  10. package/components/package-change.stories.js +8 -0
  11. package/components/payment-term.jsx +51 -14
  12. package/components/payment-term.spec.js +47 -0
  13. package/components/payment-term.stories.js +20 -0
  14. package/components/seven-day-pass-experiment-confirmation.jsx +110 -0
  15. package/components/seven-day-pass-experiment-confirmation.stories.js +33 -0
  16. package/jest.config.js +2 -0
  17. package/package.json +30 -16
  18. package/.circleci/shared-helpers/.github/settings.yml +0 -1
  19. package/.circleci/shared-helpers/CODEOWNERS +0 -3
  20. package/.circleci/shared-helpers/README.md +0 -72
  21. package/.circleci/shared-helpers/helper-check-service-ready +0 -37
  22. package/.circleci/shared-helpers/helper-configure-awscli +0 -20
  23. package/.circleci/shared-helpers/helper-generate-build-state-artifacts +0 -29
  24. package/.circleci/shared-helpers/helper-install-awscli +0 -14
  25. package/.circleci/shared-helpers/helper-install-puppeteer-deps +0 -25
  26. package/.circleci/shared-helpers/helper-npm-install-peer-deps +0 -40
  27. package/.circleci/shared-helpers/helper-npm-store-auth-token +0 -14
  28. package/.circleci/shared-helpers/helper-npm-update +0 -26
  29. package/.circleci/shared-helpers/helper-npm-version-and-publish-public +0 -19
  30. package/.circleci/shared-helpers/helper-publish-github-pages +0 -43
  31. package/.circleci/shared-helpers/helper-setup-heroku-cli +0 -46
  32. package/.circleci/shared-helpers/helper-setup-s3-upload +0 -17
  33. package/.circleci/shared-helpers/helper-upload-assets-to-s3 +0 -69
  34. package/.circleci/shared-helpers/helper.example +0 -13
  35. package/build-state/npm-shrinkwrap.json +0 -58461
  36. package/dist/accept-terms-business.js +0 -74
  37. package/dist/accept-terms-business.spec.js +0 -40
  38. package/dist/accept-terms-privacy-policy.js +0 -71
  39. package/dist/accept-terms-subscription.js +0 -124
  40. package/dist/accept-terms.js +0 -217
  41. package/dist/app-banner.js +0 -51
  42. package/dist/b2c-partnership-confirmation.js +0 -64
  43. package/dist/billing-city.js +0 -58
  44. package/dist/billing-country.js +0 -43
  45. package/dist/billing-postcode.js +0 -76
  46. package/dist/company-name.js +0 -78
  47. package/dist/confirmation.js +0 -117
  48. package/dist/continue-reading.js +0 -45
  49. package/dist/country.js +0 -106
  50. package/dist/customer-care.js +0 -52
  51. package/dist/debug.js +0 -50
  52. package/dist/decision-maker.js +0 -72
  53. package/dist/deferred-billing-terms.js +0 -112
  54. package/dist/delivery-address-map.js +0 -184
  55. package/dist/delivery-address-type.js +0 -74
  56. package/dist/delivery-address.js +0 -123
  57. package/dist/delivery-city.js +0 -70
  58. package/dist/delivery-county.js +0 -48
  59. package/dist/delivery-instructions.js +0 -123
  60. package/dist/delivery-option.js +0 -77
  61. package/dist/delivery-po-box.js +0 -75
  62. package/dist/delivery-postcode.js +0 -116
  63. package/dist/delivery-security-instructions.js +0 -72
  64. package/dist/delivery-start-date.js +0 -77
  65. package/dist/education-job-title.js +0 -67
  66. package/dist/email.js +0 -90
  67. package/dist/error-page.js +0 -45
  68. package/dist/fieldset.js +0 -58
  69. package/dist/first-name.js +0 -73
  70. package/dist/form.js +0 -29
  71. package/dist/google-sign-in.js +0 -24
  72. package/dist/graduation-date.js +0 -112
  73. package/dist/index.js +0 -425
  74. package/dist/industry.js +0 -81
  75. package/dist/job-title.js +0 -65
  76. package/dist/last-name.js +0 -73
  77. package/dist/licence-confirmation.js +0 -67
  78. package/dist/licence-header.js +0 -52
  79. package/dist/licence-sign-in.js +0 -36
  80. package/dist/licence-title.js +0 -46
  81. package/dist/lite-sub-confirmation.js +0 -118
  82. package/dist/loader.js +0 -54
  83. package/dist/message.js +0 -101
  84. package/dist/message.spec.js +0 -96
  85. package/dist/organisation.js +0 -73
  86. package/dist/package-change.js +0 -36
  87. package/dist/password.js +0 -95
  88. package/dist/payment-term.js +0 -300
  89. package/dist/payment-type.js +0 -213
  90. package/dist/personal-title.js +0 -94
  91. package/dist/phone.js +0 -85
  92. package/dist/position.js +0 -86
  93. package/dist/progress-indicator.js +0 -66
  94. package/dist/province.js +0 -80
  95. package/dist/registration-confirmation.js +0 -108
  96. package/dist/responsibility.js +0 -84
  97. package/dist/section.js +0 -20
  98. package/dist/state.js +0 -80
  99. package/dist/submit.js +0 -52
  100. package/dist/text-input.js +0 -78
  101. package/dist/trial-banner.js +0 -29
@@ -0,0 +1,110 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ const DetailsMobileView = ({ details }) => (
5
+ <dl className="ncf__list ncf__lite-sub__details ncf__lite-sub-confirmation--hidden-md ncf__lite-sub-confirmation--hidden-lg">
6
+ {details.map((detail, index) => (
7
+ <React.Fragment key={index}>
8
+ <dt className="ncf__list-title">{detail.title}</dt>
9
+ <dd className="ncf__list-data">{detail.data}</dd>
10
+ </React.Fragment>
11
+ ))}
12
+ </dl>
13
+ );
14
+
15
+ export function SevenDayPassExperimentConfirmation({
16
+ offerName = '',
17
+ details = [],
18
+ }) {
19
+ const detailElements = details && (
20
+ <React.Fragment>
21
+ <h2 className="ncf__header2--afterline">Your billing details</h2>
22
+ <dl className="ncf__list ncf__lite-sub-confirmation--hidden-sm">
23
+ {details.map((detail, index) => (
24
+ <React.Fragment key={index}>
25
+ <dt className="ncf__list-title">{detail.title}</dt>
26
+ <dd className="ncf__list-data">{detail.data}</dd>
27
+ </React.Fragment>
28
+ ))}
29
+ </dl>
30
+ <DetailsMobileView details={details} />
31
+ </React.Fragment>
32
+ );
33
+
34
+ return (
35
+ <div className="ncf ncf__wrapper">
36
+ <div className="ncf__center">
37
+ <div className="ncf__icon ncf__icon--tick ncf__icon--large"></div>
38
+ <p className="ncf__paragraph--reduced-padding ncf__paragraph--subscription-confirmation">
39
+ You are now subscribed to:
40
+ </p>
41
+ <h1 className="ncf__header ncf__header--confirmation">
42
+ {'Premium Digital'}
43
+ </h1>
44
+ </div>
45
+ <p className="ncf__paragraph">
46
+ Exciting news! You are one of the first to try a{' '}
47
+ <strong>{offerName}</strong>. As a thank you, we are pleased to extend
48
+ your subscription to one month at no additional cost.
49
+ </p>
50
+ <p className="ncf__center">
51
+ <a
52
+ href="/"
53
+ className="ncf__button ncf__button--submit ncf__button--margin ncf__lite-sub-confirmation--lite-sub-cta"
54
+ >
55
+ Go to FT.com
56
+ </a>
57
+ </p>
58
+ <p className="ncf__paragraph">
59
+ Please save or print this page for your records as your purchase
60
+ confirmation.
61
+ </p>
62
+
63
+ <p className="ncf__paragraph">
64
+ Here&apos;s a summary of your Premium Digital subscription:
65
+ </p>
66
+
67
+ {detailElements}
68
+
69
+ <div className="ncf__headed-paragraph">
70
+ <h3 className="ncf__header">Something not right?</h3>
71
+ <p className="ncf__paragraph">
72
+ Go to your{' '}
73
+ <a
74
+ className="ncf__link ncf__link--external"
75
+ href="https://www.ft.com/myaccount/personal-details"
76
+ target="_blank"
77
+ rel="noopener noreferrer"
78
+ data-trackable="yourAccount"
79
+ >
80
+ account settings
81
+ </a>{' '}
82
+ to view or edit your account. If you need to get in touch call us on{' '}
83
+ <a href="tel:+442077556248" className="ncf__link ncf__link--external">
84
+ +44 20 7755 6248
85
+ </a>
86
+ . Or{' '}
87
+ <a
88
+ className="ncf__link ncf__link--external"
89
+ href="https://help.ft.com/contact/"
90
+ target="_blank"
91
+ rel="noopener noreferrer"
92
+ >
93
+ contact us
94
+ </a>{' '}
95
+ for additional support.
96
+ </p>
97
+ </div>
98
+ </div>
99
+ );
100
+ }
101
+
102
+ SevenDayPassExperimentConfirmation.propTypes = {
103
+ offerName: PropTypes.string.isRequired,
104
+ details: PropTypes.arrayOf(
105
+ PropTypes.shape({
106
+ title: PropTypes.string.isRequired,
107
+ data: PropTypes.string.isRequired,
108
+ })
109
+ ),
110
+ };
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { SevenDayPassExperimentConfirmation } from './seven-day-pass-experiment-confirmation';
3
+
4
+ export default {
5
+ title: '7-day pass experiment confirmation',
6
+ component: SevenDayPassExperimentConfirmation,
7
+ argTypes: {
8
+ details: { control: 'array' },
9
+ offerType: { control: 'string' },
10
+ offerName: { control: 'string' },
11
+ },
12
+ };
13
+
14
+ export const Basic = (args) => <SevenDayPassExperimentConfirmation {...args} />;
15
+ Basic.args = {
16
+ offerType: 'Premium',
17
+ details: [
18
+ {
19
+ title: 'End Date',
20
+ data: 'September 18, 2023',
21
+ },
22
+ {
23
+ title: 'One-time payment',
24
+ data: '£1.99',
25
+ },
26
+ {
27
+ title: 'Payment method',
28
+ data: 'Credit / Debit Card',
29
+ },
30
+ ],
31
+ offerName: '7-day pass',
32
+ subscriptionAmount: '£1.99',
33
+ };
package/jest.config.js CHANGED
@@ -1,4 +1,5 @@
1
1
  module.exports = {
2
+ maxWorkers: 2,
2
3
  testPathIgnorePatterns: ['/node_modules/', '/cypress/', '/test/'],
3
4
  transform: {
4
5
  '.(js|jsx)': '@sucrase/jest-plugin',
@@ -12,4 +13,5 @@ module.exports = {
12
13
  setupFilesAfterEnv: ['<rootDir>/test-jest/helpers/setup.js'],
13
14
  resolver: '@financial-times/jest-browser-resolver',
14
15
  transformIgnorePatterns: ['/node_modules//(?!(@financial-times)/)'],
16
+ testEnvironment: 'jsdom',
15
17
  };
package/package.json CHANGED
@@ -1,14 +1,17 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "30.0.1",
3
+ "version": "0.0.0",
4
4
  "description": "Containing jsx components and styles for forms included on Accounts and Acqusition apps (next-signup, next-profile, next-retention, etc).",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
8
- "build": "babel components/*.jsx -d dist --copy-files",
7
+ "heroku-postbuild": "dotcom-tool-kit build:remote release:remote cleanup:remote",
9
8
  "prepare": "snyk-protect || snyk-protect -d || true",
10
- "storybook": "start-storybook -p 5005",
11
- "build-storybook": "build-storybook --docs --output-dir docs",
9
+ "build": "dotcom-tool-kit build:local",
10
+ "test": "dotcom-tool-kit test:local",
11
+ "start": "dotcom-tool-kit run:local",
12
+ "format": "dotcom-tool-kit format:local",
13
+ "storybook": "NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 5005",
14
+ "build-storybook": "NODE_OPTIONS=--openssl-legacy-provider build-storybook --docs --output-dir docs",
12
15
  "lint": "eslint . --ext .jsx,.js",
13
16
  "lint-fix": "eslint . --ext .jsx,.js --fix",
14
17
  "prettier": "prettier --write '**/*.{js,jsx,json,scss}'"
@@ -37,26 +40,36 @@
37
40
  "@babel/plugin-transform-runtime": "^7.11.0",
38
41
  "@babel/preset-env": "^7.11.0",
39
42
  "@babel/preset-react": "^7.10.4",
43
+ "@dotcom-tool-kit/component": "^3.1.8",
44
+ "@dotcom-tool-kit/eslint": "^3.1.3",
45
+ "@dotcom-tool-kit/frontend-app": "^3.1.9",
46
+ "@dotcom-tool-kit/jest": "^3.2.0",
47
+ "@dotcom-tool-kit/lint-staged": "^4.1.3",
48
+ "@dotcom-tool-kit/prettier": "^3.1.3",
49
+ "@dotcom-tool-kit/webpack": "^3.1.4",
40
50
  "@financial-times/eslint-config-next": "^6.0.0",
41
51
  "@financial-times/jest-browser-resolver": "^1.0.2",
42
- "@financial-times/n-gage": "^9.0.1",
52
+ "@snyk/protect": "1.1193.0",
43
53
  "@storybook/addon-a11y": "^6.5.13",
44
54
  "@storybook/addon-essentials": "6.5.13",
45
55
  "@storybook/react": "^6.5.13",
46
- "@snyk/protect": "1.1193.0",
47
- "@sucrase/jest-plugin": "^2.0.0",
56
+ "@sucrase/jest-plugin": "^3.0.0",
48
57
  "check-engines": "^1.5.0",
58
+ "dotcom-tool-kit": "^3.2.1",
49
59
  "enzyme": "^3.11.0",
50
60
  "enzyme-adapter-react-16": "^1.15.7",
51
61
  "eslint": "^8.28.0",
52
62
  "eslint-config-prettier": "^8.5.0",
53
- "eslint-plugin-jest": "^27.1.6",
63
+ "eslint-plugin-jest": "^27.2.3",
54
64
  "eslint-plugin-prettier": "^4.2.1",
55
65
  "eslint-plugin-react": "^7.31.1",
56
66
  "fetch-mock": "^7.2.0",
57
- "jest": "^26.0.0",
58
- "jest-serializer-html": "^7.0.0",
59
- "jsdom": "16.5.0",
67
+ "html-webpack-plugin": "^5.5.3",
68
+ "jest": "^29.6.4",
69
+ "jest-environment-jsdom": "^29.6.4",
70
+ "jest-serializer-html": "^7.1.0",
71
+ "jsdom": "^22.1.0",
72
+ "jsdom-global": "^3.0.2",
60
73
  "lint-staged": "^13.0.4",
61
74
  "pa11y-ci": "2.4.2",
62
75
  "prettier": "^2.4.1",
@@ -66,7 +79,9 @@
66
79
  "react-dom": "16.14.0",
67
80
  "react-is": "^16.13.1",
68
81
  "sass": "^1.55.0",
69
- "sass-loader": "^10.2.1"
82
+ "sass-loader": "^10.2.1",
83
+ "webpack": "^5.88.2",
84
+ "webpack-cli": "^5.1.4"
70
85
  },
71
86
  "engines": {
72
87
  "node": "16.x || 18.x",
@@ -78,9 +93,8 @@
78
93
  },
79
94
  "husky": {
80
95
  "hooks": {
81
- "commit-msg": "node_modules/.bin/secret-squirrel-commitmsg",
82
- "pre-commit": "node_modules/.bin/secret-squirrel && pretty-quick --staged && npm run lint",
83
- "pre-push": "pretty-quick --staged && make test"
96
+ "commit-msg": "dotcom-tool-kit git:commitmsg",
97
+ "pre-commit": "pretty-quick --staged && dotcom-tool-kit git:precommit"
84
98
  }
85
99
  },
86
100
  "peerDependencies": {
@@ -1 +0,0 @@
1
- _extends: github-apps-config-next
@@ -1,3 +0,0 @@
1
- # See https://help.github.com/articles/about-codeowners/ for more information about this file.
2
-
3
- * @financial-times/platforms
@@ -1,72 +0,0 @@
1
- # Next CI Helper Scripts [![CircleCI](https://circleci.com/gh/Financial-Times/next-ci-shared-helpers.svg?style=svg&circle-token=33bcf2eb98fe2e875cc66de93d7e4a50369c952d)](https://github.com/Financial-Times/next-ci-shared-helpers)
2
-
3
- This repo contains a set of common bash scripts to be used in the delivery pipeline.
4
-
5
-
6
- ## Installation
7
-
8
- ```sh
9
- git clone git@github.com:Financial-Times/next-ci-shared-helpers.git
10
- cd next-ci-shared-helpers
11
- ```
12
-
13
-
14
- ## Development
15
-
16
- ### Working locally
17
-
18
- Many of the scripts require a Unix environment so in order to run existing scripts you'll need to be familiar with [Docker](https://www.docker.com/get-started).
19
-
20
- The first step is to [install docker](https://www.docker.com/get-started) and once you're up and running you'll be able to run the scripts locally inside a Docker container.
21
-
22
- For example, the following command will run the `helper-install-awscli` script inside the container (this will output many logs but if it has worked correctly the last line on the console should read `Setting up awscli (1.11.13-1) ...`.
23
-
24
- ```shell
25
- docker run --rm -it -w /tmp --mount type=bind,source="$(pwd)",destination=/tmp circleci/node:12.18-browsers ./helper-install-awscli
26
- ```
27
-
28
- The command in the example can be largely re-used by simply changing the Docker image and script to run:
29
-
30
- ```shell
31
- docker run --rm -it -w /tmp --mount type=bind,source="$(pwd)",destination=/tmp DOCKER_IMAGE_NAME ./SCRIPT_TO_RUN
32
- ```
33
-
34
-
35
- ### Usage
36
-
37
- To make use of this package in your CircleCI deployment pipeline, firstly create a new `step` and clone the package:
38
-
39
- ```yaml
40
- - run:
41
- name: Checkout next-ci-shared-helpers
42
- command: git clone --depth 1 git@github.com:Financial-Times/next-ci-shared-helpers.git .circleci/shared-helpers
43
- ```
44
-
45
- _The convention across all FT repos is to put the helpers inside the `.circleci/shared-helpers` folder._
46
-
47
- Then add another step after it to run one of the scripts:
48
-
49
- ```yaml
50
- - run:
51
- name: shared-helper / npm-install-peer-deps
52
- command: .circleci/shared-helpers/helper-npm-install-peer-deps
53
- ```
54
-
55
- _The convention across all FT repos is to name the step as follows: `shared-helper / NAME_OF_SCRIPT`._
56
-
57
- ### General guidelines for helper scripts
58
-
59
- - Copy `helper.example` as a starting point
60
- - Avoid being "clever" - developers shouldn't require knowledge of obscure bash syntax to understand the helper scripts that you write
61
- - Comment liberally - help others (and your future self) understand *why* the helper script is doing the things it's doing
62
- - Include links to any relevant documentation in your comments
63
- - Try and avoid noisy output - it's hard to debug CI builds or understand what has happened if there are lots of unnecessary messages in the shell output
64
- - Echo out useful messages about progress and actions taken by the script - the flip side of avoiding noisy output: humans want to know what's happening/happened with their build
65
- - Remember to make your script executable by running the command `chmod +x ./<NAME_OF_SCRIPT>`
66
-
67
- ### Naming guidelines
68
-
69
- The filename of a helper script should give a clear indication of what it does:
70
-
71
- - ❌ `helper-test`
72
- - ✅ `helper-run-mocha-tests`
@@ -1,37 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # HELPER PURPOSE
4
- #
5
- # Checks availability of service containers
6
-
7
- # Set error handling
8
- set -eu -o pipefail
9
-
10
- DOCKERIZE_VERSION=v0.3.0
11
-
12
- if hash wget 2>/dev/null; then
13
- wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz;
14
- elif hash curl 2>/dev/null; then
15
- curl -XGET -L https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz --output dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz;
16
- else
17
- echo 'wget or curl are required to run helper-check-service-ready'
18
- exit 1
19
- fi
20
- mkdir -p ~/tmp
21
- tar -C ~/tmp -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
22
- rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
23
-
24
- for var in "$@"
25
- do
26
- case $var in
27
- redis)
28
- ~/tmp/dockerize -wait tcp://localhost:6379 -timeout 1m
29
- ;;
30
- neo4j)
31
- ~/tmp/dockerize -wait tcp://localhost:7687 -timeout 1m
32
- ;;
33
- mongo)
34
- ~/tmp/dockerize -wait tcp://localhost:27017 -timeout 1m
35
- ;;
36
- esac
37
- done
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # HELPER PURPOSE
4
- #
5
- # Configures the awscli tool with aws authentication keys
6
- #
7
-
8
- # Set error handling
9
- set -eu -o pipefail
10
-
11
- # HELPER COMMANDS
12
-
13
- # provide keys as arguments when invoking the helper
14
- access_key_id="$1"
15
- secret_access_key="$2"
16
-
17
- # write the auth keys to .aws/credentials
18
- aws configure set aws_access_key_id "$access_key_id"
19
- aws configure set aws_secret_access_key "$secret_access_key"
20
-
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # HELPER PURPOSE
4
- #
5
- # Generate artifacts that represent the state of
6
- # the build and can be used after the build has
7
- # run to aid with debugging
8
- #
9
-
10
- # Set error handling
11
- set -eu -o pipefail
12
-
13
- # HELPER COMMANDS
14
-
15
- BUILD_STATE_DIR_PATH="build-state/"
16
-
17
- mkdir -p "${BUILD_STATE_DIR_PATH}";
18
-
19
- echo -e ">> You can find all build-state artifacts under the 'Artifacts' tab for this build\n";
20
-
21
- # artifact: npm-shrinkwrap.json
22
- npm shrinkwrap --loglevel=warn && mv npm-shrinkwrap.json "${BUILD_STATE_DIR_PATH}";
23
- echo ">> artifact: npm-shrinkwrap.json generated, saved";
24
-
25
- # artifact: npm-debug.log
26
- if [ -e npm-debug.log ]; then
27
- mv npm-debug.log "${BUILD_STATE_DIR_PATH}";
28
- echo ">> artifact: npm-debug.log exists, saved";
29
- fi
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # HELPER PURPOSE
4
- #
5
- # Installs the awscli tool
6
- #
7
-
8
- # Set error handling
9
- set -eu -o pipefail
10
-
11
- # HELPER COMMANDS
12
-
13
- # install the awscli
14
- sudo apt-get install awscli
@@ -1,25 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # HELPER PURPOSE
4
- #
5
- # Required for pupeteer on docker based CI
6
- # https://github.com/GoogleChrome/puppeteer/issues/290
7
-
8
- # Set error handling
9
- set -eu -o pipefail
10
-
11
- # HELPER COMMANDS
12
-
13
- sudo apt-get update
14
-
15
- sudo apt-get install -yq \
16
- gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \
17
- libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 \
18
- libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 \
19
- libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
20
- libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 \
21
- libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates \
22
- fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
23
-
24
- # This is used in the request to the Change API made after deployments
25
- sudo apt-get install -yq jq
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # HELPER PURPOSE
4
-
5
- # Workaround for a bug in npm where it doesn't correctly
6
- # resolve conflicting peer dependencies.
7
- #
8
- # Parses errors for missing peer dependencies from
9
- # the output of `npm ls` and then pipes the package
10
- # names to `npm install`.
11
- #
12
- # Why we pass the flags we do to `npm install`:
13
- #
14
- # --no-package-lock - While we now use package-lock.json
15
- # in our repos, skip package-lock.json in this instance
16
- # as we don't want to accidentally modify the file
17
- # for subsequent steps in the workflow, e.g cache keys
18
- # and artefact generation.
19
- #
20
- # --no-save - We don't want to modify package.json as we
21
- # use its checksum for some CI tasks e.g. naming node_module caches
22
- #
23
-
24
- # Set error handling
25
- #
26
- # Do *not* set `-o pipefail` as `npm ls --production --parseable`
27
- # will have an exit code of 1 when there are missing peer
28
- # dependencies, but that's what we're expecting to happen
29
- set -eu
30
-
31
- # HELPER COMMANDS
32
-
33
- if [ -e package.json ]; then
34
-
35
- npm ls --production --parseable 2>&1 >/dev/null | \
36
- sed -n -e 's/^npm ERR! peer dep missing: \(.*\),.*/\1/p' | \
37
- xargs -I{} echo -n '"{}" ' | \
38
- xargs npm install --no-package-lock --no-save
39
-
40
- fi
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # HELPER PURPOSE
4
- #
5
- # Store npmjs registry auth token so npm can authenticate with it
6
- # e.g. for `npm publish` (see `helper-npm-publish`)
7
- #
8
-
9
- # Set error handling
10
- set -eu -o pipefail
11
-
12
- # HELPER COMMANDS
13
-
14
- echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > ${HOME}/.npmrc
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # HELPER PURPOSE
4
- #
5
- # Run npm update to ensure npm packages in node_modules are the latest.
6
- #
7
- # Why we pass the flags we do to `npm update`:
8
- #
9
- # --dev - Also update devDependencies
10
- #
11
- # --no-package-lock - While we now use package-lock.json
12
- # in our repos, skip package-lock.json in this instance
13
- # as we don't want to accidentally modify the file
14
- # for subsequent steps in the workflow, e.g cache keys
15
- # and artefact generation.
16
- #
17
- # --no-save - We don't want to modify package.json as we
18
- # use its checksum for some CI tasks e.g. naming node_module caches
19
- #
20
-
21
- # Set error handling
22
- set -eu -o pipefail
23
-
24
- # HELPER COMMANDS
25
-
26
- npm update --dev --no-package-lock --no-save
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # HELPER PURPOSE
4
- #
5
- # Bump package version and publicly publish to npm
6
- #
7
-
8
- # Set error handling
9
- set -eu -o pipefail
10
-
11
- # HELPER COMMANDS
12
-
13
- PRERELEASE_IDENTIFIER="-[a-z-]+"
14
- RELEASE_TAG="latest"
15
-
16
- if [[ $CIRCLE_TAG =~ $PRERELEASE_IDENTIFIER ]]; then RELEASE_TAG="pre-release"; fi
17
-
18
- npm version --no-git-tag-version ${CIRCLE_TAG}
19
- npm publish --access public --tag=${RELEASE_TAG}
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # HELPER PURPOSE
4
- #
5
- # Deploy to Github Pages
6
- # Your project should set the GITHUB_EMAIL, GITHUB_NAME and TARGET_DIR variables in Vault
7
-
8
- TARGET_BRANCH=gh-pages
9
- TEMP_DIR=tmp
10
-
11
- # Set error handling
12
- set -eu -o pipefail
13
-
14
- # Set GitHub user information (the email must match the SSH key provided to Circle)
15
- git config --global user.email $GITHUB_EMAIL
16
- git config --global user.name $GITHUB_NAME
17
-
18
- # HACK: Add GitHub to known hosts to avoid an interactive prompt when cloning over SSH
19
- mkdir -p ~/.ssh
20
- ssh-keyscan -H github.com >> ~/.ssh/known_hosts
21
-
22
- # Clone only the branch we need so we don't download all of the project history
23
- git clone $CIRCLE_REPOSITORY_URL $TEMP_DIR --single-branch --branch $TARGET_BRANCH
24
-
25
- # Remove all of the files, -q prevents logging every filename
26
- cd $TEMP_DIR
27
- git rm -rf .
28
- cd ..
29
-
30
- # Copy contents of target directory to the deployment directory
31
- cp -R -L $TARGET_DIR $TEMP_DIR
32
-
33
- # Copy CI config (which should instruct Circle to ignore this branch)
34
- cp -r .circleci $TEMP_DIR
35
-
36
- cd $TEMP_DIR
37
-
38
- # Stage and commit all of the files
39
- git add -A &> /dev/null
40
- git commit -m "Automated deployment to GitHub Pages: ${CIRCLE_SHA1}" --allow-empty
41
-
42
- # Push to the target branch, staying quiet unless something goes wrong
43
- git push -q origin $TARGET_BRANCH
@@ -1,46 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # HELPER PURPOSE
4
- #
5
- # Download heroku-cli tool, config auth with .netrc
6
- #
7
- # Based on standalone script from https://devcenter.heroku.com/articles/heroku-cli#standalone-installation
8
- #
9
-
10
- # Set error handling
11
- set -eu -o pipefail
12
-
13
- # HELPER COMMANDS
14
-
15
- # Install Heroku CLI
16
- wget https://cli-assets.heroku.com/channels/stable/heroku-linux-x64.tar.gz
17
- sudo mkdir -p /usr/local/lib /usr/local/bin
18
- sudo tar -xzf heroku-linux-x64.tar.gz -C /usr/local/lib
19
- sudo ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku
20
-
21
- # Output heroku-cli version so user can see in
22
- # build log what version is being used
23
- heroku --version
24
-
25
- # Heroku Repo plugin allows us to clear the git repo, so we can force deploys on circle rebuild
26
- heroku plugins:install heroku-repo
27
-
28
- # Heroku CLI Authentication - Netrc file format
29
- # https://devcenter.heroku.com/articles/authentication#netrc-file-format
30
-
31
- cat > ~/.netrc << EOF
32
- machine api.heroku.com
33
- login $HEROKU_LOGIN
34
- password $HEROKU_AUTH_TOKEN
35
-
36
- machine git.heroku.com
37
- login $HEROKU_LOGIN
38
- password $HEROKU_AUTH_TOKEN
39
-
40
- machine code.heroku.com
41
- login $HEROKU_LOGIN
42
- password $HEROKU_AUTH_TOKEN
43
- EOF
44
-
45
- # Set umask - owner r+w only
46
- chmod 0600 ~/.netrc
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # HELPER PURPOSE
4
- #
5
- # Download s3up for uploading files to Amazon S3 buckets
6
- #
7
-
8
- # Set error handling
9
- set -eu -o pipefail
10
-
11
- # HELPER COMMANDS
12
-
13
- # Install S3UP binary
14
- sudo mkdir -p /usr/local/bin
15
-
16
- sudo curl -sfL https://github.com/matthew-andrews/s3up/releases/download/v1.0.5/s3up_linux_386 -o /usr/local/bin/s3up
17
- sudo chmod +x /usr/local/bin/s3up