Skip to content

Commit bbb1af6

Browse files
committed
Adde new development build workflow
1 parent 9e66d7c commit bbb1af6

File tree

5 files changed

+35
-34
lines changed

5 files changed

+35
-34
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ src/**/*.map
2828
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
2929
node_modules
3030
jspm_packages
31-
typings
31+
32+
# Build directory
3233
dist/*bundle.js*
34+
dist/jspm.config.js
35+
dist/system.js
3336
out

README.md

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# React / TypeScript / JSPM / Hot-Reload - starter-kit
1+
# React / TypeScript / JSPM / Hot-Reload - starter-kit
22
> Modern & Minimalistic boilerplate for building modular apps with React - utilizing power of TypeScript, ES2016, Hot-Reload, async/await, ES Modules & in-browser transpiling powered by JSPM/SystemJS.
33
44
> Keeping up-to-date with new releases of React / TypeScript / JSPM, and to follow changes in the best practices as they might change with a new updates.
@@ -14,7 +14,7 @@
1414
- COMPLETE-WORKFLOW - helpful npm scripts and tasks, github hooks, linter, test-harness etc.
1515
- TDD-READY - test-harness setup with Tape (blue-tape) - included example code and @types
1616
- EXTRAS - css only loader while waiting for React to "kick in"
17-
17+
1818
##### Learn TypeScript from sample code
1919
- Typescript definitions for third-party libraries
2020
- solid tsconfig setup for ES2016 support
@@ -47,53 +47,55 @@ My test procedure:
4747

4848
---
4949

50-
## Usage
50+
## Installation
5151

52-
#### NPM Commands
52+
#### Prerequisites
53+
- Node.js and Git
54+
- Install JSPM with global flag to have jspm command available: `npm install jspm -g` (otherwise you'll have to use a local version from `~/node_modules/`)
5355

54-
`npm start` - start local dev server with hot-module-reload for JSPM [jspm-hmr](https://www.npmjs.com/package/jspm-hmr)
5556

56-
`npm run bundle-dev` - inject static dev-bundle to JSPM config for quick full-page reload
57+
#### 1. Clone repo
58+
git clone https://github.com/piotrwitek/react-ts-jspm-starter-kit.git my-project-folder
5759

58-
`npm run unbundle` - un-inject static dev-bundle from JSPM config
60+
#### 2. Install npm dependencies
61+
npm install
5962

60-
`npm run build` - build production app bundle (only your app source) - optimized minified version w/o source-maps (dist/ folder)
63+
#### 3. Run development server with HMR and enjoy best possible dev feedback-loop
64+
npm start
6165

62-
`npm run build-debug` - same as build but debug version with source-maps
66+
---
6367

64-
`npm run build-deps` - build production dependency bundle (only external dependencies) (dist/ folder)
68+
## Usage
6569

6670
#### Dev Workflow
6771
1. `npm run bundle-dev` - _**OPTIONAL:** run only when your dependencies has changed_
6872
2. `npm start`
6973

70-
#### Build for Production Workflow (WIP -> in next release)
74+
#### Build for Production Workflow
7175
1. `npm run build`
7276
2. `npm run build-deps` - _**OPTIONAL:** run only when your dependencies has changed_
7377
3. open `http://localhost/dist/` to check
7478
4. deploy 'dist' contents on your server
7579

76-
---
80+
#### Npm Commands
7781

78-
## Installation
82+
`npm start` - start local dev server with hot-module-reload for JSPM [jspm-hmr](https://www.npmjs.com/package/jspm-hmr)
7983

80-
#### Prerequisites
81-
- Node.js and Git
82-
- Install JSPM with global flag to have jspm command available: `npm install jspm -g` (otherwise you'll have to use a local version from `~/node_modules/`)
84+
##### Development Bundling
8385

86+
`npm run bundle-dev` - bundle static dependencies for quick full-page reload, app sources remain as seperate modules for on-the-fly HMR & transpilation
8487

85-
#### 1. Create new project folder
86-
mkdir my-project && cd my-project
88+
`npm run unbundle` - un-bundle static dependencies (usefull when changing app dependencies)
8789

88-
#### 2. Clone repo
89-
git clone https://github.com/piotrwitek/react-ts-jspm-starter-kit.git .
90+
##### Production Bundling (`dist/` folder)
9091

91-
#### 3. Install npm dependencies
92-
npm install
92+
`npm run build` - build app bundle (only your app source) - minified, no source-maps
9393

94-
#### 4. Run development server and start developing
95-
npm start
94+
`npm run build-deps` - build dependency bundle (only external dependencies) - minified, no source-maps
95+
96+
`npm run build-all` - build both app & dependecy bundle
9697

98+
`npm run build-debug` - build app bundle - debug version with source-maps
9799

98100
---
99101

dist/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
</div>
2828
<!-- body bottom scripts -->
2929
<script src="system.js"></script>
30+
<script src="jspm.config.js"></script>
3031
<script type="text/javascript">
3132
// load main module of your app
3233
System.production = true;

dist/system.js

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

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
"prepush": "npm run lint && npm test",
1515
"bundle-dev": "jspm bundle dev-bundle.config.js out/dev-bundle.js -id",
1616
"unbundle": "jspm unbundle",
17-
"bundle-deps": "jspm bundle react + react-dom dist/deps-bundle.js --minify --skip-source-maps",
17+
"bundle-deps": "jspm unbundle && jspm bundle react + react-dom deps-bundle.js --minify --skip-source-maps -i && cp jspm.config.js dist/ && cp jspm_packages/system.js dist/ && mv deps-bundle.js dist/ && jspm unbundle",
1818
"bundle-app": "jspm build src/app - react - react-dom - plugin-typescript dist/app-bundle.js --minify --skip-source-maps",
1919
"bundle-app-debug": "jspm build src/app - react - react-dom - plugin-typescript dist/app-bundle.js",
2020
"build": "npm run bundle-app && npm run regenerator",
21+
"build-all": "npm run build-deps && npm run build",
2122
"build-debug": "npm run bundle-app-debug",
22-
"build-deps": "npm run unbundle && cp jspm_packages/system.js dist/ && cp jspm.config.js dist/ && npm run bundle-deps && npm run bundle-dev",
23-
"regenerator": "cd out && cp ../dist/app-bundle.js . && regenerator -r app-bundle.js > app-bundle.regenerator.js && cp app-bundle.regenerator.js ../dist/app-bundle.js",
23+
"build-deps": "npm run bundle-deps && npm run bundle-dev",
24+
"regenerator": "cd out && cp ../dist/app-bundle.js . && regenerator -r app-bundle.js > app-bundle.regenerator.js && cp app-bundle.regenerator.js ../dist/app-bundle.js ",
2425
"init-deploy": "mkdir dist && git clone https://github.com/piotrwitek/react-ts-jspm-starter-kit --branch gh-pages dist",
2526
"deploy": "cd dist && git checkout gh-pages && git add --all && git commit -m \"New Release\" && git push",
2627
"bd": "npm run build && npm run deploy",

0 commit comments

Comments
 (0)