Skip to content
This repository was archived by the owner on Jul 2, 2022. It is now read-only.

Commit 233956a

Browse files
committed
增加了node-webpack项目模板,同时增加可选列表描述
1 parent 2be393c commit 233956a

38 files changed

+5847
-154
lines changed

bin/hardoor.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22
const commander = require("commander");
33
const fs = require("fs-extra");
4-
const pt = require("path");
4+
const ph = require("path");
55
const {install} = require("./npmInstall");
66
const hardoor = require("../package.json");
77

@@ -23,10 +23,10 @@ commander
2323
.option('-a, --auto', "Run `npm i` to install automatically")
2424
.option('-f, --force', "Force overwrite existing files")
2525
.action(function (template, {auto, force}) {
26-
let sourceDir = pt.join(__dirname, "../template/");
26+
let sourceDir = ph.join(__dirname, "../template/");
2727
let dir = fs.readdirSync(sourceDir);
2828
if (dir.includes(template)) {
29-
let sourcePath = pt.join(sourceDir, template);
29+
let sourcePath = ph.join(sourceDir, template);
3030
let targetPath = process.cwd();
3131
fs.copy(sourcePath, targetPath, {overwrite: !!force, errorOnExist: !!!force})
3232
.then(function () {
@@ -46,8 +46,12 @@ commander
4646
.command('list')
4747
.description('View a list of currently available templates')
4848
.action(function () {
49-
let dir = fs.readdirSync(pt.join(__dirname, "../template/"));
50-
console.log(dir.join("\n"));
49+
let templatePath = ph.join(__dirname, "../template/");
50+
let templates = fs.readdirSync(templatePath);
51+
templates.forEach(template => {
52+
let description = require(ph.join(templatePath, template, "package.json")).description;
53+
console.log("[" + template + "]", "---", description, "\n")
54+
});
5155
childFlag = true;
5256
});
5357

template/common-browser/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# common-browser
22

3-
common-browser是一个web项目模板采用原生html开发模式
3+
一个采用原生html开发模式web项目模板
44

55
## 技术栈
66

File renamed without changes.

template/common-browser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@template/common-browser",
33
"version": "1.0.0",
4-
"description": "",
4+
"description": "A web project template using native html development mode",
55
"private": true,
66
"scripts": {
77
"test": "echo \"no test\" && exit 0"

template/common/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# project
22

3-
project是一个web项目模板
3+
一个最简单的web项目模板
44

55
## 技术栈
66

template/common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@template/common",
33
"version": "1.0.0",
4-
"description": "",
4+
"description": "One of the simplest web project templates",
55
"private": true,
66
"scripts": {
77
"test": "echo \"no test\" && exit 0"

template/jquery/index.html

Lines changed: 0 additions & 61 deletions
This file was deleted.

template/jquery/js/main.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

template/jquery/package-lock.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

template/jquery/package.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)