[go: up one dir, main page]

This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

paths-manager
TypeScript icon, indicating that this package has built-in type declarations

0.4.3 • Public • Published


PRs welcome npm

Table of Contents

About

Discord bot projects usually maintain a lot of files due to every file being a separate command, event, handler or some data storing json files, so keeping the files organized in tree structure folders like "commands/moderation/admins-only/ban.js", yet keeping track of each file path in order to reference it anywhere inside your commands, for example: if you're making a test command to test the welcome event message rather than kicking and re-joining from another acount it'd be better to have a test command and be somewhere like "commands/tests/event-tests/welcome-test.js" and you want to require the event located at "events/guild/welcome.js" so you can call it from the tets command, you propably would write something like const welcome = require('../../../events/guild/welcome.js'); which will work fine until you move any of the files or change the name of one of their folders and that will break everything, you can just change the path text but if you're doing the same thing for every other command and event you have?, just moving the "commands/tests" folder will require you to change all path texts in all test command files and of course you don't want that, we programmers hate doing repetitive work ourselves so much that's why we made this tool, to help automate this work.

Key features of paths-manager:

  • Save all file paths inside a main folder or it's subfolder
  • Get the full path of any stored file from anywhere in your project
  • Get full paths of all stored files within a main folder or it's subfolder
Additional important info

paths-manager keeps the stored paths in variables, meaning they'll be lost once the project is stopped and you'll need to save the files every time you run it

paths-manager will auto detect all main folders if non were specified in the save files function.

paths-manager finding functions will require the extension of the file name.

when having a file with the same name as an other file, paths-manager will return the first one it finds.

Built With

  • Node.js
  • Javascript

Getting Started

Prerequisites

Install paths-manager by running the following command in your node.js project:

npm i paths-manager

or

npm install paths-manager

Usage

Require the paths-manager module like so const pathsManager = require('paths-manager');.

Save all your main folders files at the beggining of your project.

When you want to get the full path of a file that you know it's name, require the package like before.

then use the function for getting a file path, give it the full file name with it's extension like so 'example.js'.

if you have more than one file with the same name then use the function for getting a file path with a folder name it's inside, provide the folder name along with the file name to get the exact one you want.

Contributing

First off, thanks for taking the time to contribute! Contributions are what makes the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are greatly appreciated.

Please try to create bug reports that are:

  • Reproducible. Include steps to reproduce the problem.
  • Specific. Include as much detail as possible: which version, what environment, etc.
  • Unique. Do not duplicate existing opened issues.
  • Scoped to a Single Bug. One bug per report.

Support

Try contacting one of the followings:

License

This project is licensed under the MIT license. Feel free to edit and distribute this template as you like. See LICENSE for more information.

Package Sidebar

Install

npm i paths-manager

Weekly Downloads

1

Version

0.4.3

License

MIT

Unpacked Size

11.8 kB

Total Files

9

Last publish

Collaborators

  • nabil_alsaiad