Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Feb 19, 2022
1 parent 5ffef38 commit f8889f5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
3 changes: 2 additions & 1 deletion packages/docusaurus-utils-build/bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

import logger from '@docusaurus/logger';
import cli from 'commander';
import {build, watch} from '../lib/index.js';
import build from '../lib/build.js';
import watch from '../lib/watch.js';

cli
.command('build')
Expand Down
7 changes: 6 additions & 1 deletion packages/docusaurus-utils-build/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import {Globby} from '@docusaurus/utils';
import logger from '@docusaurus/logger';
import Prettier from 'prettier';
import shelljs from 'shelljs';
import {compileOrCopy, compileServerCode, compileClientCode} from './compiler';
import {
compileOrCopy,
compileServerCode,
compileClientCode,
// eslint-disable-next-line import/no-unresolved
} from './compiler.js';
// import {tsc} from './tsc';

function transformDir(
Expand Down
11 changes: 0 additions & 11 deletions packages/docusaurus-utils-build/src/index.ts

This file was deleted.

8 changes: 5 additions & 3 deletions packages/docusaurus-utils-build/src/tsc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import fs from 'fs';
import ts from 'typescript';
import {Globby} from '@docusaurus/utils';
import {getTargetPath} from './compiler';
// eslint-disable-next-line import/no-unresolved
import {getTargetPath} from './compiler.js';

const formatHost: ts.FormatDiagnosticsHost = {
getCanonicalFileName: (p) => p,
Expand All @@ -30,7 +31,7 @@ function reportDiagnostic(diagnostic: ts.Diagnostic) {

/**
* Prints a diagnostic every time the watch status changes.
* This is mainly for messages like "Starting compilation" or "Compilation completed".
* This is mainly for messages like "Starting" or "Completed".
*/
function reportWatchStatusChanged(diagnostic: ts.Diagnostic) {
console.info(ts.formatDiagnostic(diagnostic, formatHost));
Expand Down Expand Up @@ -63,7 +64,8 @@ export function watch(): void {
}

/**
* There's no API for unrolling the `extends` field in tsconfig, so we do it ourselves.
* There's no API for unrolling the `extends` field in tsconfig, so we do it
* ourselves.
*/
function resolveCompilerOptions(configEntryPath: string): ts.CompilerOptions {
let configPath: string | undefined = configEntryPath;
Expand Down
11 changes: 8 additions & 3 deletions packages/docusaurus-utils-build/src/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@

import fs from 'fs';
import chokidar from 'chokidar';
import {debounce} from 'lodash';
import _ from 'lodash';
import logger from '@docusaurus/logger';
import {compileOrCopy, compileClientCode, compileServerCode} from './compiler';
import {
compileOrCopy,
compileServerCode,
compileClientCode,
// eslint-disable-next-line import/no-unresolved
} from './compiler.js';

export default async function watch(
options: Partial<{
Expand All @@ -35,7 +40,7 @@ export default async function watch(
pollInterval: 10,
},
});
const compile = debounce((filePath: string) => {
const compile = _.debounce((filePath: string) => {
try {
// TODO: is check this good enough?
if (filePath.includes(themeDir)) {
Expand Down

0 comments on commit f8889f5

Please sign in to comment.