Giter Site home page Giter Site logo

yanhaijing / jslib-base Goto Github PK

View Code? Open in Web Editor NEW
928.0 20.0 151.0 1.15 MB

A modern JavaScript|Typescript library scaffolding, modularity, purity & extras

License: MIT License

JavaScript 98.93% HTML 0.40% TypeScript 0.47% Shell 0.20%
rollup js-libs typescript jsmini typescript-libs js-scaffold boilerplate template

jslib-base's Introduction

license npm NPM downloads Percentage of issues still open

English | 简体中文

The best JS|TS third-party library scaffold, quickly setup the basic framework of a new library in 10 seconds.

Libraries based on jslib-base can be shared on the jsmini platform.

⭐ Features

  • Command-line tool for quick creation and seamless upgrades
  • Supports writing source code in ES6+ or TypeScript, and compiles to generate production code
  • Auto-injection of third-party dependencies (automatically removes unnecessary code in third-party dependencies through tree shaking)
  • Supports multiple environments (native browser, AMD, commonjs, Webpack, Rollup, vite, fis, Node.js, etc.)
  • Integrated code style checker (eslint + prettier + husky)
  • Integrated unit test environment (mocha)
  • Integrated test coverage report (istanbul+nyc)
  • Integrated continuous integration tool github action
  • Integrated with jsmini

🚀 User Guide

To create a new project, it is recommended to use Node.js version 16 or higher.

$ npx @js-lib/cli new mylib
# Interactive queries, input project info
$ cd mylib
$ npm i

To update the project, just execute the following command in the project root directory.

$ npx @js-lib/cli update

For old projects, you can't directly execute the update command, you can first initialize a config file.

$ npx @js-lib/cli new -c

Directory Overview

.
├── demo Usage demo
├── dist Compiled out code
├── doc Project documents
├── src Source code directory
├── test Unit tests
├── CHANGELOG.md Change log
└── TODO.md To-do features

Common command scripts

$ npm run lint
$ npm run test
$ npm run build
$ npm run release
$ npm publish

Contribution Guide

This project uses lerna to manage multiple plugins, common lerna commands are:

$ npx lerna init # Initialization
$ npx lerna create @js-lib/todo # Create a package
$ npx lerna add yargs --scope=@js-lib/cli # Install dependencies for a package
$ npx lerna list # List all the packages
$ npx lerna bootstrap # Install all dependencies
$ npx lerna link # Create all links
$ npx lerna changed # List the packages to be updated in the next release
$ npx lerna publish # Release with tag, upload to git, upload to npm

Contributors

contributors

Change Log

CHANGELOG.md

TODO

TODO.md

Current Users

Relative links

jslib-base's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jslib-base's Issues

import() 语法不支持.

在 config.js 配置中添加 '@babel/plugin-transform-runtime', .babelrc 也添加了. 还有 Symbol 也不能被转化. 在 IE 中不能使用.

执行npm run release失败

执行npm run release失败

执行npm run release报:

⧗   input: $npm_package_version
✖   subject may not be empty [subject-empty]
✖   type may not be empty [type-empty]

✖   found 2 problems, 0 warnings

应该是执行到 git commit没有给正确格式的提交信息

环境

  • 系统:windows10
  • node版本:v16.16.0
  • npm版本:8.11.0

其他

如上所示,执行npm run releasegit commit失败。再次执行时,又会重新开始test、build,是否有办法接着上次的git commit继续执行呢?

建议开个typescript的分支

问题是什么

看到特性里描述支持typescript,试了下不支持,rullup的配置文件里也没有相关配置,建议开个typescript的分支,库用ts更严谨些;另外ts版本的也不用考虑低版本兼容的配置,纯现代的脚手架即可

项目里面不能使用对象扩展的语法.

What problem

let obj = {}
let target = { ...obj }
编译的时候报错.
添加 "transform-object-rest-spread" 插件没有作用.

Environment

  • Mobile: MI6
  • System: Android7.1.1
  • Browser:Chrome61
  • jslib-base version: 0.2.0
  • some other information

Online demo

Please provide online demo if possible.

Other

some other information.

代码压缩问题

问题是什么

npm run build:aio的时候报错

环境

  • 系统:win 10
  • node版本:10.13.0
  • npm版本:6.4.1

在线例子

其他

由于uglify-js is able to transpile only es5 syntax. If you want to transpile es6+ syntax use terser instead,所以会报错,是否考虑将脚手架的uglify-js换成 terser ,换成terser之后可以解决

初始化一个新项目时报错

问题是什么

初始化一个新项目时报错

环境

  • 系统:win10
  • node版本:20.12.1
  • npm版本:10.5.0
  • 其他版本信息

错误信息

image

提一个小bug

// demo/demo-global.html 例子应该修改如下

<script>
    console.log(window['jslib-base'].name);
</script>

创建新库无法默认使用 yarn

问题是什么

执行 npx @js-lib/cli new mylib 创建新库,只能选择 npmno install,无法选择使用 yarn。
image
选择 no install,会在后续要求安装 only-allow 并强制使用 npm,需手动变更 package.jsonpreinstall 的配置解决。
搜了下开发者过往的文章,在设计意图里有看到“使用 npm 还是 yarn 维护项目,或者暂时不自动安装依赖”,所以不知道这是 bug 还是 feature。

环境

  • 系统:mac 13.5.2
  • node版本:18.13.0
  • npm版本:8.19.3
  • 其他版本信息

在线例子

如果有请提供在线例子

其他

其他信息

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.