-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix(gatsby-theme-docz): add missing source sans pro font (#991) * fix(gatsby-theme-docz): replace fragment tag to the short syntax (#992) * fix(docz-example-basic): add explicit dependency to scheduler * fix(docz): make scheduler dependency explicit * docs(docz-example-basic): add instructions to quickly run the example * fix(docz-example-typescript): add scheduler dep and docs #1020 * fix(docz-example-typescript): add scheduler dep and docs * fix(docz-example-flow): add @babel/preset-flow with onCreateBabelConfig * docs(docz-example-flow): add setup instructions * Fix flow example, add setup doc (#1021) * fix(docz-example-basic): add explicit dependency to scheduler * fix(docz): make scheduler dependency explicit * docs(docz-example-basic): add instructions to quickly run the example * fix(docz-example-typescript): add scheduler dep and docs * fix(docz-example-flow): add @babel/preset-flow with onCreateBabelConfig * docs(docz-example-flow): add setup instructions * Update Gatsby example (#1022) * fix(docz-example-basic): add explicit dependency to scheduler * fix(docz): make scheduler dependency explicit * docs(docz-example-basic): add instructions to quickly run the example * fix(docz-example-typescript): add scheduler dep and docs * fix(docz-example-flow): add @babel/preset-flow with onCreateBabelConfig * docs(docz-example-flow): add setup instructions * fix(docz-example-gatsby): make gatsby example runnable outside repo * docs(docz-example-gatsby): add setup instructions * fix(docz): remove window check from useCurrentDoc fixes #985 (#1023) * feat(docz-core): setup jest and add first test * test(docz): add tests for states.config and states.entries * ci(docz): add circleci tests (#1027) * fix(gatsby-theme-docz): fix minor linting issue * feat(docz): add circleci * chore(docz): add bootstrap to ci * ci(docz): clear cache * ci(docz): add build step to install * ci(docz): build only * ci(docz-core): try without build * ci(docz-core): remove __tests__ from include * ci(docz-core): add build * ci(docz-core): back to packages * fix(docz-example-typescript): add externally usable tsconfig * fix(docz-example-typescript): add extension of tsx file in mdx * docs(docz): add link to v1 * docs(docz): add create-docz-app to examples * fix(docz-example-flow): add scheduler dep * fix(docz-example-styled-components): add scheduler and remove caaf * docs(docz-example-react-native): add scheduler temp * docs(docz-example-images): add scheduler temp * fix(docz-core): wait for app to be ready before opening the browser * fix(docz-core): extend base config instead of overwriting user config (#1028) * chore(docz-core): typo * chore(docz): bump version to 2.0.0-rc.2 * test(docz): loosen up test temporarily * chore(docz-core): prefix scripts with yarn * chore(docz): add release:next script * chore(docz): lerna version fix * v2.0.0-rc.2 * chore(docz): bump to 2.0.0-rc.3 * 2.0.0-rc.4 * 2.0.0-rc.5
- Loading branch information
1 parent
dd09a9a
commit e2286ac
Showing
47 changed files
with
3,434 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Javascript Node CircleCI 2.0 configuration file | ||
# | ||
# Check https://circleci.com/docs/2.0/language-javascript/ for more details | ||
# | ||
version: 2 | ||
jobs: | ||
build: | ||
docker: | ||
- image: circleci/node:8.12 | ||
# Specify service dependencies here if necessary | ||
# CircleCI maintains a library of pre-built images | ||
# documented at https://circleci.com/docs/2.0/circleci-images/ | ||
# - image: circleci/mongo:3.4.4 | ||
|
||
working_directory: ~/repo | ||
|
||
steps: | ||
- checkout | ||
|
||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
- v4-dependencies-{{ checksum "package.json" }} | ||
# fallback to using the latest cache if no exact match is found | ||
- v4-dependencies- | ||
|
||
- run: yarn install && yarn bs && yarn packages | ||
|
||
- save_cache: | ||
paths: | ||
- node_modules | ||
key: v3-dependencies-{{ checksum "package.json" }} | ||
|
||
# run tests! | ||
- run: yarn ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
{ | ||
"plugins": ["lodash"] | ||
"plugins": ["lodash"], | ||
"presets": [ | ||
"@babel/preset-typescript", | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"node": "current" | ||
} | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { setArgs } from '../src/config/argv' | ||
import { getBaseConfig } from '../src/config/docz' | ||
describe('config.argv & config.docz', () => { | ||
test('works', () => { | ||
const yargs = { | ||
argv: {}, | ||
option: jest.fn().mockImplementation((key, value) => { | ||
yargs.argv[value.alias ? value.alias : key] = value | ||
return yargs | ||
}), | ||
} | ||
const { argv } = setArgs(yargs) | ||
// expect(argv).toMatchInlineSnapshot(`undefined`) | ||
//@ts-ignore | ||
getBaseConfig(argv, {}) | ||
// expect(c) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import * as states from '../src/states/index' | ||
import { createConfigStateInput } from '../src/test-utils/data-bank' | ||
import { getBaseConfig } from '../src/config/docz' | ||
import * as paths from '../src/config/paths' | ||
import { Entries } from '../src/lib/Entries' | ||
import { setArgs } from '../src/config/argv' | ||
|
||
describe('states', () => { | ||
test('exports', () => { | ||
expect(states).toBeDefined() | ||
expect(typeof states.config).toEqual('function') | ||
expect(typeof states.entries).toEqual('function') | ||
expect(typeof states.props).toEqual('function') | ||
}) | ||
}) | ||
|
||
describe('states.config', () => { | ||
test('config returns valid state', () => { | ||
const state = states.config({}) | ||
expect(typeof state.close).toEqual('function') | ||
expect(typeof state.start).toEqual('function') | ||
expect(state.id).toEqual('config') | ||
state.close() | ||
}) | ||
test('config state writes config to state when started', async () => { | ||
const config = createConfigStateInput() | ||
const setState = jest.fn() | ||
const getState = jest.fn() | ||
const state = states.config(config) | ||
await state.start({ getState, setState }) | ||
delete config.paths | ||
delete config.src | ||
expect(setState).toBeCalledWith('config', expect.objectContaining(config)) | ||
state.close() | ||
}) | ||
}) | ||
|
||
describe('states.entries', () => { | ||
test('entries returns start-able state', async () => { | ||
const yargs = { | ||
argv: {}, | ||
option: jest.fn().mockImplementation((key, value) => { | ||
yargs.argv[value.alias ? value.alias : key] = value.default | ||
return yargs | ||
}), | ||
} | ||
const { argv } = setArgs(yargs) | ||
//@ts-ignore | ||
const config = { ...getBaseConfig(argv), paths } | ||
const entries = new Entries(config) | ||
const state = states.entries(entries, config) | ||
const setState = jest.fn() | ||
const getState = jest.fn() | ||
await state.start({ getState, setState }) | ||
expect(getState).toBeCalledWith() | ||
// expect(setState).toBeCalledWith('entries', []) | ||
state.close() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 11 additions & 2 deletions
13
core/docz-core/src/bundler/machine/services/exec-dev-command.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
import spawn from 'cross-spawn' | ||
import sh from 'shelljs' | ||
|
||
import waitOn from 'wait-on' | ||
import { ServerMachineCtx } from '../context' | ||
import { openBrowser } from '../../../utils/open-browser' | ||
import * as paths from '../../../config/paths' | ||
|
||
export const execDevCommand = async ({ args }: ServerMachineCtx) => { | ||
sh.cd(paths.docz) | ||
spawn('yarn', ['dev', '--port', `${args.port}`], { stdio: 'inherit' }) | ||
openBrowser(`http://${args.host}:${args.port}`) | ||
const url = `http://${args.host}:${args.port}` | ||
console.log() | ||
console.log('Building app') | ||
await waitOn({ | ||
resources: [url], | ||
timeout: 30000, | ||
}) | ||
console.log() | ||
console.log('App ready on ' + url) | ||
openBrowser(url) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Config } from '../config/argv' | ||
import * as paths from '../config/paths' | ||
// let a: Config | ||
export const createConfigStateInput = () => { | ||
return ({ | ||
title: 'test-tile', | ||
description: 'test-desc', | ||
menu: [{ name: 'menu-name' }], | ||
paths, | ||
native: undefined, | ||
themeConfig: undefined, | ||
separator: undefined, | ||
src: 'src/', | ||
} as unknown) as Config | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.