@diplodoc/cli 4.6.0-alpha-1 → 4.6.0-alpha-3

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Yandex Data UI Team <data-ui@yandex-team.ru>",
4
4
  "description": "Make documentation using yfm-docs in Markdown and HTML formats",
5
5
  "license": "MIT",
6
- "version": "4.6.0-alpha-1",
6
+ "version": "4.6.0-alpha-3",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git@github.com:diplodoc-platform/cli.git"
@@ -107,16 +107,11 @@
107
107
  },
108
108
  "pkg": {
109
109
  "scripts": [
110
- "build/index.js",
111
- "build/linter.js",
112
- "build/plugins/*.js",
113
- "build/lint-rules/*.js",
114
- "build/default-lint-config.js",
115
- "build/head-content.js"
110
+ "./build/*.js",
111
+ "./build/**/*.js"
116
112
  ],
117
113
  "assets": [
118
- "build/app.client.js",
119
- "build/app.client.css"
114
+ "./assets/*"
120
115
  ]
121
116
  },
122
117
  "keywords": [
package/src/constants.ts CHANGED
@@ -1,4 +1,4 @@
1
- import {dirname} from 'path';
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 BUILD_FOLDER = 'build';
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 client.assets) {
28
- shell.cp(path, outputBundlePath);
29
- }
27
+ shell.cp(ASSETS_FOLDER + '/*', outputBundlePath);
30
28
  }
@@ -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
- import client from '../../scripts/client';
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,8 +48,8 @@ export function generateStaticMarkup(
44
48
  height: 100vh;
45
49
  }
46
50
  </style>
47
- ${client.bundle
48
- .css(pathToBundle)
51
+ ${manifest.css
52
+ .map(dst(pathToBundle))
49
53
  .map((src: string) => `<link type="text/css" rel="stylesheet" href="${src}" />`)
50
54
  .join('\n')}
51
55
  ${PluginService.getHeadContent()}
@@ -57,8 +61,8 @@ export function generateStaticMarkup(
57
61
  window.STATIC_CONTENT = ${staticContent}
58
62
  window.__DATA__ = ${JSON.stringify(props)};
59
63
  </script>
60
- ${client.bundle
61
- .js(pathToBundle)
64
+ ${manifest.js
65
+ .map(dst(pathToBundle))
62
66
  .map(
63
67
  (src: string) =>
64
68
  `<script type="application/javascript" src="${src}"></script>`,