@jsenv/file-size-impact 13.0.0 → 13.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -8
- package/readme.md +10 -9
- package/src/internal/format_percentage.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/file-size-impact",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.2",
|
|
4
4
|
"description": "Add files size impact into pull requests",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
"node": ">=16.13.0"
|
|
13
13
|
},
|
|
14
14
|
"publishConfig": {
|
|
15
|
-
"access": "public"
|
|
16
|
-
"registry": "https://registry.npmjs.org"
|
|
15
|
+
"access": "public"
|
|
17
16
|
},
|
|
18
17
|
"type": "module",
|
|
19
18
|
"exports": {
|
|
@@ -33,9 +32,9 @@
|
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
|
35
34
|
"@jsenv/dynamic-import-worker": "1.1.0",
|
|
36
|
-
"@jsenv/filesystem": "4.1.
|
|
37
|
-
"@jsenv/github-pull-request-impact": "1.7.
|
|
38
|
-
"@jsenv/log": "
|
|
39
|
-
"@jsenv/urls": "1.2.
|
|
35
|
+
"@jsenv/filesystem": "4.1.6",
|
|
36
|
+
"@jsenv/github-pull-request-impact": "1.7.1",
|
|
37
|
+
"@jsenv/log": "3.3.1",
|
|
38
|
+
"@jsenv/urls": "1.2.8"
|
|
40
39
|
}
|
|
41
|
-
}
|
|
40
|
+
}
|
package/readme.md
CHANGED
|
@@ -48,7 +48,7 @@ export const fileSizeReport = await generateFileSizeReport({
|
|
|
48
48
|
At this stage, you could generate a file size report on your machine with the following command.
|
|
49
49
|
|
|
50
50
|
```console
|
|
51
|
-
node ./
|
|
51
|
+
node ./file_size.mjs --log
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
Now it's time to configure a workflow to compare file size reports before and after merging a pull request.
|
|
@@ -166,12 +166,13 @@ In order to analyse the impact of a pull request on file size the following step
|
|
|
166
166
|
|
|
167
167
|
1. Checkout pull request base branch
|
|
168
168
|
2. Execute an install command (_npm install_ by default)
|
|
169
|
-
3.
|
|
170
|
-
4.
|
|
171
|
-
5.
|
|
172
|
-
6.
|
|
173
|
-
7.
|
|
174
|
-
8.
|
|
169
|
+
3. Run a build command (nom build by default)
|
|
170
|
+
4. Get a file size report (dynamic import of a js module exporting `generateFileSizeReport`)
|
|
171
|
+
5. Merge pull request into its base
|
|
172
|
+
6. Execute command to generate files again
|
|
173
|
+
7. Get a second file size report
|
|
174
|
+
8. Analyse differences between the two file size reports
|
|
175
|
+
9. Post or update comment in the pull request
|
|
175
176
|
|
|
176
177
|
# generateFileSizeReport
|
|
177
178
|
|
|
@@ -347,9 +348,9 @@ _installCommand_ parameter is a string representing the command to run in order
|
|
|
347
348
|
|
|
348
349
|
_buildCommand_ parameter is a string representing the command to run in order to generate files. This parameter is optional with a default value of `"npm run-script build"`. You can pass `null` if you don't need to run a build command before computing file sizes.
|
|
349
350
|
|
|
350
|
-
##
|
|
351
|
+
## fileSizeReportUrl
|
|
351
352
|
|
|
352
|
-
|
|
353
|
+
_fileSizeReportUrl_ is a string or an url parameter representing an url leading a module file. This file must export a fileSizeReport produced by _generateFileSizeReport_.
|
|
353
354
|
|
|
354
355
|
## filesOrdering
|
|
355
356
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { setRoundedPrecision } from "@jsenv/log"
|
|
2
2
|
|
|
3
3
|
export const formatPercentage = (number) => {
|
|
4
|
-
return `${number < 0 ? `-` : "+"}${setRoundedPrecision(number, {
|
|
4
|
+
return `${number < 0 ? `-` : "+"}${setRoundedPrecision(Math.abs(number), {
|
|
5
5
|
decimals: 0,
|
|
6
6
|
decimalsWhenSmall: 1,
|
|
7
7
|
})}%`
|