Skip to content

Instantly share code, notes, and snippets.

@plastic041
Last active May 23, 2021 06:41
Show Gist options
  • Save plastic041/cf6ff70ae0895cfe2d446ac2691a41d9 to your computer and use it in GitHub Desktop.
Save plastic041/cf6ff70ae0895cfe2d446ac2691a41d9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
const execa = require('execa');
const path = require('path');
const yargs = require('yargs-parser');
const {name} = yargs(process.argv);
if (Boolean(name)) {
console.log('argv.name exists!');
} else {
console.log('argv.name does not exists...');
}
console.log('start scaffolding');
(async () => {
console.log(`yarn create @vitejs/app ${name} --template react-ts`);
const {stdout} = await execa('yarn', ['create', '@vitejs/app', name, '--template', 'react-ts']);
console.log(stdout);
const targetDir = path.join(process.cwd(), `/${name}`);
console.log('current:' + process.cwd());
console.log(targetDir);
const yarnOptions = {
cwd: targetDir,
}
console.log('yarn install');
await execa('yarn', ['install'], yarnOptions);
console.log('yarn add -D tailwindcss@latest postcss@latest autoprefixer@latest');
await execa('yarn', ['add', '-D', 'tailwindcss@latest', 'postcss@latest', 'autoprefixer@latest'], yarnOptions);
console.log('npx tailwindcss init -p');
await execa('npx', ['tailwindcss', 'init', '-p'], yarnOptions);
//console.log('npx gts init');
//await execa('npx', ['gts', 'init'], yarnOptions);
console.log('done');
})();
{
"name": "scaf-vrttg",
"version": "0.0.0",
"bin": "./index.js",
"dependencies": {
"execa": "^5.0.0",
"yargs-parser": "^20.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment