@financial-times/n-conversion-forms 30.1.0 → 31.0.1

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 (94) hide show
  1. package/.circleci/config.yml +97 -150
  2. package/.github/workflows/gh-pages-deploy.yml +3 -3
  3. package/.toolkitrc.yml +19 -0
  4. package/.toolkitstate/ci.json +6 -0
  5. package/CONTRIBUTING.md +1 -1
  6. package/README.md +2 -2
  7. package/components/accept-terms-subscription.jsx +7 -5
  8. package/jest.config.js +2 -0
  9. package/package.json +30 -16
  10. package/.circleci/shared-helpers/.github/settings.yml +0 -1
  11. package/.circleci/shared-helpers/CODEOWNERS +0 -3
  12. package/.circleci/shared-helpers/README.md +0 -72
  13. package/.circleci/shared-helpers/helper-check-service-ready +0 -37
  14. package/.circleci/shared-helpers/helper-configure-awscli +0 -20
  15. package/.circleci/shared-helpers/helper-generate-build-state-artifacts +0 -29
  16. package/.circleci/shared-helpers/helper-install-awscli +0 -14
  17. package/.circleci/shared-helpers/helper-install-puppeteer-deps +0 -25
  18. package/.circleci/shared-helpers/helper-npm-install-peer-deps +0 -40
  19. package/.circleci/shared-helpers/helper-npm-store-auth-token +0 -14
  20. package/.circleci/shared-helpers/helper-npm-update +0 -26
  21. package/.circleci/shared-helpers/helper-npm-version-and-publish-public +0 -19
  22. package/.circleci/shared-helpers/helper-publish-github-pages +0 -43
  23. package/.circleci/shared-helpers/helper-setup-heroku-cli +0 -46
  24. package/.circleci/shared-helpers/helper-setup-s3-upload +0 -17
  25. package/.circleci/shared-helpers/helper-upload-assets-to-s3 +0 -69
  26. package/.circleci/shared-helpers/helper.example +0 -13
  27. package/build-state/npm-shrinkwrap.json +0 -58461
  28. package/dist/accept-terms-business.js +0 -74
  29. package/dist/accept-terms-business.spec.js +0 -40
  30. package/dist/accept-terms-privacy-policy.js +0 -71
  31. package/dist/accept-terms-subscription.js +0 -150
  32. package/dist/accept-terms.js +0 -217
  33. package/dist/app-banner.js +0 -51
  34. package/dist/b2c-partnership-confirmation.js +0 -64
  35. package/dist/billing-city.js +0 -58
  36. package/dist/billing-country.js +0 -43
  37. package/dist/billing-postcode.js +0 -76
  38. package/dist/company-name.js +0 -78
  39. package/dist/confirmation.js +0 -117
  40. package/dist/continue-reading.js +0 -45
  41. package/dist/country.js +0 -106
  42. package/dist/customer-care.js +0 -52
  43. package/dist/debug.js +0 -50
  44. package/dist/decision-maker.js +0 -72
  45. package/dist/deferred-billing-terms.js +0 -112
  46. package/dist/delivery-address-map.js +0 -184
  47. package/dist/delivery-address-type.js +0 -74
  48. package/dist/delivery-address.js +0 -123
  49. package/dist/delivery-city.js +0 -70
  50. package/dist/delivery-county.js +0 -48
  51. package/dist/delivery-instructions.js +0 -123
  52. package/dist/delivery-option.js +0 -77
  53. package/dist/delivery-po-box.js +0 -75
  54. package/dist/delivery-postcode.js +0 -116
  55. package/dist/delivery-security-instructions.js +0 -72
  56. package/dist/delivery-start-date.js +0 -77
  57. package/dist/education-job-title.js +0 -67
  58. package/dist/email.js +0 -90
  59. package/dist/error-page.js +0 -45
  60. package/dist/fieldset.js +0 -58
  61. package/dist/first-name.js +0 -73
  62. package/dist/form.js +0 -29
  63. package/dist/google-sign-in.js +0 -24
  64. package/dist/graduation-date.js +0 -112
  65. package/dist/index.js +0 -432
  66. package/dist/industry.js +0 -81
  67. package/dist/job-title.js +0 -65
  68. package/dist/last-name.js +0 -73
  69. package/dist/licence-confirmation.js +0 -67
  70. package/dist/licence-header.js +0 -52
  71. package/dist/licence-sign-in.js +0 -36
  72. package/dist/licence-title.js +0 -46
  73. package/dist/lite-sub-confirmation.js +0 -118
  74. package/dist/loader.js +0 -54
  75. package/dist/message.js +0 -101
  76. package/dist/message.spec.js +0 -96
  77. package/dist/organisation.js +0 -73
  78. package/dist/package-change.js +0 -38
  79. package/dist/password.js +0 -95
  80. package/dist/payment-term.js +0 -328
  81. package/dist/payment-type.js +0 -213
  82. package/dist/personal-title.js +0 -94
  83. package/dist/phone.js +0 -85
  84. package/dist/position.js +0 -86
  85. package/dist/progress-indicator.js +0 -66
  86. package/dist/province.js +0 -80
  87. package/dist/registration-confirmation.js +0 -108
  88. package/dist/responsibility.js +0 -84
  89. package/dist/section.js +0 -20
  90. package/dist/seven-day-pass-experiment-confirmation.js +0 -93
  91. package/dist/state.js +0 -80
  92. package/dist/submit.js +0 -52
  93. package/dist/text-input.js +0 -78
  94. package/dist/trial-banner.js +0 -29
@@ -1,168 +1,115 @@
1
- # generator: n-circle2-cli
2
- # template: component
3
-
4
- references:
5
-
6
- container_config_node: &container_config_node
7
- working_directory: ~/project/build
1
+ # CONFIG GENERATED BY DOTCOM-TOOL-KIT, DO NOT EDIT BY HAND
2
+ version: 2.1
3
+ orbs:
4
+ tool-kit: financial-times/dotcom-tool-kit@4
5
+ executors:
6
+ node:
8
7
  docker:
9
8
  - image: cimg/node:18.17-browsers
10
- workspace_root: &workspace_root
11
- ~/project
12
-
13
- attach_workspace: &attach_workspace
14
- attach_workspace:
15
- at: *workspace_root
16
-
17
- npm_cache_keys: &npm_cache_keys
18
- keys:
19
- - v3-dependency-npm-{{ checksum "package.json" }}-
20
- - v3-dependency-npm-{{ checksum "package.json" }}
21
- - v3-dependency-npm-
22
-
23
- cache_npm_cache: &cache_npm_cache
24
- save_cache:
25
- key: v3-dependency-npm-{{ checksum "package.json" }}-{{ epoch }}
26
- paths:
27
- - ./node_modules/
28
-
29
- restore_npm_cache: &restore_npm_cache
30
- restore_cache:
31
- <<: *npm_cache_keys
32
-
33
- filters_only_main: &filters_only_main
34
- branches:
35
- only: main
36
-
37
- filters_only_renovate_nori: &filters_only_renovate_nori
38
- branches:
39
- only: /(^renovate-.*|^nori/.*)/
40
-
41
- filters_ignore_tags_renovate_nori: &filters_ignore_tags_renovate_nori
42
- tags:
43
- ignore: /.*/
44
- branches:
45
- ignore: /(^renovate-.*|^nori/.*)/
46
-
47
- filters_version_tag: &filters_version_tag
48
- tags:
49
- only:
50
- - /^v?\d+\.\d+\.\d+(?:-beta\.\d+)?$/
51
- branches:
52
- ignore: /.*/
53
-
54
- version: 2.1
55
-
56
9
  jobs:
57
-
58
- build:
59
- <<: *container_config_node
10
+ checkout:
11
+ docker:
12
+ - image: cimg/base:stable
60
13
  steps:
61
14
  - checkout
62
- - run:
63
- name: Checkout next-ci-shared-helpers
64
- command: git clone --depth 1 git@github.com:Financial-Times/next-ci-shared-helpers.git --branch unpin-heroku .circleci/shared-helpers
65
- - *restore_npm_cache
66
- - run:
67
- name: Install project dependencies
68
- command: make install
69
- - run:
70
- name: Run the project build task
71
- command: make build
72
- - run:
73
- name: shared-helper / generate-build-state-artifacts
74
- command: .circleci/shared-helpers/helper-generate-build-state-artifacts
75
- when: always
76
- - *cache_npm_cache
77
- - store_artifacts:
78
- path: build-state
79
- destination: build-state
80
- - persist_to_workspace:
81
- root: *workspace_root
82
- paths:
83
- - build
84
-
85
- test:
86
- <<: *container_config_node
87
- steps:
88
- - *attach_workspace
89
- - run:
90
- name: Run tests
91
- command: npm run lint && make test
92
- environment:
93
- JEST_JUNIT_OUTPUT: test-results/jest/results.xml
94
- MOCHA_FILE: test-results/mocha/results.xml
95
- - store_test_results:
96
- path: test-results
97
- - store_artifacts:
98
- path: test-results
99
- destination: test-results
100
-
101
- publish:
102
- <<: *container_config_node
103
- steps:
104
- - *attach_workspace
105
- - run:
106
- name: shared-helper / npm-store-auth-token
107
- command: .circleci/shared-helpers/helper-npm-store-auth-token
108
- - run: npx snyk monitor --org=customer-products --project-name=Financial-Times/n-conversion-forms
109
- - run:
110
- name: shared-helper / npm-version-and-publish-public
111
- command: .circleci/shared-helpers/helper-npm-version-and-publish-public
112
-
15
+ - tool-kit/persist-workspace:
16
+ path: .
113
17
  workflows:
114
-
115
- version: 2
116
-
117
- build-test:
118
- jobs:
119
- - build:
120
- filters:
121
- <<: *filters_ignore_tags_renovate_nori
122
- - test:
123
- requires:
124
- - build
125
-
126
- build-test-publish:
18
+ tool-kit:
19
+ when:
20
+ not:
21
+ equal:
22
+ - scheduled_pipeline
23
+ - << pipeline.trigger_source >>
127
24
  jobs:
128
- - build:
25
+ - checkout:
129
26
  filters:
130
- <<: *filters_version_tag
131
- - test:
27
+ tags:
28
+ only: /^v\d+\.\d+\.\d+(-.+)?/
29
+ - waiting-for-approval:
30
+ type: approval
132
31
  filters:
133
- <<: *filters_version_tag
32
+ branches:
33
+ only: /(^renovate-.*|^nori/.*)/
34
+ tags:
35
+ only: /^v\d+\.\d+\.\d+(-.+)?/
36
+ - tool-kit/setup:
37
+ name: tool-kit/setup-<< matrix.executor >>
134
38
  requires:
135
- - build
136
- - publish:
137
- context: npm-publish-token
39
+ - checkout
40
+ - waiting-for-approval
41
+ matrix:
42
+ parameters:
43
+ executor:
44
+ - node
138
45
  filters:
139
- <<: *filters_version_tag
46
+ tags:
47
+ only: /^v\d+\.\d+\.\d+(-.+)?/
48
+ - tool-kit/build:
49
+ name: tool-kit/build-<< matrix.executor >>
140
50
  requires:
141
- - test
142
-
143
- renovate-nori-build-test-provision:
144
- jobs:
145
- - waiting-for-approval:
146
- type: approval
51
+ - tool-kit/setup-<< matrix.executor >>
52
+ matrix:
53
+ parameters:
54
+ executor:
55
+ - node
147
56
  filters:
148
- <<: *filters_only_renovate_nori
149
- - build:
57
+ tags:
58
+ only: /^v\d+\.\d+\.\d+(-.+)?/
59
+ - tool-kit/test:
60
+ name: tool-kit/test-<< matrix.executor >>
150
61
  requires:
151
- - waiting-for-approval
152
- - test:
62
+ - tool-kit/build-<< matrix.executor >>
63
+ matrix:
64
+ parameters:
65
+ executor:
66
+ - node
67
+ filters:
68
+ tags:
69
+ only: /^v\d+\.\d+\.\d+(-.+)?/
70
+ - tool-kit/publish-tag:
153
71
  requires:
154
- - build
155
-
156
- nightly:
157
- triggers:
158
- - schedule:
159
- cron: "0 0 * * *"
72
+ - tool-kit/test-node
73
+ name: tool-kit/publish-tag-node
74
+ executor: node
160
75
  filters:
161
- <<: *filters_only_main
76
+ tags:
77
+ only: /^v\d+\.\d+\.\d+(-.+)?/
78
+ branches:
79
+ ignore: /.*/
80
+ context: npm-publish-token
81
+ nightly:
82
+ when:
83
+ and:
84
+ - equal:
85
+ - scheduled_pipeline
86
+ - << pipeline.trigger_source >>
87
+ - equal:
88
+ - nightly
89
+ - << pipeline.schedule.name >>
162
90
  jobs:
163
- - build:
164
- context: next-nightly-build
165
- - test:
91
+ - checkout
92
+ - tool-kit/setup:
93
+ name: tool-kit/setup-<< matrix.executor >>
94
+ requires:
95
+ - checkout
96
+ matrix:
97
+ parameters:
98
+ executor:
99
+ - node
100
+ - tool-kit/build:
101
+ name: tool-kit/build-<< matrix.executor >>
102
+ requires:
103
+ - tool-kit/setup-<< matrix.executor >>
104
+ matrix:
105
+ parameters:
106
+ executor:
107
+ - node
108
+ - tool-kit/test:
109
+ name: tool-kit/test-<< matrix.executor >>
166
110
  requires:
167
- - build
168
- context: next-nightly-build
111
+ - tool-kit/build-<< matrix.executor >>
112
+ matrix:
113
+ parameters:
114
+ executor:
115
+ - node
@@ -13,13 +13,13 @@ jobs:
13
13
  steps:
14
14
  - uses: actions/setup-node@v3
15
15
  with:
16
- node-version: 14.x
16
+ node-version: 18.x
17
17
  - uses: actions/checkout@v2
18
18
  with:
19
19
  persist-credentials: false
20
20
  - run: git config --global url."https://${{ secrets.NEXT_USER_PAT }}@github.com/".insteadOf ssh://git@github.com/
21
- - run: npm install -g npm@7.24.2
22
- - run: make install
21
+ - run: npm install -g npm@9.6.7
22
+ - run: npm install
23
23
  - run: npm run build-storybook
24
24
  - name: Deploy
25
25
  uses: peaceiris/actions-gh-pages@v3
package/.toolkitrc.yml ADDED
@@ -0,0 +1,19 @@
1
+ plugins:
2
+ - "@dotcom-tool-kit/component"
3
+ - "@dotcom-tool-kit/jest"
4
+ - "@dotcom-tool-kit/eslint"
5
+ - "@dotcom-tool-kit/prettier"
6
+ - "@dotcom-tool-kit/lint-staged"
7
+ hooks:
8
+ git:precommit:
9
+ - SecretSquirrel
10
+ - LintStaged
11
+ test:local:
12
+ - Eslint
13
+ - JestLocal
14
+ test:ci:
15
+ - Eslint
16
+ - JestCI
17
+ options:
18
+ "@dotcom-tool-kit/circleci":
19
+ nodeVersion: 18.17-browsers
@@ -0,0 +1,6 @@
1
+ {
2
+ "branch": "",
3
+ "repo": "n-conversion-forms",
4
+ "version": "d8566ba2cce49771df59e3038896ec5f3849fe64",
5
+ "tag": "v31.0.1"
6
+ }
package/CONTRIBUTING.md CHANGED
@@ -3,7 +3,7 @@
3
3
  To contribute to this project, clone this repository locally and commit your code to a seperate branch. Please write unit tests for your code and run the linter before opening a pull-request.
4
4
 
5
5
  ```bash
6
- make test # runs linter and unit tests
6
+ npm test # runs linter and unit tests
7
7
  ```
8
8
 
9
9
  # Releasing new versions
package/README.md CHANGED
@@ -6,8 +6,8 @@ Contains HTML and CSS that's used within the conversion forms
6
6
  [![Known Vulnerabilities](https://snyk.io/test/github/Financial-Times/n-conversion-forms/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Financial-Times/n-conversion-forms?targetFile=package.json)
7
7
 
8
8
  ```bash
9
- make install # install all dependencies
10
- make run # build and start documentation app at http://local.ft.com:5005/
9
+ npm install # install all dependencies
10
+ npm run storybook # build and start documentation app at http://local.ft.com:5005/
11
11
  ```
12
12
 
13
13
  ## Table of contents
@@ -51,11 +51,13 @@ export function AcceptTermsSubscription({
51
51
  <li>
52
52
  <span className="terms-transition terms-transition--immediate">
53
53
  By placing your order subject to the Terms & Conditions (save for
54
- section 2) referred to below, you are waiving your statutory right
55
- to cancel our contract within 14 days of payment. Your payment is
56
- a one-time payment collected at the time of checkout, and
57
- unsubscribing or cancelling at any point (whether before or after
58
- the 14-day period) will not entitle you to a refund.
54
+ section 2) referred to below, you agree that we may start your
55
+ 7-day pass immediately upon our acceptance of your order and that
56
+ you are waiving your statutory right to cancel our contract within
57
+ 14 days of confirmation. Your payment is a one-time payment
58
+ collected at the time of checkout, and cancelling at any point
59
+ (whether before or after the 14-day period) will not entitle you
60
+ to a refund.
59
61
  </span>
60
62
  </li>
61
63
  <li>
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.1.0",
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