Skip to content

Commit 00eba36

Browse files
committed
Updated dependencies; refined build processes; added sonar scanner
1 parent 8962e69 commit 00eba36

File tree

8 files changed

+1880
-759
lines changed

8 files changed

+1880
-759
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ npm run lint
2929

3030
# run tests and create coverage reports
3131
npm test
32+
33+
# run SonarQube analysis (configure sonar-project.properties first or pass parameters to choose the SonarQube instance)
34+
npm run sonar
3235
```
3336

3437
## Useful VSCode Extensions

package-lock.json

Lines changed: 1829 additions & 712 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
22
"name": "skeleton-vue-typescript",
33
"description": "A web frontend skeleton project with Vue.js, TypeScript, Bootstrap, Less, Webpack, and Jest.",
4-
"version": "0.0.1",
4+
"version": "0.0.2",
55
"license": "Apache-2.0",
66
"private": true,
77
"author": "Justus Bogner <[email protected]>",
88
"scripts": {
9-
"build": "webpack --config webpack.prod.config.js --json --progress | tail -n +2 > ./build.log.json",
9+
"build": "webpack --config webpack.prod.config.js --progress",
1010
"start": "webpack-dev-server --open --hot --config webpack.dev.config.js",
1111
"start-prod": "webpack-dev-server --open --config webpack.prod.config.js",
1212
"lint": "tslint -c tslint.json src/**/*.ts",
13-
"test": "jest"
13+
"test": "jest",
14+
"sonar": "sonar-scanner"
1415
},
1516
"jest": {
1617
"testURL": "http://localhost",
@@ -44,33 +45,35 @@
4445
"moment": "^2.22.2",
4546
"vue": "^2.5.17",
4647
"vue-class-component": "^6.2.0",
47-
"vue-property-decorator": "^7.0.0",
48+
"vue-property-decorator": "^7.1.1",
4849
"vue-router": "^3.0.1"
4950
},
5051
"devDependencies": {
5152
"@types/jest": "^23.0.0",
52-
"@vue/test-utils": "^1.0.0-beta.16",
53+
"@vue/test-utils": "^1.0.0-beta.25",
54+
"clean-webpack-plugin": "^0.1.19",
5355
"css-loader": "^1.0.0",
54-
"file-loader": "^1.1.11",
56+
"file-loader": "^2.0.0",
5557
"git-revision-webpack-plugin": "^3.0.3",
58+
"html-loader": "^0.5.5",
59+
"html-webpack-plugin": "^3.2.0",
5660
"jest": "^23.0.1",
57-
"less": "^3.8.0",
61+
"less": "^3.8.1",
5862
"less-loader": "^4.1.0",
59-
"progress-bar-webpack-plugin": "^1.11.0",
63+
"sonarqube-scanner": "^2.1.1",
6064
"string-replace-loader": "^2.1.1",
6165
"ts-jest": "^22.4.6",
62-
"ts-loader": "^4.4.2",
66+
"ts-loader": "^5.2.1",
6367
"tslint": "^5.11.0",
6468
"tslint-loader": "^3.6.0",
6569
"tslint-webpack-plugin": "^1.2.2",
66-
"typescript": "^3.0.1",
70+
"typescript": "^3.1.1",
6771
"vue-jest": "^2.6.0",
68-
"vue-loader": "^15.2.6",
72+
"vue-loader": "^15.4.2",
6973
"vue-template-compiler": "^2.5.17",
70-
"webpack": "^4.16.3",
71-
"webpack-cli": "^3.1.0",
72-
"webpack-dev-server": "^3.1.5",
73-
"webpack-file-changer": "^2.0.1",
74+
"webpack": "^4.20.2",
75+
"webpack-cli": "^3.1.1",
76+
"webpack-dev-server": "^3.1.9",
7477
"webpack-merge": "^4.1.4"
7578
}
7679
}

sonar-project.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# must be unique in a given SonarQube instance
2+
sonar.projectKey=skeleton-vue-typescript
3+
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
4+
sonar.projectName=Vue.js TypeScript Skeleton Project
5+
6+
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
7+
# This property is optional if sonar.modules is set.
8+
sonar.sources=src

src/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
<meta http-equiv="X-UA-Compatible" content="IE=edge">
77

88
<title>Vue.js TypeScript Skeleton</title>
9-
<!-- <link rel="shortcut icon" href="imgs/favicon.ico" type="image/x-icon"> -->
109

11-
<script src="bundle.js"></script>
10+
<!-- Webpack will inject the bundle script tag -->
11+
1212
</head>
1313

1414
<body>

webpack.base.config.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
// External
22
const path = require("path");
3-
const fs = require("fs");
43
const moment = require("moment");
54
const GitRevisionPlugin = require("git-revision-webpack-plugin");
6-
const ProgessBarPlugin = require("progress-bar-webpack-plugin");
75
const VueLoaderPlugin = require("vue-loader/lib/plugin");
6+
const HtmlWebpackPlugin = require("html-webpack-plugin");
87

98
const rawBuildDate = new Date();
109
// Build datestring
1110
// Regex for extracting the timezone from http://stackoverflow.com/a/15304657
12-
const buildDate = `${
13-
moment(rawBuildDate).format("YYYY-MM-DD HH:mm")
14-
} ${
11+
const buildDate = `${moment(rawBuildDate).format("YYYY-MM-DD HH:mm")} ${
1512
rawBuildDate.toString().match(/([A-Z]+[\+-][0-9]+)/)[1]
16-
}`;
13+
}`;
1714

1815
module.exports = {
1916
context: path.resolve(__dirname, "src"),
2017
plugins: [
21-
gitRevisionPlugin = new GitRevisionPlugin({
18+
(gitRevisionPlugin = new GitRevisionPlugin({
2219
lightweightTags: true
23-
}),
24-
new ProgessBarPlugin(),
25-
new VueLoaderPlugin()
20+
})),
21+
new VueLoaderPlugin(),
22+
new HtmlWebpackPlugin({
23+
template: path.resolve(__dirname, "src", "index.html"),
24+
inject: "head"
25+
})
2626
],
2727

2828
resolve: {
@@ -33,7 +33,8 @@ module.exports = {
3333
},
3434

3535
module: {
36-
rules: [{
36+
rules: [
37+
{
3738
test: /(\.ts|\.js)$/,
3839
loader: "ts-loader",
3940
exclude: /node_modules/,
@@ -53,7 +54,7 @@ module.exports = {
5354
},
5455
{
5556
test: /\.html$/,
56-
loader: "file-loader",
57+
loader: "html-loader",
5758
options: {
5859
name: "[name].[ext]"
5960
},
@@ -62,7 +63,7 @@ module.exports = {
6263
{
6364
test: /\.less$/,
6465
use: ["vue-style-loader", "css-loader", "less-loader"],
65-
exclude: /node_modules/,
66+
exclude: /node_modules/
6667
},
6768
{
6869
test: /\.css$/,
@@ -81,7 +82,8 @@ module.exports = {
8182
enforce: "pre",
8283
loader: "string-replace-loader",
8384
query: {
84-
multiple: [{
85+
multiple: [
86+
{
8587
search: "$VERSION",
8688
replace: gitRevisionPlugin.version()
8789
},
@@ -93,5 +95,5 @@ module.exports = {
9395
}
9496
}
9597
]
96-
},
98+
}
9799
};

webpack.dev.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// External
2-
const fs = require("fs");
32
const path = require("path");
4-
const webpack = require("webpack");
53
const webpackMerge = require("webpack-merge");
6-
const TSLintPlugin = require("tslint-webpack-plugin");
74

85
// Internal
96
const commonConfig = require("./webpack.base.config");

webpack.prod.config.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// External
2-
const webpack = require("webpack");
32
const webpackMerge = require("webpack-merge");
4-
const FileChanger = require("webpack-file-changer")
3+
const CleanWebpackPlugin = require("clean-webpack-plugin");
54
const path = require("path");
65

76
// Internal
@@ -14,16 +13,8 @@ module.exports = webpackMerge(commonConfig, {
1413
filename: "bundle.[hash].js"
1514
},
1615
optimization: {
16+
concatenateModules: true,
1717
minimize: true
1818
},
19-
plugins: [
20-
new FileChanger({
21-
change: [{
22-
file: "target/index.html",
23-
parameters: {
24-
"bundle\\.js": "bundle.[hash].js",
25-
}
26-
}]
27-
})
28-
]
19+
plugins: [new CleanWebpackPlugin(["target"])]
2920
});

0 commit comments

Comments
 (0)