Skip to content

Commit

Permalink
🔧 move scripts to bash run strategy
Browse files Browse the repository at this point in the history
closes #9
  • Loading branch information
VitorLuizC committed Sep 18, 2024
1 parent d3bf748 commit 7d066c8
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 9 deletions.
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 20.17.0
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

### NumberParseable

Ƭ **NumberParseable**: `number` \| `string` \| `boolean` & { `isNumberParseble`: unique `symbol` }
Ƭ **NumberParseable**: `number` \| `string` \| `boolean` & \{ `isNumberParseble`: unique `symbol` }

A Branded Type for values parseable to number.

#### Defined in

[index.ts:4](https://github.com/VitorLuizC/typescript-library-boilerplate/blob/c48c9c1/src/index.ts#L4)
[index.ts:4](https://github.com/VitorLuizC/typescript-library-boilerplate/blob/d3bf74861b541a3d38c99355f79a0fde1127a9f7/src/index.ts#L4)

## Functions

Expand Down Expand Up @@ -58,4 +58,4 @@ return Number(value);

#### Defined in

[index.ts:24](https://github.com/VitorLuizC/typescript-library-boilerplate/blob/c48c9c1/src/index.ts#L24)
[index.ts:24](https://github.com/VitorLuizC/typescript-library-boilerplate/blob/d3bf74861b541a3d38c99355f79a0fde1127a9f7/src/index.ts#L24)
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,8 @@
"typescript": "^5.2.2"
},
"scripts": {
"doc": "typedoc src/index.ts",
"test": "jest",
"lint": "eslint \"*/**/*.{ts,js,json}\"",
"lint:fix": "eslint \"*/**/*.{ts,js,json}\" --fix",
"build": "rollup --config ./rollup.config.mjs",
"prepublishOnly": "npm run doc && npm run lint && npm run test && npm run build"
"test": "bash run test",
"prepublishOnly": "bash run prepublish-only"
},
"repository": {
"type": "git",
Expand Down
85 changes: 85 additions & 0 deletions run
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/bin/bash

set -o errexit

if [ -d "./node_modules/.bin" ]; then
export PATH="./node_modules/.bin:$PATH"
fi

function setup() {
echo -e "🔄 updating asdf…\n"
asdf update

echo -e ""
echo -e "🔄 updating asdf's plugins…\n"
asdf plugin update nodejs

echo -e ""
echo -e "⬇️ installing asdf's packages…\n"
asdf install

echo -e ""
echo -e "🔄 updating npm…\n"
npm up npm --global

echo -e ""
echo -e "⬇️ installing packages with npm…\n"
npm ci
}

function cleanup() {
echo -e "🗑️ deleting './node_modules' folder…\n"
rm -rf ./node_modules

echo -e ""
echo -e "🗑️ deleting './package-lock.json' file…\n"
rm ./package-lock.json

echo -e ""
echo -e "⬇️ installing packages with npm…\n"
npm install
}

function doc() {
echo -e "🤖 generating documentation with Typedoc…\n"
typedoc "./src/index.ts"
}

function test() {
echo -e "🧪 executing unit tests with Jest…\n"
jest
}

function lint() {
echo -e "🕵 linting source code with ESLint…\n"
eslint "*/**/*.{ts,js,json}"
}

function autofix() {
echo -e "👨‍🔧 automatically fixing source code with ESLint…\n"
eslint "*/**/*.{ts,js,json}" --fix
}

function bundle() {
echo -e "📦 bundling source code with Rollup…\n"
rollup --config ./rollup.config.mjs
}

function prepublish-only() {
echo -e "▶ executing 'doc' command…\n"
bash run doc

echo ""
echo -e "▶ executing 'lint' command…\n"
bash run lint

echo ""
echo -e "▶ executing 'test' command…\n"
bash run test

echo ""
echo -e "▶ executing 'bundle' command…\n"
bash run bundle
}

eval "$@"

0 comments on commit 7d066c8

Please sign in to comment.