@createdbyjurand/node-scripts v1.7.1-SNAPSHOT
@createdbyjurand/node-scripts
Table of contents
Description
Node scripts with amazing beautiful colorful logging :)
Installation
npm i -D @createdbyjurand/node-scripts
i
is alias ofinstall
-D
is alias of--save-dev
Scripts
Rebuild modules
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
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
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
Changelog:
0.12.0-SNAPSHOT
- beta release of update release version number script
7 days ago
7 days ago
7 days ago
11 days ago
11 days ago
13 days ago
13 days ago
13 days ago
11 months ago
11 months ago
12 months ago
12 months ago
12 months ago
12 months ago
11 months ago
12 months ago
11 months ago
12 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
3 years ago
3 years ago
3 years ago