From 9b5ec1c1ea29318349577d1d98726ddc9d9f09ee Mon Sep 17 00:00:00 2001 From: dntzhang Date: Fri, 18 Oct 2019 18:30:35 +0800 Subject: [PATCH] publish(omi-cli): v3.4.13, remove spa template --- packages/omi-cli/README.md | 1 - packages/omi-cli/bin/omi | 14 +-- packages/omi-cli/lib/init-spa.js | 105 ------------------ packages/omi-cli/package.json | 2 +- .../template => templates-old}/spa/.eslintrc | 0 .../spa/config/entry.js | 0 .../spa/config/env.js | 0 .../spa/config/jest/cssTransform.js | 0 .../spa/config/jest/fileTransform.js | 0 .../spa/config/paths.js | 0 .../spa/config/polyfills.js | 0 .../spa/config/webpack.config.dev.js | 0 .../spa/config/webpack.config.prod.js | 0 .../spa/config/webpackDevServer.config.js | 0 .../template => templates-old}/spa/gitignore | 0 .../spa/package.json | 0 .../spa/public/favicon.ico | Bin .../spa/public/index.html | 0 .../spa/public/manifest.json | 0 .../spa/scripts/build.js | 0 .../spa/scripts/start.js | 0 .../spa/scripts/test.js | 0 .../spa/src/assets/_normalize.css | 0 .../spa/src/assets/index.css | 0 .../spa/src/assets/register-service-worker.js | 0 .../spa/src/elements/app/index.js | 0 .../src/elements/common/app-frame/_index.css | 0 .../src/elements/common/app-frame/index.js | 0 .../src/elements/common/app-frame/logo.png | Bin .../spa/src/elements/views/home-page/index.js | 0 .../views/nav1/omi-weui-page/index.js | 0 .../views/nav2/omi-router-page/index.js | 0 .../elements/views/not-found-page/index.js | 0 .../spa/src/index.js | 0 .../spa/src/route/error.js | 0 .../spa/src/route/index.js | 0 .../spa/src/route/nav1.js | 0 .../spa/src/route/nav2.js | 0 .../spa/src/route/route.js | 0 .../spa/src/store/app-store.js | 0 40 files changed, 2 insertions(+), 120 deletions(-) delete mode 100755 packages/omi-cli/lib/init-spa.js rename packages/{omi-cli/template => templates-old}/spa/.eslintrc (100%) rename packages/{omi-cli/template => templates-old}/spa/config/entry.js (100%) rename packages/{omi-cli/template => templates-old}/spa/config/env.js (100%) rename packages/{omi-cli/template => templates-old}/spa/config/jest/cssTransform.js (100%) rename packages/{omi-cli/template => templates-old}/spa/config/jest/fileTransform.js (100%) rename packages/{omi-cli/template => templates-old}/spa/config/paths.js (100%) rename packages/{omi-cli/template => templates-old}/spa/config/polyfills.js (100%) rename packages/{omi-cli/template => templates-old}/spa/config/webpack.config.dev.js (100%) rename packages/{omi-cli/template => templates-old}/spa/config/webpack.config.prod.js (100%) rename packages/{omi-cli/template => templates-old}/spa/config/webpackDevServer.config.js (100%) rename packages/{omi-cli/template => templates-old}/spa/gitignore (100%) rename packages/{omi-cli/template => templates-old}/spa/package.json (100%) rename packages/{omi-cli/template => templates-old}/spa/public/favicon.ico (100%) rename packages/{omi-cli/template => templates-old}/spa/public/index.html (100%) rename packages/{omi-cli/template => templates-old}/spa/public/manifest.json (100%) rename packages/{omi-cli/template => templates-old}/spa/scripts/build.js (100%) rename packages/{omi-cli/template => templates-old}/spa/scripts/start.js (100%) rename packages/{omi-cli/template => templates-old}/spa/scripts/test.js (100%) rename packages/{omi-cli/template => templates-old}/spa/src/assets/_normalize.css (100%) rename packages/{omi-cli/template => templates-old}/spa/src/assets/index.css (100%) rename packages/{omi-cli/template => templates-old}/spa/src/assets/register-service-worker.js (100%) rename packages/{omi-cli/template => templates-old}/spa/src/elements/app/index.js (100%) rename packages/{omi-cli/template => templates-old}/spa/src/elements/common/app-frame/_index.css (100%) rename packages/{omi-cli/template => templates-old}/spa/src/elements/common/app-frame/index.js (100%) rename packages/{omi-cli/template => templates-old}/spa/src/elements/common/app-frame/logo.png (100%) rename packages/{omi-cli/template => templates-old}/spa/src/elements/views/home-page/index.js (100%) rename packages/{omi-cli/template => templates-old}/spa/src/elements/views/nav1/omi-weui-page/index.js (100%) rename packages/{omi-cli/template => templates-old}/spa/src/elements/views/nav2/omi-router-page/index.js (100%) rename packages/{omi-cli/template => templates-old}/spa/src/elements/views/not-found-page/index.js (100%) rename packages/{omi-cli/template => templates-old}/spa/src/index.js (100%) rename packages/{omi-cli/template => templates-old}/spa/src/route/error.js (100%) rename packages/{omi-cli/template => templates-old}/spa/src/route/index.js (100%) rename packages/{omi-cli/template => templates-old}/spa/src/route/nav1.js (100%) rename packages/{omi-cli/template => templates-old}/spa/src/route/nav2.js (100%) rename packages/{omi-cli/template => templates-old}/spa/src/route/route.js (100%) rename packages/{omi-cli/template => templates-old}/spa/src/store/app-store.js (100%) diff --git a/packages/omi-cli/README.md b/packages/omi-cli/README.md index 451470fe8..c97161d27 100644 --- a/packages/omi-cli/README.md +++ b/packages/omi-cli/README.md @@ -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.| - ## Switch omi, omio and reomi diff --git a/packages/omi-cli/bin/omi b/packages/omi-cli/bin/omi index ff1e130ba..2648a4b45 100755 --- a/packages/omi-cli/bin/omi +++ b/packages/omi-cli/bin/omi @@ -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(); diff --git a/packages/omi-cli/lib/init-spa.js b/packages/omi-cli/lib/init-spa.js deleted file mode 100755 index 2b97d05cd..000000000 --- a/packages/omi-cli/lib/init-spa.js +++ /dev/null @@ -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; diff --git a/packages/omi-cli/package.json b/packages/omi-cli/package.json index 1b2d63e25..fbd9e4dab 100755 --- a/packages/omi-cli/package.json +++ b/packages/omi-cli/package.json @@ -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": { diff --git a/packages/omi-cli/template/spa/.eslintrc b/packages/templates-old/spa/.eslintrc similarity index 100% rename from packages/omi-cli/template/spa/.eslintrc rename to packages/templates-old/spa/.eslintrc diff --git a/packages/omi-cli/template/spa/config/entry.js b/packages/templates-old/spa/config/entry.js similarity index 100% rename from packages/omi-cli/template/spa/config/entry.js rename to packages/templates-old/spa/config/entry.js diff --git a/packages/omi-cli/template/spa/config/env.js b/packages/templates-old/spa/config/env.js similarity index 100% rename from packages/omi-cli/template/spa/config/env.js rename to packages/templates-old/spa/config/env.js diff --git a/packages/omi-cli/template/spa/config/jest/cssTransform.js b/packages/templates-old/spa/config/jest/cssTransform.js similarity index 100% rename from packages/omi-cli/template/spa/config/jest/cssTransform.js rename to packages/templates-old/spa/config/jest/cssTransform.js diff --git a/packages/omi-cli/template/spa/config/jest/fileTransform.js b/packages/templates-old/spa/config/jest/fileTransform.js similarity index 100% rename from packages/omi-cli/template/spa/config/jest/fileTransform.js rename to packages/templates-old/spa/config/jest/fileTransform.js diff --git a/packages/omi-cli/template/spa/config/paths.js b/packages/templates-old/spa/config/paths.js similarity index 100% rename from packages/omi-cli/template/spa/config/paths.js rename to packages/templates-old/spa/config/paths.js diff --git a/packages/omi-cli/template/spa/config/polyfills.js b/packages/templates-old/spa/config/polyfills.js similarity index 100% rename from packages/omi-cli/template/spa/config/polyfills.js rename to packages/templates-old/spa/config/polyfills.js diff --git a/packages/omi-cli/template/spa/config/webpack.config.dev.js b/packages/templates-old/spa/config/webpack.config.dev.js similarity index 100% rename from packages/omi-cli/template/spa/config/webpack.config.dev.js rename to packages/templates-old/spa/config/webpack.config.dev.js diff --git a/packages/omi-cli/template/spa/config/webpack.config.prod.js b/packages/templates-old/spa/config/webpack.config.prod.js similarity index 100% rename from packages/omi-cli/template/spa/config/webpack.config.prod.js rename to packages/templates-old/spa/config/webpack.config.prod.js diff --git a/packages/omi-cli/template/spa/config/webpackDevServer.config.js b/packages/templates-old/spa/config/webpackDevServer.config.js similarity index 100% rename from packages/omi-cli/template/spa/config/webpackDevServer.config.js rename to packages/templates-old/spa/config/webpackDevServer.config.js diff --git a/packages/omi-cli/template/spa/gitignore b/packages/templates-old/spa/gitignore similarity index 100% rename from packages/omi-cli/template/spa/gitignore rename to packages/templates-old/spa/gitignore diff --git a/packages/omi-cli/template/spa/package.json b/packages/templates-old/spa/package.json similarity index 100% rename from packages/omi-cli/template/spa/package.json rename to packages/templates-old/spa/package.json diff --git a/packages/omi-cli/template/spa/public/favicon.ico b/packages/templates-old/spa/public/favicon.ico similarity index 100% rename from packages/omi-cli/template/spa/public/favicon.ico rename to packages/templates-old/spa/public/favicon.ico diff --git a/packages/omi-cli/template/spa/public/index.html b/packages/templates-old/spa/public/index.html similarity index 100% rename from packages/omi-cli/template/spa/public/index.html rename to packages/templates-old/spa/public/index.html diff --git a/packages/omi-cli/template/spa/public/manifest.json b/packages/templates-old/spa/public/manifest.json similarity index 100% rename from packages/omi-cli/template/spa/public/manifest.json rename to packages/templates-old/spa/public/manifest.json diff --git a/packages/omi-cli/template/spa/scripts/build.js b/packages/templates-old/spa/scripts/build.js similarity index 100% rename from packages/omi-cli/template/spa/scripts/build.js rename to packages/templates-old/spa/scripts/build.js diff --git a/packages/omi-cli/template/spa/scripts/start.js b/packages/templates-old/spa/scripts/start.js similarity index 100% rename from packages/omi-cli/template/spa/scripts/start.js rename to packages/templates-old/spa/scripts/start.js diff --git a/packages/omi-cli/template/spa/scripts/test.js b/packages/templates-old/spa/scripts/test.js similarity index 100% rename from packages/omi-cli/template/spa/scripts/test.js rename to packages/templates-old/spa/scripts/test.js diff --git a/packages/omi-cli/template/spa/src/assets/_normalize.css b/packages/templates-old/spa/src/assets/_normalize.css similarity index 100% rename from packages/omi-cli/template/spa/src/assets/_normalize.css rename to packages/templates-old/spa/src/assets/_normalize.css diff --git a/packages/omi-cli/template/spa/src/assets/index.css b/packages/templates-old/spa/src/assets/index.css similarity index 100% rename from packages/omi-cli/template/spa/src/assets/index.css rename to packages/templates-old/spa/src/assets/index.css diff --git a/packages/omi-cli/template/spa/src/assets/register-service-worker.js b/packages/templates-old/spa/src/assets/register-service-worker.js similarity index 100% rename from packages/omi-cli/template/spa/src/assets/register-service-worker.js rename to packages/templates-old/spa/src/assets/register-service-worker.js diff --git a/packages/omi-cli/template/spa/src/elements/app/index.js b/packages/templates-old/spa/src/elements/app/index.js similarity index 100% rename from packages/omi-cli/template/spa/src/elements/app/index.js rename to packages/templates-old/spa/src/elements/app/index.js diff --git a/packages/omi-cli/template/spa/src/elements/common/app-frame/_index.css b/packages/templates-old/spa/src/elements/common/app-frame/_index.css similarity index 100% rename from packages/omi-cli/template/spa/src/elements/common/app-frame/_index.css rename to packages/templates-old/spa/src/elements/common/app-frame/_index.css diff --git a/packages/omi-cli/template/spa/src/elements/common/app-frame/index.js b/packages/templates-old/spa/src/elements/common/app-frame/index.js similarity index 100% rename from packages/omi-cli/template/spa/src/elements/common/app-frame/index.js rename to packages/templates-old/spa/src/elements/common/app-frame/index.js diff --git a/packages/omi-cli/template/spa/src/elements/common/app-frame/logo.png b/packages/templates-old/spa/src/elements/common/app-frame/logo.png similarity index 100% rename from packages/omi-cli/template/spa/src/elements/common/app-frame/logo.png rename to packages/templates-old/spa/src/elements/common/app-frame/logo.png diff --git a/packages/omi-cli/template/spa/src/elements/views/home-page/index.js b/packages/templates-old/spa/src/elements/views/home-page/index.js similarity index 100% rename from packages/omi-cli/template/spa/src/elements/views/home-page/index.js rename to packages/templates-old/spa/src/elements/views/home-page/index.js diff --git a/packages/omi-cli/template/spa/src/elements/views/nav1/omi-weui-page/index.js b/packages/templates-old/spa/src/elements/views/nav1/omi-weui-page/index.js similarity index 100% rename from packages/omi-cli/template/spa/src/elements/views/nav1/omi-weui-page/index.js rename to packages/templates-old/spa/src/elements/views/nav1/omi-weui-page/index.js diff --git a/packages/omi-cli/template/spa/src/elements/views/nav2/omi-router-page/index.js b/packages/templates-old/spa/src/elements/views/nav2/omi-router-page/index.js similarity index 100% rename from packages/omi-cli/template/spa/src/elements/views/nav2/omi-router-page/index.js rename to packages/templates-old/spa/src/elements/views/nav2/omi-router-page/index.js diff --git a/packages/omi-cli/template/spa/src/elements/views/not-found-page/index.js b/packages/templates-old/spa/src/elements/views/not-found-page/index.js similarity index 100% rename from packages/omi-cli/template/spa/src/elements/views/not-found-page/index.js rename to packages/templates-old/spa/src/elements/views/not-found-page/index.js diff --git a/packages/omi-cli/template/spa/src/index.js b/packages/templates-old/spa/src/index.js similarity index 100% rename from packages/omi-cli/template/spa/src/index.js rename to packages/templates-old/spa/src/index.js diff --git a/packages/omi-cli/template/spa/src/route/error.js b/packages/templates-old/spa/src/route/error.js similarity index 100% rename from packages/omi-cli/template/spa/src/route/error.js rename to packages/templates-old/spa/src/route/error.js diff --git a/packages/omi-cli/template/spa/src/route/index.js b/packages/templates-old/spa/src/route/index.js similarity index 100% rename from packages/omi-cli/template/spa/src/route/index.js rename to packages/templates-old/spa/src/route/index.js diff --git a/packages/omi-cli/template/spa/src/route/nav1.js b/packages/templates-old/spa/src/route/nav1.js similarity index 100% rename from packages/omi-cli/template/spa/src/route/nav1.js rename to packages/templates-old/spa/src/route/nav1.js diff --git a/packages/omi-cli/template/spa/src/route/nav2.js b/packages/templates-old/spa/src/route/nav2.js similarity index 100% rename from packages/omi-cli/template/spa/src/route/nav2.js rename to packages/templates-old/spa/src/route/nav2.js diff --git a/packages/omi-cli/template/spa/src/route/route.js b/packages/templates-old/spa/src/route/route.js similarity index 100% rename from packages/omi-cli/template/spa/src/route/route.js rename to packages/templates-old/spa/src/route/route.js diff --git a/packages/omi-cli/template/spa/src/store/app-store.js b/packages/templates-old/spa/src/store/app-store.js similarity index 100% rename from packages/omi-cli/template/spa/src/store/app-store.js rename to packages/templates-old/spa/src/store/app-store.js