Skip to content

Commit

Permalink
updates for 0.8.0 & fixes
Browse files Browse the repository at this point in the history
- fix webpack:build
- update test data build script to refresh hourly
- change version number to 0.8.0 (was 0.7.1)
- added raw limit migration to index since missing
- fix comment in preferences migration
  • Loading branch information
huss committed Jan 19, 2022
1 parent f04fefd commit 2305101
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 89 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/testData.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/server/migrations/registerMigration.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
];

Expand Down
165 changes: 85 additions & 80 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 2305101

Please sign in to comment.