react_on_rails 5.1.1 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -2
  3. data/README.md +3 -77
  4. data/docs/additional-reading/heroku-deployment.md +30 -0
  5. data/docs/contributor-info/contributing.md +11 -6
  6. data/docs/contributor-info/releasing.md +1 -1
  7. data/docs/tutorial.md +3 -1
  8. data/lib/generators/react_on_rails/base_generator.rb +0 -57
  9. data/lib/generators/react_on_rails/install_generator.rb +0 -28
  10. data/lib/generators/react_on_rails/templates/base/base/client/app/bundles/HelloWorld/components/HelloWorldWidget.jsx.tt +8 -22
  11. data/lib/generators/react_on_rails/templates/base/base/client/package.json.tt +4 -54
  12. data/lib/generators/react_on_rails/templates/base/base/package.json.tt +5 -25
  13. data/lib/react_on_rails/version.rb +1 -1
  14. data/package.json +3 -3
  15. data/rakelib/examples_config.yml +1 -6
  16. metadata +2 -26
  17. data/lib/generators/react_on_rails/bootstrap_generator.rb +0 -86
  18. data/lib/generators/react_on_rails/heroku_deployment_generator.rb +0 -29
  19. data/lib/generators/react_on_rails/js_linters_generator.rb +0 -19
  20. data/lib/generators/react_on_rails/ruby_linters_generator.rb +0 -35
  21. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-hot.tt +0 -4
  22. data/lib/generators/react_on_rails/templates/base/base/client/index.jade +0 -15
  23. data/lib/generators/react_on_rails/templates/base/base/client/server.js +0 -72
  24. data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.hot.config.js.tt +0 -70
  25. data/lib/generators/react_on_rails/templates/base/base/lib/tasks/linters.rake.tt +0 -88
  26. data/lib/generators/react_on_rails/templates/bootstrap/app/assets/stylesheets/_bootstrap-custom.scss +0 -63
  27. data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_post-bootstrap.scss +0 -10
  28. data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_pre-bootstrap.scss +0 -8
  29. data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_react-on-rails-sass-helper.scss +0 -19
  30. data/lib/generators/react_on_rails/templates/bootstrap/client/bootstrap-sass.config.js +0 -89
  31. data/lib/generators/react_on_rails/templates/heroku_deployment/Procfile +0 -1
  32. data/lib/generators/react_on_rails/templates/heroku_deployment/config/puma.rb +0 -15
  33. data/lib/generators/react_on_rails/templates/js_linters/client/.eslintignore +0 -1
  34. data/lib/generators/react_on_rails/templates/js_linters/client/.eslintrc +0 -48
  35. data/lib/generators/react_on_rails/templates/js_linters/client/.jscsrc +0 -18
  36. data/lib/generators/react_on_rails/templates/ruby_linters/.rubocop.yml +0 -27
  37. data/lib/generators/react_on_rails/templates/ruby_linters/.scss-lint.yml +0 -205
  38. data/lib/generators/react_on_rails/templates/ruby_linters/lib/tasks/brakeman.rake +0 -17
  39. data/lib/generators/react_on_rails/templates/ruby_linters/lib/tasks/ci.rake +0 -33
  40. data/lib/generators/react_on_rails/templates/ruby_linters/ruby-lint.yml.tt +0 -26
@@ -1,70 +0,0 @@
1
- // This config file setups up the Webpack Dev Server:
2
- // https://webpack.github.io/docs/webpack-dev-server.html
3
- // Run like this:
4
- // cd client && node server.js
5
-
6
- const webpack = require('webpack');
7
- const path = require('path');
8
- const config = require('./webpack.client.base.config');
9
-
10
- config.entry.app.push(
11
-
12
- // Webpack dev server
13
- 'webpack-dev-server/client?http://localhost:4000',
14
- 'webpack/hot/dev-server'<%- unless options.skip_bootstrap? -%>,
15
-
16
- // See: https://github.com/shakacode/bootstrap-sass-loader
17
- // We're using the bootstrap-sass loader.
18
- 'bootstrap-sass!./bootstrap-sass.config.js'
19
- <%- end -%>
20
-
21
- );
22
-
23
- config.output = {
24
-
25
- // this file is served directly by webpack
26
- filename: '[name]-bundle.js',
27
- path: __dirname,
28
- };
29
- config.plugins.unshift(new webpack.HotModuleReplacementPlugin());
30
- config.devtool = 'eval-source-map';
31
-
32
- // All the styling loaders only apply to hot-reload, not rails
33
- config.module.loaders.push(
34
- {
35
- test: /\.jsx?$/,
36
- loader: 'babel',
37
- exclude: /node_modules/,
38
- query: {
39
- plugins: [
40
- [
41
- 'react-transform',
42
- {
43
- transforms: [
44
- {
45
- transform: 'react-transform-hmr',
46
- imports: ['react'],
47
- locals: ['module'],
48
- },
49
- ],
50
- },
51
- ],
52
- ],
53
- },
54
- },
55
- { test: /\.css$/, loader: 'style-loader!css-loader' },
56
- {
57
- test: /\.scss$/,
58
- loader: `style!css!sass?outputStyle=expanded&imagePath=/assets/images&includePaths[]=\
59
- ${path.resolve(__dirname, './assets/stylesheets')}`,
60
- },
61
-
62
- // The url-loader uses DataUrls. The file-loader emits files.
63
- { test: /\.woff$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff' },
64
- { test: /\.woff2$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff' },
65
- { test: /\.ttf$/, loader: 'file-loader' },
66
- { test: /\.eot$/, loader: 'file-loader' },
67
- { test: /\.svg$/, loader: 'file-loader' }
68
- );
69
-
70
- module.exports = config;
@@ -1,88 +0,0 @@
1
- if %w(development test).include? Rails.env
2
- namespace :lint do
3
- <%- if options.ruby_linters? -%>
4
- # This fails: https://github.com/bbatsov/rubocop/issues/1840
5
- # RuboCop::RakeTask.new
6
- # require "rubocop/rake_task"
7
- desc "Run Rubocop lint in shell. Specify option fix to auto-correct (and don't have uncommitted files!)."
8
- task :rubocop, [:fix] => [] do |_t, args|
9
- def to_bool(str)
10
- return true if str =~ (/^(true|t|yes|y|1)$/i)
11
- return false if str.blank? || str =~ (/^(false|f|no|n|0)$/i)
12
- fail ArgumentError, "invalid value for Boolean: \"#{str}\""
13
- end
14
-
15
- fix = (args.fix == "fix") || to_bool(args.fix)
16
- cmd = "rubocop -S -D#{fix ? ' -a' : ''} ."
17
- puts "Running Rubocop Linters via `#{cmd}`#{fix ? ' auto-correct is turned on!' : ''}"
18
- sh cmd
19
- end
20
-
21
- desc "Run ruby-lint as shell"
22
- task :ruby do
23
- cmd = "ruby-lint app config spec lib"
24
- puts "Running ruby-lint Linters via `#{cmd}`"
25
- sh cmd
26
- end
27
-
28
- desc "See docs for task 'scss_lint'"
29
- task :scss do
30
- begin
31
- require 'scss_lint/rake_task'
32
- SCSSLint::RakeTask.new do |t|
33
- t.files = ["app/assets/stylesheets/", "client/assets/stylesheets/"]
34
- end
35
- Rake::Task[:scss_lint].invoke
36
- rescue LoadError
37
- puts "** add gem 'scss_lint' to your Gemfile for scss linting."
38
- end
39
- end
40
-
41
- # desc "haml_lint"
42
- # task :haml_lint do
43
- # require 'haml_lint/rake_task'
44
-
45
- # HamlLint::RakeTask.new do |t|
46
- # t.files = ["app/views"]
47
- # end
48
- # end
49
-
50
- # desc "See docs for task 'slim_lint'"
51
- # task slim: :slim_lint
52
- # SlimLint::RakeTask.new do |t|
53
- # t.files = ["app/views"]
54
- # end
55
-
56
- <%- end -%>
57
- <%- unless options.skip_js_linters? -%>
58
- desc "eslint"
59
- task :eslint do
60
- cmd = "cd client && npm run eslint"
61
- puts "Running eslint via `#{cmd}`"
62
- sh cmd
63
- end
64
-
65
- desc "jscs"
66
- task :jscs do
67
- cmd = "cd client && npm run jscs"
68
- puts "Running jscs via `#{cmd}`"
69
- sh cmd
70
- end
71
-
72
- desc "JS Linting"
73
- task js: [:eslint, :jscs] do
74
- puts "Completed running all JavaScript Linters"
75
- end
76
- <%- end -%>
77
-
78
- <%- enabled_linters = [] -%>
79
- <%- enabled_linters << %i(rubocop ruby scss) if options.ruby_linters? -%>
80
- <%- enabled_linters << %i(js) unless options.skip_js_linters? -%>
81
- task lint: <%= enabled_linters.flatten %> do
82
- puts "Completed all linting"
83
- end
84
- end
85
-
86
- desc "Runs all linters. Run `rake -D lint` to see all available lint options"
87
- task lint: ["lint:lint"]
88
- end
@@ -1,63 +0,0 @@
1
- // This file loads Bootstrap by importing components explicitly instead of doing `@import 'bootstrap';`
2
- // Doing so allows for customization of exactly which components are imported.
3
- // The components themselves are made available via bootstrap-sass (https://github.com/twbs/bootstrap-sass#sass)
4
-
5
- // IMPORTANT: Make sure to keep the customizations defined in this file
6
- // in-sync with the ones defined in client/bootstrap-sass.config.js.
7
-
8
- // For a reference on customizations,refer to:
9
- // https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/_bootstrap.scss
10
-
11
- // If you are looking to merely change bootstrap variables from their default,
12
- // you should instead declare them in client/assets/stylesheets/_post-bootstrap.scss
13
-
14
- // Core variables and mixins
15
- @import 'bootstrap/variables';
16
- @import 'bootstrap/mixins';
17
-
18
- // Reset and dependencies
19
- @import 'bootstrap/normalize';
20
- @import 'bootstrap/print';
21
- @import 'bootstrap/glyphicons';
22
-
23
- // Core CSS
24
- @import 'bootstrap/scaffolding';
25
- @import 'bootstrap/type';
26
- @import 'bootstrap/code';
27
- @import 'bootstrap/grid';
28
- @import 'bootstrap/tables';
29
- @import 'bootstrap/forms';
30
- @import 'bootstrap/buttons';
31
-
32
- // Components
33
- @import 'bootstrap/component-animations';
34
- @import 'bootstrap/dropdowns';
35
- @import 'bootstrap/button-groups';
36
- @import 'bootstrap/input-groups';
37
- @import 'bootstrap/navs';
38
- @import 'bootstrap/navbar';
39
- @import 'bootstrap/breadcrumbs';
40
- @import 'bootstrap/pagination';
41
- @import 'bootstrap/pager';
42
- @import 'bootstrap/labels';
43
- @import 'bootstrap/badges';
44
- @import 'bootstrap/jumbotron';
45
- @import 'bootstrap/thumbnails';
46
- @import 'bootstrap/alerts';
47
- @import 'bootstrap/progress-bars';
48
- @import 'bootstrap/media';
49
- @import 'bootstrap/list-group';
50
- @import 'bootstrap/panels';
51
- @import 'bootstrap/responsive-embed';
52
- @import 'bootstrap/wells';
53
- @import 'bootstrap/close';
54
-
55
- // Components w/ JavaScript
56
- @import 'bootstrap/modals';
57
- @import 'bootstrap/tooltip';
58
- @import 'bootstrap/popovers';
59
- @import 'bootstrap/carousel';
60
-
61
- // Utility classes
62
- @import 'bootstrap/utilities';
63
- @import 'bootstrap/responsive-utilities';
@@ -1,10 +0,0 @@
1
- // The Rails server imports this file via app/assets/stylesheets/application.css.scss
2
- // The webpack HMR dev server loads this file via client/bootstrap-sass.config.js
3
-
4
- // In either case, this file is loaded AFTER bootstrap has been loaded.
5
- // This is where you can add your own styles and override bootstrap styles
6
- // utilizing bootstrap variables and mixins.
7
-
8
- .this-works {
9
- color: orange;
10
- }
@@ -1,8 +0,0 @@
1
- // The Rails server imports this file via app/assets/stylesheets/application.css.scss
2
- // The webpack HMR dev server loads this file via client/bootstrap-sass.config.js
3
-
4
- // In either case, this file is loaded BEFORE bootstrap has been loaded.
5
- // Use it to define variables BEFORE bootstrap loads. See http://getbootstrap.com/customize/
6
-
7
- // This is a file that provides a fallback for `img-url` and fonts
8
- @import 'react-on-rails-sass-helper';
@@ -1,19 +0,0 @@
1
- // The Rails server imports this file via app/assets/stylesheets/application.css.scss
2
- // The webpack HMR dev server loads this file via client/bootstrap-sass.config.js
3
-
4
- // This file allows the same sass code with Rails and node-sass for the Webpack Dev Server.
5
- // It is CRTICAL that this file is loaded first.
6
-
7
- $rails: false !default; // defaults to false (e.g. webpack environment)
8
-
9
- // Sass 3 removes image-url helper
10
- // https://github.com/sass/libsass/issues/489
11
- $image-url-path: '/assets/images/' !default;
12
-
13
- @function img-url($image) {
14
- @if $rails {
15
- @return image-url($image);
16
- } @else {
17
- @return url('#{$image-url-path}#{$image}');
18
- }
19
- }
@@ -1,89 +0,0 @@
1
- // See https://github.com/shakacode/bootstrap-sass-loader for more information
2
-
3
- // IMPORTANT: Make sure to keep the customizations defined in this file
4
- // in-sync with the ones defined in app/assets/stylesheets/_bootstrap-custom.scss.
5
-
6
- // For a reference on customizations,refer to:
7
- // https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/_bootstrap.scss
8
-
9
- module.exports = {
10
- bootstrapCustomizations: './assets/stylesheets/_pre-bootstrap.scss',
11
- mainSass: './assets/stylesheets/_post-bootstrap.scss',
12
-
13
- // Default for the style loading is to put in your js files
14
- // styleLoader: 'style-loader!css-loader!sass-loader',
15
-
16
- // See: https://github.com/sass/node-sass#outputstyle
17
- // https://github.com/sass/node-sass#imagepath
18
- styleLoader: 'style-loader!css-loader!sass-loader?imagePath=/assets/images',
19
-
20
- // ### Scripts
21
- // Any scripts here set to false will never make it to the client,
22
- // i.e. it's not packaged by webpack.
23
- scripts: {
24
- transition: true,
25
- alert: true,
26
- button: true,
27
-
28
- carousel: true,
29
- collapse: true,
30
- dropdown: true,
31
-
32
- modal: true,
33
- tooltip: true,
34
- popover: true,
35
- scrollspy: true,
36
- tab: true,
37
- affix: true,
38
- },
39
-
40
- // ### Styles
41
- // Enable or disable certain less components and thus remove
42
- // the css for them from the build.
43
- styles: {
44
- mixins: true,
45
-
46
- normalize: true,
47
- print: true,
48
-
49
- scaffolding: true,
50
- type: true,
51
- code: true,
52
- grid: true,
53
- tables: true,
54
- forms: true,
55
- buttons: true,
56
-
57
- 'component-animations': true,
58
- glyphicons: true,
59
- dropdowns: true,
60
- 'button-groups': true,
61
- 'input-groups': true,
62
- navs: true,
63
- navbar: true,
64
- breadcrumbs: true,
65
- pagination: true,
66
- pager: true,
67
- labels: true,
68
- badges: true,
69
-
70
- jumbotron: true,
71
- thumbnails: true,
72
- alerts: true,
73
-
74
- 'progress-bars': true,
75
- media: true,
76
- 'list-group': true,
77
- panels: true,
78
- wells: true,
79
- close: true,
80
-
81
- modals: true,
82
- tooltip: true,
83
- popovers: true,
84
- carousel: true,
85
-
86
- utilities: true,
87
- 'responsive-utilities': true,
88
- },
89
- };
@@ -1 +0,0 @@
1
- web: bundle exec puma -C config/puma.rb
@@ -1,15 +0,0 @@
1
- workers Integer(ENV["WEB_CONCURRENCY"] || 2)
2
- threads_count = Integer(ENV["MAX_THREADS"] || 5)
3
- threads threads_count, threads_count
4
-
5
- preload_app!
6
-
7
- rackup DefaultRackup
8
- port ENV["PORT"] || 3000
9
- environment ENV["RACK_ENV"] || "development"
10
-
11
- on_worker_boot do
12
- # Worker specific setup for Rails 4.1+
13
- # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
14
- ActiveRecord::Base.establish_connection
15
- end
@@ -1,48 +0,0 @@
1
- ---
2
- parser: babel-eslint
3
-
4
- extends: eslint-config-shakacode
5
-
6
- plugins:
7
- - react
8
-
9
- globals:
10
- __DEBUG_SERVER_ERRORS__: true
11
- __SERVER_ERRORS__: true
12
-
13
- env:
14
- browser: true
15
- node: true
16
- mocha: true
17
-
18
- rules:
19
- ### Variables
20
- no-undef: 2
21
- no-unused-vars: [2, { vars: all, args: none }]
22
-
23
- ### Stylistic issues
24
- indent: [1, 2, { SwitchCase: 1, VariableDeclarator: 2 }]
25
- id-length: [1, { min: 2, exceptions: [_, e, i, k, v] }]
26
-
27
- ### React
28
- jsx-quotes: [1, prefer-double]
29
- react/display-name: 0
30
- react/jsx-boolean-value: [1, always]
31
- react/jsx-curly-spacing: [1, never]
32
- react/jsx-no-duplicate-props: [2, { ignoreCase: true }]
33
- react/jsx-no-undef: 2
34
- react/jsx-sort-prop-types: 0
35
- react/jsx-sort-props: 0
36
- react/jsx-uses-react: 2
37
- react/jsx-uses-vars: 2
38
- react/no-danger: 0
39
- react/no-did-mount-set-state: 1
40
- react/no-did-update-set-state: 0
41
- react/no-multi-comp: 2
42
- react/no-unknown-property: 2
43
- react/prop-types: 1
44
- react/react-in-jsx-scope: 2
45
- react/require-extension: [1, { extensions: [.js, .jsx] }]
46
- react/self-closing-comp: 2
47
- react/sort-comp: 0 # Should be 1. `statics` should be on top.
48
- react/wrap-multilines: 2
@@ -1,18 +0,0 @@
1
- {
2
- "preset": "airbnb",
3
- "fileExtensions": [
4
- ".js",
5
- ".jsx"
6
- ],
7
- "excludeFiles": [
8
- "assets/**",
9
- "build/**",
10
- "node_modules/**"
11
- ],
12
- "esprima": "babel-jscs",
13
- "validateQuoteMarks": {
14
- "mark": "'",
15
- "escape": true,
16
- "ignoreJSX": true
17
- }
18
- }