refactor: remove a lot of implicit anys (#7468)

This commit is contained in:
Joshua Chen 2022-05-23 15:40:53 +08:00 committed by GitHub
parent 0c8e57de67
commit 3666a2ede5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 148 additions and 163 deletions

View file

@ -5,19 +5,27 @@
* LICENSE file in the root directory of this source tree.
*/
// @ts-check
import fs from 'fs-extra';
import shell from 'shelljs';
const NODE_MAJOR_VERSION = parseInt(process.versions.node.split('.')[0], 10);
const NODE_MAJOR_VERSION = parseInt(
/** @type {string} */ (process.versions.node.split('.')[0]),
10,
);
if (NODE_MAJOR_VERSION < 16) {
throw new Error(
'This generateExamples Docusaurus script requires at least Node.js 16 and npm 7. See why here: https://github.com/facebook/docusaurus/pull/5722#issuecomment-948847891',
);
}
// Generate one example per init template
// We use those generated examples as CodeSandbox projects
// See https://github.com/facebook/docusaurus/issues/1699
/**
* Generate one example per init template
* We use those generated examples as CodeSandbox projects
* See https://github.com/facebook/docusaurus/issues/1699
* @param {string} template
*/
async function generateTemplateExample(template) {
try {
console.log(
@ -103,6 +111,12 @@ async function generateTemplateExample(template) {
* Button visible here: https://jamstack.org/generators/
*/
function updateStarters() {
/**
* @param {Object} param0
* @param {string} param0.subfolder
* @param {string} param0.remote
* @param {string} param0.remoteBranch
*/
function forcePushGitSubtree({subfolder, remote, remoteBranch}) {
console.log('');
// See https://stackoverflow.com/questions/33172857/how-do-i-force-a-subtree-push-to-overwrite-remote-changes