Skip to content

Saber2pr/saber-tsmod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

saber-tsmod

types version license github

a cli for ts dev.

publish your ts module to npm!

npm install saber-tsmod -g

Usage:

  1. init: init the project files.

  2. create <module>: create a new ts module file and its test file.

  3. create ~c <tsmod.json>: create src by a tsmod.json file.

  4. config <option>: create config file of typescript or webpack.


# create workspace
mkdir <projectFolder>

cd <projectFolder>

# init project.
saber-tsmod init

# create module and test file.
saber-tsmod create <module>
saber-tsmod create ~c

# for example:
saber-tsmod create hello

saber-tsmod create shop/shop.service
saber-tsmod create shop/shop.controller
saber-tsmod create shop/shop.module

saber-tsmod create shop/shop.service shop/shop.controller shop/shop.module

saber-tsmod create ~c tsmod.json

# create config file
# tsconfig.json
saber-tsmod config ts
# webpack.config.json
saber-tsmod config webpack

for example(tsmod.json)

[
  "users/controller.ts",
  "users/service.ts",
  "users/module.ts",
  "shop/controller.ts",
  "shop/service.ts",
  "shop/module.ts"
]

start

# install the typescript and webpack.
npm install
# auto compile to commonjs.
npm start

# auto compile to es5.
npm run dev

Author: saber2pr(AK-12)


develope and test

you should write ts in /src

ts -(tsc)-> commonjs -(webpack)-> es5

you should make test in /src/test

export your core in /src/index.ts!


publish

Before publish, there are some items in package.json should to be updated below:

  1. name
  2. version
  3. description
  4. repository(url)
  5. author
# if all is well, try:
npm publish

Releases

No releases published

Packages

No packages published