Skip to content

Commit 35133d2

Browse files
committed
Initial commit
1 parent 9521dbe commit 35133d2

22 files changed

+24614
-0
lines changed

.babelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["env", "stage-1", "react"],
3+
"plugins": ["add-module-exports"]
4+
}

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = LF
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.eslintrc

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
{
2+
3+
"extends": ["eslint:recommended", "plugin:react/recommended"],
4+
5+
"env": {
6+
"browser": true,
7+
"es6": true,
8+
"node": true
9+
},
10+
11+
"globals": {
12+
"document": false,
13+
"escape": false,
14+
"navigator": false,
15+
"unescape": false,
16+
"window": false,
17+
"describe": true,
18+
"before": true,
19+
"it": true,
20+
"expect": true,
21+
"sinon": true
22+
},
23+
24+
"parser": "babel-eslint",
25+
26+
"plugins": [
27+
"react"
28+
],
29+
30+
"rules": {
31+
"block-scoped-var": 2,
32+
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
33+
"camelcase": [2, { "properties": "always" }],
34+
"comma-dangle": [2, "never"],
35+
"comma-spacing": [2, { "before": false, "after": true }],
36+
"comma-style": [2, "last"],
37+
"complexity": 0,
38+
"consistent-return": 2,
39+
"consistent-this": 0,
40+
"curly": [2, "multi-line"],
41+
"default-case": 0,
42+
"dot-location": [2, "property"],
43+
"dot-notation": 0,
44+
"eol-last": 2,
45+
"eqeqeq": [2, "allow-null"],
46+
"func-names": 0,
47+
"func-style": 0,
48+
"generator-star-spacing": [2, "both"],
49+
"guard-for-in": 0,
50+
"handle-callback-err": [2, "^(err|error|anySpecificError)$" ],
51+
"indent": [2, 2, { "SwitchCase": 1 }],
52+
"key-spacing": [2, { "beforeColon": false, "afterColon": true }],
53+
"keyword-spacing": [2, {"before": true, "after": true}],
54+
"linebreak-style": 0,
55+
"max-depth": 0,
56+
"max-len": [2, 120, 4, { "ignoreRegExpLiterals": true, "ignoreUrls": true, "ignorePattern": "data:"}],
57+
"max-nested-callbacks": 0,
58+
"max-params": 0,
59+
"max-statements": 0,
60+
"new-cap": [2, { "newIsCap": true, "capIsNew": false }],
61+
"newline-after-var": [2, "always"],
62+
"new-parens": 2,
63+
"no-alert": 0,
64+
"no-array-constructor": 2,
65+
"no-bitwise": 0,
66+
"no-caller": 2,
67+
"no-catch-shadow": 0,
68+
"no-cond-assign": 2,
69+
"no-console": 0,
70+
"no-constant-condition": 0,
71+
"no-continue": 0,
72+
"no-control-regex": 2,
73+
"no-debugger": 2,
74+
"no-delete-var": 2,
75+
"no-div-regex": 0,
76+
"no-dupe-args": 2,
77+
"no-dupe-keys": 2,
78+
"no-duplicate-case": 2,
79+
"no-else-return": 2,
80+
"no-empty": 0,
81+
"no-empty-character-class": 2,
82+
"no-eq-null": 0,
83+
"no-eval": 2,
84+
"no-ex-assign": 2,
85+
"no-extend-native": 2,
86+
"no-extra-bind": 2,
87+
"no-extra-boolean-cast": 2,
88+
"no-extra-parens": 0,
89+
"no-extra-semi": 0,
90+
"no-extra-strict": 0,
91+
"no-fallthrough": 2,
92+
"no-floating-decimal": 2,
93+
"no-func-assign": 2,
94+
"no-implied-eval": 2,
95+
"no-inline-comments": 0,
96+
"no-inner-declarations": [2, "functions"],
97+
"no-invalid-regexp": 2,
98+
"no-irregular-whitespace": 2,
99+
"no-iterator": 2,
100+
"no-label-var": 2,
101+
"no-labels": 2,
102+
"no-lone-blocks": 0,
103+
"no-lonely-if": 0,
104+
"no-loop-func": 0,
105+
"no-mixed-requires": 0,
106+
"no-mixed-spaces-and-tabs": [2, false],
107+
"no-multi-spaces": 2,
108+
"no-multi-str": 2,
109+
"no-multiple-empty-lines": [2, { "max": 1 }],
110+
"no-native-reassign": 2,
111+
"no-negated-in-lhs": 2,
112+
"no-nested-ternary": 0,
113+
"no-new": 2,
114+
"no-new-func": 2,
115+
"no-new-object": 2,
116+
"no-new-require": 2,
117+
"no-new-wrappers": 2,
118+
"no-obj-calls": 2,
119+
"no-octal": 2,
120+
"no-octal-escape": 2,
121+
"no-path-concat": 0,
122+
"no-plusplus": 0,
123+
"no-process-env": 0,
124+
"no-process-exit": 0,
125+
"no-proto": 2,
126+
"no-redeclare": 2,
127+
"no-regex-spaces": 2,
128+
"no-reserved-keys": 0,
129+
"no-restricted-modules": 0,
130+
"no-return-assign": 2,
131+
"no-script-url": 0,
132+
"no-self-compare": 2,
133+
"no-sequences": 2,
134+
"no-shadow": 0,
135+
"no-shadow-restricted-names": 2,
136+
"no-spaced-func": 2,
137+
"no-sparse-arrays": 2,
138+
"no-sync": 0,
139+
"no-ternary": 0,
140+
"no-throw-literal": 2,
141+
"no-trailing-spaces": 2,
142+
"no-undef": 2,
143+
"no-undef-init": 2,
144+
"no-undefined": 0,
145+
"no-underscore-dangle": 0,
146+
"no-unneeded-ternary": 2,
147+
"no-unreachable": 2,
148+
"no-unused-expressions": 0,
149+
"no-unused-vars": [2, { "vars": "all", "args": "none" }],
150+
"no-use-before-define": 2,
151+
"no-var": 0,
152+
"no-void": 0,
153+
"no-warning-comments": 0,
154+
"no-with": 2,
155+
"one-var": 0,
156+
"operator-assignment": 0,
157+
"operator-linebreak": [2, "after"],
158+
"padded-blocks": 0,
159+
"quote-props": 0,
160+
"quotes": [2, "single", "avoid-escape"],
161+
"radix": 2,
162+
"semi": [2, "always"],
163+
"semi-spacing": 0,
164+
"sort-vars": 0,
165+
"space-before-blocks": [2, "always"],
166+
"space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
167+
"space-in-brackets": 0,
168+
"space-in-parens": [2, "never"],
169+
"space-infix-ops": 2,
170+
"space-unary-ops": [2, { "words": true, "nonwords": false }],
171+
"spaced-comment": [2, "always"],
172+
"strict": 0,
173+
"use-isnan": 2,
174+
"valid-jsdoc": 0,
175+
"valid-typeof": 2,
176+
"vars-on-top": 2,
177+
"wrap-iife": [2, "any"],
178+
"wrap-regex": 0,
179+
"yoda": [2, "never"]
180+
}
181+
}

.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Logs
2+
logs
3+
*.log
4+
5+
# Runtime data
6+
pids
7+
*.pid
8+
*.seed
9+
10+
# Directory for instrumented libs generated by jscoverage/JSCover
11+
lib-cov
12+
13+
# Coverage directory used by tools like istanbul
14+
coverage
15+
16+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17+
.grunt
18+
19+
# node-waf configuration
20+
.lock-wscript
21+
22+
# Compiled binary addons (http://nodejs.org/api/addons.html)
23+
build/Release
24+
25+
# Dependency directory
26+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
27+
node_modules
28+
29+
# Remove some common IDE working directories
30+
.idea
31+
.vscode
32+
33+
.DS_Store

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v6.10

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: node_js
2+
node_js:
3+
- "node"
4+
- "7"
5+
- "6"

README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,90 @@
11
# react-from-flex
22
React components inspired by Adobe/Apache Flex MXML. https://www.npmjs.com/package/react-from-flex
3+
4+
5+
6+
# Webpack library starter
7+
8+
Webpack based boilerplate for producing libraries (Input: ES6, Output: universal library)
9+
10+
![Travis](https://travis-ci.org/krasimir/webpack-library-starter.svg?branch=master)
11+
12+
## Features
13+
14+
* Webpack 3 based.
15+
* ES6 as a source.
16+
* Exports in a [umd](https://github.com/umdjs/umd) format so your library works everywhere.
17+
* ES6 test setup with [Mocha](http://mochajs.org/) and [Chai](http://chaijs.com/).
18+
* Linting with [ESLint](http://eslint.org/).
19+
20+
## Process
21+
22+
```
23+
ES6 source files
24+
|
25+
|
26+
webpack
27+
|
28+
+--- babel, eslint
29+
|
30+
ready to use
31+
library
32+
in umd format
33+
```
34+
35+
*Have in mind that you have to build your library before publishing. The files under the `lib` folder are the ones that should be distributed.*
36+
37+
## Getting started
38+
39+
1. Setting up the name of your library
40+
* Open `webpack.config.js` file and change the value of `libraryName` variable.
41+
* Open `package.json` file and change the value of `main` property so it matches the name of your library.
42+
2. Build your library
43+
* Run `yarn install` (recommended) or `npm install` to get the project's dependencies
44+
* Run `yarn build` or `npm run build` to produce minified version of your library.
45+
3. Development mode
46+
* Having all the dependencies installed run `yarn dev` or `npm run dev`. This command will generate an non-minified version of your library and will run a watcher so you get the compilation on file change.
47+
4. Running the tests
48+
* Run `yarn test` or `npm run test`
49+
50+
## Scripts
51+
52+
* `yarn build` or `npm run build` - produces production version of your library under the `lib` folder
53+
* `yarn dev` or `npm run dev` - produces development version of your library and runs a watcher
54+
* `yarn test` or `npm run test` - well ... it runs the tests :)
55+
* `yarn test:watch` or `npm run test:watch` - same as above but in a watch mode
56+
57+
## Readings
58+
59+
* [Start your own JavaScript library using webpack and ES6](http://krasimirtsonev.com/blog/article/javascript-library-starter-using-webpack-es6)
60+
61+
## Misc
62+
63+
### An example of using dependencies that shouldn’t be resolved by webpack, but should become dependencies of the resulting bundle
64+
65+
In the following example we are excluding React and Lodash:
66+
67+
```js
68+
{
69+
devtool: 'source-map',
70+
output: {
71+
path: '...',
72+
libraryTarget: 'umd',
73+
library: '...'
74+
},
75+
entry: '...',
76+
...
77+
externals: {
78+
react: 'react'
79+
// Use more complicated mapping for lodash.
80+
// We need to access it differently depending
81+
// on the environment.
82+
lodash: {
83+
commonjs: 'lodash',
84+
commonjs2: 'lodash',
85+
amd: '_',
86+
root: '_'
87+
}
88+
}
89+
}
90+
```

0 commit comments

Comments
 (0)