mirror of
https://github.com/dergigi/boris.git
synced 2025-12-29 20:44:37 +01:00
feat: initialize markr nostr bookmark client
- Add project structure with TypeScript, React, and Vite - Implement nostr authentication using browser extension (NIP-07) - Add NIP-51 compliant bookmark fetching and display - Create minimal UI with login and bookmark components - Integrate applesauce-core and applesauce-react libraries - Add responsive styling with dark/light mode support - Include comprehensive README with setup instructions This is a minimal MVP for a nostr bookmark client that allows users to view their bookmarks according to NIP-51 specification.
This commit is contained in:
44
node_modules/flat-cache/src/utils.js
generated
vendored
Normal file
44
node_modules/flat-cache/src/utils.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var flatted = require('flatted');
|
||||
|
||||
module.exports = {
|
||||
tryParse: function (filePath, defaultValue) {
|
||||
var result;
|
||||
try {
|
||||
result = this.readJSON(filePath);
|
||||
} catch (ex) {
|
||||
result = defaultValue;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
/**
|
||||
* Read json file synchronously using flatted
|
||||
*
|
||||
* @method readJSON
|
||||
* @param {String} filePath Json filepath
|
||||
* @returns {*} parse result
|
||||
*/
|
||||
readJSON: function (filePath) {
|
||||
return flatted.parse(
|
||||
fs.readFileSync(filePath, {
|
||||
encoding: 'utf8',
|
||||
})
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Write json file synchronously using circular-json
|
||||
*
|
||||
* @method writeJSON
|
||||
* @param {String} filePath Json filepath
|
||||
* @param {*} data Object to serialize
|
||||
*/
|
||||
writeJSON: function (filePath, data) {
|
||||
fs.mkdirSync(path.dirname(filePath), {
|
||||
recursive: true,
|
||||
});
|
||||
fs.writeFileSync(filePath, flatted.stringify(data));
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user