mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-03 16:59:06 +02:00
chore(v2): fix TS definition & workspaces config
This commit is contained in:
parent
99a58263ca
commit
d52e6d3c3f
5 changed files with 17 additions and 6 deletions
|
@ -3,7 +3,8 @@
|
|||
"workspaces": [
|
||||
"packages/*",
|
||||
"website",
|
||||
"website-1.x"
|
||||
"website-1.x",
|
||||
"packages/docusaurus/templates/*"
|
||||
],
|
||||
"scripts": {
|
||||
"start": "yarn tsc && yarn start:v2",
|
||||
|
|
|
@ -13,7 +13,7 @@ import path from 'path';
|
|||
import _ from 'lodash';
|
||||
import {execSync} from 'child_process';
|
||||
|
||||
function hasYarn() {
|
||||
function hasYarn(): Boolean {
|
||||
try {
|
||||
execSync('yarnpkg --version', {stdio: 'ignore'});
|
||||
return true;
|
||||
|
@ -22,11 +22,11 @@ function hasYarn() {
|
|||
}
|
||||
}
|
||||
|
||||
function isValidGitRepoUrl(gitRepoUrl) {
|
||||
function isValidGitRepoUrl(gitRepoUrl): Boolean {
|
||||
return gitRepoUrl.startsWith('https://') || gitRepoUrl.startsWith('git@');
|
||||
}
|
||||
|
||||
async function updatePkg(pkgPath, obj) {
|
||||
async function updatePkg(pkgPath: string, obj): Promise<void> {
|
||||
const content = await fs.readFile(pkgPath, 'utf-8');
|
||||
const pkg = JSON.parse(content);
|
||||
const newPkg = Object.assign(pkg, obj);
|
||||
|
@ -87,7 +87,7 @@ export async function init(
|
|||
const {gitRepoUrl} = await inquirer.prompt({
|
||||
type: 'input',
|
||||
name: 'gitRepoUrl',
|
||||
validate: url => {
|
||||
validate: (url?: string) => {
|
||||
if (url && isValidGitRepoUrl(url)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ export async function loadRoutes(pluginsRouteConfigs: RouteConfig[]) {
|
|||
}
|
||||
|
||||
function genRouteChunkNames(
|
||||
value: RouteModule | Module | null | undefined,
|
||||
value: RouteModule | RouteModule[] | Module | null | undefined,
|
||||
prefix?: string,
|
||||
name?: string,
|
||||
) {
|
||||
|
|
8
packages/docusaurus/templates/README.MD
Normal file
8
packages/docusaurus/templates/README.MD
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Templates
|
||||
|
||||
Official templates provided by Docusaurus. They are designed to be selected when using the `docusaurus init` CLI command.
|
||||
|
||||
## Guide to Test Templates for Developer
|
||||
|
||||
1. `yarn install` in the root of the repo (one level above this directory).
|
||||
1. Go to any template's directory, example: `cd classic && yarn start`.
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"name": "docusaurus-2-classic-template",
|
||||
"version": "2.0.0-alpha.16",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue