Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bookworms

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bookworms - npm Package Compare versions

Comparing version 1.2.3 to 1.3.0

src/_tests_/check-bookmarks.test.js

21

bin/index.js

@@ -8,2 +8,3 @@ #!/usr/bin/env node

convertBookmarks,
checkBookmarks,
} from "../src/index.js";

@@ -61,3 +62,3 @@

handler: (argv) => {
console.log("COVERTING BOOKMARKS");
console.log("CONVERTING BOOKMARKS");
convertBookmarks.createBookmarks(

@@ -71,2 +72,19 @@ argv.bookmarks,

const checkCommand = {
command: "check <bookmarks>",
desc: "Local path of exported browser bookmarks",
handler: async (argv) => {
console.log("CHECKING BOOKMARKS");
const checkResult = await checkBookmarks.checkBookmarks(
argv.bookmarks,
argv.directory
);
if (!checkResult) {
console.log("Bookmarks are not up to date");
process.exit(1);
}
console.log("Bookmarks are up to date");
},
};
yargs(hideBin(process.argv))

@@ -87,2 +105,3 @@ .option("d", {

.command(convertCommand)
.command(checkCommand)
.help().argv;

@@ -40,3 +40,3 @@ # Advanced usage

## Covert
## Convert

@@ -46,3 +46,3 @@ If you already have bookmarks in your browser you can speed up the process of converting them into `YAML` using the `convert` tool, read more about that here:

The `covert` command works in a similar way to `get` with the same options.
The `convert` command works in a similar way to `get` with the same options.

@@ -68,1 +68,15 @@ ```BASH

```
## Check
Check whether current generated files are up to date with the yaml file.
This can be used either in a git hook or in your CI to make sure the output files have been changed after a change to the yaml file.
The `check` command works in a similar way to `get` with the same options.
```BASH
$ npx bookworms check ./my-bookmarks.yaml
```
This will print whether the generated bookmark files are up to date.
The process will also exit with exit code 0 if the files are up to date, and 1 if not.

@@ -85,2 +85,11 @@ # Developers

#### `checkBoomkarks`
A collection of helpers for checking whether the output files are up to date with the yaml file.
- `checkBookmarks(path, directory)` - load bookmarks from `path`, and check whether the files generated from it are equivalent to the output files residing in `directory`
- `sanitizeDynamicData(bookmarkBody)` - sanitizes dynamic data from the bookmark body, to be clean of data which is generated dynamically unrelated to the yaml. Currently, the dynamic data in the output is creation dates.
- `checkBookmarkBody(existingBookmarkBody, generatedBookmarkBody)` - returns whether 2 output bookmarks files are equivalent (equal except dynamic data).
- `checkSingleBookmark(generatedBookmark, directory)` - checks whether a bookmark object (with a `filename` and `body`) is equivalent to the output bookmark file with the same name in `directory`.
## Contributing to Bookworms

@@ -87,0 +96,0 @@

2

package.json
{
"name": "bookworms",
"version": "1.2.3",
"version": "1.3.0",
"description": "A cli tool for centralising and generating bookmarks",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

@@ -7,2 +7,3 @@ import {

convertBookmarks,
checkBookmarks,
} from "../index";

@@ -26,2 +27,5 @@

});
test("should return checkBookmarks", () => {
expect(checkBookmarks).toBeDefined();
});
});

@@ -6,2 +6,3 @@ import * as loadBookmarks from "./load-bookmarks.js";

import * as convertBookmarks from "./convert-bookmarks.js";
import * as checkBookmarks from "./check-bookmarks.js";

@@ -14,2 +15,3 @@ export {

convertBookmarks,
checkBookmarks,
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc