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

@createdbyjurand/node-scripts

v2.1.0-SNAPSHOT

Published

@createdbyjurand/node-scripts

Downloads

193

Readme

@createdbyjurand/node-scripts

 

Table of contents

 

Description

Node scripts with amazing beautiful colorful logging :)

 

Installation

npm i -D @createdbyjurand/node-scripts
  • i is alias of install
  • -D is alias of --save-dev

 

Scripts

 

Rebuild modules

Back to table of contents

 

Description:

Script goes through specified directory and all its subdirectories recursively deleting index files and creating new ones for each directory with exports of all files in the directory.

 

Configuration:

Add to package.json:

{
  "scripts": {
    "rebuild modules": "rebuild-modules@createdbyjurand --path=src/@module --no-root --extension=ts"
  }
}

 

Parameters:

| Parameter | Required | Default value | Available options | | ------------------------------------ | -------- | ------------- | --------------------------------------------------------------------------------------------------------- | | --path=[PATH_TO_MODULES_DIRECTORY] | yes | | --no-root | no | | --extension=[INDEX_FILE_EXTENSION] | no | ts | js ts jsx tsx cjs mjs node.cjs node.js node.mjs |

--path=

Path to module(s) directory.

--no-root

This can be set or not. It forces not to create index file in the root directory where path is pointing.

--extension=

This sets the extension of index files in modules. Only index files with specified extension will be removed and recreated.

 

Supported file extensions:

Those are file extensions that this script will include in index module file. Other files will be omitted.

  • js
  • ts
  • jsx
  • tsx
  • cjs
  • mjs
  • json
  • jsonc
  • json5
  • svg

 

Examples:

 

Commands to build modules:

rebuild-modules@createdbyjurand --path=src/@io

 

Imports:

import { sth1, sth2, sth3 } from @io/auth
import { sth4, sth5 } from @io/components
import { sth6, sth7, sth8, sth9 } from @io/interfaces

 

Folder structure:

└ src
  └ @io
    ├ auth
    │ ├ sth1.ts // or .js or .mjs or .cjs or .json or .svg
    │ ├ sth2.ts
    │ └ sth3.ts
    ├ components
    │ ├ sth4.ts
    │ └ sth5.ts
    ├ interfaces
    │ ├ sth6.ts
    │ ├ sth7.ts
    │ ├ sth8.ts
    │ └ sth9.ts
    ├ resources
    │ ├ sth10.svg
    │ └ sth11.json
    ├ routes
    │ ├ sth12.ts
    │ └ sth13.ts
    └ some-other-folder
      └ sth14.ts

 

Folder structure after script run:

└ src
  └ @io
    ├ auth
    │ ├ index.ts
    │ ├ sth1.ts
    │ ├ sth2.ts
    │ └ sth3.ts
    ├ components
    │ ├ index.ts
    │ ├ sth4.ts
    │ └ sth5.ts
    ├ interfaces
    │ ├ index.ts
    │ ├ sth6.ts
    │ ├ sth7.ts
    │ ├ sth8.ts
    │ └ sth9.ts
    ├ resources
    │ ├ index.ts
    │ ├ sth10.svg
    │ └ sth11.json
    ├ routes
    │ ├ index.ts
    │ ├ sth12.ts
    │ └ sth13.ts
    └ some-other-folder
    │ ├ index.ts
      └ sth14.ts

 

Index files contents:

export * from './sth1';
export * from './sth2';
export * from './sth3';
import Sth10 from './sth10.svg';
import Sth11 from './sth11.json';

export const Sth10Svg = Sth10;
export const Sth11Json = Sth11;

 

Changelog:

0.8.11-SNAPSHOT

  • added: remove empty index files
  • added: do not create empty index files
  • info: --no-root still forces not to create index file for root directory even if there are files

0.7.3-SNAPSHOT

  • stable release of rebuild modules script

0.7.2-SNAPSHOT

  • bugfixes

0.7.1-SNAPSHOT

  • bugfixes

0.7.0-SNAPSHOT

  • added *.svg and *.json support.

0.5.3-SNAPSHOT

  • bugfixes

0.5.0-SNAPSHOT

  • test resease

 

Uglify directory

Back to table of contents

 

Description:

This script runs UglifyJS command for every file in the directory recursively overwriting it with uglified version.

!!!   :warning:   BE CAREFUL, THIS SCRIPT OVERWRITES FILES   :warning:   !!!

Use it on dist or build directories. For this it was intended for.

 

Configuration:

Add script to package.json:

{
  "scripts": {
    "uglify": "uglify-directory@createdbyjurand --path=dist --compress --mangle --toplevel --v8"
  }
}

 

Parameters:

| Parameter | Required | | ------------------------------------------------ | -------- | | --path=[PATH_TO_DIRECTORY_TO_BE_UGLIFIED] | yes | | --[OTHER_ARGUMENTS_WILL_BE_PASSED_TO_UGLIFYJS] | no |

 

--path=

Path to directory to be uglified.

 

--[OTHER_ARGUMENTS]

Any other argument that starts with -- except --path= will be passed to uglifyjs command. Examples: --compress --mangle --toplevel --v8

 

Script does not support:

  • arguments with one - (like -p or -w). Only two -- arguments work
  • arguments that have spaces, space is the end of an argument

 

Changelog:

0.8.6-SNAPSHOT

  • removed some console logs
  • added yellow color to console logs for directory

0.8.5-SNAPSHOT

  • removed extensions support

0.8.3-SNAPSHOT

  • stable release of uglify directory script

0.8.2-SNAPSHOT

  • bugfixes

0.8.1-SNAPSHOT

  • bugfixes

0.8.0-SNAPSHOT

  • test resease

 

Update dependencies

Back to table of contents

 

Description:

This script updates dependencies to the @latest version by default, but that can be changed with parameters.

 

Configuration:

Add script to package.json:

{
  "scripts": {
    "update": "update-dependencies@createdbyjurand --all"
  }
}

 

Parameters:

| Parameter | Required | | ---------------------------------------------------------------- | -------- | | --all | no | | --deps | no | | --dev-deps | no | | --except=[DEPENDENCY_NAMES_SEPARATED_BY_COMMA] | no | | --legacy-peer-deps | no | | --overwrite=[DEPENDENCY_NAMES_WITH_VERSION_SEPARATED_BY_COMMA] | no | | --path=[PATH_TO_package.json_DIRECTORY] | no | | --remove-prefixes | no |

 

--all

Update all dependencies and devDependencies to the @latest version.

 

--deps

Update all dependencies to the @latest version.

 

--dev-deps

Update all devDependencies to the @latest version.

 

--except=[DEPENDENCY_NAMES_SEPARATED_BY_COMMA]

Exclude dependencies.

 

--legacy-peer-deps

Add --legacy-peer-deps argument to installation.

 

--overwrite=[DEPENDENCY_NAMES_WITH_VERSION_SEPARATED_BY_COMMA]

Overwrite dependencies with the specified version.

 

--path=[PATH_TO_package.json_DIRECTORY]

Set path to package.json if the script is run elsewhere.

 

--remove-prefixes

Remove prefixes from dependency versions in package.json file.

 

Examples:

package.json scripts:

{
  "scripts": {
    "update": "update-dependencies@createdbyjurand --all"
  }
}
{
  "scripts": {
    "update": "update-dependencies@createdbyjurand --all --overwrite=typescript@^4 --remove-prefixes"
  }
}
{
  "scripts": {"update": "update-dependencies@createdbyjurand --deps --overwrite=typescript@^4.0"}
}
{
  "scripts": {
    "update": "update-dependencies@createdbyjurand --dev-deps --except=rimraf,dotenv --overwrite=typescript@^4,rimraf@1 --remove-prefixes"
  }
}
{
  "scripts": {"update": "update-dependencies@createdbyjurand --path=frontend --all"}
}
{
  "scripts": {
    "update": "update-dependencies@createdbyjurand --all --legacy-peer-deps"
  }
}

 

Changelog:

0.11.0-SNAPSHOT

  • stable release of update dependencies script

 

Update release version number

Back to table of contents

 

Changelog:

0.12.0-SNAPSHOT

  • beta release of update release version number script