Skip to content

Commit d85269c

Browse files
committed
sort bundling files in natural sort order
we want 10 to come after 9
1 parent eb306c7 commit d85269c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

scripts/bundle-data-dir.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const yaml = require('js-yaml')
33
const fs = require('fs')
44
const junk = require('junk')
55
const path = require('path')
6+
const natsort = require('string-natural-compare')
67

78
// run cli
89
if (process.mainModule === module) {
@@ -25,6 +26,9 @@ function bundleDataDir({fromDir, toFile}) {
2526
return
2627
}
2728

29+
// sort the files so that 9 comes before 10
30+
files.sort(natsort)
31+
2832
const loaded = files.map(fpath => {
2933
console.log(fpath)
3034
let contents = fs.readFileSync(fpath, 'utf-8')

0 commit comments

Comments
 (0)