from-module
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

🚀 From.js

An easy and fast importer of global modules

📦 Installation

YARN

yarn add from.js

NPM

npm install from.js

🧐 How to use

Importing

Common Js
const fromJs = require("from-module");
Js Modules
import fromJs from "from-module";

📥 Install module

// False to install with npm
// True to install with yarn

fromJs.i("moduleName", false /* default */, (mods) => `Installed ${mods[0]}!`)

🗑 Removing module

fromJs.r("moduleName", (mods) => `Removed ${mods[0]}!`)

🎈 Importing module

fromJs("moduleName", (mod) => {
    // Your code here
})

🧶 Updating a module

// False to update with npm
// True to update with yarn

fromJs.update("moduleName", false /* default */)

🤔 Checking a module version

fromJs.version("moduleName") // If the module is not in package.json it will return undefined

🤔 Checking if a module is installed

if (fromJs.has("moduleName")) console.log("The module is installed")
else console.log("The module is not installed")

🎭 Events

install

fromJs.on("install", (std, modules) => {
  // Your code here
})

remove

fromJs.on("remove", (std, modules) => {
  // Your code here
})

update

fromJs.on("update", (std, modules) => {
  // Your code here
})

🎗 License

MIT License

Copyright (c) 2021 Brian Rhudy

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Package Sidebar

Install

npm i from-module

Weekly Downloads

0

Version

1.0.8

License

MIT

Unpacked Size

23 kB

Total Files

14

Last publish

Collaborators

  • lrd_7