mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-01 10:22:30 +02:00
refactor: convert CLI entry points to ESM; migrate create-docusaurus to ESM (#6661)
* refactor: convert CLI entry points to ESM * fix * fix * fix * fix! * create-docusaurus ESM * fix lock * final touchups * fix lodash * fix * use lodash * fix hasYarn
This commit is contained in:
parent
eacc695542
commit
67918e35e2
12 changed files with 85 additions and 54 deletions
|
@ -8,14 +8,15 @@
|
|||
|
||||
// @ts-check
|
||||
|
||||
const logger = require('@docusaurus/logger').default;
|
||||
const semver = require('semver');
|
||||
const cli = require('commander');
|
||||
const path = require('path');
|
||||
import logger from '@docusaurus/logger';
|
||||
import semver from 'semver';
|
||||
import cli from 'commander';
|
||||
import path from 'path';
|
||||
import {createRequire} from 'module';
|
||||
import {migrateDocusaurusProject, migrateMDToMDX} from '../lib/index.js';
|
||||
|
||||
const requiredVersion = require('../package.json').engines.node;
|
||||
|
||||
const {migrateDocusaurusProject, migrateMDToMDX} = require('../lib');
|
||||
const requiredVersion = createRequire(import.meta.url)('../package.json')
|
||||
.engines.node;
|
||||
|
||||
function wrapCommand(fn) {
|
||||
return (...args) =>
|
||||
|
@ -50,6 +51,7 @@ cli
|
|||
const newSitePath = path.resolve(newDir);
|
||||
wrapCommand(migrateMDToMDX)(sitePath, newSitePath);
|
||||
});
|
||||
|
||||
cli.parse(process.argv);
|
||||
|
||||
if (!process.argv.slice(2).length) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue