{"id":14981605,"url":"https://github.com/secundant/neodx","last_synced_at":"2025-04-13T00:46:05.153Z","repository":{"id":62273671,"uuid":"526371318","full_name":"secundant/neodx","owner":"secundant","description":"A collection of frontend-focused tools aimed at enhancing your development experience","archived":false,"fork":false,"pushed_at":"2024-11-15T16:51:50.000Z","size":18014,"stargazers_count":85,"open_issues_count":39,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T00:45:40.436Z","etag":null,"topics":["builder","figma","fs","icons","library","logging","nodejs","svg","svg-sprites","toolkit","typescript","vfs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/secundant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-18T21:00:02.000Z","updated_at":"2025-04-05T16:22:18.000Z","dependencies_parsed_at":"2024-12-18T12:02:25.274Z","dependency_job_id":"c1b55279-eb96-4328-a10d-75045498bbf0","html_url":"https://github.com/secundant/neodx","commit_stats":{"total_commits":377,"total_committers":5,"mean_commits":75.4,"dds":0.0954907161803713,"last_synced_commit":"0d154ec25abe8568aa7ce2d540de7e90eb0df9ef"},"previous_names":[],"tags_count":121,"template":false,"template_full_name":"secundant/product-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/secundant%2Fneodx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/secundant%2Fneodx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/secundant%2Fneodx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/secundant%2Fneodx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/secundant","download_url":"https://codeload.github.com/secundant/neodx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650420,"owners_count":21139672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["builder","figma","fs","icons","library","logging","nodejs","svg","svg-sprites","toolkit","typescript","vfs"],"created_at":"2024-09-24T14:03:55.611Z","updated_at":"2025-04-13T00:46:04.917Z","avatar_url":"https://github.com/secundant.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003ca aria-label=\"@neodx - Frontend toolkit\" href=\"https://github.com/secundant/neodx\"\u003e\n    @neodx: Everyday instruments for web development\n  \u003c/a\u003e\n\u003c/h1\u003e\n\u003chr /\u003e\n\nThis project is designed to tackle common web development challenges with ease.\n\nCheck out our [documentation](https://neodx.pages.dev) to learn more!\n\n\u003e **Warning**\n\u003e Most of the packages are still under development, so API may change.\n\u003e I'll try to keep it stable, but updates still can bring breaking changes.\n\nPackages overview:\n\n- [@neodx/figma](#neodxfigma) | [docs](https://neodx.pages.dev/figma) | [source](./libs/figma)\n- [@neodx/svg](#neodxsvg) | [docs](https://neodx.pages.dev/svg) | [source](./libs/svg)\n- [@neodx/log](#neodxlog) | [docs](https://neodx.pages.dev/log) | [source](./libs/log)\n- [@neodx/vfs](#neodxvfs) | [docs](https://neodx.pages.dev/vfs) | [source](./libs/vfs)\n\n### [@neodx/figma](./libs/figma)\n\nFigma is a great tool for design collaboration, but we don't have a solid way to use it in our development workflow.\n\n#### But we have a problem!\n\nProbably, you've already tried to write your own integration or use some existing solutions and faced the following problems as me:\n\n- 🤯 Multiple different not maintained packages with different APIs\n- 🫠 Bad documentation/usage examples or even no documentation at all\n- 💀 Terrible flexibility and solution design, you just can't use it in your project because of the different document structure or workflow\n- 🙅‍♀️ No type safety, autocomplete, etc.\n\nIn other words, there is no really well-designed complex solution for Figma integration.\n\n#### Let's solve it!\n\nSo, `@neodx/figma` is an attempt to create it. Currently, we have the following features:\n\n- **Flexible Export CLI**: You can use it to export icons or other elements. It's a simple wrapper around our Node.JS API.\n- **Typed Figma API**: All Figma API methods are typed and have autocomplete support.\n- **Built-in document graph API**: Figma API is too low-level for writing any stable solution. We provide an API that allows you work with the document as a simple high-level graph of nodes.\n\n[Visit `@neodx/figma` documentation](https://neodx.pages.dev/svg) to learn more!\n\nSee our examples for more details:\n\n- [SVG sprite generation on steroids with Figma export](./examples/svg-magic-with-figma-export) - Integrated showcase of the `@neodx/svg` and `@neodx/figma` packages with real application usage!\n- [Export icons from the Community Weather Icons Kit](./examples/figma-export-file-assets) - A simple step-by-step example of how to use the `@neodx/figma` to export icons.\n\nAlso, we have some ideas for future development, so stay tuned and feel free to request your own! 🚀\n\n### [@neodx/svg](./libs/svg)\n\nSupercharge your icons ⚡️\n\nAre you converting every SVG icon to a React component with SVGR or something similar? It's so ease to use!\n\nBut wait; did you know that SVG sprites are a native approach for icons? It's even easier to use!\n\n```typescript jsx\nimport { Icon, type AnyIconName } from '@/shared/ui/icon';\n\nexport interface MyComponentProps {\n  icon: AnyIconName;\n}\n\nexport const MyComponent = ({ icon }: MyComponentProps) =\u003e (\n  \u003c\u003e\n    {/* Use as is */}\n    \u003cIcon name=\"common/check\" /\u003e\n    {/* Change color */}\n    \u003cIcon name=\"common/close\" className=\"text-red-500\" /\u003e\n    {/* Change size */}\n    \u003cIcon name=\"text/bold\" className=\"text-lg\" /\u003e\n    {/* Add any other styles */}\n    \u003cIcon name=\"actions/delete\" className=\"p-2 rounded-md bg-stone-300\" /\u003e\n    {/* Use simple type-safe names instead of weird components */}\n    \u003cIcon name={icon} /\u003e\n  \u003c/\u003e\n);\n```\n\nNo runtime overhead, one component for all icons, native browser support, static resource instead of JS bundle, etc.\n\nSounds good? Of course! Native sprites are unfairly deprived technique.\nProbably, you already know about it, but didn't use it because of the lack of tooling.\n\nHere we go! Type safety, autocomplete, runtime access to icon metadata all wrapped in simple plugins for all popular bundlers.\n\n[Visit `@neodx/svg` documentation](https://neodx.pages.dev/svg) to learn more!\n\nAlso, you can check out our examples:\n\n- [React, Vite, TailwindCSS, and multicolored icon](./examples/svg-vite) - A step-by-step tutorial showcasing how to integrate sprite icons into your Vite project.\n- [React, Vite, icons exported by \"@neodx/figma\"](./examples/svg-magic-with-figma-export) - Integrated showcase of the seamless automation capabilities of `@neodx/svg` and `@neodx/figma` for your icons!\n- [Next.js, webpack and simple flat icons](./examples/svg-next) - An example demonstrating the usage of `@neodx/svg` webpack plugin with Next.js.\n\n### [@neodx/log](./libs/log)\n\nA lightweight, flexible, and isomorphic logger and logging framework designed for modern development needs.\n\nTired of dealing with `console.log`?\nHaving trouble finding a suitable logging library because they're too heavy, platform-specific, or not flexible enough?\n\nI faced the same issues, which led me to create `@neodx/log`.\nIt's simple, efficient, and avoids most critical drawbacks.\nFurthermore, it's easily replaceable and extensible, making it a great fit for your development needs.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg alt=\"Header\" src=\"libs/log/docs/preview-intro.png\" width=\"1458\"\u003e\n\u003c/div\u003e\n\n- ~ 1KB gzipped in browser\n- Configurable log levels and log targets\n- Built-in JSON logs in production and pretty logs in development for Node.js\n\n```typescript\nimport { createLogger } from '@neodx/log';\nimport { createWriteStream } from 'node:fs';\n\n// Simple setup\n\nconst logger = createLogger({\n  name: 'my-app',\n  level: process.env.NODE_ENV === 'production' ? 'info' : 'debug'\n});\n\nlogger.debug({ login, password }, 'User logged in, session id: %s', sessionId); // Will be ignored in production\nlogger.warn('Retries: %i', retriesCount); // Our default levels: error, warn, info, verbose, debug\n\n// Nested loggers\n\nconst child = logger.child('child'); // Child logger will inherit parent logger settings\n\nchild.info('Hello, world!'); // [my-app \u003e child] Hello, world!\n\n// Clone and extend\n\nconst forked = child.fork({ meta: { requestId } }); // Forked logger will inherit parent logger settings and extend config\n\nforked.info({ path, method }, 'Request received'); // [my-app \u003e child] Request received { path: '/api', method: 'GET', requestId: '...' }\n\n// Custom log targets\n\nconst targeted = createLogger({\n  name: 'my-app',\n  level: 'debug',\n  target: createPrettyTarget()\n});\n// Or you can use array notation to define multiple targets:\nconst withMultipleOutput = createLogger({\n  target: [\n    createPrettyTarget(), // Will log all levels to console\n    {\n      level: 'info',\n      target: createJsonTarget({\n        target: createWriteStream('logs/info.log')\n      })\n    }\n  ]\n});\n```\n\n### [@neodx/vfs](./libs/vfs)\n\nAre you working on tasks or scripts that depend on the file system, such as code generation, codemods, or internal tools? Have you ever struggled to test them, needed a \"dry-run\" mode, or encountered other challenges?\n\nMeet `@neodx/vfs`, the missing abstraction layer for file system operations that makes working with the file system a breeze. Let's take a look at an example:\n\n```typescript\nimport { createVfs } from '@neodx/vfs';\n\nconst fs = createVfs();\n\nawait fs.writeJson('.cache/meta.json', { timestamp: Date.now(), stats });\nawait fs.updateJson('package.json', pkg =\u003e {\n  pkg.version = '1.0.0';\n});\nawait fs.write('src/index.ts', 'export const foo = 42;');\nawait fs.apply();\n}\n```\n\nWhile it may seem unnecessary at first glance, let's explore the core concepts that make `@neodx/vfs` invaluable:\n\n- Single abstraction - just share `Vfs` instance between all parts of your tool\n- Inversion of control: you can provide any implementation of `Vfs` interface\n  - Btw, we already have built-in support in the `createVfs` API\n- Dry-run mode: you can test your tool without any side effects (only in-memory changes, read-only FS access)\n- Virtual mode: you can test your tool without any real file system access, offering in-memory emulation for isolated testing\n- Attached working directory - you can use clean relative paths in your logic without any additional logic\n- Extensible: you can build your own features on top of `Vfs` interface\n  - Currently, we have built-in support for formatting files, updating JSON files, and package.json dependencies management\n\nIn other words, it's designed as single API for all file system operations, so you can focus on your tool logic instead of reinventing the wheel.\n\n## Development and contribution\n\n### Getting started\n\nWe're using [Yarn 3 (berry)](https://yarnpkg.com/) as a package manager and [Nx](https://nx.dev/) as a monorepo management tool.\n\nAfter cloning the repo, to install dependencies, run:\n\n```shell\nyarn\n```\n\nAnd, optionally, for building all packages, run:\n\n```shell\nyarn nx run-many  --all --target=build\n```\n\nIt isn't necessary, you can start working with the codebase right away, but it will boost initial cache whn you run e2e tests (scenarios in examples/\\*).\n\n### Internal scripts\n\n#### Create a new global example\n\n```shell\nyarn neodx example new-example-name\n```\n\n#### Create a new library\n\n```shell\nyarn neodx lib new-lib-name\n```\n\nThe source code can be accessed by starting from [tools/scripts/bin.mjs](./tools/scripts/bin.mjs)..\n\n## License\n\nLicensed under the [MIT License](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecundant%2Fneodx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsecundant%2Fneodx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecundant%2Fneodx/lists"}