I just created my first script with ScriptKit. This script boilerplates a repo and pushes it to my GitHub account.

Open Boilerplate Repo in Script Kit

this is my 0.1 version, so still iterating.

import "@johnlindquist/kit";
// Menu: Boilerplate repository
// Description: Create a new github repository
// Shortcut: command option control b
// Author: Joël Grimberg
// Twitter: @joelgrimberg
import fs from "fs";
const open = await npm("open");
const { Octokit } = await npm("@octokit/rest");
const simpleGit = await npm("simple-git");
const boilerplateFolder = await env(
"BOILERPLATE_DIR",
`What's the path to the boilerplate directory on this machine?`
);
const githubAuthToken = await env(
"githubAuthToken",
`Please enter the GitHub token`
);
const octokit = new Octokit({
auth: githubAuthToken,
});
const project = await arg({
placeholder: `What is the name of the project?`,
hint: "repo-name",
ignoreBlur: true,
});
const description = await arg({
placeholder: `What is the description of the project?`,
hint: "description",
ignoreBlur: true,
});
octokit.rest.repos.createForAuthenticatedUser({
name: project,
});
if (!fs.existsSync(boilerplateFolder)) {
fs.mkdirSync(boilerplateFolder);
}
const pwd = `${boilerplateFolder}/${project}`;
fs.mkdirSync(pwd);
const options = {
baseDir: pwd,
binary: "git",
maxConcurrentProcesses: 6,
};
const git = simpleGit(options);
await git
.init()
.addRemote("origin", `git@github.com:joelgrimberg/${project}.git`);
await $`cd ${pwd} && npm init -y -init-author-name='Joël Grimberg <joel@joelgrimberg.nl> (https://blog.joelgrimberg.dev)'`;
await $`cd ${pwd} && npm install cypress --save-dev`;
await $`cd ${pwd} && echo '
<h1 align="center"><a href="https://blog.joelgrimberg.dev">🚀 ${project}</a></h1>' > README.md`;
await $`cd ${pwd} && echo -n "## ${description}" >> README.md`;
await $`echo "node_modules/" > ${pwd}/.gitignore`;
await git.add(".").commit("initial commit");
await $`cd ${pwd} && git push --set-upstream origin main`;
edit(`${pwd}/README.md`, pwd);
browse(`https://github.com/joelgrimberg/${project}`);