npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bash-script-dependency-generator

v1.1.12

Published

This package creates bash installation scripts by reading dependency files such as package.json or requirements.txt

Downloads

4

Readme

Bash Installation Script Generator

This repository is for an NPM package I made that reads dependency installation files like requirements.text or package.json and generates long bash script commands for quick installation in Linux, Python, and JavaScript environments

This tool allows you to rebuild your bash installation scripts very fast and makes it easier to maintain.

You can read dependencies from a file like requirements.txt for Python or package.json for JavaScript/TypeScript.

This is still in development so this package's main use is to generate very long scripts using hardcoded objects/arrays in the Generator class or using a file like requirements.txt to generate a long chain of pip installs or package.json for npm installs (regular dependencies and dev)

pic

I made this from scratch in a couple hours so this is very Work in Progress and a lot of features to be implemented

Click the image below to watch demo

Video

Other dependency installation file types will get added in the future

If you do not have dependency files or want to use an unsupported language you can hardcode in your dependencies as seen below in 'node_modules/bash-script-dependency-generator/class/Generator.js'. Here you can update one large array of strings called nonVersionedDependencies if package version does not matter or one large object called versionedDependencies if you want to keep track of versions. This allows you to be able to update your dependencies and change the wording of the installation quick and easy.

pic


Editing nonVersionedDependencies Array when version does not matter

Ex. install python3-dev and python3-pip without specific version


// This is for arrays of package names when version isn't important

// Leave this as empty array unless you want to hardcode each package



const nonVersionedDependencies = [

"python3-dev",

"python3-pip"

];

Editing versionedDependencies object when specific versions is required

Ex. install pip at 20.3.4 and requests as 2.25.1


// This is for an object with keys equal to package names and values of the package version for when specific version is important

// Leave this as empty object unless you want to hardcode in the package + version



const versionedDependencies = {

pip: "20.3.4",

requests: "2.25.1",

};




Demo

clone this repo with

git clone https://github.com/ChristianGracia/Bash-Script-Generator.git

run in root of project after repository is cloned

Creating pip install script from examples/requirements.txt

npm run pip

Creating npm install script from examples/package.json

npm run npm


Installation

npm i --dev bash-script-dependency-generator@latest

Use

Run the following command where language is the installation language (Ex. Python would be pip install, Linux would use sudo apt-get install)

node node_modules/bash-script-dependency-generator/ INSTALLATION_LANGUAGE FILE

File argument is optional, if omitted, a script will be attempted to be built from whatever is in the versionedDependencies object or nonVersionedDependencies array

Python dependencies - Pip

Run in terminal if hardcoded versionedDependencyObject property on Generator class

node node_modules/bash-script-dependency-generator/ pip

Run in terminal if you have the dependency file

node node_modules/bash-script-dependency-generator/ pip PATH/TO/requirements.txt

Debian Linux - APT

Run in terminal if hardcoded nonVersionedDependency array property on Generator class

node node_modules/bash-script-dependency-generator/ apt

JavaScript/TypeScript - NPM

Run in terminal

node node_modules/bash-script-dependency-generator/ npm package.json

Tests

pic

run tests with jest using

npm run test