Open boilerplate-gitlab in Script Kit

// Name: Gitlab
// Menu: Gitlab Boilerplate Repository
// Description: Create a new Gitlab repository
// Shortcut: command option g
// Author: Joël Grimberg
// Twitter: @joelgrimberg
import "@johnlindquist/kit";
import fs from "fs";
const filenamify = await npm("filenamify");
/** @type {typeof import("filenamify")} */
const GITLAB_USER = await env(
"GITLAB_USER",
"please enter your Gitlab username"
);
const GITLAB_AUTH_TOKEN = await env(
"GITLAB_AUTH_TOKEN",
"please enter your Gitlab Auth token"
);
const GITLAB_BOILERPLATE_FOLDER = await env(
"gitlabBoilerplateFolder",
"please enter the location you want to save your boilerplate folder"
);
const NPM_AUTHOR_NAME = await env(
"NPM_AUTHOR_NAME",
"please enter your NPM author name"
);
const boilerplateProject = await arg({
pleaceholder: "please enter the name of your project",
hint: "name of repository",
});
const project = filenamify(boilerplateProject);
const boilerplateDescription = await arg({
placeholder: `project description`,
hint: "a description oneliner",
});
const pwd = `${GITLAB_BOILERPLATE_FOLDER}/${project}`;
//TODO
fs.mkdirSync(pwd);
cd(pwd);
await $`npm init -y -init-author-name='${NPM_AUTHOR_NAME}'`;
await $`git init`;
await $`echo "/node_modules" > .gitignore`;
await $`npm install cypress --save-dev`;
await $`echo '
<h1 align="center"><a href="https://blog.joelgrimberg.dev">🚀 ${project}</a></h1>' > README.md`;
await $`git add .`;
await $`git commit -m 'initial commit'`;
await $`git remote add origin git@gitlab.com:${GITLAB_USER}/${project}.git`;
await $`curl --silent --header "PRIVATE-TOKEN: ${GITLAB_AUTH_TOKEN}" \
-XPOST "https://gitlab.com/api/v4/projects?name=${project}&visibility=private&initialize_with_readme=false" | jq '.id'`;
await $`git push --set-upstream origin main`;
edit(`README.md`, pwd);
browse(`https://gitlab.com/${GITLAB_USER}/${project}`);