multipages-generator

授权协议 Readme
开发语言 JavaScript
所属分类 Web应用开发、 常用JavaScript包
软件类型 开源软件
地区 不详
投 递 者 乌俊健
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

English | 中文

multipages-generator NPM version

NPM

multipages-generator is a multiple pages application generator (or CLI) for mobile. It has the whole DevOps which includes development, build, publish and the deployment. It is One-stop solution for mobile H5.

Scene

Multipages-generator suite for multipages website whatever is mobile website or PC website, H5 in hybird app. For example: this, chiji game.

Feature

  1. One-stop mobile MPA solution with modern web technologys like Nodejs, webpack4, babel, Vue with server side rendering.
  2. Efficient commands like new, develop,build,upload,analysis,deploy.
  3. Best practices for architechure and organization.
  4. �� (new) Support Vue SSR and no framework or any other framework you like.
  5. Support development,producton ENV.
  6. Support sass、less、postcss
  7. Hot code reload for CSS and JS
  8. Support upload to Ali OSS and Qiniu OSS
  9. Support mobile adaptation with taobao flexible layout solution,fit different screen size and DPI.
  10. Support pm2 deployment

Document

Global install ⚙️

Envirment requirement

NodeJS: >= 6.11.0

OS: MacOS,windows,centos

install

npm install multipages-generator -g  //now the latest is 1.6.x

Create a project ��

init a project

meet init

Choose a template:

  • No JavaScript framework (You can add your framework like jQuery,zepto,vue,react and so on.)
  • Vue width SSR (It's add SSR default for now)
? Select your JavaScript framework (Use arrow keys)
❯ No JavaScript framework 
  Vue width SSR

start

When initialized, install the dependencis and start the demo

C:\xxx\workspace>meet init
? Project name: h5-project
  __  __           _      ____ _     ___
 |  \/  | ___  ___| |_   / ___| |   |_ _|
 | |\/| |/ _ \/ _ \ __| | |   | |    | |
 | |  | |  __/  __/ |_  | |___| |___ | |
 |_|  |_|\___|\___|\__|  \____|_____|___|

   [Success] Project h5-project init finished, be pleasure to use ��!

   Install dependencies:
     cd h5-project && npm install

   Run the app:
     meet start demo
   Or:
     pm2 start process.json

Commands

Use meet -help to show all the commands.

C:\xxx\workspace>meet -help

  Usage: meet [command]

  Options:

    -v, --version                 output the version number
    -h, --help                    output usage information

  Commands:

    init                          initialize your project
    new [module]/[module]-[page]  generate_native a new module
    start [module]                start application in development mode
    build [module]                build a module using webpack
    upload                        upload dist files to CDN
    analyse                       analysis dist files size and percent
    git                           auto git commit and push

Create a new module

meet new [module]/[module]-[page]

Description

Attention, create a new module use like this

meet new [module]

When you need to create a new page in the existed module, use this command:

meet new [module]-[page]

For a example, create a game H5(module)

meet new game  // create a game with default page index.html

Because it's so called multiple pages generator, so create another page use this:

meet new game-detail // create the game detail.html in the game module

And you got a list files like this:

game
 ├─images // this is no images, just a dictory
 ├─js
 | ├─index
 | | ├─business.js  // the business js(Expand as you wish)
 | | ├─service.js   // http service code
 | | └─util.js      // utils code
 | └─index.js       // the main js file
 ├─styles
 | └─index.css      // css code
 └─views
   └─index.html     // html code

Develop a module

meet start [module]

meet start demo

It started with this followed, you can choose a link to open in browser.

 √ Build done

[Tips] visit: http://localhost:8080/demo/
            : http://192.168.50.194:8080/demo/

Attention:Vue CSR: http://localhost:8080/demo/?csr=trueVue SSR: http://localhost:8080/demo/

Hot reload

JS、CSS support hot code reload,HTML changes need man to refresh the browser.

Html generated contain two marker, you don't need to worry about this. It's for better development and will removed when in build.

<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <% include ../head.html %>
  <title>demo</title>
  <!--@hot-reload, will auto remove after compiled-->
  <link rel="stylesheet" data-hr="hot-reload" href="/demo/styles/index.css">
</head>
<body>
  <div>you content...</div>
  <!--@hot-reload, will auto remove after compiled-->
  <script type="text/javascript" data-hr="hot-reload" src="/common/js/hot-reload.js"></script>
</body>
</html>

Build a module

meet build [demo]

meet build demo
C:xxx\workspace\h5>meet build demo

> mg-template@1.0.0 build C:\meetyou\workspace\test\mg-workspace\h5
> cross-env NODE_ENV=production node build/commands/build.js "demo"

Delete dist directory!
  ⣾ Building...
  ⣽ lasted 1 seconds. HTML去除开发环境hotReload代码: ..\server\views\prod\demo\index.html
Hash: 2a217fb45f03fb354254
Version: webpack 4.17.2
Time: 1687ms
Built at: 2018-09-06 19:50:40
                               Asset      Size  Chunks             Chunk Names
                  index.12969e6e.css  4.71 KiB       0  [emitted]  index
                   index.080a1e3d.js  1.01 KiB       0  [emitted]  index
..\server\views\prod\demo\index.html  3.74 KiB          [emitted]
Entrypoint index = index.12969e6e.css index.080a1e3d.js

Upload dist files to Qiniu CDN:
Webpack Bundle Analyzer is started at http://127.0.0.1:8888
Use Ctrl+C to close it
[Success]: 上传文件至七牛云CDN成功!文件地址:http://cnd.yintage.com/index.080a1e3d.js
[Success]: 上传文件至七牛云CDN成功!文件地址:http://cnd.yintage.com/index.12969e6e.css
[Success]: 上传完毕 ��!
Use Ctrl+C to close it

After analysis powerd by webpack plugin, the page will show the code proportion.

meet analyse

Use this command after builded.

meet analyse

Upload

meet upload

Upload the files which in the dist dictory to OSS server. Config the Ali OSS or Qiniu OSS configs in mg.config.js.

meet upload

Config

mg.config.js

mg.config.js is look like:

module.exports = {

    // the client server (use for hot reload ) port
    clientPort: '8080',

    // the server(for deployment) port
    server: {
        port: '8090',
    },

    // upload config
    upload: {
        cdn: '//oflt40zxf.bkt.clouddn.com/',
        projectPrefix: 'nodejs-common',

        // if use Ali OSS,set aliconfig a empty object, now it support Ali CLI for upload, 
        // aliconfig: {
        //
        // },
       
        // Qiniu OSS
        qconfig: {
            ACCESS_KEY: 'ei1uOdGpVLliA7kb50sLcV9i4wfYLPwt5v0shU10',
            SECRET_KEY: '-pFFIY-ew35Exyfcd67Sbaw40k15ah3UfZTFWFKF',
            bucket:'hotshots-image',
            origin:'http://cnd.yintage.com'
        },

        // is auto upload after build
        autoUpload: true

    }
};

Ali OSS upload

Todo List

  1. Better Vue SSR solution
  2. Support react, react-ssr

deployment

deploy to server in 30 minutes

License

The MIT License

 相关资料
  • 问题内容: Python生成器非常有用。与返回列表的函数相比,它们具有优势。但是,您可以。有办法吗? 更新: 当然可以了..... 我正在尝试使用在新生成的生成器中创建的生成器。作为新生成器中计算的一部分,它需要知道旧生成器的长度。但是,我想将它们和生成器的属性保持在一起,特别是- 不要将整个列表保存在内存中,因为它可能 很 长。 更新2: 假设生成器甚至从第一步就 知道 它的目标长度。另外,没有

  • 问题内容: 我正在生成一个简单的类,并且无法注入适当的变量名。ASM版本是。 这是代码: 我正在使用来简化代码生成。由于继承自,因此我假定它被允许使用它的方法。 除了变量名之外,发出的字节码没有其他问题。当方法被调用,而不是给变量指定名称的它会在字节码一个新的。 发出的字节码: 我正在使用newLocal()调用中提供的变量索引。但是在字节码中映射的索引3不是1。如果变量具有“更短”的类型,例如i

  • 问题内容: 我有一个问题,我无法解决。在hibernate状态下,我没有以下问题: 然后在我的schema.ddl中,我有这个: 这里没什么可看的。一切正常。但是,如果我将提供程序切换到EclipseLink,则会出现此错误: 因此,我当然会四处搜索,如果初始值为1且它应该等于分配大小,那么我会看到有关EclipseLink创建负数的一些信息。 因此,好的,因此添加“ initialValue =

  • 本文向大家介绍Springboot通用mapper和mybatis-generator代码示例,包括了Springboot通用mapper和mybatis-generator代码示例的使用技巧和注意事项,需要的朋友参考一下 实现功能:根据数据库中的表,自动生成model、dao和对应的xml文件。xml中实现通用mapper中CURD功能 1、引入依赖 2、配置通用mapper 方式1:配置要扫描

  • 本文向大家介绍keras实现图像预处理并生成一个generator的案例,包括了keras实现图像预处理并生成一个generator的案例的使用技巧和注意事项,需要的朋友参考一下 如下所示: 接下来,给出我自己目前积累的代码,从目录中自动读取图像,并产生generator: 第一步:建立好目录结构和图像 可以看到目录images_keras_dict下有次级目录,次级目录下就直接包含照片了 **第