More webpack reference removals.

pull/1103/head
Rick Carlino 2019-01-30 08:00:26 -06:00
parent 835ea510a4
commit 0959533319
988 changed files with 47 additions and 239 deletions

View File

@ -30,14 +30,14 @@ jobs:
- run:
name: Run linters
command: |
sudo docker-compose run webpack npm run tslint
sudo docker-compose run webpack npm run sass-lint
sudo docker-compose run webpack npm run typecheck
sudo docker-compose run parcel npm run tslint
sudo docker-compose run parcel npm run sass-lint
sudo docker-compose run parcel npm run typecheck
- run:
name: Run JS tests
command: |
sudo docker-compose run webpack npm run test-slow
sudo docker-compose run -e COVERALLS_REPO_TOKEN=lEX6nkql7y2YFCcIXVq5ORvdvMtYzfZdG webpack npm run coverage
sudo docker-compose run parcel npm run test-slow
sudo docker-compose run -e COVERALLS_REPO_TOKEN=lEX6nkql7y2YFCcIXVq5ORvdvMtYzfZdG parcel npm run coverage
- run:
name: Check Coveralls coverage on staging
command: |

View File

@ -1,8 +1,8 @@
webpack/**/*__test*
webpack/**/*test*.ts
webpack/**/*test*.tsx
frontend/**/*__test*
frontend/**/*test*.ts
frontend/**/*test*.tsx
**__test**
**__tests__**
**test**
webpack/entry.tsx
webpack/password_reset/index.tsx
frontend/entry.tsx
frontend/password_reset/index.tsx

34
.gitignore vendored
View File

@ -1,32 +1,26 @@
.cache
dist/ # Parcel "accidents" happen here.
.env
.vscode
log/
*.log
*.pem
tmp
*scratchpad*
/config/master.key
api_docs.md
config/application.yml
config/credentials.yml.enc
coverage
coverage_api
coverage_fe
dist/ # Parcel "accidents" happen here.
docker_volumes
erd_diagram.png
erd.pdf
latest_corpus.ts
log/
mqtt/
node_modules
package-lock.json
public/direct_upload/temp/*.jpg
public/dist
public/system
public/webpack
coverage_api
coverage_fe
api_docs.md
erd_diagram.png
erd.pdf
*scratchpad*
scratchpad.rb
/config/master.key
config/credentials.yml.enc
# Legacy
config/application.yml
coverage
mqtt/
tmp

View File

@ -9,7 +9,7 @@ options:
max-warnings: 0
# File Options
files:
include: 'webpack/css/**/*.s+(a|c)ss'
include: 'frontend/css/**/*.s+(a|c)ss'
# Rule Configuration
rules:
extends-before-mixins: 2

View File

@ -28,7 +28,6 @@ gem "appsignal"
gem "skylight"
gem "tzinfo" # For validation of user selected timezone names
gem "valid_url"
gem "webpack-rails"
gem "rabbitmq_http_api_client"
gem "zero_downtime_migrations"
gem "redis", "~> 4.0"

View File

@ -17,17 +17,8 @@ module FarmBot
config.active_job.queue_adapter = :delayed_job
config.action_dispatch.perform_deep_munge = false
I18n.enforce_available_locales = false
LOCAL_API_HOST = ENV.fetch("API_HOST", "webpack")
LOCAL_API_HOST = ENV.fetch("API_HOST", "parcel")
WEBPACK_URL = "http://#{LOCAL_API_HOST}:3808"
config.webpack.dev_server.host = proc { request.host }
# PROBLEM: Containers run in docker. Default dev_server.manifest_host is
# "localhost", but our `dev_server` runs in a different docker
# container.
# SOLUTION: Explicitly set the hostname of the container where Webpack runs.
# In our case, that's `webpack`. See docker-compose.yml for all
# hostnames. -RC 1 OCT 18
config.webpack.dev_server.manifest_host = LOCAL_API_HOST
config.webpack.dev_server.manifest_port = 3808
config.generators do |g|
g.template_engine :erb
g.test_framework :rspec, :fixture_replacement => :factory_bot, :views => false, :helper => false

View File

@ -1,14 +0,0 @@
var production = [
process.env.RAILS_ENV,
process.env.TARGET
].includes('production');
console.log(`
WEBPACK IS RUNNING IN ${ production ? "prod" : "dev"} MODE.
`)
var configFile = production ? "./webpack.prod" : "./webpack.dev";
module.exports = require(configFile);

View File

@ -1,68 +0,0 @@
var path = require("path");
var StatsPlugin = require('stats-webpack-plugin');
var host = process.env["API_HOST"] || "localhost"
var devServerPort = 3808;
module.exports = {
mode: "none",
output: {
// must match config.webpack.output_dir
path: path.join(__dirname, '..', 'public', 'webpack'),
publicPath: `//${host}:${devServerPort}/webpack/`,
filename: '[name].js'
},
entry: {
"app_bundle": "./webpack/entry.tsx",
"front_page": "./webpack/front_page/index.tsx",
"password_reset": "./webpack/password_reset/index.tsx",
"tos_update": "./webpack/tos_update/index.tsx"
},
devtool: "eval",
module: {
rules: [
{
test: [/\.scss$/, /\.css$/],
use: ["style-loader", "css-loader", "sass-loader"]
},
{
test: /\.tsx?$/,
use: "ts-loader"
},
{
test: [/\.woff$/, /\.woff2$/, /\.ttf$/],
use: "url-loader"
},
{
test: [/\.eot$/, /\.svg(\?v=\d+\.\d+\.\d+)?$/],
use: "file-loader"
}
]
},
// Allows imports without file extensions.
resolve: {
extensions: [".js", ".ts", ".tsx", ".css", ".scss", ".json"]
},
plugins: [
new StatsPlugin('manifest.json', {
// We only need assetsByChunkName
chunkModules: false,
source: false,
chunks: false,
modules: false,
assets: true
})
],
node: {
fs: "empty"
},
devServer: {
port: devServerPort,
disableHostCheck: true,
watchOptions: {
aggregateTimeout: 300,
poll: 1000
},
host: "0.0.0.0",
headers: { 'Access-Control-Allow-Origin': '*' }
}
};

View File

@ -1,90 +0,0 @@
'use strict';
global.WEBPACK_ENV = "production";
var path = require("path");
var UglifyJsPlugin = require("webpack-uglify-js-plugin");
var OptimizeCssAssetsPlugin = require("optimize-css-assets-webpack-plugin");
var webpack = require("webpack");
var StatsPlugin = require('stats-webpack-plugin');
var publicPath = '/webpack/';
var conf = {
mode: "none",
devtool: "source-map",
entry: {
"app_bundle": "./webpack/entry.tsx",
"front_page": "./webpack/front_page/index.tsx",
"password_reset": "./webpack/password_reset/index.tsx",
"tos_update": "./webpack/tos_update/index.tsx"
},
output: {
path: path.join(__dirname, '..', 'public', 'webpack'),
publicPath,
filename: '[name]-[chunkhash].js',
chunkFilename: '[id].[name].[chunkhash].js'
},
module: {
rules: [
{
test: [/\.scss$/, /\.css$/],
use: ["style-loader", "css-loader", "sass-loader"]
},
{
test: /\.tsx?$/,
use: "ts-loader"
},
{
test: [/\.woff$/, /\.woff2$/, /\.ttf$/],
use: "url-loader"
},
{
test: [/\.eot$/, /\.svg(\?v=\d+\.\d+\.\d+)?$/],
use: "file-loader"
}
]
},
// Allows imports without file extensions.
resolve: {
extensions: [".js", ".ts", ".tsx", ".css", ".scss", ".json"]
},
plugins: [
new StatsPlugin('manifest.json', {
// We only need assetsByChunkName
chunkModules: false,
source: false,
chunks: false,
modules: false,
assets: true
}),
new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.css$/g,
cssProcessor: require("cssnano"),
cssProcessorOptions: { discardComments: { removeAll: true } },
canPrint: true
}),
new UglifyJsPlugin({
cacheFolder: path.resolve(__dirname, "../public/dist/cached_uglify/"),
debug: true,
minimize: true,
sourceMap: true,
screw_ie8: true,
output: { comments: false },
compressor: { warnings: false }
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify("production")
}
})
],
node: {
fs: "empty"
}
};
var accessToken = process.env.ROLLBAR_ACCESS_TOKEN
if (accessToken) {
var RollbarSourceMapPlugin = require('rollbar-sourcemap-webpack-plugin')
var version = process.env.BUILT_AT || process.env.HEROKU_SLUG_COMMIT || "????"
var plugin = new RollbarSourceMapPlugin({accessToken, version, publicPath})
conf.plugins.push(plugin)
}
module.exports = conf;

View File

@ -51,7 +51,7 @@ services:
- RABBITMQ_CONFIG_FILE=/farmbot/farmbot_rmq_config
volumes:
- ./docker_volumes/rabbit:/farmbot
webpack: # ====================
parcel: # ====================
<<: *base_config
<<: *rails
depends_on: ["db","mqtt", "web"]

View File

@ -19,8 +19,7 @@ export class API {
* factors such as hostname and protocol (HTTP vs. HTTPS). */
static inferPort(location = window.location): string {
// ATTEMPT 1: Most devs running a webpack server on localhost
// run the API on port 3000.
// ATTEMPT 1: Most devs run a server on localhost with the API on port 3000.
if (location.port === "3808") { return "3000"; }
// ATTEMPT 2: If they provide an explicit port (as in ://localhost:3000)

Some files were not shown because too many files have changed in this diff Show More