@diplodoc/cli 4.5.1 → 4.6.0-alpha-2
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.
- package/build/index.js +180 -216
- package/build/index.js.map +4 -4
- package/build/linter.js +71 -105
- package/build/linter.js.map +4 -4
- package/build/pkg.json +9 -0
- package/package.json +3 -4
- package/src/constants.ts +2 -6
- package/src/steps/processAssets.ts +3 -5
- package/src/utils/markup.ts +16 -5
- package/build/app.client.css +0 -2684
- package/build/app.client.js +0 -3
package/src/constants.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {resolve} from 'path';
|
|
2
2
|
const os = require('os');
|
|
3
3
|
const notes = require('@diplodoc/transform/lib/plugins/notes');
|
|
4
4
|
const anchors = require('@diplodoc/transform/lib/plugins/anchors');
|
|
@@ -24,10 +24,8 @@ includes.collect = require('@diplodoc/transform/lib/plugins/includes/collect');
|
|
|
24
24
|
images.collect = require('@diplodoc/transform/lib/plugins/images/collect');
|
|
25
25
|
changelog.collect = require('@diplodoc/transform/lib/plugins/changelog/collect');
|
|
26
26
|
|
|
27
|
-
export const
|
|
27
|
+
export const ASSETS_FOLDER = resolve(__dirname, '..', 'assets');
|
|
28
28
|
export const BUNDLE_FOLDER = '_bundle';
|
|
29
|
-
export const BUNDLE_JS_FILENAME = 'app.client.js';
|
|
30
|
-
export const BUNDLE_CSS_FILENAME = 'app.client.css';
|
|
31
29
|
export const TMP_INPUT_FOLDER = '.tmp_input';
|
|
32
30
|
export const TMP_OUTPUT_FOLDER = '.tmp_output';
|
|
33
31
|
export const MAIN_TIMER_ID = 'Build time';
|
|
@@ -67,8 +65,6 @@ export enum ResourceType {
|
|
|
67
65
|
script = 'script',
|
|
68
66
|
}
|
|
69
67
|
|
|
70
|
-
export const BUILD_FOLDER_PATH = dirname(require.resolve('@diplodoc/client'));
|
|
71
|
-
|
|
72
68
|
export const YFM_PLUGINS = [
|
|
73
69
|
meta,
|
|
74
70
|
deflist,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import walkSync from 'walk-sync';
|
|
2
2
|
import shell from 'shelljs';
|
|
3
3
|
|
|
4
|
-
import client from '../../scripts/client';
|
|
5
4
|
import {ArgvService} from '../services';
|
|
6
5
|
import {copyFiles} from '../utils';
|
|
7
6
|
|
|
7
|
+
import {ASSETS_FOLDER} from '../constants';
|
|
8
|
+
|
|
8
9
|
/**
|
|
9
10
|
* Processes assets files (everything except .yaml and .md files)
|
|
10
11
|
* @param {string} outputBundlePath
|
|
@@ -23,8 +24,5 @@ export function processAssets(outputBundlePath: string) {
|
|
|
23
24
|
|
|
24
25
|
/* Copy js bundle to user' output folder */
|
|
25
26
|
shell.mkdir('-p', outputBundlePath);
|
|
26
|
-
|
|
27
|
-
for (const path of Object.values(client.dst)) {
|
|
28
|
-
shell.cp(path, outputBundlePath);
|
|
29
|
-
}
|
|
27
|
+
shell.cp(ASSETS_FOLDER + '/*', outputBundlePath);
|
|
30
28
|
}
|
package/src/utils/markup.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {join} from 'path';
|
|
1
2
|
import {platform} from 'process';
|
|
2
3
|
|
|
3
4
|
import {CUSTOM_STYLE, Platforms, ResourceType} from '../constants';
|
|
@@ -5,7 +6,10 @@ import {Resources, SinglePageResult} from '../models';
|
|
|
5
6
|
import {ArgvService, PluginService} from '../services';
|
|
6
7
|
import {preprocessPageHtmlForSinglePage} from './singlePage';
|
|
7
8
|
import {DocInnerProps, DocPageData, render} from '@diplodoc/client';
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
import manifest from '@diplodoc/client/manifest';
|
|
11
|
+
|
|
12
|
+
const dst = (bundlePath: string) => (target: string) => join(bundlePath, target);
|
|
9
13
|
|
|
10
14
|
export interface TitleMeta {
|
|
11
15
|
title?: string;
|
|
@@ -44,7 +48,10 @@ export function generateStaticMarkup(
|
|
|
44
48
|
height: 100vh;
|
|
45
49
|
}
|
|
46
50
|
</style>
|
|
47
|
-
|
|
51
|
+
${manifest.css
|
|
52
|
+
.map(dst(pathToBundle))
|
|
53
|
+
.map((src: string) => `<link type="text/css" rel="stylesheet" href="${src}" />`)
|
|
54
|
+
.join('\n')}
|
|
48
55
|
${PluginService.getHeadContent()}
|
|
49
56
|
${resources}
|
|
50
57
|
</head>
|
|
@@ -54,9 +61,13 @@ export function generateStaticMarkup(
|
|
|
54
61
|
window.STATIC_CONTENT = ${staticContent}
|
|
55
62
|
window.__DATA__ = ${JSON.stringify(props)};
|
|
56
63
|
</script>
|
|
57
|
-
|
|
58
|
-
pathToBundle
|
|
59
|
-
|
|
64
|
+
${manifest.js
|
|
65
|
+
.map(dst(pathToBundle))
|
|
66
|
+
.map(
|
|
67
|
+
(src: string) =>
|
|
68
|
+
`<script type="application/javascript" src="${src}"></script>`,
|
|
69
|
+
)
|
|
70
|
+
.join('\n')}
|
|
60
71
|
</body>
|
|
61
72
|
</html>
|
|
62
73
|
`;
|