chore: regenerate beta.6 examples + fix regen script (#5484)

* update examples script

* rename ext

* typo

* update examples

* fix script to update starters

* update examples

* add --allow-empty so that script does not fail if nothing changed

* fix lint
This commit is contained in:
Sébastien Lorber 2021-09-03 16:54:06 +02:00 committed by GitHub
parent 52844f2b01
commit 3d05ec2e4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
125 changed files with 14341 additions and 3257 deletions

View file

@ -102,25 +102,45 @@ See https://github.com/jamstack/jamstack.org/pull/609
Button visible here: https://jamstack.org/generators/
*/
function updateStarters() {
execSync(
'git subtree push --prefix examples/classic --squash origin starter',
);
console.log(
'Update success for https://github.com/facebook/docusaurus/tree/starter',
);
try {
execSync(
'git subtree push --prefix examples/classic --squash git@github.com:slorber/docusaurus-starter.git main --squash',
);
console.log(
'Update success for https://github.com/slorber/docusaurus-starter',
);
} catch {
console.error(
'could not update https://github.com/slorber/docusaurus-starter , ask permission to @slorber if needed',
);
function forcePushGitSubtree({subfolder, remote, remoteBranch}) {
console.log('');
// See https://stackoverflow.com/questions/33172857/how-do-i-force-a-subtree-push-to-overwrite-remote-changes
const command = `git push ${remote} \`git subtree split --prefix ${subfolder}\`:${remoteBranch} --force`;
try {
console.log(`forcePushGitSubtree command: ${command}`);
execSync(command);
console.log('forcePushGitSubtree success!');
} catch (e) {
console.error(
`Can't force push to git subtree with command '${command}'`,
);
console.error(`If it's a permission problem, ask @slorber`);
console.error(e);
}
console.log('');
}
console.log('');
console.log('Updating https://github.com/facebook/docusaurus/tree/starter');
forcePushGitSubtree({
subfolder: 'examples/classic',
remote: 'origin',
remoteBranch: 'starter',
});
console.log('');
console.log('');
// TODO replace by starter repo in Docusaurus-community org (if we get it)
console.log('Updating https://github.com/slorber/docusaurus-starter');
forcePushGitSubtree({
subfolder: 'examples/classic',
remote: 'git@github.com:slorber/docusaurus-starter.git',
remoteBranch: 'main',
});
console.log('');
}
function run() {
@ -155,12 +175,15 @@ function run() {
console.log('-------');
console.log('## Generate example folders...');
console.log('');
const data = readdirSync('./packages/docusaurus-init/templates');
const templates = data.filter((i) => i !== 'README.MD');
const excludes = ['README.md', 'shared'];
const templates = readdirSync('./packages/docusaurus-init/templates').filter(
(name) => !excludes.includes(name),
);
console.log(`Will generate examples for templates: ${templates}`);
templates.forEach(generateTemplateExample);
console.log('Commiting changes');
execSync('git add examples');
execSync("git commit -am 'update examples'");
execSync("git commit -am 'update examples' --allow-empty");
console.log('');
// update starters