npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

leanseed

v0.2.2

Published

a leanCloud seed project based on Express and Vue.js

Downloads

7

Readme

LeanSeed npm

LeanSeed (灵犀) 是以 Express 4.x 和 Vue.js 为基础的全栈开发框架,灵犀支持 LeanEngine,可将项目一键部署到 LeanCloud,无需配置服务器,体验 Serverless 的开发方式。

在灵犀中,我们使用了前后端完全分离的架构,因此,开发者可以不用在乎前端项目和后端逻辑的开发进度,并行开发。前后端代码均使用了 ES2015(ES6)编写,完全支持 import=>、解构等全新 JavaScript 语法,统一了前后端模块的模块定义和加载方式,使用 JS 全栈编写项目更加便捷,简单,易于理解。此外,灵犀采用 Babel 6.x 编译项目源码,无需担心服务器生产环境中 Node 版本是否支持全新 JavaScript 标准。

在线演示

灵犀的演示项目站点为: http://leanseed.leanapp.cn/

可访问此 API 测试在线演示是否稳定: http://leanseed.leanapp.cn/api/ping

初始化项目

灵犀的初始化非常简单,按照如下步骤进行:

将本项目 Clone 项目到本地

$ git clone [email protected]:guo-yu/leanseed.git

安装相关依赖:

$ cd leanseed
$ cnpm install .
$ npm install -g avoscloud-code

使用 LeanEngine cli 工具在本地注册此项目:

$ lean add <appName> <appId>

其中,appName 填写为在 LeanCloud 项目中设置的二级域名。

文件结构

灵犀中的文件结构很简单,依次代表以下含义:

  • app.js API 服务入口文件,在开发模式下采用了 require hook 的方式动态编译源码
  • server 后端服务文件夹,在生产环境使用 npm run build 编译到 ./build 文件夹中
    • index.js 后端服务入口文件
    • routes.jsapi.js 后端路由文件
  • libs 前端库文件夹
    • app.js 前端项目主文件
    • routes.js 前端路由文件
  • components 前端组件文件夹,包括所有 Vue 组件
  • css 样式文件夹,目前支持以 cssnext 形式编写
  • dist 前端编译后的最终文件,此文件夹的文件默认会托管在 API 服务的根域,包括一个 index.html 入口文件
  • build 服务编译后的最终文件,将成为生产环境入口执行文件
  • webpack.config.js webpack 配置文件

目前用以构建此项目的依赖模块版本

  • Vue.js 1.x
  • Express 4.x
  • LeanEngine 0.4.0
  • Babel 6.x
  • avoscloud-code cli > 1.1.x (推荐使用)

本地开发

灵犀的前后端分别由 Express 和 Vue 搭建,后端服务是一个 API 服务,前后端完全分离,因此开发模式也是不同的:

一、启用本地开发服务器(API 服务):

$ npm run debug

API 服务请访问:http://localhost:3000

二、启用基于 Webpack 动态热替换的前端开发工作流:

$ npm run dev

前端开发工作流请访问 http://localhost:8080

三、熟悉自动化工作流

在先前提到的 webpack.config.js 中,我们定义了所有前端工作流,这些工作流的快捷方式,可以在 package.json 中的 scripts 字段找到。

总的来说,执行:

  • npm start 会启动 API 服务
  • npm run build 会编译前端和后端代码,包括所有静态资源文件,到 ./dist 文件夹
  • npm run debug 会启动前端开发工作流
  • npm run deploy 会使用 leanEngine CLI 将项目发布到测试环境

部署到测试环境

可利用 LeanEngine cli 一键部署到测试环境:

$ npm run deploy

部署到测试环境由于需要自动化安装依赖模块,可能需要近五分钟左右,请耐心等待至返回成功部署的结果以及 hashTag。

测试环境清访问:http://stg-[appName].leanapp.cn 免费项目的测试环境暂时不可用,可直接访问: http://[appName].leanapp.cn

发布到生产环境

可利用 LeanEngine cli 一键发布到生产环境:

$ npm run pub

生产环境清访问:http://[appName].leanapp.cn

其他

  • 更多关于 Lean Engine 和其 CLI 的操作,可以查阅 avoscloud-code@npm 和 leanengine@npm 相关模块文档。

MIT license

Copyright (c) 2016 turing <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.