Skip to content

Commit 74adc68

Browse files
committed
Component init
0 parents  commit 74adc68

18 files changed

+16975
-0
lines changed

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 4
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.gitignore

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
### SublimeText ###
2+
*.sublime-workspace
3+
4+
### OSX ###
5+
.DS_Store
6+
.AppleDouble
7+
.LSOverride
8+
Icon
9+
10+
# Thumbnails
11+
._*
12+
13+
# Files that might appear on external disk
14+
.Spotlight-V100
15+
.Trashes
16+
17+
### Windows ###
18+
# Windows image file caches
19+
Thumbs.db
20+
ehthumbs.db
21+
22+
# Folder config file
23+
Desktop.ini
24+
25+
# Recycle Bin used on file shares
26+
$RECYCLE.BIN/
27+
28+
# App specific
29+
30+
node_modules/
31+
.tmp
32+
dist
33+
/src/main.js

.jshintrc

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"node": true,
3+
"browser": true,
4+
"esnext": true,
5+
"bitwise": true,
6+
"camelcase": false,
7+
"curly": true,
8+
"eqeqeq": true,
9+
"immed": true,
10+
"indent": 2,
11+
"latedef": true,
12+
"newcap": true,
13+
"noarg": true,
14+
"quotmark": "false",
15+
"regexp": true,
16+
"undef": true,
17+
"unused": false,
18+
"strict": true,
19+
"trailing": true,
20+
"smarttabs": true,
21+
"white": true,
22+
"newcap": false,
23+
"globals": {
24+
"React": true
25+
}
26+
}
27+

.yo-rc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"generator-react-webpack": {
3+
"app-name": "reactIntlTelInput",
4+
"architecture": false,
5+
"styles-language": "scss",
6+
"component-suffix": "js"
7+
}
8+
}

Gruntfile.js

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
'use strict';
2+
3+
var mountFolder = function (connect, dir) {
4+
return connect.static(require('path').resolve(dir));
5+
};
6+
7+
var webpackDistConfig = require('./webpack.dist.config.js'),
8+
webpackDevConfig = require('./webpack.config.js');
9+
10+
module.exports = function (grunt) {
11+
// Let *load-grunt-tasks* require everything
12+
require('load-grunt-tasks')(grunt);
13+
14+
// Read configuration from package.json
15+
var pkgConfig = grunt.file.readJSON('package.json');
16+
17+
grunt.initConfig({
18+
pkg: pkgConfig,
19+
20+
webpack: {
21+
options: webpackDistConfig,
22+
dist: {
23+
cache: false
24+
}
25+
},
26+
27+
'webpack-dev-server': {
28+
options: {
29+
hot: true,
30+
port: 8000,
31+
webpack: webpackDevConfig,
32+
publicPath: '/assets/',
33+
contentBase: './<%= pkg.src %>/'
34+
},
35+
36+
start: {
37+
keepAlive: true
38+
}
39+
},
40+
41+
connect: {
42+
options: {
43+
port: 8000
44+
},
45+
46+
dist: {
47+
options: {
48+
keepalive: true,
49+
middleware: function (connect) {
50+
return [
51+
mountFolder(connect, pkgConfig.dist)
52+
];
53+
}
54+
}
55+
}
56+
},
57+
58+
open: {
59+
options: {
60+
delay: 500
61+
},
62+
dev: {
63+
path: 'http://localhost:<%= connect.options.port %>/webpack-dev-server/'
64+
},
65+
dist: {
66+
path: 'http://localhost:<%= connect.options.port %>/'
67+
}
68+
},
69+
70+
karma: {
71+
unit: {
72+
configFile: 'karma.conf.js'
73+
}
74+
},
75+
76+
copy: {
77+
dist: {
78+
files: [
79+
// includes files within path
80+
{
81+
flatten: true,
82+
expand: true,
83+
src: ['<%= pkg.src %>/*'],
84+
dest: '<%= pkg.dist %>/',
85+
filter: 'isFile'
86+
},
87+
{
88+
flatten: true,
89+
expand: true,
90+
src: ['<%= pkg.src %>/images/*'],
91+
dest: '<%= pkg.dist %>/images/'
92+
}
93+
]
94+
}
95+
},
96+
97+
clean: {
98+
dist: {
99+
files: [{
100+
dot: true,
101+
src: [
102+
'<%= pkg.dist %>'
103+
]
104+
}]
105+
}
106+
}
107+
});
108+
109+
grunt.registerTask('serve', function (target) {
110+
if (target === 'dist') {
111+
return grunt.task.run(['build', 'open:dist', 'connect:dist']);
112+
}
113+
114+
grunt.task.run([
115+
'open:dev',
116+
'webpack-dev-server'
117+
]);
118+
});
119+
120+
grunt.registerTask('test', ['karma']);
121+
122+
grunt.registerTask('build', ['clean', 'copy', 'webpack']);
123+
124+
grunt.registerTask('default', []);
125+
};

karma.conf.js

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
'use strict';
2+
3+
var path = require('path');
4+
5+
module.exports = function (config) {
6+
config.set({
7+
basePath: '',
8+
frameworks: ['jasmine'],
9+
files: [
10+
'test/helpers/**/*.js',
11+
'test/spec/components/**/*.js'
12+
],
13+
preprocessors: {
14+
'test/spec/components/**/*.js': ['webpack'],
15+
'test/spec/components/**/*.jsx': ['webpack']
16+
},
17+
webpack: {
18+
cache: true,
19+
module: {
20+
loaders: [{
21+
test: /\.gif/,
22+
loader: 'url-loader?limit=10000&mimetype=image/gif'
23+
}, {
24+
test: /\.jpg/,
25+
loader: 'url-loader?limit=10000&mimetype=image/jpg'
26+
}, {
27+
test: /\.png/,
28+
loader: 'url-loader?limit=10000&mimetype=image/png'
29+
}, {
30+
test: /\.(js|jsx)$/,
31+
loader: 'babel-loader'
32+
}, {
33+
test: /\.scss/,
34+
loader: 'style-loader!css-loader!sass-loader?outputStyle=expanded'
35+
}, {
36+
test: /\.css$/,
37+
loader: 'style-loader!css-loader'
38+
}, {
39+
test: /\.woff/,
40+
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
41+
}, {
42+
test: /\.woff2/,
43+
loader: 'url-loader?limit=10000&mimetype=application/font-woff2'
44+
}]
45+
},
46+
resolve: {
47+
alias: {
48+
'styles': path.join(process.cwd(), './src/styles/'),
49+
'components': path.join(process.cwd(), './src/components/')
50+
}
51+
}
52+
},
53+
webpackServer: {
54+
stats: {
55+
colors: true
56+
}
57+
},
58+
exclude: [],
59+
port: 8080,
60+
logLevel: config.LOG_INFO,
61+
colors: true,
62+
autoWatch: false,
63+
// Start these browsers, currently available:
64+
// - Chrome
65+
// - ChromeCanary
66+
// - Firefox
67+
// - Opera
68+
// - Safari (only Mac)
69+
// - PhantomJS
70+
// - IE (only Windows)
71+
browsers: ['PhantomJS'],
72+
reporters: ['progress'],
73+
captureTimeout: 60000,
74+
singleRun: true
75+
});
76+
};

package.json

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "reactintltelinput",
3+
"version": "0.0.0",
4+
"description": "",
5+
"repository": "",
6+
"private": true,
7+
"src": "src",
8+
"test": "test",
9+
"dist": "dist",
10+
"mainInput": "ReactIntlTelInputApp",
11+
"mainOutput": "main",
12+
"dependencies": {
13+
"react": "~0.12.2",
14+
"normalize.css": "~3.0.3"
15+
},
16+
"devDependencies": {
17+
"grunt": "~0.4.5",
18+
"load-grunt-tasks": "~0.6.0",
19+
"grunt-contrib-connect": "~0.8.0",
20+
"webpack": "~1.4.3",
21+
"grunt-webpack": "~1.0.8",
22+
"style-loader": "~0.8.0",
23+
"url-loader": "~0.5.5",
24+
"css-loader": "~0.9.0",
25+
"karma-script-launcher": "~0.1.0",
26+
"karma-chrome-launcher": "~0.1.4",
27+
"karma-firefox-launcher": "~0.1.3",
28+
"karma-jasmine": "~0.1.5",
29+
"karma-phantomjs-launcher": "~0.1.3",
30+
"karma": "~0.12.21",
31+
"grunt-karma": "~0.8.3",
32+
"karma-webpack": "~1.2.2",
33+
"webpack-dev-server": "~1.6.5",
34+
"grunt-open": "~0.2.3",
35+
"jshint-loader": "~0.8.0",
36+
"jsxhint-loader": "~0.2.0",
37+
"grunt-contrib-copy": "~0.5.0",
38+
"babel": "^4.0.0",
39+
"babel-loader": "^4.0.0",
40+
"grunt-contrib-clean": "~0.6.0",
41+
"sass-loader": "^1.0.1",
42+
"react-hot-loader": "^1.0.7"
43+
}
44+
}
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use strict';
2+
3+
var React = require('react/addons');
4+
var ReactTransitionGroup = React.addons.TransitionGroup;
5+
6+
// CSS
7+
require('normalize.css');
8+
require('../styles/main.css');
9+
10+
var imageURL = require('../images/yeoman.png');
11+
12+
var ReactIntlTelInputApp = React.createClass({
13+
render: function() {
14+
return (
15+
<div className='main'>
16+
<ReactTransitionGroup transitionName="fade">
17+
<img src={imageURL} />
18+
</ReactTransitionGroup>
19+
</div>
20+
);
21+
}
22+
});
23+
React.render(<ReactIntlTelInputApp />, document.getElementById('content')); // jshint ignore:line
24+
25+
module.exports = ReactIntlTelInputApp;

src/favicon.ico

4.19 KB
Binary file not shown.

src/images/yeoman.png

13.2 KB
Loading

src/index.html

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6+
<title></title>
7+
<meta name="description" content="">
8+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
9+
</head>
10+
<body>
11+
<!--[if lt IE 8]>
12+
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
13+
<![endif]-->
14+
<div id="content">
15+
<h1>If you can see this, something is broken (or JS is not enabled)!!.</h1>
16+
</div>
17+
18+
<script>
19+
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__
20+
</script>
21+
<script type="text/javascript" src="assets/main.js"></script>
22+
</body>
23+
</html>

0 commit comments

Comments
 (0)