mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
🐛 fix dependencies issues
This commit is contained in:
parent
e5ddc8221c
commit
3055214116
@ -1 +0,0 @@
|
|||||||
defaults
|
|
@ -34,8 +34,6 @@ Gruntfile.js
|
|||||||
.flowconfig
|
.flowconfig
|
||||||
.documentup.json
|
.documentup.json
|
||||||
.yarn-metadata.json
|
.yarn-metadata.json
|
||||||
.*.yml
|
|
||||||
*.yml
|
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
*.gz
|
*.gz
|
||||||
|
@ -356,7 +356,7 @@ GEM
|
|||||||
activesupport (>= 4)
|
activesupport (>= 4)
|
||||||
railties (>= 4)
|
railties (>= 4)
|
||||||
request_store (~> 1.0)
|
request_store (~> 1.0)
|
||||||
loofah (2.3.1)
|
loofah (2.4.0)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
mail (2.7.1)
|
mail (2.7.1)
|
||||||
@ -388,7 +388,7 @@ GEM
|
|||||||
net-ssh (>= 2.6.5, < 6.0.0)
|
net-ssh (>= 2.6.5, < 6.0.0)
|
||||||
net-ssh (5.2.0)
|
net-ssh (5.2.0)
|
||||||
nio4r (2.5.1)
|
nio4r (2.5.1)
|
||||||
nokogiri (1.10.5)
|
nokogiri (1.10.7)
|
||||||
mini_portile2 (~> 2.4.0)
|
mini_portile2 (~> 2.4.0)
|
||||||
nokogumbo (2.0.1)
|
nokogumbo (2.0.1)
|
||||||
nokogiri (~> 1.8, >= 1.8.4)
|
nokogiri (~> 1.8, >= 1.8.4)
|
||||||
@ -660,7 +660,7 @@ GEM
|
|||||||
addressable (>= 2.3.6)
|
addressable (>= 2.3.6)
|
||||||
crack (>= 0.3.2)
|
crack (>= 0.3.2)
|
||||||
hashdiff (>= 0.4.0, < 2.0.0)
|
hashdiff (>= 0.4.0, < 2.0.0)
|
||||||
webpacker (4.2.0)
|
webpacker (4.2.2)
|
||||||
activesupport (>= 4.2)
|
activesupport (>= 4.2)
|
||||||
rack-proxy (>= 0.6.1)
|
rack-proxy (>= 0.6.1)
|
||||||
railties (>= 4.2)
|
railties (>= 4.2)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
web: env PORT=3000 bundle exec puma -C config/puma.rb
|
web: env PORT=3000 bundle exec puma -C config/puma.rb
|
||||||
sidekiq: env PORT=3000 bundle exec sidekiq
|
sidekiq: env PORT=3000 bundle exec sidekiq
|
||||||
stream: env PORT=4000 yarn run start
|
stream: killall node && env PORT=4000 yarn run start
|
||||||
webpack: ./bin/webpack-dev-server --listen-host 0.0.0.0
|
webpack: ./bin/webpack-dev-server --listen-host 0.0.0.0
|
||||||
|
26
app/javascript/packs/hello_react.jsx
Normal file
26
app/javascript/packs/hello_react.jsx
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Run this example by adding <%= javascript_pack_tag 'hello_react' %> to the head of your layout file,
|
||||||
|
// like app/views/layouts/application.html.erb. All it does is render <div>Hello React</div> at the bottom
|
||||||
|
// of the page.
|
||||||
|
|
||||||
|
import React from 'react'
|
||||||
|
import ReactDOM from 'react-dom'
|
||||||
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
|
const Hello = props => (
|
||||||
|
<div>Hello {props.name}!</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
Hello.defaultProps = {
|
||||||
|
name: 'David'
|
||||||
|
}
|
||||||
|
|
||||||
|
Hello.propTypes = {
|
||||||
|
name: PropTypes.string
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
ReactDOM.render(
|
||||||
|
<Hello name="React" />,
|
||||||
|
document.body.appendChild(document.createElement('div')),
|
||||||
|
)
|
||||||
|
})
|
154
babel.config.js
154
babel.config.js
@ -1,71 +1,91 @@
|
|||||||
module.exports = (api) => {
|
module.exports = function (api) {
|
||||||
const env = api.env();
|
var validEnv = ['development', 'test', 'production'];
|
||||||
|
var currentEnv = api.env();
|
||||||
|
var isDevelopmentEnv = api.env('development');
|
||||||
|
var isProductionEnv = api.env('production');
|
||||||
|
var isTestEnv = api.env('test');
|
||||||
|
|
||||||
const reactOptions = {
|
if (!validEnv.includes(currentEnv)) {
|
||||||
development: false,
|
throw new Error(
|
||||||
};
|
'Please specify a valid `NODE_ENV` or ' +
|
||||||
|
'`BABEL_ENV` environment variables. Valid values are "development", ' +
|
||||||
const envOptions = {
|
'"test", and "production". Instead, received: ' +
|
||||||
loose: true,
|
JSON.stringify(currentEnv) +
|
||||||
modules: false,
|
'.',
|
||||||
debug: false,
|
);
|
||||||
};
|
|
||||||
|
|
||||||
const config = {
|
|
||||||
presets: [
|
|
||||||
['@babel/react', reactOptions],
|
|
||||||
['@babel/env', envOptions],
|
|
||||||
],
|
|
||||||
plugins: [
|
|
||||||
['@babel/proposal-decorators', { legacy: true }],
|
|
||||||
'@babel/proposal-class-properties',
|
|
||||||
['react-intl', { messagesDir: './build/messages' }],
|
|
||||||
'preval',
|
|
||||||
],
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
test: /tesseract\.js/,
|
|
||||||
presets: [
|
|
||||||
['@babel/env', { ...envOptions, modules: 'commonjs' }],
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
switch (env) {
|
|
||||||
case 'production':
|
|
||||||
config.plugins.push(...[
|
|
||||||
'lodash',
|
|
||||||
[
|
|
||||||
'transform-react-remove-prop-types',
|
|
||||||
{
|
|
||||||
mode: 'remove',
|
|
||||||
removeImport: true,
|
|
||||||
additionalLibraries: [
|
|
||||||
'react-immutable-proptypes',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'@babel/transform-react-inline-elements',
|
|
||||||
[
|
|
||||||
'@babel/transform-runtime',
|
|
||||||
{
|
|
||||||
helpers: true,
|
|
||||||
regenerator: false,
|
|
||||||
useESModules: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
break;
|
|
||||||
case 'development':
|
|
||||||
reactOptions.development = true;
|
|
||||||
envOptions.debug = true;
|
|
||||||
break;
|
|
||||||
case 'test':
|
|
||||||
envOptions.modules = 'commonjs';
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return config;
|
return {
|
||||||
|
presets: [
|
||||||
|
isTestEnv && [
|
||||||
|
'@babel/preset-env',
|
||||||
|
{
|
||||||
|
targets: {
|
||||||
|
node: 'current',
|
||||||
|
},
|
||||||
|
modules: 'commonjs',
|
||||||
|
},
|
||||||
|
'@babel/preset-react',
|
||||||
|
],
|
||||||
|
(isProductionEnv || isDevelopmentEnv) && [
|
||||||
|
'@babel/preset-env',
|
||||||
|
{
|
||||||
|
forceAllTransforms: true,
|
||||||
|
useBuiltIns : 'entry',
|
||||||
|
corejs : 3,
|
||||||
|
modules : false,
|
||||||
|
exclude : ['transform-typeof-symbol'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'@babel/preset-react',
|
||||||
|
{
|
||||||
|
development: isDevelopmentEnv || isTestEnv,
|
||||||
|
useBuiltIns: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
].filter(Boolean),
|
||||||
|
plugins: [
|
||||||
|
'babel-plugin-macros',
|
||||||
|
'@babel/plugin-syntax-dynamic-import',
|
||||||
|
isTestEnv && 'babel-plugin-dynamic-import-node',
|
||||||
|
'@babel/plugin-transform-destructuring',
|
||||||
|
[
|
||||||
|
'@babel/plugin-proposal-decorators',
|
||||||
|
{ 'legacy': true },
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'@babel/plugin-proposal-class-properties',
|
||||||
|
{
|
||||||
|
loose: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'@babel/plugin-proposal-object-rest-spread',
|
||||||
|
{
|
||||||
|
useBuiltIns: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'@babel/plugin-transform-runtime',
|
||||||
|
{
|
||||||
|
helpers : false,
|
||||||
|
regenerator: true,
|
||||||
|
corejs : false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'@babel/plugin-transform-regenerator',
|
||||||
|
{
|
||||||
|
async: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
isProductionEnv && [
|
||||||
|
'babel-plugin-transform-react-remove-prop-types',
|
||||||
|
{
|
||||||
|
removeImport: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
].filter(Boolean),
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ require "pathname"
|
|||||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
||||||
Pathname.new(__FILE__).realpath)
|
Pathname.new(__FILE__).realpath)
|
||||||
|
|
||||||
require "rubygems"
|
|
||||||
require "bundler/setup"
|
require "bundler/setup"
|
||||||
|
|
||||||
require "webpacker"
|
require "webpacker"
|
||||||
|
@ -7,7 +7,6 @@ require "pathname"
|
|||||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
||||||
Pathname.new(__FILE__).realpath)
|
Pathname.new(__FILE__).realpath)
|
||||||
|
|
||||||
require "rubygems"
|
|
||||||
require "bundler/setup"
|
require "bundler/setup"
|
||||||
|
|
||||||
require "webpacker"
|
require "webpacker"
|
||||||
|
5
config/webpack/test.js
Normal file
5
config/webpack/test.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
|
||||||
|
|
||||||
|
const environment = require('./environment')
|
||||||
|
|
||||||
|
module.exports = environment.toWebpackConfig()
|
@ -7,7 +7,7 @@ default: &default
|
|||||||
public_output_path: packs
|
public_output_path: packs
|
||||||
cache_path: tmp/cache/webpacker
|
cache_path: tmp/cache/webpacker
|
||||||
check_yarn_integrity: false
|
check_yarn_integrity: false
|
||||||
webpack_compile_output: false
|
webpack_compile_output: true
|
||||||
|
|
||||||
# Additional paths webpack should lookup modules
|
# Additional paths webpack should lookup modules
|
||||||
# ['app/assets', 'engine/foo/app/assets']
|
# ['app/assets', 'engine/foo/app/assets']
|
||||||
@ -34,6 +34,7 @@ default: &default
|
|||||||
- .woff2
|
- .woff2
|
||||||
|
|
||||||
extensions:
|
extensions:
|
||||||
|
- .jsx
|
||||||
- .mjs
|
- .mjs
|
||||||
- .js
|
- .js
|
||||||
- .sass
|
- .sass
|
||||||
@ -69,6 +70,7 @@ development:
|
|||||||
disable_host_check: true
|
disable_host_check: true
|
||||||
use_local_ip: false
|
use_local_ip: false
|
||||||
quiet: false
|
quiet: false
|
||||||
|
pretty: false
|
||||||
headers:
|
headers:
|
||||||
'Access-Control-Allow-Origin': '*'
|
'Access-Control-Allow-Origin': '*'
|
||||||
watch_options:
|
watch_options:
|
||||||
|
11624
package-lock.json
generated
11624
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -68,6 +68,7 @@
|
|||||||
"@babel/preset-react": "^7.7.4",
|
"@babel/preset-react": "^7.7.4",
|
||||||
"@babel/runtime": "^7.7.4",
|
"@babel/runtime": "^7.7.4",
|
||||||
"@clusterws/cws": "^0.16.0",
|
"@clusterws/cws": "^0.16.0",
|
||||||
|
"@rails/webpacker": "^4.2.2",
|
||||||
"array-includes": "^3.0.3",
|
"array-includes": "^3.0.3",
|
||||||
"arrow-key-navigation": "^1.1.0",
|
"arrow-key-navigation": "^1.1.0",
|
||||||
"autoprefixer": "^9.6.1",
|
"autoprefixer": "^9.6.1",
|
||||||
@ -119,10 +120,10 @@
|
|||||||
"pg": "^6.4.0",
|
"pg": "^6.4.0",
|
||||||
"postcss-loader": "^3.0.0",
|
"postcss-loader": "^3.0.0",
|
||||||
"postcss-object-fit-images": "^1.1.2",
|
"postcss-object-fit-images": "^1.1.2",
|
||||||
"prop-types": "^15.5.10",
|
"prop-types": "^15.7.2",
|
||||||
"punycode": "^2.1.0",
|
"punycode": "^2.1.0",
|
||||||
"rails-ujs": "^5.2.4",
|
"rails-ujs": "^5.2.4",
|
||||||
"react": "^16.10.2",
|
"react": "^16.12.0",
|
||||||
"react-dom": "^16.12.0",
|
"react-dom": "^16.12.0",
|
||||||
"react-hotkeys": "^1.1.4",
|
"react-hotkeys": "^1.1.4",
|
||||||
"react-immutable-proptypes": "^2.1.0",
|
"react-immutable-proptypes": "^2.1.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user