@financial-times/n-myft-ui 33.0.0 → 33.1.1-alpha.4
Sign up to get free protection for your applications and to get access to all the features.
- package/.circleci/config.yml +98 -179
- package/.toolkitrc.yml +31 -0
- package/.toolkitstate/ci.json +6 -0
- package/README.md +29 -3
- package/components/jsx/preferences-modal/index.js +6 -6
- package/components/unread-articles-indicator/initialise-feed-start-time.js +1 -1
- package/karma.conf.js +2 -1
- package/myft/ui/lists.js +12 -0
- package/package.json +25 -10
- package/scripts/build-demo.sh +53 -0
- package/scripts/deploy-gh-pages.sh +5 -2
- package/scripts/make-static-demo.sh +6 -2
- package/scripts/transpile-jsx.sh +3 -0
- package/toolkit/demoScripts/.toolkitrc.yml +0 -0
- package/toolkit/demoScripts/index.js +77 -0
- package/toolkit/karma/.toolkitrc.yml +0 -0
- package/toolkit/karma/index.js +16 -0
- package/.circleci/shared-helpers/.github/settings.yml +0 -1
- package/.circleci/shared-helpers/CODEOWNERS +0 -3
- package/.circleci/shared-helpers/Makefile +0 -5
- package/.circleci/shared-helpers/README.md +0 -72
- package/.circleci/shared-helpers/helper-check-service-ready +0 -37
- package/.circleci/shared-helpers/helper-configure-awscli +0 -20
- package/.circleci/shared-helpers/helper-generate-build-state-artifacts +0 -29
- package/.circleci/shared-helpers/helper-install-awscli +0 -14
- package/.circleci/shared-helpers/helper-install-puppeteer-deps +0 -25
- package/.circleci/shared-helpers/helper-npm-install-peer-deps +0 -40
- package/.circleci/shared-helpers/helper-npm-store-auth-token +0 -14
- package/.circleci/shared-helpers/helper-npm-update +0 -26
- package/.circleci/shared-helpers/helper-npm-version-and-publish-public +0 -19
- package/.circleci/shared-helpers/helper-publish-github-pages +0 -43
- package/.circleci/shared-helpers/helper-setup-heroku-cli +0 -46
- package/.circleci/shared-helpers/helper-setup-s3-upload +0 -17
- package/.circleci/shared-helpers/helper-upload-assets-to-s3 +0 -69
- package/.circleci/shared-helpers/helper.example +0 -13
- package/.circleci/shared-helpers/secret-squirrel.js +0 -25
- package/Makefile +0 -48
- package/build-state/npm-shrinkwrap.json +0 -52320
package/.circleci/config.yml
CHANGED
@@ -1,213 +1,132 @@
|
|
1
|
-
# generator: n-circle2-cli
|
2
|
-
# template: component
|
3
|
-
|
4
|
-
references:
|
5
|
-
container_config_node: &container_config_node
|
6
|
-
working_directory: ~/project/build
|
7
|
-
docker:
|
8
|
-
- image: cimg/node:<< parameters.node-version >>-browsers
|
9
|
-
parameters:
|
10
|
-
node-version:
|
11
|
-
default: "18.18"
|
12
|
-
type: string
|
13
|
-
|
14
|
-
workspace_root: &workspace_root ~/project
|
15
|
-
|
16
|
-
attach_workspace: &attach_workspace
|
17
|
-
attach_workspace:
|
18
|
-
at: *workspace_root
|
19
|
-
|
20
|
-
npm_cache_keys: &npm_cache_keys
|
21
|
-
keys:
|
22
|
-
- v8-dependency-npm-{{ checksum "package-lock.json" }}-
|
23
|
-
- v8-dependency-npm-{{ checksum "package-lock.json" }}
|
24
|
-
- v8-dependency-npm-
|
25
|
-
|
26
|
-
cache_npm_cache: &cache_npm_cache
|
27
|
-
save_cache:
|
28
|
-
key: v8-dependency-npm-{{ checksum "package-lock.json" }}-{{ epoch }}
|
29
|
-
paths:
|
30
|
-
- ./node_modules/
|
31
|
-
|
32
|
-
restore_npm_cache: &restore_npm_cache
|
33
|
-
restore_cache:
|
34
|
-
<<: *npm_cache_keys
|
35
|
-
|
36
|
-
filters_ignore_gh_pages: &filters_ignore_gh_pages
|
37
|
-
branches:
|
38
|
-
ignore: gh_pages
|
39
|
-
|
40
|
-
filters_only_main: &filters_only_main
|
41
|
-
branches:
|
42
|
-
only: main
|
43
|
-
|
44
|
-
filters_ignore_main: &filters_ignore_main
|
45
|
-
branches:
|
46
|
-
ignore: main
|
47
|
-
|
48
|
-
filters_ignore_tags: &filters_ignore_tags
|
49
|
-
tags:
|
50
|
-
ignore: /.*/
|
51
|
-
|
52
|
-
filters_version_tag: &filters_version_tag
|
53
|
-
tags:
|
54
|
-
only:
|
55
|
-
- /^v?\d+\.\d+\.\d+(?:-beta\.\d+)?$/
|
56
|
-
branches:
|
57
|
-
ignore: /.*/
|
58
|
-
|
59
1
|
version: 2.1
|
60
|
-
|
61
2
|
orbs:
|
62
|
-
|
63
|
-
|
3
|
+
tool-kit: financial-times/dotcom-tool-kit@5
|
4
|
+
executors:
|
5
|
+
node:
|
6
|
+
docker:
|
7
|
+
- image: cimg/node:18.17-browsers
|
64
8
|
jobs:
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
- checkout
|
69
|
-
- node/install-npm:
|
70
|
-
version: "^7"
|
71
|
-
- run:
|
72
|
-
name: Checkout next-ci-shared-helpers
|
73
|
-
command: git clone --depth 1
|
74
|
-
git@github.com:Financial-Times/next-ci-shared-helpers.git --branch
|
75
|
-
unpin-heroku .circleci/shared-helpers
|
76
|
-
- *restore_npm_cache
|
77
|
-
- run:
|
78
|
-
name: Install project dependencies
|
79
|
-
command: make install
|
80
|
-
- run:
|
81
|
-
name: Transpile JSX to JS
|
82
|
-
command: make transpile-jsx
|
83
|
-
- run:
|
84
|
-
name: shared-helper / generate-build-state-artifacts
|
85
|
-
command: .circleci/shared-helpers/helper-generate-build-state-artifacts
|
86
|
-
when: always
|
87
|
-
- *cache_npm_cache
|
88
|
-
- store_artifacts:
|
89
|
-
path: build-state
|
90
|
-
destination: build-state
|
91
|
-
- persist_to_workspace:
|
92
|
-
root: *workspace_root
|
93
|
-
paths:
|
94
|
-
- build
|
95
|
-
|
96
|
-
test:
|
97
|
-
<<: *container_config_node
|
98
|
-
parallelism: 1
|
99
|
-
steps:
|
100
|
-
- *attach_workspace
|
101
|
-
- run:
|
102
|
-
name: Run tests
|
103
|
-
command: make test
|
104
|
-
environment:
|
105
|
-
JEST_JUNIT_OUTPUT: test-results/jest/results.xml
|
106
|
-
MOCHA_FILE: test-results/mocha/results.xml
|
107
|
-
- store_test_results:
|
108
|
-
path: test-results
|
109
|
-
- store_artifacts:
|
110
|
-
path: test-results
|
111
|
-
destination: test-results
|
112
|
-
|
113
|
-
publish:
|
114
|
-
<<: *container_config_node
|
115
|
-
steps:
|
116
|
-
- *attach_workspace
|
117
|
-
- run:
|
118
|
-
name: shared-helper / npm-store-auth-token
|
119
|
-
command: .circleci/shared-helpers/helper-npm-store-auth-token
|
120
|
-
- run: npx snyk monitor --org=customer-products
|
121
|
-
--project-name=Financial-Times/n-myft-ui
|
122
|
-
- run:
|
123
|
-
name: shared-helper / npm-version-and-publish-public
|
124
|
-
command: .circleci/shared-helpers/helper-npm-version-and-publish-public
|
125
|
-
|
126
|
-
deploy:
|
127
|
-
<<: *container_config_node
|
9
|
+
deploy-gh-pages:
|
10
|
+
docker:
|
11
|
+
- image: cimg/base:stable
|
128
12
|
steps:
|
129
|
-
-
|
13
|
+
- tool-kit/attach-workspace
|
130
14
|
- add_ssh_keys:
|
131
15
|
fingerprints:
|
132
16
|
- "83:b5:09:e4:e5:2e:74:35:c1:1b:99:73:e3:dc:b8:6f"
|
133
17
|
- run:
|
134
18
|
name: Publish GitHub Pages
|
135
19
|
command: ./scripts/deploy-gh-pages.sh
|
136
|
-
|
20
|
+
checkout:
|
21
|
+
docker:
|
22
|
+
- image: cimg/base:stable
|
23
|
+
steps:
|
24
|
+
- checkout
|
25
|
+
- tool-kit/persist-workspace:
|
26
|
+
path: .
|
137
27
|
workflows:
|
138
|
-
|
139
|
-
|
28
|
+
tool-kit:
|
29
|
+
when:
|
30
|
+
not:
|
31
|
+
equal:
|
32
|
+
- scheduled_pipeline
|
33
|
+
- << pipeline.trigger_source >>
|
140
34
|
jobs:
|
141
|
-
-
|
35
|
+
- deploy-gh-pages:
|
36
|
+
requires:
|
37
|
+
- tool-kit/test-node
|
142
38
|
filters:
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
node-version: [ "16.20", "18.18" ]
|
149
|
-
- test:
|
39
|
+
tags:
|
40
|
+
only: /^v\d+\.\d+\.\d+(-.+)?/
|
41
|
+
branches:
|
42
|
+
ignore: /.*/
|
43
|
+
- checkout:
|
150
44
|
filters:
|
151
|
-
|
45
|
+
tags:
|
46
|
+
only: /^v\d+\.\d+\.\d+(-.+)?/
|
47
|
+
- waiting-for-approval:
|
48
|
+
type: approval
|
49
|
+
filters:
|
50
|
+
branches:
|
51
|
+
only: /(^renovate-.*|^nori/.*)/
|
52
|
+
- tool-kit/setup:
|
53
|
+
name: tool-kit/setup-<< matrix.executor >>
|
152
54
|
requires:
|
153
|
-
-
|
154
|
-
|
55
|
+
- checkout
|
56
|
+
- waiting-for-approval
|
155
57
|
matrix:
|
156
58
|
parameters:
|
157
|
-
|
158
|
-
|
59
|
+
executor:
|
60
|
+
- node
|
159
61
|
filters:
|
160
|
-
|
62
|
+
tags:
|
63
|
+
only: /^v\d+\.\d+\.\d+(-.+)?/
|
64
|
+
- tool-kit/build:
|
65
|
+
name: tool-kit/build-<< matrix.executor >>
|
161
66
|
requires:
|
162
|
-
-
|
163
|
-
build-test-publish:
|
164
|
-
jobs:
|
165
|
-
- build:
|
166
|
-
filters:
|
167
|
-
<<: *filters_version_tag
|
168
|
-
<<: *filters_ignore_gh_pages
|
169
|
-
name: build-v<< matrix.node-version >>
|
67
|
+
- tool-kit/setup-<< matrix.executor >>
|
170
68
|
matrix:
|
171
69
|
parameters:
|
172
|
-
|
173
|
-
|
70
|
+
executor:
|
71
|
+
- node
|
174
72
|
filters:
|
175
|
-
|
73
|
+
tags:
|
74
|
+
only: /^v\d+\.\d+\.\d+(-.+)?/
|
75
|
+
- tool-kit/test:
|
76
|
+
name: tool-kit/test-<< matrix.executor >>
|
176
77
|
requires:
|
177
|
-
- build
|
178
|
-
name: test-v<< matrix.node-version >>
|
78
|
+
- tool-kit/build-<< matrix.executor >>
|
179
79
|
matrix:
|
180
80
|
parameters:
|
181
|
-
|
182
|
-
|
183
|
-
context: npm-publish-token
|
81
|
+
executor:
|
82
|
+
- node
|
184
83
|
filters:
|
185
|
-
|
84
|
+
tags:
|
85
|
+
only: /^v\d+\.\d+\.\d+(-.+)?/
|
86
|
+
- tool-kit/publish-tag:
|
186
87
|
requires:
|
187
|
-
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
- schedule:
|
192
|
-
cron: "0 0 * * *"
|
88
|
+
- deploy-gh-pages
|
89
|
+
- tool-kit/test-node
|
90
|
+
name: tool-kit/publish-tag-node
|
91
|
+
executor: node
|
193
92
|
filters:
|
194
|
-
|
93
|
+
tags:
|
94
|
+
only: /^v\d+\.\d+\.\d+(-.+)?/
|
95
|
+
branches:
|
96
|
+
ignore: /.*/
|
97
|
+
context: npm-publish-token
|
98
|
+
nightly:
|
99
|
+
when:
|
100
|
+
and:
|
101
|
+
- equal:
|
102
|
+
- scheduled_pipeline
|
103
|
+
- << pipeline.trigger_source >>
|
104
|
+
- equal:
|
105
|
+
- nightly
|
106
|
+
- << pipeline.schedule.name >>
|
195
107
|
jobs:
|
196
|
-
-
|
197
|
-
|
198
|
-
name:
|
108
|
+
- checkout
|
109
|
+
- tool-kit/setup:
|
110
|
+
name: tool-kit/setup-<< matrix.executor >>
|
111
|
+
requires:
|
112
|
+
- checkout
|
113
|
+
matrix:
|
114
|
+
parameters:
|
115
|
+
executor:
|
116
|
+
- node
|
117
|
+
- tool-kit/build:
|
118
|
+
name: tool-kit/build-<< matrix.executor >>
|
119
|
+
requires:
|
120
|
+
- tool-kit/setup-<< matrix.executor >>
|
199
121
|
matrix:
|
200
122
|
parameters:
|
201
|
-
|
202
|
-
|
123
|
+
executor:
|
124
|
+
- node
|
125
|
+
- tool-kit/test:
|
126
|
+
name: tool-kit/test-<< matrix.executor >>
|
203
127
|
requires:
|
204
|
-
- build
|
205
|
-
context: next-nightly-build
|
206
|
-
name: test-v<< matrix.node-version >>
|
128
|
+
- tool-kit/build-<< matrix.executor >>
|
207
129
|
matrix:
|
208
130
|
parameters:
|
209
|
-
|
210
|
-
|
211
|
-
notify:
|
212
|
-
webhooks:
|
213
|
-
- url: https://ft-next-webhooks.herokuapp.com/circleci2-workflow
|
131
|
+
executor:
|
132
|
+
- node
|
package/.toolkitrc.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
plugins:
|
2
|
+
- "@dotcom-tool-kit/component"
|
3
|
+
- "@dotcom-tool-kit/mocha"
|
4
|
+
- "@dotcom-tool-kit/eslint"
|
5
|
+
- "@dotcom-tool-kit/pa11y"
|
6
|
+
- "@dotcom-tool-kit/lint-staged-npm"
|
7
|
+
- "./toolkit/karma"
|
8
|
+
- "./toolkit/demoScripts"
|
9
|
+
hooks:
|
10
|
+
build:local:
|
11
|
+
- TranspileJsx
|
12
|
+
build:ci:
|
13
|
+
- TranspileJsx
|
14
|
+
build:demo:
|
15
|
+
- DemoBuilder
|
16
|
+
test:local:
|
17
|
+
- Eslint
|
18
|
+
- Karma
|
19
|
+
test:ci:
|
20
|
+
- Karma
|
21
|
+
- DemoBuilder
|
22
|
+
- RunPa11yCi
|
23
|
+
options:
|
24
|
+
"@dotcom-tool-kit/circleci":
|
25
|
+
nodeVersion: "18.17-browsers"
|
26
|
+
"@dotcom-tool-kit/eslint": {
|
27
|
+
files: "{,!(public)/**/}*.js"
|
28
|
+
}
|
29
|
+
'@dotcom-tool-kit/vault':
|
30
|
+
team: next
|
31
|
+
app: n-myft-ui
|
package/README.md
CHANGED
@@ -32,13 +32,39 @@ If you are making a major change, you will need to update the package.json files
|
|
32
32
|
## Running locally
|
33
33
|
|
34
34
|
```
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
npm install
|
36
|
+
npm run build
|
37
|
+
npm run demo
|
38
38
|
```
|
39
39
|
|
40
40
|
View the demo on `localhost:5005`
|
41
41
|
|
42
|
+
|
43
|
+
## Demo tasks
|
44
|
+
```
|
45
|
+
npm run demo-build
|
46
|
+
```
|
47
|
+
This task will build the demo and place it in the `demo/dist` folder.
|
48
|
+
```
|
49
|
+
npm run demo
|
50
|
+
```
|
51
|
+
This task will run a express server on localhost:5005 serving the builded demo.(it calls demo-build internally).
|
52
|
+
```
|
53
|
+
npm run static-demo
|
54
|
+
```
|
55
|
+
This tasks will start a Node.js application located in the "demos/app" directory as a background process,
|
56
|
+
waits for 10 seconds, fetches content from "http://localhost:5005", adjusts the links in the retrieved content,
|
57
|
+
saves it as "index.html" in the "public" directory, moves all files from the "public" directory to the current directory,
|
58
|
+
and finally terminates the Node.js process.
|
59
|
+
This is to prepare it to be uploaded to gh static page.
|
60
|
+
|
42
61
|
## Unstable versions
|
43
62
|
|
44
63
|
v24, v25, v26 has JSX migration code. They are not stable therefore v27 is released. It is to remove JSX and rollback to handlebars. Please use ^v27.
|
64
|
+
|
65
|
+
# RunPa11yCi task
|
66
|
+
The default Pa11y plugin is configured to run against a deployed review app on heroku.
|
67
|
+
In cases where the project is an npm component without a deployed environment like this project, this task allows for local server setup prior to running Pa11y tests.
|
68
|
+
The RunPa11yCi task is a custom task class designed to automate the process of running Pa11y accessibility tests against a local server instance that runs the demo. It utilizes Node.js child processes to manage both the server and Pa11y processes,
|
69
|
+
ensuring proper execution and cleanup.
|
70
|
+
|
@@ -11,10 +11,10 @@ const renderError = ({ message, preferencesModal }) => {
|
|
11
11
|
|
12
12
|
const removeError = ({ preferencesModal }) => {
|
13
13
|
renderError({
|
14
|
-
message:
|
14
|
+
message: '',
|
15
15
|
preferencesModal,
|
16
16
|
});
|
17
|
-
}
|
17
|
+
};
|
18
18
|
|
19
19
|
/**
|
20
20
|
* This preference modal is part of a test
|
@@ -60,7 +60,7 @@ const toggleCheckboxStatus = ({ instantAlertsCheckbox, isChecked }) => {
|
|
60
60
|
instantAlertsCheckbox.dataset.trackable = 'pop-up-box|set-instant-alert-on';
|
61
61
|
instantAlertsCheckbox.checked = false;
|
62
62
|
}
|
63
|
-
}
|
63
|
+
};
|
64
64
|
|
65
65
|
const tracking = (conceptId) => {
|
66
66
|
const trackingData = {
|
@@ -72,7 +72,7 @@ const tracking = (conceptId) => {
|
|
72
72
|
name: 'pop-up-box',
|
73
73
|
id: '72de123e-5082-11ee-be56-0242ac120002',
|
74
74
|
}
|
75
|
-
}
|
75
|
+
};
|
76
76
|
|
77
77
|
const trackingEvent = new CustomEvent('oTracking.event', {
|
78
78
|
detail: trackingData,
|
@@ -218,7 +218,7 @@ const toggleInstantAlertsPreference = async ({ event, conceptId, preferencesModa
|
|
218
218
|
instantAlertsCheckbox.removeAttribute('disabled');
|
219
219
|
};
|
220
220
|
|
221
|
-
const setCheckboxForAlertConceptToOff =
|
221
|
+
const setCheckboxForAlertConceptToOff = ({ event, preferencesModal }) => {
|
222
222
|
const conceptId = preferencesModal.dataset.conceptId;
|
223
223
|
const instantAlertsCheckbox = preferencesModal.querySelector('[data-component-id="myft-preferences-modal-checkbox"]');
|
224
224
|
|
@@ -231,7 +231,7 @@ const setCheckboxForAlertConceptToOff = ({ event, preferencesModal }) => {
|
|
231
231
|
instantAlertsCheckbox,
|
232
232
|
isChecked: false,
|
233
233
|
});
|
234
|
-
}
|
234
|
+
};
|
235
235
|
|
236
236
|
export default () => {
|
237
237
|
/**
|
@@ -31,7 +31,7 @@ const determineFeedStartTime = (userId, now, previousFeedStartTime) => {
|
|
31
31
|
|
32
32
|
return fetchUserLastVisitedAt(userId)
|
33
33
|
.then((userLastVisitedAt) =>
|
34
|
-
isToday(userLastVisitedAt) ? userLastVisitedAt : Promise.reject()
|
34
|
+
isToday(userLastVisitedAt) ? userLastVisitedAt : Promise.reject(new Error('No last visited user data today'))
|
35
35
|
)
|
36
36
|
.catch(() => startOfDay(now));
|
37
37
|
};
|
package/karma.conf.js
CHANGED
@@ -39,6 +39,7 @@ module.exports = function (karma) {
|
|
39
39
|
'test/**/*.spec.js': ['webpack', 'sourcemap']
|
40
40
|
},
|
41
41
|
webpack: {
|
42
|
+
mode: 'development',
|
42
43
|
resolve: {
|
43
44
|
modules: ['node_modules'],
|
44
45
|
descriptionFiles: ['package.json'],
|
@@ -155,7 +156,7 @@ module.exports = function (karma) {
|
|
155
156
|
safari: {
|
156
157
|
base: 'BrowserStack',
|
157
158
|
os: 'OS X',
|
158
|
-
os_version : '
|
159
|
+
os_version : 'Monterey',
|
159
160
|
browser: 'Safari',
|
160
161
|
browser_version: 'latest'
|
161
162
|
}
|
package/myft/ui/lists.js
CHANGED
@@ -500,6 +500,12 @@ function openCreateListAndAddArticleOverlay (contentId, config) {
|
|
500
500
|
function initialEventListeners () {
|
501
501
|
|
502
502
|
document.body.addEventListener('myft.user.saved.content.add', event => {
|
503
|
+
//Only show the create list overlay if the saved article is the main article, this is useful if there are other article listed in the article page
|
504
|
+
//For example having a related articles that can also be saved
|
505
|
+
const currentContentId = document.querySelector('[data-content-id]').dataset.contentId;
|
506
|
+
if (event && event.detail && currentContentId !== event.detail.subject) {
|
507
|
+
return;
|
508
|
+
}
|
503
509
|
event.stopPropagation();
|
504
510
|
const contentId = event.detail.subject;
|
505
511
|
const configSet = event.currentTarget.querySelector('[data-myft-ui-save-config]');
|
@@ -512,6 +518,12 @@ function initialEventListeners () {
|
|
512
518
|
});
|
513
519
|
|
514
520
|
document.body.addEventListener('myft.user.saved.content.remove', event => {
|
521
|
+
//Only show unsave notification if the saved article is the main article, this is useful if there are other article listed in the article page
|
522
|
+
//For example having a related articles that can also be saved
|
523
|
+
const currentContentId = document.querySelector('[data-content-id]').dataset.contentId;
|
524
|
+
if (event && event.detail && currentContentId !== event.detail.subject) {
|
525
|
+
return;
|
526
|
+
}
|
515
527
|
event.stopPropagation();
|
516
528
|
const contentId = event.detail.subject;
|
517
529
|
return showUnsavedNotification(contentId);
|
package/package.json
CHANGED
@@ -1,12 +1,19 @@
|
|
1
1
|
{
|
2
2
|
"name": "@financial-times/n-myft-ui",
|
3
|
-
"version": "33.
|
3
|
+
"version": "33.1.1-alpha.4",
|
4
4
|
"description": "Client side component for interaction with myft",
|
5
5
|
"main": "server.js",
|
6
6
|
"scripts": {
|
7
|
-
"
|
7
|
+
"sass": "sass demos/src/demo.scss public/main.css --load-path node_modules",
|
8
|
+
"test": "dotcom-tool-kit test:local",
|
8
9
|
"commit": "commit-wizard",
|
9
|
-
"prepare": "npx snyk protect || npx snyk protect -d || true"
|
10
|
+
"prepare": "npx snyk protect || npx snyk protect -d || true",
|
11
|
+
"build": "dotcom-tool-kit build:local",
|
12
|
+
"start": "dotcom-tool-kit run:local",
|
13
|
+
"demo-build": "dotcom-tool-kit build:demo -- demo-build",
|
14
|
+
"demo": "dotcom-tool-kit build:demo -- demo",
|
15
|
+
"static-demo": "dotcom-tool-kit build:demo -- static-demo",
|
16
|
+
"deploy-gh": "dotcom-tool-kit deploy:gh-pages"
|
10
17
|
},
|
11
18
|
"repository": {
|
12
19
|
"type": "git",
|
@@ -19,13 +26,19 @@
|
|
19
26
|
},
|
20
27
|
"homepage": "https://github.com/Financial-Times/n-myft-ui#readme",
|
21
28
|
"devDependencies": {
|
29
|
+
"@dotcom-tool-kit/component": "^4.1.2",
|
30
|
+
"@dotcom-tool-kit/doppler": "^1.1.0",
|
31
|
+
"@dotcom-tool-kit/eslint": "^3.2.0",
|
32
|
+
"@dotcom-tool-kit/lint-staged-npm": "^3.2.0",
|
33
|
+
"@dotcom-tool-kit/mocha": "^3.2.0",
|
34
|
+
"@dotcom-tool-kit/pa11y": "^0.5.2",
|
22
35
|
"@financial-times/dotcom-build-base": "^8.2.1",
|
23
36
|
"@financial-times/dotcom-build-code-splitting": "^8.2.1",
|
24
37
|
"@financial-times/dotcom-build-js": "^8.2.1",
|
25
38
|
"@financial-times/dotcom-build-sass": "^8.2.1",
|
26
39
|
"@financial-times/dotcom-server-handlebars": "^8.2.1",
|
40
|
+
"@financial-times/eslint-config-next": "^7.1.0",
|
27
41
|
"@financial-times/n-express": "^28.0.3",
|
28
|
-
"@financial-times/n-gage": "^9.0.1",
|
29
42
|
"ascii-table": "0.0.9",
|
30
43
|
"autoprefixer": "9.7.0",
|
31
44
|
"aws-sdk-mock": "4.5.0",
|
@@ -47,7 +60,7 @@
|
|
47
60
|
"check-engine": "^1.12.0",
|
48
61
|
"css-loader": "^0.23.1",
|
49
62
|
"denodeify": "^1.2.1",
|
50
|
-
"
|
63
|
+
"dotcom-tool-kit": "^3.4.4",
|
51
64
|
"eslint-plugin-react": "^7.33.2",
|
52
65
|
"extract-css-block-webpack-plugin": "^1.3.0",
|
53
66
|
"fetch-mock": "^5.0.3",
|
@@ -63,7 +76,7 @@
|
|
63
76
|
"karma-chrome-launcher": "3.2.0",
|
64
77
|
"karma-firefox-launcher": "^1.0.0",
|
65
78
|
"karma-html-reporter": "^0.2.6",
|
66
|
-
"karma-mocha": "^
|
79
|
+
"karma-mocha": "^2.0.1",
|
67
80
|
"karma-sinon": "^1.0.5",
|
68
81
|
"karma-sinon-chai": "2.0.2",
|
69
82
|
"karma-sourcemap-loader": "^0.3.7",
|
@@ -71,7 +84,7 @@
|
|
71
84
|
"karma-webpack": "^4.0.2",
|
72
85
|
"lintspaces-cli": "^0.7.0",
|
73
86
|
"lolex": "5.1.2",
|
74
|
-
"mocha": "
|
87
|
+
"mocha": "^10.2.0",
|
75
88
|
"mockery": "2.1.0",
|
76
89
|
"node-fetch": "2.6.0",
|
77
90
|
"nodemon": "^1.9.2",
|
@@ -131,9 +144,11 @@
|
|
131
144
|
},
|
132
145
|
"husky": {
|
133
146
|
"hooks": {
|
134
|
-
"commit-msg": "
|
135
|
-
"pre-commit": "
|
136
|
-
"pre-push": "make verify -j3"
|
147
|
+
"commit-msg": "dotcom-tool-kit git:commitmsg",
|
148
|
+
"pre-commit": "dotcom-tool-kit git:precommit"
|
137
149
|
}
|
150
|
+
},
|
151
|
+
"lint-staged": {
|
152
|
+
"**/*.js": "dotcom-tool-kit format:staged test:staged --"
|
138
153
|
}
|
139
154
|
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
chmod +x $0
|
4
|
+
|
5
|
+
# Define the demo-build function
|
6
|
+
demo-build() {
|
7
|
+
# Remove existing directory
|
8
|
+
rm -rf node_modules/@financial-times/n-myft-ui
|
9
|
+
# Create necessary directories
|
10
|
+
mkdir -p node_modules/@financial-times/n-myft-ui/myft
|
11
|
+
# Copy components to the corresponding directory
|
12
|
+
cp -r components node_modules/@financial-times/n-myft-ui/components/
|
13
|
+
# Compile SCSS file to CSS
|
14
|
+
sass demos/src/demo.scss public/main.css --load-path node_modules
|
15
|
+
# Indicate that build is complete
|
16
|
+
echo "Demo build completed."
|
17
|
+
}
|
18
|
+
|
19
|
+
# Define the demo function
|
20
|
+
demo() {
|
21
|
+
# Build the demo
|
22
|
+
demo-build
|
23
|
+
# Run the Node.js application
|
24
|
+
node demos/app
|
25
|
+
}
|
26
|
+
|
27
|
+
# Define the static-demo function
|
28
|
+
static-demo() {
|
29
|
+
# Build the demo
|
30
|
+
demo-build
|
31
|
+
# Execute the shell script to generate the static demo
|
32
|
+
scripts/make-static-demo.sh
|
33
|
+
}
|
34
|
+
|
35
|
+
# Check the first argument passed to the script
|
36
|
+
case "$1" in
|
37
|
+
demo-build)
|
38
|
+
demo-build
|
39
|
+
;;
|
40
|
+
demo)
|
41
|
+
demo
|
42
|
+
;;
|
43
|
+
static-demo)
|
44
|
+
static-demo
|
45
|
+
;;
|
46
|
+
*)
|
47
|
+
# If the argument does not match any of the above options, display an error message
|
48
|
+
echo "Usage: $0 {demo-build|demo|static-demo}"
|
49
|
+
exit 1
|
50
|
+
;;
|
51
|
+
esac
|
52
|
+
|
53
|
+
exit 0
|
@@ -1,13 +1,16 @@
|
|
1
1
|
git config --global user.email "$GITHUB_EMAIL"
|
2
2
|
git config --global user.name "$GITHUB_NAME"
|
3
3
|
|
4
|
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
5
|
+
echo "script dir: $SCRIPT_DIR"
|
6
|
+
|
4
7
|
# hackily remove all identities, and later force the specific identity
|
5
8
|
# otherwise git keeps using the wrong boi
|
6
9
|
ssh-add -D
|
7
10
|
|
8
11
|
git --version
|
9
12
|
|
10
|
-
export GIT_SSH="
|
13
|
+
export GIT_SSH="$SCRIPT_DIR/ssh.sh"
|
11
14
|
|
12
15
|
git clone $CIRCLE_REPOSITORY_URL honk --single-branch
|
13
16
|
|
@@ -18,7 +21,7 @@ git checkout -b gh-pages
|
|
18
21
|
mv ../node_modules .
|
19
22
|
cp ../scripts/* scripts/
|
20
23
|
|
21
|
-
make
|
24
|
+
./make-static-demo.sh
|
22
25
|
|
23
26
|
git add -A .
|
24
27
|
|
@@ -1,6 +1,10 @@
|
|
1
1
|
#!/bin/sh
|
2
2
|
|
3
|
-
|
3
|
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
4
|
+
PUBLIC_DIR="$SCRIPT_DIR/../public"
|
5
|
+
|
6
|
+
|
7
|
+
node "$SCRIPT_DIR/../demos/app" &
|
4
8
|
|
5
9
|
pid="$!"
|
6
10
|
|
@@ -8,6 +12,6 @@ sleep 10
|
|
8
12
|
|
9
13
|
curl http://localhost:5005 | sed 's#/public/main.css#main.css#' | sed 's#href="/"#href="index.html"#' > public/index.html
|
10
14
|
|
11
|
-
mv
|
15
|
+
mv "$PUBLIC_DIR"/* .
|
12
16
|
|
13
17
|
kill $pid
|