Skip to content

Commit

Permalink
[ADD] NPM release: prepare package for release
Browse files Browse the repository at this point in the history
- Add webpack config for creating es5 bundles
- Change tsconfig for compiled source code
- Add ignores for git and npm
  • Loading branch information
elboman committed Aug 22, 2016
1 parent 5f03fc3 commit 211d898
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.DS_STORE

typings/
node_modules/
node_modules/

dist/
_bundles/
7 changes: 7 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS_STORE

typings/
node_modules/

example/
code/
21 changes: 17 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
{
"name": "proof",
"name": "proofed",
"version": "0.1.0",
"description": "A flexible library for user interaction validation",
"main": "index.js",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"start": "webpack-dev-server --host 0.0.0.0 --port 8000 --config example/webpack.config.js --history-api-fallback --content-base example"
"start": "webpack-dev-server --host 0.0.0.0 --port 8000 --config example/webpack.config.js --history-api-fallback --content-base example",
"bundle": "rimraf _bundles && mkdirp _bundles && NODE_ENV=production webpack",
"compile": "rimraf dist && mkdirp dist && node ./node_modules/typescript/bin/tsc",
"package": "npm run bundle && npm run compile"
},
"author": {
"name": "Marco Botto",
"web": "https://github.com/elboman"
},
"repository": {
"type": "git",
"url": "https://github.com/elboman/proofed.git"
},
"author": "",
"license": "MIT",
"devDependencies": {
"awesome-typescript-loader": "^1.1.1",
"react": "^15.3.0",
"react-dom": "^15.3.0",
"rimraf": "^2.5.4",
"ts-loader": "^0.8.2",
"tsc": "^1.20150623.0",
"typescript": "^1.8.10",
Expand Down
23 changes: 22 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
{
"moduleResolution": "node",
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"jsx": "react",
"allowSyntheticDefaultImports": true,
"suppressImplicitAnyIndexErrors": true,
"forceConsistentCasingInFileNames": true
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"declaration": true,
"outDir": "dist",
"sourceRoot": "code",
"rootDir": "code"
},
"exclude": [
"node_modules",
"bower_components",
"example"
],
"awesomeTypescriptLoaderOptions": {
"module": "commonjs",
"target": "es5",
"jsx": "react",
"allowSyntheticDefaultImports": true,
"suppressImplicitAnyIndexErrors": true,
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"declaration": false
},
"compileOnSave": false,
"buildOnSave": false
Expand Down
39 changes: 39 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
var path = require('path');
var webpack = require('webpack');

module.exports = {
entry: {
"react-proofed": ['./code/index.ts'],
"react-proofed.min": ['./code/index.ts']
},
output: {
path: path.resolve(__dirname, '_bundles'),
filename: '[name].js',
libraryTarget: "umd",
library: "react-proofed",
umdNamedDefine: true
},
resolve: {
extensions: ['', '.ts', '.tsx', '.js', '.jsx']
},
devtool: 'source-map',
plugins: [
new webpack.optimize.UglifyJsPlugin({
minimize: true,
include: /\.min\.js$/,
})
],
module: {
loaders: [
{
test: /\.tsx?$/,
loader: "awesome-typescript-loader",
exclude: /node_modules/
}
]
},
externals: {
"react": "React",
"react-dom": "ReactDOM"
}
};

0 comments on commit 211d898

Please sign in to comment.