project generators & project scaffold
project generators & project scaffold
how to write a node cli & Project Scaffold
https://www.sitepoint.com/scaffolding-tool-caporal-js/
Copying the Template Files
shellJS
http://documentup.com/shelljs/shelljs#cpoptions-source--source--dest
if (fs.existsSync(templatePath)) {
logger.info('Copying files…');
shell.cp('-R', `${templatePath}/*`, localPath);
logger.info(' The files have been copied!');
} else {
logger.error(`The requested template for ${args.template} wasn't found.`)
process.exit(1);
}
https://medium.com/northcoders/creating-a-project-generator-with-node-29e13b3cd309
https://javascriptplayground.com/writing-a-command-line-node-tool/
select options
checkbox
https://www.sitepoint.com/javascript-command-line-interface-cli-node-js/
https://github.com/sitepoint-editors/ginit
creating directories
https://scotch.io/tutorials/building-cli-applications-with-nodejs
mkd directory_name
# Create a new directory and enter it
function mkd() {
mkdir -p "$@" && cd "$_";
}
shit live share bug
stuck
babel 7.0.0
https://babeljs.io/setup#installation
https://babeljs.io/setup#installation
shell
https://github.com/shelljs/shelljs#cpoptions-source--source--dest
https://github.com/shelljs/shelljs#shellstringstr
hui-cli
https://www.sitepoint.com/javascript-command-line-interface-cli-node-js/
https://github.com/sitepoint-editors/ginit
https://www.npmjs.com/package/clui
ASCII Art
https://www.npmjs.com/package/figlet
https://github.com/patorjk/figlet.js
dependencies & devDependencies
$ npm i -D app-node-env commander shelljs colors
$ npm i -D inquirer optionator chalk
$ npm i -D @babel/cli @babel/core @babel/preset-env rimraf
$ npm i -D clear clui figlet
css grid
view-source:https://junon.me/
html,
body {
margin: auto 0;
padding: auto 0;
width: 100vw;
height: 100vh;
}
body {
display: grid;
grid-template-rows: 1fr 1fr 1fr;
grid-template-columns: 1fr auto 1fr;
font-family: "Anonymous Pro", monospace;
font-size: 1rem;
background: #111;
}
body>.master {
color: #EEE;
text-shadow: 1px 0 0 rgba(0, 0, 0, 0.2),
-1px 0 0 rgba(0, 0, 0, 0.2),
0 1px 0 rgba(0, 0, 0, 0.2),
0 -1px 0 rgba(0, 0, 0, 0.2),
1px 1px rgba(0, 0, 0, 0.2),
-1px -1px 0 rgba(0, 0, 0, 0.2),
1px -1px 0 rgba(0, 0, 0, 0.2),
-1px 1px 0 rgba(0, 0, 0, 0.2);
}
body>div {
grid-row: 2 / 3;
grid-column: 2 / 3;
margin: 1rem;
}
.master>div,
#shift>div>div {
margin-top: 2rem;
}
body * {
position: relative;
transition: transform 2s cubic-bezier(0, .97, .31, 1.15);
}
#shift {
user-select: none;
}
#shift>* {
mix-blend-mode: screen;
position: absolute;
width: 100%;
}
.code {
padding: 0.5rem;
background: #222;
text-shadow: none;
color: #ffd300;
}
.code::before {
color: #ff007b;
text-shadow: none;
content: '$ ';
}
hr {
visibility: hidden;
margin: 2rem 0;
}
.master h1,
.master hr {
border: 0;
border-bottom: 1px dashed #ff007b;
visibility: visible;
}
h1 {
padding-bottom: 1rem;
}
a {
color: inherit;
}
.social {
display: flex;
align-items: center;
justify-content: center;
font-size: 4rem;
}
refs
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/10930225.html
未经授权禁止转载,违者必究!