diff --git a/package.json b/package.json index d27d85f98..0dd45dda0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Open-Energy-Dashboard", - "version": "0.7.0", + "version": "0.8.0", "private": false, "license": "MPL-2.0", "repository": "https://github.com/OpenEnergyDashboard/OED", diff --git a/src/scripts/testData.sh b/src/scripts/testData.sh index 7e89b9cd5..2d4001370 100755 --- a/src/scripts/testData.sh +++ b/src/scripts/testData.sh @@ -75,7 +75,7 @@ do if [ $i == $((${#csvfiles[@]} - 1)) ] then # The last loaded data does a refresh of the readings so can see in OED and will do it for all previous data. - curl localhost:3000/api/csv/readings -X POST -F "meterName=${meternames[i]}" -F 'refreshReadings=true' -F 'createMeter=true' -F 'headerRow=true' -F 'gzip=false' -F "email=$csvuser" -F "password=$csvpassword" -F "csvfile=@${csvfiles[i]}" + curl localhost:3000/api/csv/readings -X POST -F "meterName=${meternames[i]}" -F 'refreshReadings=true' -F 'refreshHourlyReadings=true' -F 'createMeter=true' -F 'headerRow=true' -F 'gzip=false' -F "email=$csvuser" -F "password=$csvpassword" -F "csvfile=@${csvfiles[i]}" else curl localhost:3000/api/csv/readings -X POST -F "meterName=${meternames[i]}" -F 'createMeter=true' -F 'headerRow=true' -F 'gzip=false' -F "email=$csvuser" -F "password=$csvpassword" -F "csvfile=@${csvfiles[i]}" fi diff --git a/src/server/migrations/0.7.0-0.7.1/index.js b/src/server/migrations/0.7.0-0.8.0/index.js similarity index 57% rename from src/server/migrations/0.7.0-0.7.1/index.js rename to src/server/migrations/0.7.0-0.8.0/index.js index 1c6c24039..fca3c1251 100644 --- a/src/server/migrations/0.7.0-0.7.1/index.js +++ b/src/server/migrations/0.7.0-0.8.0/index.js @@ -7,11 +7,12 @@ const sqlFile = database.sqlFile; module.exports = { fromVersion: '0.7.0', - toVersion: '0.7.1', + toVersion: '0.8.0', up: async db => { - await db.none(sqlFile('../migrations/0.7.0-0.7.1/sql/preferences/alter_preferences_type.sql')); - await db.none(sqlFile('../migrations/0.7.0-0.7.1/sql/readings/create_materialized_hourly_readings.sql')); - await db.none(sqlFile('../migrations/0.7.0-0.7.1/sql/readings/drop_minutely_readings.sql')); - await db.none(sqlFile('../migrations/0.7.0-0.7.1/sql/readings/replace_compressed_readings_2.sql')); + await db.none(sqlFile('../migrations/0.7.0-0.8.0/sql/preferences/add_preferences_raw_limits.sql')); + await db.none(sqlFile('../migrations/0.7.0-0.8.0/sql/preferences/alter_preferences_type.sql')); + await db.none(sqlFile('../migrations/0.7.0-0.8.0/sql/readings/create_materialized_hourly_readings.sql')); + await db.none(sqlFile('../migrations/0.7.0-0.8.0/sql/readings/drop_minutely_readings.sql')); + await db.none(sqlFile('../migrations/0.7.0-0.8.0/sql/readings/replace_compressed_readings_2.sql')); } }; diff --git a/src/server/migrations/0.7.0-0.7.1/sql/preferences/add_preferences_raw_limits.sql b/src/server/migrations/0.7.0-0.8.0/sql/preferences/add_preferences_raw_limits.sql similarity index 100% rename from src/server/migrations/0.7.0-0.7.1/sql/preferences/add_preferences_raw_limits.sql rename to src/server/migrations/0.7.0-0.8.0/sql/preferences/add_preferences_raw_limits.sql diff --git a/src/server/migrations/0.7.0-0.7.1/sql/preferences/alter_preferences_type.sql b/src/server/migrations/0.7.0-0.8.0/sql/preferences/alter_preferences_type.sql similarity index 88% rename from src/server/migrations/0.7.0-0.7.1/sql/preferences/alter_preferences_type.sql rename to src/server/migrations/0.7.0-0.8.0/sql/preferences/alter_preferences_type.sql index 234c080f4..5167e72af 100644 --- a/src/server/migrations/0.7.0-0.7.1/sql/preferences/alter_preferences_type.sql +++ b/src/server/migrations/0.7.0-0.8.0/sql/preferences/alter_preferences_type.sql @@ -6,7 +6,7 @@ -- Move the currently named type to a temporary name. ALTER TYPE graph_type RENAME TO graph_type_temp; --- Create the type desired with new value, 'other' in this case but need to include old ones. +-- Create the type desired with new value, 'map' in this case but need to include old ones. CREATE TYPE graph_type as enum ('line', 'bar', 'compare', 'map'); -- Change the column in meters to use the new type with the current rows. ALTER TABLE preferences ALTER COLUMN default_chart_to_render TYPE graph_type USING default_chart_to_render::text::graph_type; diff --git a/src/server/migrations/0.7.0-0.7.1/sql/readings/create_materialized_hourly_readings.sql b/src/server/migrations/0.7.0-0.8.0/sql/readings/create_materialized_hourly_readings.sql similarity index 100% rename from src/server/migrations/0.7.0-0.7.1/sql/readings/create_materialized_hourly_readings.sql rename to src/server/migrations/0.7.0-0.8.0/sql/readings/create_materialized_hourly_readings.sql diff --git a/src/server/migrations/0.7.0-0.7.1/sql/readings/drop_minutely_readings.sql b/src/server/migrations/0.7.0-0.8.0/sql/readings/drop_minutely_readings.sql similarity index 100% rename from src/server/migrations/0.7.0-0.7.1/sql/readings/drop_minutely_readings.sql rename to src/server/migrations/0.7.0-0.8.0/sql/readings/drop_minutely_readings.sql diff --git a/src/server/migrations/0.7.0-0.7.1/sql/readings/replace_compressed_readings_2.sql b/src/server/migrations/0.7.0-0.8.0/sql/readings/replace_compressed_readings_2.sql similarity index 100% rename from src/server/migrations/0.7.0-0.7.1/sql/readings/replace_compressed_readings_2.sql rename to src/server/migrations/0.7.0-0.8.0/sql/readings/replace_compressed_readings_2.sql diff --git a/src/server/migrations/registerMigration.js b/src/server/migrations/registerMigration.js index 81fd45c56..8b672a53d 100644 --- a/src/server/migrations/registerMigration.js +++ b/src/server/migrations/registerMigration.js @@ -11,7 +11,7 @@ const migrations = [ require('./0.3.0-0.5.0'), require('./0.5.0-0.6.0'), require('./0.6.0-0.7.0'), - require('./0.7.0-0.7.1') + require('./0.7.0-0.8.0') /* eslint-disable global-require */ ]; diff --git a/webpack.config.js b/webpack.config.js index ef1e80f8f..39ef26392 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,83 +2,88 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const LodashModuleReplacementPlugin = require('lodash-webpack-plugin'); -const TerserPlugin = require("terser-webpack-plugin"); -const NodePolyfillPlugin = require("node-polyfill-webpack-plugin") -const webpack = require('webpack'); -const path = require('path'); -const { CheckerPlugin } = require('awesome-typescript-loader'); - -const BUILD_DIR = path.resolve(__dirname, 'src/client/public/app'); -const APP_DIR = path.resolve(__dirname, 'src/client/app'); - -const config = { - // Enable sourcemaps for debugging webpack's output. - devtool: 'source-map', - entry: { - application: APP_DIR + "/index.tsx", - }, - cache: { - type: "filesystem" - }, - resolve: { - fallback: { - "buffer": require.resolve('buffer/'), - "assert": require.resolve('assert/'), - "stream": require.resolve('stream-browserify'), - "fs": false - }, - // Add '.ts' and '.tsx' as resolvable extensions. - extensions: [".css", ".ts", ".tsx", ".js", ".jsx", ".json"] - }, - - // Ignore warnings about bundle size - performance: { - hints: false - }, - module: { - rules: [ - // All TypeScript ('.ts' or '.tsx') will be handled by 'awesome-typescript-loader'. - // Also, for development, JavaScript is handled by 'awesome-typescript-loader' and passed to Babel. - { test: /\.[jt]sx?$/, exclude: /node_modules/, use:[{loader: "awesome-typescript-loader"}] }, - // Any remaining JavaScript ('.js' or '.jsx') will be transpiled by Babel, for production uglification. - { test: /\/jsx?$/, exclude: /node_modules/, use:[{loader: "babel-loader"}] }, - // CSS stylesheet loader. - { test: /\.css$/, use: [ - {loader: "style-loader"}, - {loader: "css-loader"} - ], }, - // Babel not able to resolve imports https://github.com/webpack/webpack/issues/11467#issuecomment-691873586 - { - test: /\.m?js/, - resolve: { - fullySpecified: false - } - }, - // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'. - { enforce: "pre", test: /\.js$/, use:[{loader: "source-map-loader"}] } - ] - }, - output: { - filename: "bundle.js", - path: BUILD_DIR - }, - plugins: [ - new LodashModuleReplacementPlugin(), - new NodePolyfillPlugin(), - new CheckerPlugin(), - ] -}; - -if (process.env.NODE_ENV === 'production') { - config.plugins.push( - new webpack.DefinePlugin({ - 'process.env': { - NODE_ENV: JSON.stringify('production') - } - }), - new TerserPlugin({ sourceMap: true }) - ); -} - -module.exports = config; + const LodashModuleReplacementPlugin = require('lodash-webpack-plugin'); + const TerserPlugin = require("terser-webpack-plugin"); + const NodePolyfillPlugin = require("node-polyfill-webpack-plugin") + const webpack = require('webpack'); + const path = require('path'); + const { CheckerPlugin } = require('awesome-typescript-loader'); + + const BUILD_DIR = path.resolve(__dirname, 'src/client/public/app'); + const APP_DIR = path.resolve(__dirname, 'src/client/app'); + + const config = { + // Enable sourcemaps for debugging webpack's output. + devtool: 'source-map', + entry: { + application: APP_DIR + "/index.tsx", + }, + cache: { + type: "filesystem" + }, + resolve: { + fallback: { + "buffer": require.resolve('buffer/'), + "assert": require.resolve('assert/'), + "stream": require.resolve('stream-browserify'), + "fs": false + }, + // Add '.ts' and '.tsx' as resolvable extensions. + extensions: [".css", ".ts", ".tsx", ".js", ".jsx", ".json"] + }, + + // Ignore warnings about bundle size + performance: { + hints: false + }, + module: { + rules: [ + // All TypeScript ('.ts' or '.tsx') will be handled by 'awesome-typescript-loader'. + // Also, for development, JavaScript is handled by 'awesome-typescript-loader' and passed to Babel. + { test: /\.[jt]sx?$/, exclude: /node_modules/, use:[{loader: "awesome-typescript-loader"}] }, + // Any remaining JavaScript ('.js' or '.jsx') will be transpiled by Babel, for production uglification. + { test: /\/jsx?$/, exclude: /node_modules/, use:[{loader: "babel-loader"}] }, + // CSS stylesheet loader. + { test: /\.css$/, use: [ + {loader: "style-loader"}, + {loader: "css-loader"} + ], }, + // Babel not able to resolve imports https://github.com/webpack/webpack/issues/11467#issuecomment-691873586 + { + test: /\.m?js/, + resolve: { + fullySpecified: false + } + }, + // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'. + { enforce: "pre", test: /\.js$/, use:[{loader: "source-map-loader"}] } + ] + }, + output: { + filename: "bundle.js", + path: BUILD_DIR + }, + plugins: [ + new LodashModuleReplacementPlugin(), + new NodePolyfillPlugin(), + new CheckerPlugin(), + ] + }; + + if (process.env.NODE_ENV === 'production') { + config.plugins.push( + new webpack.DefinePlugin({ + 'process.env': { + NODE_ENV: JSON.stringify('production') + } + }), + new TerserPlugin({ + terserOptions: { + sourceMap: true + }, + }) + ); + } + + module.exports = config; + \ No newline at end of file