@financial-times/n-myft-ui 24.0.0 → 24.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/build-state/npm-shrinkwrap.json +218 -609
- package/demos/app.js +19 -26
- package/demos/templates/demo-layout.html +1 -1
- package/demos/templates/demo.html +436 -413
- package/package.json +5 -5
- package/demos/fixtures/follow-button-plus-digest.json +0 -6
- package/demos/templates/digest-on-follow.html +0 -12
package/demos/app.js
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
require('sucrase/register');
|
2
|
-
const
|
2
|
+
const nExpress = require('@financial-times/n-express');
|
3
3
|
const chalk = require('chalk');
|
4
4
|
const errorHighlight = chalk.bold.red;
|
5
5
|
const highlight = chalk.bold.green;
|
6
6
|
const { PageKitReactJSX } = require('@financial-times/dotcom-server-react-jsx');
|
7
7
|
const fs = require('fs');
|
8
8
|
const path = require('path');
|
9
|
-
const xHandlebars = require('@financial-times/x-handlebars');
|
10
9
|
const handlebars = require('handlebars');
|
11
|
-
const { helpers } = require('@financial-times/dotcom-server-handlebars');
|
10
|
+
const { PageKitHandlebars, helpers } = require('@financial-times/dotcom-server-handlebars');
|
12
11
|
|
13
12
|
const demoJSX = require('./templates/demo').default;
|
14
13
|
const demoLayoutSource = fs.readFileSync(path.join(__dirname, './templates/demo-layout.html'),'utf8').toString();
|
@@ -22,32 +21,38 @@ const fixtures = {
|
|
22
21
|
instantAlert: require('./fixtures/instant-alert')
|
23
22
|
};
|
24
23
|
|
25
|
-
const app = module.exports =
|
24
|
+
const app = module.exports = nExpress({
|
26
25
|
name: 'public',
|
27
26
|
systemCode: 'n-myft-ui-demo',
|
28
27
|
withFlags: true,
|
29
|
-
|
30
|
-
|
28
|
+
withConsent: false,
|
29
|
+
withServiceMetrics: false,
|
31
30
|
withAnonMiddleware: false,
|
32
31
|
hasHeadCss: false,
|
33
|
-
layoutsDir: 'demos/templates',
|
34
|
-
viewsDirectory: '/demos/templates',
|
35
32
|
partialsDirectory: process.cwd(),
|
36
33
|
directory: process.cwd(),
|
37
34
|
demo: true,
|
38
|
-
|
39
|
-
helpers: {
|
40
|
-
x: xHandlebars(),
|
41
|
-
renderReactComponent: helpers.renderReactComponent
|
42
|
-
},
|
35
|
+
withBackendAuthentication: false,
|
43
36
|
});
|
44
37
|
|
38
|
+
app.set('views', path.join(__dirname, '/templates'));
|
39
|
+
app.set('view engine', '.html');
|
40
|
+
|
41
|
+
app.engine('.html', new PageKitHandlebars({
|
42
|
+
cache: false,
|
43
|
+
handlebars,
|
44
|
+
helpers: {
|
45
|
+
...helpers
|
46
|
+
}
|
47
|
+
}).engine);
|
48
|
+
|
49
|
+
app.use('/public', nExpress.static(path.join(__dirname, '../public'), { redirect: false }));
|
50
|
+
|
45
51
|
const jsxRenderer = (new PageKitReactJSX({ includeDoctype: false }));
|
46
52
|
|
47
53
|
app.get('/', (req, res) => {
|
48
54
|
res.render('demo', Object.assign({
|
49
55
|
title: 'n-myft-ui demo',
|
50
|
-
layout: 'demo-layout',
|
51
56
|
flags: {
|
52
57
|
myFtApi: true,
|
53
58
|
myFtApiWrite: true
|
@@ -58,7 +63,6 @@ app.get('/', (req, res) => {
|
|
58
63
|
app.get('/demo-jsx', async (req, res) => {
|
59
64
|
let demo = await jsxRenderer.render(demoJSX, Object.assign({
|
60
65
|
title: 'n-myft-ui demo',
|
61
|
-
layout: 'demo-layout',
|
62
66
|
flags: {
|
63
67
|
myFtApi: true,
|
64
68
|
myFtApiWrite: true
|
@@ -71,17 +75,6 @@ app.get('/demo-jsx', async (req, res) => {
|
|
71
75
|
res.send(result);
|
72
76
|
});
|
73
77
|
|
74
|
-
app.get('/digest-on-follow', (req, res) => {
|
75
|
-
res.render('digest-on-follow', Object.assign({
|
76
|
-
title: 'n-myft-ui digest on follow',
|
77
|
-
layout: 'demo-layout',
|
78
|
-
flags: {
|
79
|
-
myFtApi: true,
|
80
|
-
myFtApiWrite: true,
|
81
|
-
},
|
82
|
-
appIsStreamPage: false
|
83
|
-
}, fixtures.followButtonPlusDigest));
|
84
|
-
});
|
85
78
|
|
86
79
|
function runPa11yTests () {
|
87
80
|
const spawn = require('child_process').spawn;
|