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

Commit

Permalink
chore: some improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Dec 21, 2018
1 parent 8e0cab6 commit 96937a9
Show file tree
Hide file tree
Showing 22 changed files with 1,194 additions and 471 deletions.
91 changes: 0 additions & 91 deletions core/babel-preset-docz/CHANGELOG.md

This file was deleted.

41 changes: 0 additions & 41 deletions core/babel-preset-docz/package.json

This file was deleted.

73 changes: 0 additions & 73 deletions core/babel-preset-docz/src/config.ts

This file was deleted.

61 changes: 0 additions & 61 deletions core/babel-preset-docz/src/index.ts

This file was deleted.

10 changes: 0 additions & 10 deletions core/babel-preset-docz/src/types.d.ts

This file was deleted.

11 changes: 0 additions & 11 deletions core/babel-preset-docz/tsconfig.json

This file was deleted.

3 changes: 0 additions & 3 deletions core/babel-preset-docz/tslint.json

This file was deleted.

1 change: 1 addition & 0 deletions core/docz-core/librc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
plugins: [copy('templates/*.{js,html,json}', 'dist/templates')],
external: Object.keys(pkg.dependencies).concat([
'crypto',
'lodash/fp',
'react-dev-utils/errorOverlayMiddleware',
'react-dev-utils/evalSourceMapMiddleware',
'react-dev-utils/FileSizeReporter',
Expand Down
2 changes: 2 additions & 0 deletions core/docz-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"art-template": "^4.13.2",
"babel-loader": "^8.0.2",
"babel-preset-docz": "^0.13.5",
"babel-plugin-export-metadata": "^0.13.5",
"babylon": "^6.18.0",
"cache-loader": "^1.2.5",
"chalk": "^2.4.1",
Expand Down Expand Up @@ -60,6 +61,7 @@
"lodash": "^4.17.11",
"mini-html-webpack-plugin": "^0.2.3",
"p-reduce": "^1.0.0",
"poi": "^12.2.4",
"progress-estimator": "^0.2.2",
"react-dev-utils": "^6.1.1",
"react-docgen-typescript-loader": "^3.0.0-rc.0",
Expand Down
2 changes: 1 addition & 1 deletion core/docz-core/src/Bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import WebpackDevServer from 'webpack-dev-server'

import { Plugin } from './Plugin'
import { Config as Args, Env } from './commands/args'
import { getBabelConfig, BabelRC } from './utils/babel-config'
import { getBabelConfig, BabelRC } from './config/babel'
import * as paths from './config/paths'

export interface ServerHooks {
Expand Down
10 changes: 5 additions & 5 deletions core/docz-core/src/DataServer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import WS from 'ws'
import { isFunction } from 'lodash/fp'

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

Expand Down Expand Up @@ -58,7 +58,7 @@ export class DataServer {
await Promise.all(
Array.from(this.states).map(
async state =>
isFn(state.init) &&
isFunction(state.init) &&
state.init({
state: { ...this.state },
setState: this.setState(),
Expand Down Expand Up @@ -88,7 +88,7 @@ export class DataServer {
await Promise.all(
Array.from(this.states).map(
async state =>
isFn(state.close) &&
isFunction(state.close) &&
state.close({
state: { ...this.state },
setState: this.setState(),
Expand All @@ -100,7 +100,7 @@ export class DataServer {
private handleConnection(socket: WS): () => void {
const states = Array.from(this.states).map(
async state =>
isFn(state.update) &&
isFunction(state.update) &&
state.update({
state: this.state,
setState: this.setState(socket),
Expand All @@ -109,7 +109,7 @@ export class DataServer {

return async () => {
const fns = await Promise.all(states.filter(Boolean))
for (const fn of fns) isFn(fn) && fn()
for (const fn of fns) isFunction(fn) && fn()
}
}

Expand Down
7 changes: 6 additions & 1 deletion core/docz-core/src/Entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import glob from 'fast-glob'

import * as paths from './config/paths'
import { touch, compiled } from './utils/fs'
import { mapToObj } from './utils/helpers'

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

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

const mapToObj = (map: Map<any, any>) =>
Array.from(map.entries()).reduce(
(obj, [key, value]) => ({ ...obj, [`${key}`]: value }),
{}
)

const matchFilesWithSrc = (config: Config) => (files: string[]) => {
const src = path.relative(paths.root, config.src)
return files.map(file => (file.startsWith(src) ? file : path.join(src, file)))
Expand Down
Loading

0 comments on commit 96937a9

Please sign in to comment.