import bookmarks and makes a folder in new browser
const fs = require('fs');
const path = require('path');

// Create dist folder
const distPath = path.join(__dirname, 'dist');
fs.mkdirSync(distPath);

// Import browser bookmark file
const bookmarkFilePath = path.join(__dirname, 'path/to/bookmark/file');
const bookmarks = require(bookmarkFilePath);

// Loop through bookmarklets
const bookmarkletsPath = path.join(__dirname, 'src/utils/bookmarklets');
fs.readdirSync(bookmarkletsPath).forEach(file => {
	const bookmarkletPath = path.join(bookmarkletsPath, file);
	const bookmarklet = fs.readFileSync(bookmarkletPath, 'utf8');

	// Create new bookmark for each bookmarklet
	const newBookmark = {
		name: file,
		url: `javascript:${bookmarklet}`
	};

	bookmarks.push(newBookmark);
});

// Save updated bookmarks
fs.writeFileSync(bookmarkFilePath, JSON.stringify(bookmarks, null, 2));