Skip to content

Commit 2305101

Browse files
committed
updates for 0.8.0 & fixes
- 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
1 parent f04fefd commit 2305101

File tree

10 files changed

+95
-89
lines changed

10 files changed

+95
-89
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Open-Energy-Dashboard",
3-
"version": "0.7.0",
3+
"version": "0.8.0",
44
"private": false,
55
"license": "MPL-2.0",
66
"repository": "https://github.com/OpenEnergyDashboard/OED",

src/scripts/testData.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ do
7575
if [ $i == $((${#csvfiles[@]} - 1)) ]
7676
then
7777
# The last loaded data does a refresh of the readings so can see in OED and will do it for all previous data.
78-
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]}"
78+
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]}"
7979
else
8080
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]}"
8181
fi

src/server/migrations/0.7.0-0.7.1/index.js renamed to src/server/migrations/0.7.0-0.8.0/index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ const sqlFile = database.sqlFile;
77

88
module.exports = {
99
fromVersion: '0.7.0',
10-
toVersion: '0.7.1',
10+
toVersion: '0.8.0',
1111
up: async db => {
12-
await db.none(sqlFile('../migrations/0.7.0-0.7.1/sql/preferences/alter_preferences_type.sql'));
13-
await db.none(sqlFile('../migrations/0.7.0-0.7.1/sql/readings/create_materialized_hourly_readings.sql'));
14-
await db.none(sqlFile('../migrations/0.7.0-0.7.1/sql/readings/drop_minutely_readings.sql'));
15-
await db.none(sqlFile('../migrations/0.7.0-0.7.1/sql/readings/replace_compressed_readings_2.sql'));
12+
await db.none(sqlFile('../migrations/0.7.0-0.8.0/sql/preferences/add_preferences_raw_limits.sql'));
13+
await db.none(sqlFile('../migrations/0.7.0-0.8.0/sql/preferences/alter_preferences_type.sql'));
14+
await db.none(sqlFile('../migrations/0.7.0-0.8.0/sql/readings/create_materialized_hourly_readings.sql'));
15+
await db.none(sqlFile('../migrations/0.7.0-0.8.0/sql/readings/drop_minutely_readings.sql'));
16+
await db.none(sqlFile('../migrations/0.7.0-0.8.0/sql/readings/replace_compressed_readings_2.sql'));
1617
}
1718
};

src/server/migrations/0.7.0-0.7.1/sql/preferences/alter_preferences_type.sql renamed to src/server/migrations/0.7.0-0.8.0/sql/preferences/alter_preferences_type.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
-- Move the currently named type to a temporary name.
88
ALTER TYPE graph_type RENAME TO graph_type_temp;
9-
-- Create the type desired with new value, 'other' in this case but need to include old ones.
9+
-- Create the type desired with new value, 'map' in this case but need to include old ones.
1010
CREATE TYPE graph_type as enum ('line', 'bar', 'compare', 'map');
1111
-- Change the column in meters to use the new type with the current rows.
1212
ALTER TABLE preferences ALTER COLUMN default_chart_to_render TYPE graph_type USING default_chart_to_render::text::graph_type;

src/server/migrations/registerMigration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const migrations = [
1111
require('./0.3.0-0.5.0'),
1212
require('./0.5.0-0.6.0'),
1313
require('./0.6.0-0.7.0'),
14-
require('./0.7.0-0.7.1')
14+
require('./0.7.0-0.8.0')
1515
/* eslint-disable global-require */
1616
];
1717

webpack.config.js

Lines changed: 85 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -2,83 +2,88 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5-
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
6-
const TerserPlugin = require("terser-webpack-plugin");
7-
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin")
8-
const webpack = require('webpack');
9-
const path = require('path');
10-
const { CheckerPlugin } = require('awesome-typescript-loader');
11-
12-
const BUILD_DIR = path.resolve(__dirname, 'src/client/public/app');
13-
const APP_DIR = path.resolve(__dirname, 'src/client/app');
14-
15-
const config = {
16-
// Enable sourcemaps for debugging webpack's output.
17-
devtool: 'source-map',
18-
entry: {
19-
application: APP_DIR + "/index.tsx",
20-
},
21-
cache: {
22-
type: "filesystem"
23-
},
24-
resolve: {
25-
fallback: {
26-
"buffer": require.resolve('buffer/'),
27-
"assert": require.resolve('assert/'),
28-
"stream": require.resolve('stream-browserify'),
29-
"fs": false
30-
},
31-
// Add '.ts' and '.tsx' as resolvable extensions.
32-
extensions: [".css", ".ts", ".tsx", ".js", ".jsx", ".json"]
33-
},
34-
35-
// Ignore warnings about bundle size
36-
performance: {
37-
hints: false
38-
},
39-
module: {
40-
rules: [
41-
// All TypeScript ('.ts' or '.tsx') will be handled by 'awesome-typescript-loader'.
42-
// Also, for development, JavaScript is handled by 'awesome-typescript-loader' and passed to Babel.
43-
{ test: /\.[jt]sx?$/, exclude: /node_modules/, use:[{loader: "awesome-typescript-loader"}] },
44-
// Any remaining JavaScript ('.js' or '.jsx') will be transpiled by Babel, for production uglification.
45-
{ test: /\/jsx?$/, exclude: /node_modules/, use:[{loader: "babel-loader"}] },
46-
// CSS stylesheet loader.
47-
{ test: /\.css$/, use: [
48-
{loader: "style-loader"},
49-
{loader: "css-loader"}
50-
], },
51-
// Babel not able to resolve imports https://github.com/webpack/webpack/issues/11467#issuecomment-691873586
52-
{
53-
test: /\.m?js/,
54-
resolve: {
55-
fullySpecified: false
56-
}
57-
},
58-
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
59-
{ enforce: "pre", test: /\.js$/, use:[{loader: "source-map-loader"}] }
60-
]
61-
},
62-
output: {
63-
filename: "bundle.js",
64-
path: BUILD_DIR
65-
},
66-
plugins: [
67-
new LodashModuleReplacementPlugin(),
68-
new NodePolyfillPlugin(),
69-
new CheckerPlugin(),
70-
]
71-
};
72-
73-
if (process.env.NODE_ENV === 'production') {
74-
config.plugins.push(
75-
new webpack.DefinePlugin({
76-
'process.env': {
77-
NODE_ENV: JSON.stringify('production')
78-
}
79-
}),
80-
new TerserPlugin({ sourceMap: true })
81-
);
82-
}
83-
84-
module.exports = config;
5+
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
6+
const TerserPlugin = require("terser-webpack-plugin");
7+
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin")
8+
const webpack = require('webpack');
9+
const path = require('path');
10+
const { CheckerPlugin } = require('awesome-typescript-loader');
11+
12+
const BUILD_DIR = path.resolve(__dirname, 'src/client/public/app');
13+
const APP_DIR = path.resolve(__dirname, 'src/client/app');
14+
15+
const config = {
16+
// Enable sourcemaps for debugging webpack's output.
17+
devtool: 'source-map',
18+
entry: {
19+
application: APP_DIR + "/index.tsx",
20+
},
21+
cache: {
22+
type: "filesystem"
23+
},
24+
resolve: {
25+
fallback: {
26+
"buffer": require.resolve('buffer/'),
27+
"assert": require.resolve('assert/'),
28+
"stream": require.resolve('stream-browserify'),
29+
"fs": false
30+
},
31+
// Add '.ts' and '.tsx' as resolvable extensions.
32+
extensions: [".css", ".ts", ".tsx", ".js", ".jsx", ".json"]
33+
},
34+
35+
// Ignore warnings about bundle size
36+
performance: {
37+
hints: false
38+
},
39+
module: {
40+
rules: [
41+
// All TypeScript ('.ts' or '.tsx') will be handled by 'awesome-typescript-loader'.
42+
// Also, for development, JavaScript is handled by 'awesome-typescript-loader' and passed to Babel.
43+
{ test: /\.[jt]sx?$/, exclude: /node_modules/, use:[{loader: "awesome-typescript-loader"}] },
44+
// Any remaining JavaScript ('.js' or '.jsx') will be transpiled by Babel, for production uglification.
45+
{ test: /\/jsx?$/, exclude: /node_modules/, use:[{loader: "babel-loader"}] },
46+
// CSS stylesheet loader.
47+
{ test: /\.css$/, use: [
48+
{loader: "style-loader"},
49+
{loader: "css-loader"}
50+
], },
51+
// Babel not able to resolve imports https://github.com/webpack/webpack/issues/11467#issuecomment-691873586
52+
{
53+
test: /\.m?js/,
54+
resolve: {
55+
fullySpecified: false
56+
}
57+
},
58+
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
59+
{ enforce: "pre", test: /\.js$/, use:[{loader: "source-map-loader"}] }
60+
]
61+
},
62+
output: {
63+
filename: "bundle.js",
64+
path: BUILD_DIR
65+
},
66+
plugins: [
67+
new LodashModuleReplacementPlugin(),
68+
new NodePolyfillPlugin(),
69+
new CheckerPlugin(),
70+
]
71+
};
72+
73+
if (process.env.NODE_ENV === 'production') {
74+
config.plugins.push(
75+
new webpack.DefinePlugin({
76+
'process.env': {
77+
NODE_ENV: JSON.stringify('production')
78+
}
79+
}),
80+
new TerserPlugin({
81+
terserOptions: {
82+
sourceMap: true
83+
},
84+
})
85+
);
86+
}
87+
88+
module.exports = config;
89+

0 commit comments

Comments
 (0)