You can execute the create-ts-lib CLI using npx or by installing it globally with npm i -g create-ts-lib.
# Use NPX or npm install -g create-ts-lib to install it as a global package
npx create-ts-lib@latest my-typescript-lib
cd my-typescript-lib && npm start- Browse http://localhost:3000/ to see your bootstrapped module.
- A bundle is created under
/distfolder. - Create a minified bundle with
npm run build.
You donβt need to install or configure tools like Webpack, Typescript, Karma or Jasmine.
They are preconfigured so that you can focus on the code, but as a starter kit you still can modify all the configuration files.
- (Application Type) Typescript 3
- (Bundler) Webpack 4
- Karma, Jasmine
# Use NPX or npm install -g create-ts-lib to install it as a global package
npx create-ts-lib@latest my-typescript-lib
cd my-typescript-lib && npm startCalling create-ts-lib with my-typescript-lib as an argument creates a directory my-typescript-lib inside the current directory.
Inside that directory, the initial file structure of the project is generated with all the devDependencies installed.
my-typescript-lib
βββ node_modules
βββ src
β βββ index.html
β βββ index.ts
β βββ MyLibrary.ts
β βββ MyLibrary.spec.ts
βββ tests
β βββ unit
β βββ spec-bundle.js
βββ README.md
βββ package.json
βββ .gitignore
βββ karma.conf.js
βββ tsconfig.json
βββ tslint.json
βββ webpack.config.jsNo configuration or complicated folder structures, just the files you need to start your app / package / module.
Runs the app in development / production mode using Webpack dev server. Open http://localhost:3000 π to view it in the browser.
Runs the unit tests using Karma as test runner and Jasmine as testing framework.
Creates a bundle into the dist folder:
dist
βββ MyLibrary.d.ts # - Example of a 'd.ts' declaration file
βββ app.bundle.js # - Main bundle of the application. name from webpack.config
βββ app.bundle.js.map # - Sourcemap
βββ index.d.ts
βββ index.html # - html page referencing app.bundle.jsWe'd love to have your helping hand on create-ts-lib! See CONTRIBUTING.md for more information on what we're looking for and how to get started.
This project exists thanks to all the people who contribute. [Contribute].
Thank you to all our backers! π [Become a backer]
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]
