Created
November 28, 2021 18:44
-
-
Save vojtaholik/b06cd9c4c465288a66ddaab49be95c90 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Menu: New Project | |
// Description: Creates new project from template | |
/** @type {import("@johnlindquist/kit")} */ | |
const PROJECTS_DIR = `~/Documents/dev/projects`; | |
const DEFAULT_TEMPLATE_DIR = `${PROJECTS_DIR}/template`; | |
let projectName = await arg("Project name"); | |
let projectTemplate = await arg("Project template", [ | |
"template", | |
"create-react-app", | |
"create-next-app@latest --ts", | |
]); | |
await exec( | |
` | |
cd ${PROJECTS_DIR} | |
${ | |
projectTemplate !== "template" | |
? `npx ${projectTemplate} ${projectName}` | |
: ` | |
mkdir ${projectName} | |
cp -a ${DEFAULT_TEMPLATE_DIR}/. ${projectName}/. | |
` | |
} | |
cd ${projectName} | |
code . | |
` | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment