Skip to content

Commit

Permalink
test: apply alphanum-sort
Browse files Browse the repository at this point in the history
  • Loading branch information
sergioramos committed Oct 13, 2020
1 parent a32218f commit dc1d992
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"tempy": "^1.0.0"
},
"devDependencies": {
"alphanum-sort": "^1.0.2",
"apr-for-each": "^3.0.3",
"apr-intercept": "^3.0.4",
"apr-main": "^4.0.3",
Expand Down
8 changes: 8 additions & 0 deletions test/__fixtures__/js-nm-individually/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,13 @@ __metadata:
languageName: node
linkType: hard

"alphanum-sort@npm:^1.0.2":
version: 1.0.2
resolution: "alphanum-sort@npm:1.0.2"
checksum: 3/28bad91719e15959e36a791a3538924e07da356ebe3b5f992e7668e8018cfc417a7ba4a69512771e5ffa306c7e028435c7748546f66f72d4f7b0ad694cf55069
languageName: node
linkType: hard

"ansi-align@npm:^2.0.0":
version: 2.0.0
resolution: "ansi-align@npm:2.0.0"
Expand Down Expand Up @@ -8262,6 +8269,7 @@ fsevents@~2.1.2:
resolution: "serverless-plugin-tree-shake@workspace:plugin"
dependencies:
"@vercel/nft": ^0.9.3
alphanum-sort: ^1.0.2
apr-find: ^3.0.3
apr-for-each: ^3.0.3
apr-intercept: ^3.0.4
Expand Down
8 changes: 8 additions & 0 deletions test/__fixtures__/js-nm-single/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,13 @@ __metadata:
languageName: node
linkType: hard

"alphanum-sort@npm:^1.0.2":
version: 1.0.2
resolution: "alphanum-sort@npm:1.0.2"
checksum: 3/28bad91719e15959e36a791a3538924e07da356ebe3b5f992e7668e8018cfc417a7ba4a69512771e5ffa306c7e028435c7748546f66f72d4f7b0ad694cf55069
languageName: node
linkType: hard

"ansi-align@npm:^2.0.0":
version: 2.0.0
resolution: "ansi-align@npm:2.0.0"
Expand Down Expand Up @@ -8262,6 +8269,7 @@ fsevents@~2.1.2:
resolution: "serverless-plugin-tree-shake@workspace:plugin"
dependencies:
"@vercel/nft": ^0.9.3
alphanum-sort: ^1.0.2
apr-find: ^3.0.3
apr-for-each: ^3.0.3
apr-intercept: ^3.0.4
Expand Down
8 changes: 8 additions & 0 deletions test/__fixtures__/js-pnp-individually/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,13 @@ __metadata:
languageName: node
linkType: hard

"alphanum-sort@npm:^1.0.2":
version: 1.0.2
resolution: "alphanum-sort@npm:1.0.2"
checksum: 3/28bad91719e15959e36a791a3538924e07da356ebe3b5f992e7668e8018cfc417a7ba4a69512771e5ffa306c7e028435c7748546f66f72d4f7b0ad694cf55069
languageName: node
linkType: hard

"ansi-align@npm:^2.0.0":
version: 2.0.0
resolution: "ansi-align@npm:2.0.0"
Expand Down Expand Up @@ -8262,6 +8269,7 @@ fsevents@~2.1.2:
resolution: "serverless-plugin-tree-shake@workspace:plugin"
dependencies:
"@vercel/nft": ^0.9.3
alphanum-sort: ^1.0.2
apr-find: ^3.0.3
apr-for-each: ^3.0.3
apr-intercept: ^3.0.4
Expand Down
8 changes: 8 additions & 0 deletions test/__fixtures__/js-pnp-single/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,13 @@ __metadata:
languageName: node
linkType: hard

"alphanum-sort@npm:^1.0.2":
version: 1.0.2
resolution: "alphanum-sort@npm:1.0.2"
checksum: 3/28bad91719e15959e36a791a3538924e07da356ebe3b5f992e7668e8018cfc417a7ba4a69512771e5ffa306c7e028435c7748546f66f72d4f7b0ad694cf55069
languageName: node
linkType: hard

"ansi-align@npm:^2.0.0":
version: 2.0.0
resolution: "ansi-align@npm:2.0.0"
Expand Down Expand Up @@ -8262,6 +8269,7 @@ fsevents@~2.1.2:
resolution: "serverless-plugin-tree-shake@workspace:plugin"
dependencies:
"@vercel/nft": ^0.9.3
alphanum-sort: ^1.0.2
apr-find: ^3.0.3
apr-for-each: ^3.0.3
apr-intercept: ^3.0.4
Expand Down
8 changes: 8 additions & 0 deletions test/__fixtures__/ts-nm-individually/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,13 @@ __metadata:
languageName: node
linkType: hard

"alphanum-sort@npm:^1.0.2":
version: 1.0.2
resolution: "alphanum-sort@npm:1.0.2"
checksum: 3/28bad91719e15959e36a791a3538924e07da356ebe3b5f992e7668e8018cfc417a7ba4a69512771e5ffa306c7e028435c7748546f66f72d4f7b0ad694cf55069
languageName: node
linkType: hard

"ansi-align@npm:^2.0.0":
version: 2.0.0
resolution: "ansi-align@npm:2.0.0"
Expand Down Expand Up @@ -8265,6 +8272,7 @@ fsevents@~2.1.2:
resolution: "serverless-plugin-tree-shake@workspace:plugin"
dependencies:
"@vercel/nft": ^0.9.3
alphanum-sort: ^1.0.2
apr-find: ^3.0.3
apr-for-each: ^3.0.3
apr-intercept: ^3.0.4
Expand Down
8 changes: 8 additions & 0 deletions test/__fixtures__/ts-nm-single/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,13 @@ __metadata:
languageName: node
linkType: hard

"alphanum-sort@npm:^1.0.2":
version: 1.0.2
resolution: "alphanum-sort@npm:1.0.2"
checksum: 3/28bad91719e15959e36a791a3538924e07da356ebe3b5f992e7668e8018cfc417a7ba4a69512771e5ffa306c7e028435c7748546f66f72d4f7b0ad694cf55069
languageName: node
linkType: hard

"ansi-align@npm:^2.0.0":
version: 2.0.0
resolution: "ansi-align@npm:2.0.0"
Expand Down Expand Up @@ -8265,6 +8272,7 @@ fsevents@~2.1.2:
resolution: "serverless-plugin-tree-shake@workspace:plugin"
dependencies:
"@vercel/nft": ^0.9.3
alphanum-sort: ^1.0.2
apr-find: ^3.0.3
apr-for-each: ^3.0.3
apr-intercept: ^3.0.4
Expand Down
8 changes: 8 additions & 0 deletions test/__fixtures__/ts-pnp-individually/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,13 @@ __metadata:
languageName: node
linkType: hard

"alphanum-sort@npm:^1.0.2":
version: 1.0.2
resolution: "alphanum-sort@npm:1.0.2"
checksum: 3/28bad91719e15959e36a791a3538924e07da356ebe3b5f992e7668e8018cfc417a7ba4a69512771e5ffa306c7e028435c7748546f66f72d4f7b0ad694cf55069
languageName: node
linkType: hard

"ansi-align@npm:^2.0.0":
version: 2.0.0
resolution: "ansi-align@npm:2.0.0"
Expand Down Expand Up @@ -8265,6 +8272,7 @@ fsevents@~2.1.2:
resolution: "serverless-plugin-tree-shake@workspace:plugin"
dependencies:
"@vercel/nft": ^0.9.3
alphanum-sort: ^1.0.2
apr-find: ^3.0.3
apr-for-each: ^3.0.3
apr-intercept: ^3.0.4
Expand Down
8 changes: 8 additions & 0 deletions test/__fixtures__/ts-pnp-single/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,13 @@ __metadata:
languageName: node
linkType: hard

"alphanum-sort@npm:^1.0.2":
version: 1.0.2
resolution: "alphanum-sort@npm:1.0.2"
checksum: 3/28bad91719e15959e36a791a3538924e07da356ebe3b5f992e7668e8018cfc417a7ba4a69512771e5ffa306c7e028435c7748546f66f72d4f7b0ad694cf55069
languageName: node
linkType: hard

"ansi-align@npm:^2.0.0":
version: 2.0.0
resolution: "ansi-align@npm:2.0.0"
Expand Down Expand Up @@ -8265,6 +8272,7 @@ fsevents@~2.1.2:
resolution: "serverless-plugin-tree-shake@workspace:plugin"
dependencies:
"@vercel/nft": ^0.9.3
alphanum-sort: ^1.0.2
apr-find: ^3.0.3
apr-for-each: ^3.0.3
apr-intercept: ^3.0.4
Expand Down
5 changes: 3 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const Intercept = require('apr-intercept');
const { basename, dirname, extname, join, resolve, relative } = require('path');
const { isSymlinkSync } = require('path-type');
const Reduce = require('apr-reduce');
const Sort = require('alphanum-sort');
const Setup = require('./setup');

const EVENT = {
Expand All @@ -20,9 +21,9 @@ const normalizeTree = ({ path, type, children = [] }) => {
const isSymlink = isSymlinkSync(path);
const link = isSymlink ? ` -> ${readlinkSync(path)}` : '';

return Flatten(
return Sort(Flatten(
[`${type} ${fullpath}${link}`].concat(children.map(normalizeTree)),
).sort();
));
};

const decompress = async (file, cwd) => {
Expand Down
Binary file modified test/snapshots/index.js.snap
Binary file not shown.
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,13 @@ __metadata:
languageName: node
linkType: hard

"alphanum-sort@npm:^1.0.2":
version: 1.0.2
resolution: "alphanum-sort@npm:1.0.2"
checksum: 3/28bad91719e15959e36a791a3538924e07da356ebe3b5f992e7668e8018cfc417a7ba4a69512771e5ffa306c7e028435c7748546f66f72d4f7b0ad694cf55069
languageName: node
linkType: hard

"ansi-align@npm:^3.0.0":
version: 3.0.0
resolution: "ansi-align@npm:3.0.0"
Expand Down Expand Up @@ -4530,6 +4537,7 @@ resolve@^1.10.0:
resolution: "serverless-plugin-tree-shake@workspace:."
dependencies:
"@vercel/nft": ^0.9.3
alphanum-sort: ^1.0.2
apr-find: ^3.0.3
apr-for-each: ^3.0.3
apr-intercept: ^3.0.4
Expand Down

0 comments on commit dc1d992

Please sign in to comment.