1 Star 0 Fork 0

姜静源 / typescripe-lib-starter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

typescripe-lib-starter

项目介绍

基于Typescript的库项目模板。基于Rollup、Karma+Jasmin及Webpack。

Quick Start

Install Dependencies

$ npm i

Build

$ npm run build
  • 使用Rollup构建Typescript源代码,生成UMD、ESM5标准bundle
  • 作为默认,构建脚本同时会生成一个包含了所有第三方代码的、UMD标准的单文件bundle, 如果您并不需要这个bundle,您可以手动在script/build.js注释掉相应的代码块。

Unit Test

$ npm run test
  • 使用Karma + Webpack构建Typescript单元测试代码
  • 您可以直接使用Typescript编写您的测试用例,并按您的意愿组织测试用例目录结构。
  • 只有以*.spec.ts的测试代码会被执行

Serve And Trouble-shooting

$ npm start
  • 使用Webpack以一个常规的Web项目形式构建并运行demo,您可以在这之上进行快速开发及调试
  • 尽管最终您编写的库并非按与demo相同的形式被人使用,但对于一些最终应用于Web App中的库项目,demo对于快速开发将很有帮助
  • 如有需要,您可以使用npm build-demo命令构建demo的内容

Directory structure

|- src/
|- test/
|- demo
|    |- src/
|    |- assets
|    |- app.bundle.js
|    |- index.html
|- script/
|    |- build.js
|    |- release.js
|- tsconfig.json
|- karma.conf.js
|- webpack.config.js
|- package.json
  • src: 源代码目录
  • test: 单元测试目录
  • demo: Demo页面目录
    • src: Demo页面源码
    • app.bundle.js: 执行npm run build-demo后由Webpack生成的生产版本的bundle。注意,使用npm startWebpack并不生成此bundle
  • script: 工具脚本目录
    • build.js: 构建脚本,在此文件中调用了Rollup完成构建任务。您可以选择性的使用其中的构建代码块,这取决于您正在编写的库是何种用途
    • release.js: 发布脚本,此脚本能够帮您自动publishnpm
  • tsconfig.json: typescript配置文件
  • karma.conf.js: karma配置文件。用于单元测试
  • webpack.config.js: Webpack配置文件。用于运行或构建demo项目
The MIT License (MIT) Copyright (c) 2018 appleskiller 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.

简介

基于Typescript的库项目模板。基于Typescript的库项目模板。基于Rollup、Karma+Jasmin及Webpack。 展开 收起
TypeScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
TypeScript
1
https://gitee.com/appleskiller/typescripe-lib-starter.git
git@gitee.com:appleskiller/typescripe-lib-starter.git
appleskiller
typescripe-lib-starter
typescripe-lib-starter
master

搜索帮助