1.7.1-SNAPSHOT • Published 7 days ago

@createdbyjurand/node-scripts v1.7.1-SNAPSHOT

Weekly downloads
-
License
ISC
Repository
-
Last release
7 days ago

@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:

ParameterRequiredDefault valueAvailable options
--path=[PATH_TO_MODULES_DIRECTORY]yes
--no-rootno
--extension=[INDEX_FILE_EXTENSION]notsjs 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:

ParameterRequired
--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:

ParameterRequired
--allno
--depsno
--dev-depsno
--except=[DEPENDENCY_NAMES_SEPARATED_BY_COMMA]no
--legacy-peer-depsno
--overwrite=[DEPENDENCY_NAMES_WITH_VERSION_SEPARATED_BY_COMMA]no
--path=[PATH_TO_package.json_DIRECTORY]no
--remove-prefixesno

 

--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
1.7.1-SNAPSHOT

7 days ago

1.6.0-SNAPSHOT

7 days ago

1.7.0-SNAPSHOT

7 days ago

1.5.0-SNAPSHOT

11 days ago

1.4.0-SNAPSHOT

11 days ago

1.1.0-SNAPSHOT

13 days ago

1.2.0-SNAPSHOT

13 days ago

1.3.0-SNAPSHOT

13 days ago

1.0.0-SNAPSHOT

11 months ago

0.11.2-SNAPSHOT

11 months ago

0.10.4-SNAPSHOT

12 months ago

0.10.1-SNAPSHOT

12 months ago

0.9.0-SNAPSHOT

12 months ago

0.10.5-SNAPSHOT

12 months ago

0.11.3-SNAPSHOT

11 months ago

0.10.0-SNAPSHOT

12 months ago

0.11.1-SNAPSHOT

11 months ago

0.9.1-SNAPSHOT

12 months ago

0.10.3-SNAPSHOT

12 months ago

0.11.0-SNAPSHOT

12 months ago

0.10.2-SNAPSHOT

12 months ago

0.8.12-SNAPSHOT

1 year ago

0.8.10-SNAPSHOT

1 year ago

0.8.0-SNAPSHOT

1 year ago

0.8.2-SNAPSHOT

1 year ago

0.8.8-SNAPSHOT

1 year ago

0.8.5-SNAPSHOT

1 year ago

0.8.9-SNAPSHOT

1 year ago

0.8.4-SNAPSHOT

1 year ago

0.8.1-SNAPSHOT

1 year ago

0.8.6-SNAPSHOT

1 year ago

0.8.11-SNAPSHOT

1 year ago

0.8.3-SNAPSHOT

1 year ago

0.8.7-SNAPSHOT

1 year ago

0.7.3-SNAPSHOT

1 year ago

0.7.2-SNAPSHOT

1 year ago

0.7.1-SNAPSHOT

1 year ago

0.7.0-SNAPSHOT

1 year ago

0.6.1-SNAPSHOT

1 year ago

0.6.0-SNAPSHOT

1 year ago

0.5.2-SNAPSHOT

1 year ago

0.5.0-SNAPSHOT

1 year ago

0.4.0-SNAPSHOT

1 year ago

0.5.1-SNAPSHOT

1 year ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago