Skip to content

Commit

Permalink
chore: Regular updates for scripts and devDependencies (#11)
Browse files Browse the repository at this point in the history
* Regular dependency updates

* Sync with general project standards
  • Loading branch information
spautz committed Jun 18, 2021
1 parent 981e441 commit 141f846
Show file tree
Hide file tree
Showing 14 changed files with 1,186 additions and 1,010 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
benchmark/
build/
coverage/
dist/
legacy-types/
lib-dist/
node_modules/
storybook-static/

benchmark/
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 10.x, 12.x, 14.x, 15.x ]
node-version: [ 10.x, 12.x, 14.x, 16.x ]

steps:
- uses: actions/checkout@v2
Expand All @@ -31,7 +31,7 @@ jobs:
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
run: yarn install --prefer-offline
run: yarn install --ignore-scripts --prefer-offline

- name: Clear local caches
run: yarn clean
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
*.log*
.DS_Store

.idea/
.vscode/

build/
coverage/
dist/
legacy-types/
coverage/
lib-dist/
node_modules/
storybook-static/
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.15.4
16.2.0
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ The original `state` is not modified.
## Notes

- If you're using [lodash](https://lodash.com) then you don't need this: [see this thread for alternatives](https://github.com/lodash/lodash/issues/1696#issuecomment-328335502).
- Unlike most other setter utilities, this is faster if you use a string for the path, instead of an array.
(E.g.. `set(obj, "deep.path[123]", newVal)` instead of `set(obj, ["deep", "path", 123], newVal)`)
- Unlike most other setter utilities, this is slightly faster if you use a string for the path, instead of an array: `set(obj, "deep.path[123]", newVal)` instead of `set(obj, ["deep", "path", 123], newVal)`.
- The small bundle size of this library comes with a slight speed tradeoff. This library is a little slower than
immutable-assign and immutable.js, but a little faster than Immer and seamless-immutable.
[See full benchmark here.](./benchmark)
35 changes: 14 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,19 @@
},
"scripts": {
"____ LIFECYCLE HOOKS _______________________________________________": "",
"prepare": "yon run build",
"prebuild": "yon run build:clean",
"prepare": "yon run build && husky install",
"prerelease": "yon run build:clean",
"prepublishOnly": "yarn run dev:readonly && yarn run build && yarn run pinst --disable",
"pretest": "yon run test:clean",
"postbuild": "yon run build:types",
"postinstall": "husky install",
"postpublish": "pinst --enable",
"prepublishOnly": "yarn run dev:readonly && yarn run build",
"____ INTEGRATION ___________________________________________________": "",
"clean": "yon run build:clean && yon run test:clean && rimraf ./node_modules/.cache",
"clean": "yon run build:clean && yon run test:clean && rimraf ./node_modules/.cache/",
"dev": "yon run format && yon run types && yon run lint",
"dev:readonly": "yon run format:verify && yon run types && yon run lint",
"all": "yon run clean && yon run dev && yon run test:coverage && yon run build",
"all:readonly": "yon run clean && yon run dev:readonly && yon run test:coverage",
"ci": "yon run clean && yon run dev:readonly && yon run test:report",
"all:readonly": "yon run dev:readonly && yon run test:coverage",
"____ INDIVIDUAL COMMANDS ___________________________________________": "",
"build": "tsdx build",
"build": "yon run build:clean && yon run build:main && yon run build:types",
"build:clean": "rimraf ./dist ./legacy-types",
"build:main": "tsdx build",
"build:types": "yon run build:types:3.x && yon run build:types:4.x",
"build:types:3.x": "downlevel-dts ./dist ./legacy-types/ts3.x/dist --to=3.0",
"build:types:4.x": "downlevel-dts ./dist ./dist --to=4.0",
Expand All @@ -68,25 +63,23 @@
"release:tag": "standard-version --commit-all --sign --skip.changelog --release-as ",
"test": "yon run test:coverage",
"test:clean": "rimraf ./coverage",
"test:coverage": "tsdx test --coverage",
"test:nowatch": "tsdx test",
"test:watch": "tsdx test --watch",
"test:watchcoverage": "tsdx test --watchAll --coverage",
"test:coverage": "yon run test:clean && tsdx test --coverage",
"test:nowatch": "yon run test:clean && tsdx test",
"test:watch": "yon run test:clean && tsdx test --watch",
"test:watchcoverage": "yon run test:clean && tsdx test --watchAll --coverage",
"types": "tsc --noEmit --p tsconfig.json"
},
"dependencies": {},
"devDependencies": {
"@ngard/tiny-get": "1.2.2",
"@types/jest": "26.0.20",
"@types/node": "14.14.31",
"@types/jest": "26.0.23",
"@types/node": "15.12.3",
"downlevel-dts": "0.7.0",
"husky": "5.1.1",
"husky": "6.0.0",
"lint-staged": "10.5.4",
"pinst": "2.1.6",
"rimraf": "3.0.2",
"standard-version": "9.1.1",
"standard-version": "9.3.0",
"tsdx": "0.14.1",
"tslib": "2.1.0",
"typescript": "4.2.2",
"yarn-or-npm": "3.0.1"
},
Expand Down
10 changes: 7 additions & 3 deletions scripts/build-everything.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e
# This script runs from the project root
cd "$(dirname "$0")/.."

source scripts/helpers.sh
source ./scripts/helpers/helpers.sh

###################################################################################################
# Setup
Expand All @@ -15,8 +15,12 @@ run_command "./scripts/check-environment.sh"
run_command "yarn install"

###################################################################################################
# Run all read-write scripts and read-only scripts. This is overkill and duplicates some work, but
# also helps catch intermittent errors. Suitable for running before lunch or teatime.
# Run all read-write scripts and read-only scripts. This is overkill and duplicates a lot of work,
# but also helps catch intermittent errors. Suitable for running before lunch or teatime.

run_command "yarn all"
run_command "yarn all:readonly"

###################################################################################################

echo "All builds completed"
4 changes: 2 additions & 2 deletions scripts/check-environment.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e
# This script runs from the project root
cd "$(dirname "$0")/.."

source scripts/helpers.sh
source ./scripts/helpers/helpers.sh

###################################################################################################
# Check versions of Node, Yarn, and any other tools required
Expand All @@ -32,4 +32,4 @@ fi

###################################################################################################

echo "All environment checks passed!"
echo "Environment checks completed"
29 changes: 26 additions & 3 deletions scripts/clean-everything.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e
# This script runs from the project root
cd "$(dirname "$0")/.."

source scripts/helpers.sh
source ./scripts/helpers/helpers.sh

###################################################################################################
# Halt running processes and local servers
Expand All @@ -22,10 +22,18 @@ fi
##################################################################################################
# Clear caches

run_npm_command jest --clearCache --config={}
if [ -d "./node_modules/" ]; then
run_command yarn clean
run_npm_command jest --clearCache
else
run_npm_command jest --clearCache --config={}
fi

if command_exists yarn; then
run_command yarn cache clean
fi

run_command npm cache clean --force
run_command yarn cache clean

if command_exists watchman; then
run_command watchman watch-del-all
Expand All @@ -40,10 +48,25 @@ run_command "rm -rf

run_command "rm -rf
.yarn
build/
coverage/
dist/
legacy-types/
lib-dist/
node_modules/
storybook-static/
lerna-debug.log*
npm-debug.log*
yarn-debug.log*
yarn-error.log*
"

REMAINING_FILES=$(git clean -xdn)
if [[ $REMAINING_FILES ]]; then
echo "Ignored files left:"
echo "$REMAINING_FILES"
fi;

###################################################################################################

echo "Environment reset completed"
32 changes: 25 additions & 7 deletions scripts/full-ci.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,33 @@ set -e
# This script runs from the project root
cd "$(dirname "$0")/.."

source scripts/helpers.sh
source ./scripts/helpers/helpers.sh

###################################################################################################
# Setup: Node should already have been set up in the environment init

run_command "./scripts/check-environment.sh"
run_command "yarn install --frozen-lockfile"
if [[ $* == *--local* ]]; then

if command_exists act; then
# act = https://github.com/nektos/act
act
else
echo "Could not find act"
exit 1
fi

# @TODO: Detect actions-runner/Runner.Client
# https://github.com/ChristopherHX/runner.server

else
# This is a manually-synced copy of what's in .github/worksflows/ci.yml

run_command "./scripts/check-environment.sh"
run_command "yarn install --ignore-scripts --prefer-offline"
run_command "yarn clean"
run_command "yarn all:readonly"
run_command "yarn build"

fi

###################################################################################################
# Run whatever the script in package.json wants to run

run_command "yarn ci"
echo "Local CI completed"
21 changes: 21 additions & 0 deletions scripts/full-everything.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

# Fail if anything in here fails
set -e

# This script runs from the project root
cd "$(dirname "$0")/.."

source ./scripts/helpers/helpers.sh

###################################################################################################

echo "Going to doing everything: this will take a while..."
source ./scripts/setup-environment.sh
./scripts/clean-everything.sh
./scripts/full-ci.sh
./scripts/build-everything.sh

###################################################################################################

echo "Done doing everything"
File renamed without changes.
38 changes: 38 additions & 0 deletions scripts/setup-environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

# Fail if anything in here fails
set -e

# This script runs from the project root
cd "$(dirname "$0")/.."

source ./scripts/helpers/helpers.sh

###################################################################################################
# NVM and Node

# on Windows `nvm` will be a real command; on other environments -- with "real" nvm -- it's just a function
if ! command_exists nvm; then
NVM_INIT="$HOME/.nvm/nvm.sh"
if [ -f $NVM_INIT ]; then
source $NVM_INIT
else
echo "Could not find nvm!"
fi
fi

# Must include .nvmrc content manually to support all platforms
run_command "nvm install $(cat .nvmrc)"
run_command "nvm use $(cat .nvmrc)"

if ! command_exists yarn; then
echo "Could not find yarn!"
fi

run_command "./scripts/check-environment.sh"
run_command "yarn install --frozen-lockfile --prefer-offline --network-timeout=60000"
run_command "yarn clean"

###################################################################################################

echo "Environment setup complete"
Loading

0 comments on commit 141f846

Please sign in to comment.