refactor(pwa): simplify registerSW code, fix ESLint errors (#7579)

This commit is contained in:
Joshua Chen 2022-06-07 21:42:17 +08:00 committed by GitHub
parent bada5c11cc
commit 7869e74fd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 204 additions and 247 deletions

View file

@ -34,19 +34,19 @@ cli
.option('--mdx', 'try to migrate MD to MDX too')
.option('--page', 'try to migrate pages too')
.description('Migrate between versions of Docusaurus website.')
.action((siteDir = '.', newDir = '.', {mdx, page} = {}) => {
.action(async (siteDir = '.', newDir = '.', {mdx, page} = {}) => {
const sitePath = path.resolve(siteDir);
const newSitePath = path.resolve(newDir);
migrateDocusaurusProject(sitePath, newSitePath, mdx, page);
await migrateDocusaurusProject(sitePath, newSitePath, mdx, page);
});
cli
.command('mdx [siteDir] [newDir]')
.description('Migrate markdown files to MDX.')
.action((siteDir = '.', newDir = '.') => {
.action(async (siteDir = '.', newDir = '.') => {
const sitePath = path.resolve(siteDir);
const newSitePath = path.resolve(newDir);
migrateMDToMDX(sitePath, newSitePath);
await migrateMDToMDX(sitePath, newSitePath);
});
cli.parse(process.argv);