Skip to content

Commit

Permalink
fix(docz-core): use react from parent directory (#1053)
Browse files Browse the repository at this point in the history
* 2.0.0-rc.21
  • Loading branch information
rakannimer authored Sep 1, 2019
1 parent 9a322a0 commit b55b786
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 17 deletions.
3 changes: 2 additions & 1 deletion core/docz-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docz-core",
"version": "2.0.0-rc.12",
"version": "2.0.0-rc.21",
"description": "All docz core logic of bundle and parsing is included on this package",
"license": "MIT",
"main": "dist/index.js",
Expand All @@ -17,6 +17,7 @@
"fix": "yarn lint --fix",
"lint": "yarn eslint . --ext .ts,.tsx",
"precommit": "lint-staged",
"prepare": "yarn build",
"test": "yarn jest"
},
"dependencies": {
Expand Down
12 changes: 9 additions & 3 deletions core/docz-core/src/bundler/machine/services/create-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ const writeGatsbyConfig = async ({ args, isDoczRepo }: ServerMachineCtx) => {
})
}

const writeGatsbyConfigNode = async () => {
const outputPath = path.join(paths.docz, 'gatsby-node.js')
await outputFileFromTemplate('gatsby-node.tpl.js', outputPath)
}

const copyGatsbyConfigFile = async (from: string, to: string) => {
const filepath = path.join(paths.root, from)
const dest = path.join(paths.docz, to)
Expand All @@ -78,8 +83,8 @@ const copyGatsbyConfigFile = async (from: string, to: string) => {
const writeGatsbyConfigCustom = async () =>
copyGatsbyConfigFile('gatsby-config.js', 'gatsby-config.custom.js')

const writeGatsbyNode = async () =>
copyGatsbyConfigFile('gatsby-node.js', 'gatsby-node.js')
const writeGatsbyNodeCustom = async () =>
copyGatsbyConfigFile('gatsby-node.js', 'gatsby-node.custom.js')

const writeGatsbySSR = async () =>
copyGatsbyConfigFile('gatsby-ssr.js', 'gatsby-ssr.js')
Expand All @@ -95,8 +100,9 @@ export const createResources = async (ctx: ServerMachineCtx) => {
await writeEslintRc(ctx)
await writeNotFound()
await writeGatsbyConfig(ctx)
await writeGatsbyConfigNode()
await writeGatsbyConfigCustom()
await writeGatsbyNode()
await writeGatsbyNodeCustom()
await writeGatsbyBrowser()
await writeGatsbySSR()
} catch (err) {
Expand Down
4 changes: 2 additions & 2 deletions core/docz-core/src/utils/create-deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ const getCoreDeps = async ({ isDoczRepo }: ServerMachineCtx, pkg: any) => {
export const createDeps = async (ctx: ServerMachineCtx) => {
const filepath = path.join(paths.root, 'package.json')
const pkg = await fs.readJSON(filepath, { throws: false })

const dependencies = pkg.dependencies
return {
dependencies: pkg.dependencies,
dependencies,
devDependencies: {
...pkg.devDependencies,
...(await getDeps(REQUIRED_DEV_DEPS, ctx, pkg)),
Expand Down
11 changes: 11 additions & 0 deletions core/docz-core/templates/gatsby-node.tpl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const path = require('path')

exports.onCreateWebpackConfig = ({ actions }) => {
actions.setWebpackConfig({
resolve: {
alias: {
react: path.resolve('../node_modules/react'),
},
},
})
}
4 changes: 2 additions & 2 deletions core/docz/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docz",
"version": "2.0.0-rc.12",
"version": "2.0.0-rc.21",
"description": "It's has never been so easy to documents your things!",
"license": "MIT",
"main": "dist/index.js",
Expand Down Expand Up @@ -28,7 +28,7 @@
"array-sort": "^1.0.0",
"capitalize": "^2.0.0",
"docz-components": "^2.0.0-rc.12",
"docz-core": "^2.0.0-rc.12",
"docz-core": "^2.0.0-rc.21",
"fast-deep-equal": "^2.0.1",
"gatsby": "^2.13.27",
"lodash": "^4.17.14",
Expand Down
4 changes: 2 additions & 2 deletions core/gatsby-theme-docz/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-theme-docz",
"version": "2.0.0-rc.12",
"version": "2.0.0-rc.21",
"description": "Gatsby theme created to use Docz",
"license": "MIT",
"author": "Pedro Nauck (pedronauck@gmail.com)",
Expand Down Expand Up @@ -46,7 +46,7 @@
"rehype-slug": "^2.0.3",
"remark-docz": "^2.0.0-rc.1",
"remark-frontmatter": "^1.3.2",
"theme-ui": "^0.2.14",
"theme-ui": "^0.2.38",
"typescript": "3.5.3",
"typography-theme-moraga": "^0.16.19",
"yargs": "^13.3.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"scheduler": "^0.15.0"
},
"devDependencies": {
"docz": "2.0.0-rc.9"
"docz": "next"
}
}
2 changes: 1 addition & 1 deletion examples/flow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"devDependencies": {
"@babel/preset-flow": "^7.0.0",
"docz": "2.0.0-rc.9",
"docz": "next",
"flow-bin": "^0.102.0",
"flow-typed": "^2.6.0"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/images/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"scheduler": "^0.15.0"
},
"devDependencies": {
"docz": "2.0.0-rc.9"
"docz": "next"
}
}
2 changes: 1 addition & 1 deletion examples/now/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"scheduler": "^0.15.0"
},
"devDependencies": {
"docz": "2.0.0-rc.9",
"docz": "next",
"now": "^16.1.2"
}
}
2 changes: 1 addition & 1 deletion examples/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
},
"devDependencies": {
"@babel/core": "^7.5.5",
"docz": "2.0.0-rc.9"
"docz": "next"
}
}
2 changes: 1 addition & 1 deletion examples/styled-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"styled-components": "^4.3.2"
},
"devDependencies": {
"docz": "2.0.0-rc.9"
"docz": "next"
}
}
2 changes: 1 addition & 1 deletion examples/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"devDependencies": {
"@types/react": "^16.8.23",
"@types/react-dom": "^16.8.4",
"docz": "2.0.0-rc.9"
"docz": "next"
}
}

0 comments on commit b55b786

Please sign in to comment.