graceful-fs
electron-settings
graceful-fs | electron-settings | |
---|---|---|
3 | 3 | |
1,264 | 795 | |
- | - | |
3.0 | 1.7 | |
10 months ago | 15 days ago | |
JavaScript | TypeScript | |
ISC License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
graceful-fs
-
My fist codestory. A day in my life, as a coder :)
async (config?: { /** * Overwrite the default ignored behavior */ customIgnored?: string[]; }) => { const projectRoot = getProjectRoot(); if (!projectRoot) return; // NB: fix to globally alter real fs in order to fix EMFile error that happens in TSMorph (see https://github.com/isaacs/node-graceful-fs) gracefulFs.gracefulify(realFs); console.log("Searching..."); const tsFunctions = await db.get("TsFunction"); const projectWatcherTsFunctions = tsFunctions.filter( (x) => x.explicitTypeName === "ProjectWatcher" ); const projectWatchers = projectWatcherTsFunctions .map((x) => x.name) .map((name) => sdk[name as keyof typeof sdk] as ProjectWatcher | undefined) .filter(notEmpty); log(`${projectWatchers.length} watchers gonna watch ${projectRoot}`, { type: "important", }); const startupWaitMs = 1000; setTimeout(() => { log( `There they are! \n\n${projectWatchers .map((projectWatcher) => { return `👁 👁 ${projectWatcher.name} ✅`; }) .join("\n")}`, { type: "success", } ); }, startupWaitMs); const startTimeAt = Date.now(); watch(projectRoot, { ignoreInitial: true, ignored: config?.customIgnored || [ "**/node_modules/**", "**/.next/**", "**/.expo/**", "**/build/**", "**/db/**", "**/.git/**", "**/.turbo/**", "**/generated/**", ], // alwaysStat: true, // not sure why I would need this, seems inefficient if I don't need it, I can simply run fs.stat }).on("all", (eventName, path, stats) => { if (Date.now() < startTimeAt + startupWaitMs) return; const relevantWatchers = projectWatchers.filter((watcher) => watcher.filter(eventName, path) ); oneByOne(relevantWatchers, async (projectWatcher) => { await projectWatcher(eventName, path); }); }); };
-
My theory on why so many people are bad at coding.
What's probably got your shorts in a knot is the contents of the node_modules directory. That directory is a cache for mode.js modules so the tutorial can function standalone without having to install anything else. Treat it as you would object code. I pulled a half-dozen of those modules at random and went to their repositories. Every one of them had unit tests: block-stream, graceful-fs, lowercase-keys, minimist, pify and safe-buffer. Nobody sane ships unit tests with their executables.
-
I'm a noob, I've hit a wall and I need a bit of handholding re: creating node.js app
graceful-fs https://www.npmjs.com/package/graceful-fs
electron-settings
-
How to save user preferences?
Use electron-settings (no updates in 2 years)
-
I'm a noob, I've hit a wall and I need a bit of handholding re: creating node.js app
electron-settings https://github.com/nathanbuchar/electron-settings
-
Tracking How Many People Used/Download Electron App?
One relatively straightforward way to do that would be to use something like electron-settings to record a little bit of persistent state data to disk. I.e., in your main.js as part of the app bootstrapping logic you would (1) attempt to read a "first_launch" flag from the settings, and (2) when missing, post the info to the server and write the first_launch=true flag to the settings so you know you've done it already on the next launch.
What are some alternatives?
fs-extra - Node.js: extra methods for the fs object like copy(), remove(), mkdirs()
electron-store - Simple data persistence for your Electron app or module - Save and load user preferences, app state, cache, etc
chokidar - Minimal and efficient cross-platform file watching library
pnpm - Fast, disk space efficient package manager
fs-jetpack - Better file system API for Node.js
sentry-javascript - Official Sentry SDKs for JavaScript
globby - User-friendly glob matching
electron-release-server - A fully featured, self-hosted release server for electron applications, compatible with auto-updater.
proper-lockfile - An inter-process and inter-machine lockfile utility that works on a local or network file system.
electron-json-storage - :package: Easily write and read user settings in Electron apps
fs-write-stream-atomic - Like `fs.createWriteStream(...)`, but atomic.
Nest - A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀