Skip to content

Commit 7f9e782

Browse files
committed
fix: bookmarks need to be formated
1 parent 3c04df9 commit 7f9e782

5 files changed

Lines changed: 93 additions & 19 deletions

File tree

DEV_NOTES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
1. Backup Firefox bookmarks
2+
3+
2. Place the file in root of this project
4+
5+
3. Use `Format JSON` of `magic-beans`

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
"string-fn": "^2.9.0"
3030
},
3131
"devDependencies": {
32+
"@types/jest": "^26.0.8",
3233
"jest": "^24.9.0"
3334
},
34-
"depFn": ["rambdax"]
35-
}
35+
"depFn": [
36+
"rambdax"
37+
]
38+
}

src/_modules/bookmarksToLinks.js

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,21 @@ const today = dayjs().format('YYYY-MM-DD')
88
const GITHUB_MARKER = 'https://github.com/'
99

1010
async function bookmarksToLinks(destinationFilePath){
11-
console.log({ destinationFilePath })
12-
const sourcePath = resolve(__dirname, `../../bookmarks-${ today }.json`)
13-
console.log({sourcePath})
14-
const asText = await readFile(sourcePath)
11+
const sourcePath = resolve(__dirname, `../../bookmarks-${ today }.json`)
12+
const asText = await readFile(sourcePath)
1513

16-
const githubRepos = asText
17-
.toString()
18-
.match(/\"uri\":\s\".+(?=\")/g)
19-
.filter(x => !x.includes('selfrefactor') && x.includes(GITHUB_MARKER))
20-
.map(remove([ 'uri', ':', /\"/g ]))
21-
.map(trim)
22-
.filter(x => !x.includes('trending') && x.split('/').length === 5)
23-
.join('\n')
24-
25-
writeFileSync(destinationFilePath, githubRepos)
26-
27-
return githubRepos
14+
const githubRepos = asText
15+
.toString()
16+
.match(/\"uri\":\s\".+(?=\")/g)
17+
.filter(x => !x.includes('selfrefactor') && x.includes(GITHUB_MARKER))
18+
.map(remove([ 'uri', ':', /\"/g ]))
19+
.map(trim)
20+
.filter(x => !x.includes('trending') && x.split('/').length === 5)
21+
.join('\n')
22+
23+
writeFileSync(destinationFilePath, githubRepos)
24+
25+
return githubRepos
2826
}
2927

3028
exports.bookmarksToLinks = bookmarksToLinks

src/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ async function populate({
154154
updateSecondary,
155155
fromSelfrefactor,
156156
}){
157-
if (bookmarks) bookmarksToLinks(BOOKMARKS)
157+
if (bookmarks) await bookmarksToLinks(BOOKMARKS)
158158
if (fromSelfrefactor) await updateFromSelfrefactor()
159159
if (updateSecondary) await updateSecondaryFn()
160160
if (createData) await createDataJSON()

yarn.lock

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,16 @@
321321
"@types/istanbul-reports" "^1.1.1"
322322
"@types/yargs" "^13.0.0"
323323

324+
"@jest/types@^25.5.0":
325+
version "25.5.0"
326+
resolved "https://registry.yarnpkg.com/@jest/types/-/types-25.5.0.tgz#4d6a4793f7b9599fc3680877b856a97dbccf2a9d"
327+
integrity sha512-OXD0RgQ86Tu3MazKo8bnrkDRaDXXMGUqd+kTtLtK1Zb7CRzQcaSRPPPV37SvYTdevXEBVxe0HXylEjs8ibkmCw==
328+
dependencies:
329+
"@types/istanbul-lib-coverage" "^2.0.0"
330+
"@types/istanbul-reports" "^1.1.1"
331+
"@types/yargs" "^15.0.0"
332+
chalk "^3.0.0"
333+
324334
"@types/babel__core@^7.1.0":
325335
version "7.1.2"
326336
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.2.tgz#608c74f55928033fce18b99b213c16be4b3d114f"
@@ -379,6 +389,14 @@
379389
"@types/istanbul-lib-coverage" "*"
380390
"@types/istanbul-lib-report" "*"
381391

392+
"@types/jest@^26.0.8":
393+
version "26.0.8"
394+
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.8.tgz#f5c5559cf25911ce227f7ce30f1f160f24966369"
395+
integrity sha512-eo3VX9jGASSuv680D4VQ89UmuLZneNxv2MCZjfwlInav05zXVJTzfc//lavdV0GPwSxsXJTy2jALscB7Acqg0g==
396+
dependencies:
397+
jest-diff "^25.2.1"
398+
pretty-format "^25.2.1"
399+
382400
"@types/stack-utils@^1.0.1":
383401
version "1.0.1"
384402
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e"
@@ -401,6 +419,13 @@
401419
dependencies:
402420
"@types/yargs-parser" "*"
403421

422+
"@types/yargs@^15.0.0":
423+
version "15.0.5"
424+
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.5.tgz#947e9a6561483bdee9adffc983e91a6902af8b79"
425+
integrity sha512-Dk/IDOPtOgubt/IaevIUbTgV7doaKkoorvOyYM2CMwuDyP89bekI7H4xLIwunNYiK9jhCkmc6pUrJk3cj2AB9w==
426+
dependencies:
427+
"@types/yargs-parser" "*"
428+
404429
abab@^2.0.0:
405430
version "2.0.0"
406431
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.0.tgz#aba0ab4c5eee2d4c79d3487d85450fb2376ebb0f"
@@ -500,6 +525,14 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1:
500525
dependencies:
501526
color-convert "^1.9.0"
502527

528+
ansi-styles@^4.0.0:
529+
version "4.2.1"
530+
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359"
531+
integrity sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==
532+
dependencies:
533+
"@types/color-name" "^1.1.1"
534+
color-convert "^2.0.1"
535+
503536
ansi-styles@^4.1.0:
504537
version "4.2.0"
505538
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.0.tgz#5681f0dcf7ae5880a7841d8831c4724ed9cc0172"
@@ -1363,6 +1396,11 @@ diff-sequences@^24.9.0:
13631396
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5"
13641397
integrity sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew==
13651398

1399+
diff-sequences@^25.2.6:
1400+
version "25.2.6"
1401+
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-25.2.6.tgz#5f467c00edd35352b7bca46d7927d60e687a76dd"
1402+
integrity sha512-Hq8o7+6GaZeoFjtpgvRBUknSXNeJiCx7V9Fr94ZMljNiCr9n9L8H8aJqgWOQiDDGdyn29fRNcDdRVJ5fdyihfg==
1403+
13661404
docsify-cli@^4.3.0:
13671405
version "4.3.0"
13681406
resolved "https://registry.yarnpkg.com/docsify-cli/-/docsify-cli-4.3.0.tgz#12b9cca29840d71653fe19bdc2ce8265a753b392"
@@ -2625,6 +2663,16 @@ jest-diff@^24.9.0:
26252663
jest-get-type "^24.9.0"
26262664
pretty-format "^24.9.0"
26272665

2666+
jest-diff@^25.2.1:
2667+
version "25.5.0"
2668+
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-25.5.0.tgz#1dd26ed64f96667c068cef026b677dfa01afcfa9"
2669+
integrity sha512-z1kygetuPiREYdNIumRpAHY6RXiGmp70YHptjdaxTWGmA085W3iCnXNx0DhflK3vwrKmrRWyY1wUpkPMVxMK7A==
2670+
dependencies:
2671+
chalk "^3.0.0"
2672+
diff-sequences "^25.2.6"
2673+
jest-get-type "^25.2.6"
2674+
pretty-format "^25.5.0"
2675+
26282676
jest-docblock@^24.3.0:
26292677
version "24.9.0"
26302678
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.9.0.tgz#7970201802ba560e1c4092cc25cbedf5af5a8ce2"
@@ -2671,6 +2719,11 @@ jest-get-type@^24.9.0:
26712719
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.9.0.tgz#1684a0c8a50f2e4901b6644ae861f579eed2ef0e"
26722720
integrity sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q==
26732721

2722+
jest-get-type@^25.2.6:
2723+
version "25.2.6"
2724+
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-25.2.6.tgz#0b0a32fab8908b44d508be81681487dbabb8d877"
2725+
integrity sha512-DxjtyzOHjObRM+sM1knti6or+eOgcGU4xVSb2HNP1TqO4ahsT+rqZg+nyqHWJSvWgKC5cG3QjGFBqxLghiF/Ig==
2726+
26742727
jest-haste-map@^24.9.0:
26752728
version "24.9.0"
26762729
resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.9.0.tgz#b38a5d64274934e21fa417ae9a9fbeb77ceaac7d"
@@ -3958,6 +4011,16 @@ pretty-format@^24.9.0:
39584011
ansi-styles "^3.2.0"
39594012
react-is "^16.8.4"
39604013

4014+
pretty-format@^25.2.1, pretty-format@^25.5.0:
4015+
version "25.5.0"
4016+
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-25.5.0.tgz#7873c1d774f682c34b8d48b6743a2bf2ac55791a"
4017+
integrity sha512-kbo/kq2LQ/A/is0PQwsEHM7Ca6//bGPPvU6UnsdDRSKTWxT/ru/xb88v4BJf6a69H+uTytOEsTusT9ksd/1iWQ==
4018+
dependencies:
4019+
"@jest/types" "^25.5.0"
4020+
ansi-regex "^5.0.0"
4021+
ansi-styles "^4.0.0"
4022+
react-is "^16.12.0"
4023+
39614024
prismjs@^1.15.0:
39624025
version "1.17.1"
39634026
resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.17.1.tgz#e669fcbd4cdd873c35102881c33b14d0d68519be"
@@ -4064,6 +4127,11 @@ rc@^1.0.1, rc@^1.1.6, rc@^1.2.7:
40644127
minimist "^1.2.0"
40654128
strip-json-comments "~2.0.1"
40664129

4130+
react-is@^16.12.0:
4131+
version "16.13.1"
4132+
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
4133+
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
4134+
40674135
react-is@^16.8.4:
40684136
version "16.9.0"
40694137
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.9.0.tgz#21ca9561399aad0ff1a7701c01683e8ca981edcb"

0 commit comments

Comments
 (0)