Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions core/docz-core/src/bundler/machine/services/create-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,22 @@ const copyAndModifyPkgJson = async (ctx: ServerMachineCtx) => {
await fs.outputJSON(movePath, newPkg, { spaces: 2 })
}

const writeEslintRc = async ({ isDoczRepo }: ServerMachineCtx) => {
if (!isDoczRepo) return
const filepath = path.join(paths.docz, '.eslintrc')
await fs.outputJSON(filepath, { extends: 'react-app' })
const writeEslintRc = async () => {
const possibleFilenames = [
'.eslintrc.js',
'.eslintrc.yaml',
'.eslintrc.yml',
'.eslintrc.json',
'.eslintrc',
]
for (const filename of possibleFilenames) {
const filepath = path.join(paths.root, filename)
const dest = path.join(paths.docz, filename)
if (fs.pathExistsSync(filepath)) {
await fs.copy(filepath, dest)
return
}
}
}

const copyEslintIgnore = async () => {
Expand Down Expand Up @@ -108,7 +120,7 @@ export const createResources = async (ctx: ServerMachineCtx) => {
try {
copyDoczRc(ctx.args.config)
await copyAndModifyPkgJson(ctx)
await writeEslintRc(ctx)
await writeEslintRc()
await copyEslintIgnore()
await writeNotFound()
await writeGatsbyConfig(ctx)
Expand Down
12 changes: 8 additions & 4 deletions core/docz-core/src/bundler/machine/services/exec-dev-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@ export const execDevCommand = async ({ args }: ServerMachineCtx) => {
// For monorepos that install dependencies higher in the fs tree
const repoRootPath = get(args, 'repoRootPath', await findRootPath())
const gatsbyPath = path.join(repoRootPath, 'node_modules/.bin/gatsby')
spawn(gatsbyPath, ['develop', '--host', `${args.host}`, '--port', `${args.port}`], {
stdio: 'inherit',
cwd: paths.docz,
})
spawn(
gatsbyPath,
['develop', '--host', `${args.host}`, '--port', `${args.port}`],
{
stdio: 'inherit',
cwd: paths.docz,
}
)
const url = `http://${args.host}:${args.port}`
console.log()
console.log('Building app')
Expand Down