Skip to content

Commit

Permalink
Added webpack build for node support
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom32i committed Jun 10, 2017
1 parent b5b4fdf commit 57a81ab
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 19 deletions.
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"presets": ["es2015"]
"presets": ["es2015"],
"plugins": ["transform-class-properties"]
}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/node_modules/
/node_modules
/dist
yarn.lock
package-lock.json
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Elao
Copyright (c) 2017 élao

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Microscopic dependency injection container

## Installation

yarn add elao-container.js
npm install @elao/container.js

## Usage

Expand All @@ -28,7 +28,7 @@ Set up your container like that:

```js
// my-container.js
import Container from 'elao-container.js';
import Container from '@elao/container.js';
import MyApiClient from './MyApiClient';

const container = new Container();
Expand Down
38 changes: 24 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,40 @@
{
"name": "elao-container.js",
"version": "1.0.0",
"name": "@elao/container.js",
"version": "2.0.0",
"description": "Microscopic dependency injection container",
"main": "src/Container.js",
"keywords": [
"dependency",
"injection",
"container",
"service"
],
"main": "dist/container.js",
"repository": {
"type": "git",
"url": "git+https://github.com/Elao/container.js.git"
},
"author": "Thomas Jarrand <[email protected]>",
"author": "Thomas Jarrand <[email protected]> (http://thomas.jarrand.fr)",
"license": "MIT",
"copyright": "Copyright 2017 élao",
"bugs": {
"url": "https://github.com/Elao/container.js/issues"
},
"homepage": "https://github.com/Elao/container.js#readme",
"scripts": {
"test": "jest"
"test": "jest",
"build": "NODE_ENV=production webpack",
"start": "NODE_ENV=dev webpack --watch"
},
"keywords": [
"dependency",
"injection",
"container",
"service"
],
"devDependencies": {
"babel-jest": "^19.0.0",
"babel-preset-es2015": "^6.24.0",
"jest": "^19.0.2"
"babel": "^6.23.0",
"babel-core": "^6.25.0",
"babel-eslint": "^7.2.3",
"babel-jest": "^20.0.3",
"babel-loader": "^7.0.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"jest": "^20.0.4",
"webpack": "^2.6.1"
}
}
33 changes: 33 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const webpack = require('webpack');
const meta = require('./package.json');

module.exports = {
entry: './src/Container.js',
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
]
},
output: {
path: __dirname + '/dist',
filename: 'container.js',
library: 'Container',
libraryTarget: 'umd',
},
devServer: {
contentBase: './dist',
},
devtool: 'source-map',
plugins: [
new webpack.optimize.UglifyJsPlugin(),
new webpack.BannerPlugin([
`${meta.name} - ${meta.version}`,
`${meta.homepage}`,
`${meta.copyright}`,
].join('\n'))
]
};

0 comments on commit 57a81ab

Please sign in to comment.