publish(omi-cli): v3.4.13, remove spa template

This commit is contained in:
dntzhang 2019-10-18 18:30:35 +08:00
parent 7882465ce1
commit 9b5ec1c1ea
40 changed files with 2 additions and 120 deletions

View File

@ -33,7 +33,6 @@ Directory description:
|Mobile Template|`omi init-weui my-app`| Mobile web app template with weui and omi-router.|
|omi-mp Template(omi-cli v3.0.13+)|`omi init-mp my-app` |Developing web with mini program template.|
|MVVM Template(omi-cli v3.0.22+)|`omi init-mvvm my-app` |MVVM template.|
<!-- |[SPA Template](https://tencent.github.io/omi/packages/omi-router/examples/spa/build/)(omi-cli v3.0.10+)|`omi init-spa my-app`|Single page application template with omi-router.| -->
## Switch omi, omio and reomi

View File

@ -58,18 +58,6 @@ program
switchCommand(cmd, { project: projectName, mirror: options.mirror, language: options.language });
});
program
.command('init-spa [projectName]')
.description('Initialize a new SPA with omi-router in the current folder')
.action(function(projectName, option){
var cmd = 'init-spa';
if (option.parent.mirror && typeof option.parent.mirror === 'string') {
options.mirror = option.parent.mirror;
}
switchCommand(cmd, { project: projectName, mirror: options.mirror, language: options.language });
})
program
.command('init-weui [projectName]')
@ -176,7 +164,7 @@ function help() {
console.log(` ${chalk.green('init-kbone [project-name]')} Initialize a new omi kbone project in the current folder `)
console.log(` ${chalk.green('init-ts [project-name]')} Initialize a new omi project with typescript in the current folder `)
console.log(` ${chalk.green('init-weui [project-name]')} Initialize a mobile project with weui in the current folder `)
console.log(` ${chalk.green('init-spa [project-name]')} Initialize a new omi spa with omi-router in the current folder `)
console.log(` ${chalk.green('init-mp [project-name]')} Initialize a new omi-mp in the current folder `)
console.log(` ${chalk.green('init-md2site [project-name]')} Initialize a project of static site generator by markdown in the current folder `)
console.log();

View File

@ -1,105 +0,0 @@
var path = require("path");
var join = path.join;
var basename = path.basename;
var fs = require("fs");
var vfs = require("vinyl-fs");
var renameSync = fs.renameSync;
var existsSync = fs.existsSync;
var chalk = require("chalk");
var through = require("through2");
var emptyDir = require("empty-dir");
var info = require("./logger").info;
var error = require("./logger").error;
var success = require("./logger").success;
var isCnFun = require("./utils").isCnFuc;
var emptyFs = require("./utils").emptyFs;
var isSafeToCreateProjectIn = require("./utils").isSafeToCreateProjectIn;
function init(args) {
var omiCli = chalk.bold.cyan("Omi-Cli");
var isCn = isCnFun(args.language);
var customPrjName = args.project || "";
var tpl = join(__dirname, "../template/spa");
var dest = join(process.cwd(), customPrjName);
var projectName = basename(dest);
var mirror = args.mirror;
console.log();
console.log(omiCli + (!isCn ? " is booting... " : " 正在启动..."));
console.log(
omiCli +
(!isCn ? " will execute init command... " : " 即将执行 init 命令...")
);
if (existsSync(dest) && !emptyDir.sync(dest)) {
if (!isSafeToCreateProjectIn(dest, projectName)) {
process.exit(1);
}
}
createApp();
function createApp() {
console.log();
console.log(
chalk.bold.cyan("Omi-Cli") +
(!isCn
? " will creating a new omi app in "
: " 即将创建一个新的应用在 ") +
dest
);
vfs
.src(["**/*", "!node_modules/**/*"], {
cwd: tpl,
cwdbase: true,
dot: true
})
.pipe(template(dest, tpl))
.pipe(vfs.dest(dest))
.on("end", function() {
try {
info("Rename", "gitignore -> .gitignore");
renameSync(join(dest, "gitignore"), join(dest, ".gitignore"));
if (customPrjName) {
try {
process.chdir(customPrjName);
} catch (err) {
console.log(error(err));
}
}
info(
"Install",
"We will install dependencies, if you refuse, press ctrl+c to abort, and install dependencies by yourself. :>"
);
console.log();
require("./install")(mirror, done);
} catch (e) {
console.log(error(e));
}
})
.resume();
}
function done() {
console.log();
console.log();
console.log();
success(`Congratulation! "${projectName}" has been created successfully! `);
console.log();
console.log(`${chalk.bold.cyan("Omi Spa")} https://github.com/Tencent/omi`);
}
}
function template(dest, cwd) {
return through.obj(function(file, enc, cb) {
if (!file.stat.isFile()) {
return cb();
}
info("Copy", file.path.replace(cwd + "/", ""));
this.push(file);
cb();
});
}
module.exports = init;

View File

@ -1,6 +1,6 @@
{
"name": "omi-cli",
"version": "3.4.12",
"version": "3.4.13",
"description": "Create website, app with no build configuration. be friendly to [Omi](https://github.com/Tencent/omi) framework.",
"main": "bin/omi",
"engines": {

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 145 KiB