Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit 96937a9

Browse files
committed
chore: some improvements
1 parent 8e0cab6 commit 96937a9

File tree

22 files changed

+1194
-471
lines changed

22 files changed

+1194
-471
lines changed

core/babel-preset-docz/CHANGELOG.md

Lines changed: 0 additions & 91 deletions
This file was deleted.

core/babel-preset-docz/package.json

Lines changed: 0 additions & 41 deletions
This file was deleted.

core/babel-preset-docz/src/config.ts

Lines changed: 0 additions & 73 deletions
This file was deleted.

core/babel-preset-docz/src/index.ts

Lines changed: 0 additions & 61 deletions
This file was deleted.

core/babel-preset-docz/src/types.d.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

core/babel-preset-docz/tsconfig.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

core/babel-preset-docz/tslint.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

core/docz-core/librc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module.exports = {
1414
plugins: [copy('templates/*.{js,html,json}', 'dist/templates')],
1515
external: Object.keys(pkg.dependencies).concat([
1616
'crypto',
17+
'lodash/fp',
1718
'react-dev-utils/errorOverlayMiddleware',
1819
'react-dev-utils/evalSourceMapMiddleware',
1920
'react-dev-utils/FileSizeReporter',

core/docz-core/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"art-template": "^4.13.2",
3434
"babel-loader": "^8.0.2",
3535
"babel-preset-docz": "^0.13.5",
36+
"babel-plugin-export-metadata": "^0.13.5",
3637
"babylon": "^6.18.0",
3738
"cache-loader": "^1.2.5",
3839
"chalk": "^2.4.1",
@@ -60,6 +61,7 @@
6061
"lodash": "^4.17.11",
6162
"mini-html-webpack-plugin": "^0.2.3",
6263
"p-reduce": "^1.0.0",
64+
"poi": "^12.2.4",
6365
"progress-estimator": "^0.2.2",
6466
"react-dev-utils": "^6.1.1",
6567
"react-docgen-typescript-loader": "^3.0.0-rc.0",

core/docz-core/src/Bundler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import WebpackDevServer from 'webpack-dev-server'
44

55
import { Plugin } from './Plugin'
66
import { Config as Args, Env } from './commands/args'
7-
import { getBabelConfig, BabelRC } from './utils/babel-config'
7+
import { getBabelConfig, BabelRC } from './config/babel'
88
import * as paths from './config/paths'
99

1010
export interface ServerHooks {

core/docz-core/src/DataServer.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import WS from 'ws'
2+
import { isFunction } from 'lodash/fp'
23

34
import { touch } from './utils/fs'
4-
import { isFn } from './utils/helpers'
55
import * as paths from './config/paths'
66
import { onSignal } from './utils/on-signal'
77

@@ -58,7 +58,7 @@ export class DataServer {
5858
await Promise.all(
5959
Array.from(this.states).map(
6060
async state =>
61-
isFn(state.init) &&
61+
isFunction(state.init) &&
6262
state.init({
6363
state: { ...this.state },
6464
setState: this.setState(),
@@ -88,7 +88,7 @@ export class DataServer {
8888
await Promise.all(
8989
Array.from(this.states).map(
9090
async state =>
91-
isFn(state.close) &&
91+
isFunction(state.close) &&
9292
state.close({
9393
state: { ...this.state },
9494
setState: this.setState(),
@@ -100,7 +100,7 @@ export class DataServer {
100100
private handleConnection(socket: WS): () => void {
101101
const states = Array.from(this.states).map(
102102
async state =>
103-
isFn(state.update) &&
103+
isFunction(state.update) &&
104104
state.update({
105105
state: this.state,
106106
setState: this.setState(socket),
@@ -109,7 +109,7 @@ export class DataServer {
109109

110110
return async () => {
111111
const fns = await Promise.all(states.filter(Boolean))
112-
for (const fn of fns) isFn(fn) && fn()
112+
for (const fn of fns) isFunction(fn) && fn()
113113
}
114114
}
115115

core/docz-core/src/Entries.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import glob from 'fast-glob'
55

66
import * as paths from './config/paths'
77
import { touch, compiled } from './utils/fs'
8-
import { mapToObj } from './utils/helpers'
98

109
import { Entry, EntryObj } from './Entry'
1110
import { Plugin } from './Plugin'
@@ -14,6 +13,12 @@ import { getRepoEditUrl } from './utils/repo-info'
1413

1514
export const fromTemplates = (file: string) => path.join(paths.templates, file)
1615

16+
const mapToObj = (map: Map<any, any>) =>
17+
Array.from(map.entries()).reduce(
18+
(obj, [key, value]) => ({ ...obj, [`${key}`]: value }),
19+
{}
20+
)
21+
1722
const matchFilesWithSrc = (config: Config) => (files: string[]) => {
1823
const src = path.relative(paths.root, config.src)
1924
return files.map(file => (file.startsWith(src) ? file : path.join(src, file)))

0 commit comments

Comments
 (0)