Skip to content

Commit 1cbe658

Browse files
authored
Merge pull request #22 from nobrainr/feat/package-updates
Feat: Update to Webpack 4 and Typescript 3
2 parents 0a27b5d + 9c3d892 commit 1cbe658

24 files changed

+11392
-1764
lines changed

β€Ž.circleci/config.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Javascript Node CircleCI 2.0 configuration file
2+
#
3+
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
4+
#
5+
version: 2
6+
jobs:
7+
test-job:
8+
docker:
9+
- image: circleci/node:9-browsers
10+
working_directory: ~/repo
11+
steps:
12+
- checkout
13+
# Download and cache dependencies
14+
- restore_cache:
15+
keys:
16+
- v1-dependencies-{{ checksum "package-lock.json" }}
17+
# fallback to using the latest cache if no exact match is found
18+
- v1-dependencies-
19+
- run: npm install
20+
- run: npm run build
21+
- run: npm test
22+
- save_cache:
23+
paths:
24+
- node_modules
25+
- packages/cli
26+
key: v1-dependencies-{{ checksum "package-lock.json" }}
27+
28+
publish-job:
29+
docker:
30+
- image: circleci/node:9
31+
working_directory: ~/repo
32+
steps:
33+
- checkout
34+
- restore_cache:
35+
keys:
36+
- v1-dependencies-{{ checksum "package-lock.json" }}
37+
# fallback to using the latest cache if no exact match is found
38+
- v1-dependencies-
39+
- run:
40+
name: Pre-Publish Script
41+
command: ./tools/publish.sh
42+
- run: npm run build
43+
- run: npm run publish
44+
45+
workflows:
46+
version: 2
47+
test:
48+
jobs:
49+
- test-job
50+
- publish-job:
51+
filters:
52+
branches:
53+
only:
54+
- master
55+
requires:
56+
- test-job

β€Ž.travis.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

β€ŽCONTRIBUTING.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Contributing to create-ts-lib
2+
3+
Welcome, and thank you for your interest in contributing to create-ts-lib!
4+
5+
There are many ways that you can contribute, beyond writing code. The goal of this document is to provide a high-level overview of how you can get involved.
6+
7+
## Architecture
8+
9+
1. Application Type
10+
- Javascript (ES5, ES6, ES7)
11+
- Typescript
12+
- React
13+
- React-Redux
14+
- ....
15+
2. Bundler
16+
- Webpack
17+
- Rollup
18+
- Parcel
19+
- ....
20+
3. Test Framework
21+
- Karma + Jasmine
22+
- Jest
23+
- Mocha + Chai
24+
4. Automatic Versionning (?)
25+
- semver
26+
- semantic-release
27+
5. CI/CD
28+
- TravisCI
29+
- CircleCI
30+
- TeamCity
31+
- ...
32+
- Push to NPM
33+
- Push to CDN
34+
35+
## Presets
36+
37+
1. default
38+
- 1.Typescript, 2.Webpack, 3.Karma+Jasmine, 4.Semantic Release, 5.CircleCI
39+
2. minimal
40+
- 1.Typescript, 2.None, 3.None, 4.None, 5.None
41+
42+
## Commands
43+
44+
```sh
45+
tws-cli create -p default | minimal -n app
46+
```
47+
48+
```sh
49+
tws-cli search --filter presets | actions <query>
50+
```

β€ŽREADME.md

Lines changed: 37 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,49 @@
1-
# create-ts-lib [![Build Status](https://img.shields.io/travis/emyann/typescript-webpack-starter.svg)](https://travis-ci.org/emyann/typescript-webpack-starter) [![Npm Package](https://img.shields.io/npm/v/create-ts-lib.svg)](https://www.npmjs.com/package/create-ts-lib)
1+
# create-ts-lib [![CircleCI](https://img.shields.io/circleci/project/github/nobrainr/typescript-webpack-starter.svg)](https://circleci.com/gh/nobrainr/workflows/typescript-webpack-starter/tree/master) [![Npm Package](https://img.shields.io/npm/v/create-ts-lib.svg)](https://www.npmjs.com/package/create-ts-lib)
22

3-
> A yet another Typescript Webpack Starter
3+
## Quick Start
44

5-
![Imgur](https://i.imgur.com/sj1kwB9.gif)
6-
7-
8-
## Built upon
9-
10-
- [x] [Webpack 3](https://webpack.js.org/)
11-
- [x] [Typescript 2](https://blogs.msdn.microsoft.com/typescript/2016/07/11/announcing-typescript-2-0-beta/)
12-
- [x] [Webpack Dashboard](https://github.com/FormidableLabs/webpack-dashboard)
13-
- [x] [Karma](https://karma-runner.github.io/1.0/index.html), [Jasmine](https://jasmine.github.io/)
14-
15-
16-
## Quick Overview
5+
You can execute the `create-ts-lib` CLI using [`npx`](https://github.com/zkat/npx) or by installing it globally with `npm i -g create-ts-lib`.
176

187
```sh
19-
npm install -g create-ts-lib
20-
21-
create-ts-lib my-typescript-lib
22-
cd my-typescript-lib/
23-
npm start
8+
# Use NPX or npm install -g create-ts-lib to install it as a global package
9+
npx create-ts-lib my-typescript-lib
10+
cd my-typescript-lib && npm start
2411
```
2512

26-
Then open http://localhost:3000/ to see your bootstrapped module.
27-
When you’re ready to deploy to production, create a minified bundle with `npm run build`.
13+
### Build and Serve it
2814

29-
### Get Started Immediately
15+
- Browse http://localhost:3000/ to see your bootstrapped module.
16+
- A bundle is created under `/dist` folder.
17+
- Create a minified bundle with `npm run build`.
3018

31-
You **don’t** need to install or configure tools like Webpack or Babel.<br>
32-
They are preconfigured so that you can focus on the code, but as a starter kit you still can modify them.
19+
## Features
3320

34-
Just create a project, and you’re good to go.
21+
You **don’t** need to install or configure tools like `Webpack`, `Typescript`, `Karma` or `Jasmine`.<br>
22+
They are preconfigured so that you can focus on the code, but as a starter kit you still can modify all the configuration files.
3523

36-
## Getting started
37-
38-
### Installation
24+
- [x] (Application Type) [Typescript 3](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-0.html)
25+
- [x] (Bundler) [Webpack 4](https://webpack.js.org/)
26+
- [x] [Karma](https://karma-runner.github.io/1.0/index.html), [Jasmine](https://jasmine.github.io/)
3927

40-
Install it once globally:
28+
### Create a Typescript project
4129

4230
```sh
43-
npm install -g create-ts-lib
31+
# Use NPX or npm install -g create-ts-lib to install it as a global package
32+
npx create-ts-lib my-typescript-lib
33+
cd my-typescript-lib && npm start
4434
```
4535

46-
### Creating a TypeScript module
47-
48-
To create a new module, run:
36+
Calling `create-ts-lib` with `my-typescript-lib` as an argument creates a directory `my-typescript-lib` inside the current directory.<br>
37+
Inside that directory, the initial file structure of the project is generated with all the devDependencies installed.
4938

5039
```sh
51-
create-ts-lib my-ts-module
52-
cd my-ts-module
53-
```
54-
55-
It will create a directory called `my-ts-module` inside the current folder.<br>
56-
Inside that directory, it will generate the initial project structure and install the transitive dependencies:
57-
58-
```
59-
my-ts-module
40+
my-typescript-lib
6041
β”œβ”€β”€ node_modules
6142
β”œβ”€β”€ src
6243
β”‚ └── index.html
63-
β”‚ └── index.spec.ts
6444
β”‚ └── index.ts
65-
β”‚ └── vendor.js
45+
β”‚ └── MyLibrary.ts
46+
β”‚ └── MyLibrary.spec.ts
6647
β”œβ”€β”€ tests
6748
β”‚ └── unit
6849
β”‚ └── spec-bundle.js
@@ -76,8 +57,7 @@ my-ts-module
7657
└── webpack.config.js
7758
```
7859

79-
No configuration or complicated folder structures, just the files you need to build your app.<br>
80-
Once the installation is done, you can run some commands inside the project folder:
60+
No configuration or complicated folder structures, just the files you need to start your app / package / module.<br>
8161

8262
### `npm start` or `npm run server:prod`
8363

@@ -89,13 +69,18 @@ Open [http://localhost:3000](http://localhost:3000) πŸŽ‰ to view it in the brows
8969
Runs the unit tests using Karma as test runner and Jasmine as testing framework.
9070

9171
### `npm run build` or `npm run build:prod`
92-
Build a development release
9372

94-
After build phase, 3 files are generated into the `dist` folder:
95-
- `app.bundle.js` - contains the core of the application. From the entry point `src/index.ts`
96-
- `vendor.bundle.js` - contains the vendor dependencies. From the entry point `src/vendor.ts` (lodash is added as an example)
97-
- `index.html` - html page referencing these files
73+
Creates a bundle into the `dist` folder:
74+
75+
```sh
76+
dist
77+
β”œβ”€β”€ MyLibrary.d.ts # - Example of a 'd.ts' declaration file
78+
β”œβ”€β”€ app.bundle.js # - Main bundle of the application. name from webpack.config
79+
β”œβ”€β”€ app.bundle.js.map # - Sourcemap
80+
β”œβ”€β”€ index.d.ts
81+
└── index.html # - html page referencing app.bundle.js
82+
```
9883

9984
## Development
10085

101-
We'd love to have your helping hand on `create-ts-lib`! See [CONTRIBUTING.md](CONTRIBUTING.md) for more information on what we're looking for and how to get started.
86+
We'd love to have your helping hand on `create-ts-lib`! See [CONTRIBUTING.md](CONTRIBUTING.md) for more information on what we're looking for and how to get started.

β€Žlerna.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
2-
"lerna": "2.8.0",
3-
"packages": [
4-
"packages/*"
5-
],
6-
"version": "0.1.0"
2+
"command": {
3+
"publish": {
4+
"ignoreChanges": ["*.npmrc"]
5+
}
6+
},
7+
"packages": ["packages/*"],
8+
"version": "0.2.6"
79
}

0 commit comments

Comments
Β (0)