Skip to content

Commit 88a56a4

Browse files
committed
refactor: Renovate project base files
1 parent 1952d54 commit 88a56a4

10 files changed

+3258
-102
lines changed

.editorconfig

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
# The JSON files contain newlines inconsistently
13+
[*.json]
14+
insert_final_newline = ignore
15+
16+
# Makefiles always use tabs for indentation
17+
[Makefile]
18+
indent_style = tab
19+
20+
[*.md]
21+
trim_trailing_whitespace = false

.eslintrc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"extends": [
4+
"plugin:@typescript-eslint/recommended",
5+
],
6+
"rules": {
7+
"@typescript-eslint/indent": "off",
8+
"@typescript-eslint/no-var-requires": "off"
9+
}
10+
}

.gitignore

+44-17
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,54 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# System Files
4+
.DS_Store
5+
Thumbs.db
6+
7+
# IDE - VSCode
8+
.vscode/
9+
10+
# Coverage directory used by tools like istanbul
11+
coverage
12+
13+
# IDEs and editors
14+
.idea
15+
.project
16+
.classpath
17+
.c9/
18+
*.launch
19+
.settings/
20+
*.sublime-workspace
21+
122
# Logs
223
logs
324
*.log
25+
npm-debug.log*
26+
yarn-debug.log*
27+
yarn-error.log*
428

5-
# Runtime data
6-
pids
7-
*.pid
8-
*.seed
29+
# Dependency directories
30+
node_modules/
31+
jspm_packages/
932

10-
# Directory for instrumented libs generated by jscoverage/JSCover
11-
lib-cov
33+
# Optional npm cache directory
34+
.npm
1235

13-
# Coverage directory used by tools like istanbul
14-
coverage
36+
# Optional eslint cache
37+
.eslintcache
38+
39+
# Optional REPL history
40+
.node_repl_history
41+
42+
# Output of 'npm pack'
43+
*.tgz
1544

16-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17-
.grunt
45+
# Yarn Integrity file
46+
.yarn-integrity
1847

19-
# node-waf configuration
20-
.lock-wscript
48+
# dotenv environment variables file
49+
.env
2150

22-
# Compiled binary addons (http://nodejs.org/api/addons.html)
23-
build/Release
51+
# next.js build output
52+
.next
2453

25-
# Dependency directory
26-
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
27-
node_modules
54+
dist/

.prettierrc.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
semi: true,
3+
trailingComma: 'all',
4+
singleQuote: true,
5+
printWidth: 120,
6+
tabWidth: 2,
7+
};

README.md

+53-49
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,86 @@
1-
# webpack-bundle-tracker
2-
3-
[![Join the chat at https://gitter.im/owais/webpack-bundle-tracker](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/owais/webpack-bundle-tracker?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4-
1+
# Webpack Bundle Tracker [![Join the chat at https://gitter.im/owais/webpack-bundle-tracker](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/owais/webpack-bundle-tracker?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
52

63
Spits out some stats about webpack compilation process to a file.
74

85
<br>
96

10-
#### Install
7+
## Install
118

129
```bash
1310
npm install --save-dev webpack-bundle-tracker
1411
```
1512

13+
```bash
14+
yarn add --dev webpack-bundle-tracker
15+
```
16+
1617
<br>
1718

18-
#### Usage
19+
## Usage
20+
1921
```javascript
20-
var BundleTracker = require('webpack-bundle-tracker');
22+
var BundleTracker = require("webpack-bundle-tracker");
2123
module.exports = {
22-
context: __dirname,
23-
entry: {
24-
app: ['./app']
25-
},
26-
27-
output: {
28-
path: require("path").resolve('./assets/bundles/'),
29-
filename: "[name]-[hash].js",
30-
publicPath: 'http://localhost:3000/assets/bundles/',
31-
},
32-
33-
plugins: [
34-
new BundleTracker({path: __dirname, filename: './assets/webpack-stats.json'})
35-
]
36-
}
24+
context: __dirname,
25+
entry: {
26+
app: ["./app"]
27+
},
28+
29+
output: {
30+
path: require("path").resolve("./assets/bundles/"),
31+
filename: "[name]-[hash].js",
32+
publicPath: "http://localhost:3000/assets/bundles/"
33+
},
34+
35+
plugins: [
36+
new BundleTracker({
37+
path: __dirname,
38+
filename: "./assets/webpack-stats.json"
39+
})
40+
]
41+
};
3742
```
3843

3944
`./assets/webpack-stats.json` will look like,
4045

4146
```json
4247
{
43-
"status":"done",
44-
"chunks":{
45-
"app":[{
46-
"name":"app-0828904584990b611fb8.js",
47-
"publicPath":"http://localhost:3000/assets/bundles/app-0828904584990b611fb8.js",
48-
"path":"/home/user/project-root/assets/bundles/app-0828904584990b611fb8.js"
49-
}]
50-
}
48+
"status": "done",
49+
"chunks": {
50+
"app": [
51+
{
52+
"name": "app-0828904584990b611fb8.js",
53+
"publicPath": "http://localhost:3000/assets/bundles/app-0828904584990b611fb8.js",
54+
"path": "/home/user/project-root/assets/bundles/app-0828904584990b611fb8.js"
55+
}
56+
]
57+
}
5158
}
5259
```
5360

5461
In case webpack is still compiling, it'll look like,
5562

56-
5763
```json
5864
{
59-
"status":"compiling",
65+
"status": "compiling"
6066
}
6167
```
6268

63-
64-
6569
And errors will look like,
70+
6671
```json
6772
{
68-
"status": "error",
69-
"file": "/path/to/file/that/caused/the/error",
70-
"error": "ErrorName",
71-
"message": "ErrorMessage"
73+
"status": "error",
74+
"file": "/path/to/file/that/caused/the/error",
75+
"error": "ErrorName",
76+
"message": "ErrorMessage"
7277
}
7378
```
7479

7580
`ErrorMessage` shows the line and column that caused the error.
7681

77-
78-
7982
And in case `logTime` option is set to `true`, the output will look like,
83+
8084
```
8185
{
8286
"status":"done",
@@ -92,18 +96,18 @@ And in case `logTime` option is set to `true`, the output will look like,
9296
}
9397
```
9498

95-
96-
9799
By default, the output JSON will not be indented. To increase readability, you can use the `indent`
98100
option to make the output legible. By default it is off. The value that is set here will be directly
99-
passed to the `space` parameter in `JSON.stringify`. More information can be found here:
100-
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
101+
passed to the `space` parameter in `JSON.stringify`. More information can be found [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)
102+
101103

102104
<br>
103105

104-
#### Bundle Tracker Options
106+
## Options
105107

106-
* `filename` - Name of the bundle tracker JSON file.
107-
* `logTime` - Optional boolean property to output `startTime` and `endTime` in bundle tracker file.
108-
* `path` - Optional bundle tracker output path.
109-
* `publicPath` - Optional property to override `output.publicPath`.
108+
| Name | Type | Default | Description |
109+
| ------------ | ----------- | ---------------------- | ------------------------------------------------------------------------ |
110+
| `path` | `{String}` | `'.'` | Output directory of bundle tracker JSON file . |
111+
| `filename` | `{String}` | `'webpack-stats.json'` | Name of the bundle tracker JSON file. |
112+
| `publicPath` | `{String}` | `?` | Override `output.publicPath` from Webpack config. |
113+
| `logTime` | `{Boolean}` | `false` | Output `startTime` and `endTime` properties in bundle tracker JSON file. |

lib/index.d.ts

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { Compiler } from 'webpack';
2+
3+
export = Plugin;
4+
5+
declare class Plugin {
6+
constructor(options?: Plugin.Options);
7+
8+
apply(compiler: Compiler): void;
9+
}
10+
11+
declare namespace Plugin {
12+
interface Options {
13+
/**
14+
* Output directory of the bundle tracker JSON file
15+
* Default: `'.'`
16+
*/
17+
path: string;
18+
/**
19+
* Name of the bundle tracker JSON file.
20+
* Default: `'webpack-stats.json'`
21+
*/
22+
filename: string;
23+
/**
24+
* Property to override default `output.publicPath` from Webpack config file.
25+
*/
26+
publicPath: string;
27+
/**
28+
* Output `startTime` and `endTime` properties to JSON file.
29+
* Default: `false`
30+
*/
31+
logTime: boolean;
32+
}
33+
}

index.js renamed to lib/index.js

File renamed without changes.

package.json

+28-20
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,42 @@
22
"name": "webpack-bundle-tracker",
33
"version": "0.4.2-beta",
44
"description": "Spits out some stats about webpack compilation process to a file",
5-
"license": "MIT",
6-
"main": "index.js",
7-
"scripts": {
8-
"test": "echo \"Error: no test specified\" && exit 1"
9-
},
10-
"repository": {
11-
"type": "git",
12-
"url": "https://github.com/owais/webpack-bundle-tracker.git"
13-
},
145
"keywords": [
15-
"webpack",
166
"bundle",
7+
"files",
8+
"plugin",
179
"stats",
18-
"files"
10+
"webpack"
1911
],
12+
"homepage": "https://github.com/owais/webpack-bundle-tracker",
13+
"bugs": "https://github.com/owais/webpack-bundle-tracker/issues",
14+
"repository": "https://github.com/owais/webpack-bundle-tracker.git",
15+
"license": "MIT",
2016
"author": "Owais Lone",
21-
"licenses": [
22-
{
23-
"type": "MIT",
24-
"url": "https://github.com/brentertz/scapegoat/blob/master/LICENSE-MIT"
25-
}
26-
],
27-
"bugs": {
28-
"url": "https://github.com/owais/webpack-bundle-tracker/issues"
17+
"main": "lib/index.js",
18+
"types": "lib/index.d.ts",
19+
"scripts": {
20+
"pretest": "prettier --check lib/*.js",
21+
"posttest": "tsc",
22+
"test": "echo \"Error: no test specified\" && exit 1"
2923
},
3024
"dependencies": {
3125
"deep-extend": "^0.6.0",
3226
"mkdirp": "^0.5.1",
33-
"strip-ansi": "^2.0.1"
27+
"strip-ansi": "^5.2.0"
28+
},
29+
"devDependencies": {
30+
"@types/deep-extend": "^0.4.31",
31+
"@types/mkdirp": "^0.5.2",
32+
"@types/node": "^12.6.9",
33+
"@types/webpack": "^4.32.1",
34+
"@typescript-eslint/eslint-plugin": "^1.13.0",
35+
"@typescript-eslint/parser": "^1.13.0",
36+
"commitizen": "^4.0.3",
37+
"cz-conventional-changelog": "^3.0.2",
38+
"eslint": "^6.1.0",
39+
"prettier": "^1.18.2",
40+
"standard-version": "^7.0.0",
41+
"typescript": "^3.5.3"
3442
}
3543
}

0 commit comments

Comments
 (0)