Skip to content

Commit

Permalink
🔀 #2473 from LSS-Manager/dev
Browse files Browse the repository at this point in the history
🔀🔖 4.7.7
  • Loading branch information
jxn-30 authored Jul 10, 2023
2 parents 8795b84 + 747a61b commit f0fe32d
Show file tree
Hide file tree
Showing 249 changed files with 2,440 additions and 1,667 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ jobs:
corepack enable
yarn set version "${{ env.YARN_VERSION }}"
- name: '[🔗] symlink yarn executable'
id: yarn_symlink
run: |
ln -sf "$(find ./.yarn/releases/ -name 'yarn-*.cjs')" ./yarn
- name: '[ℹ] print versions (node, yarn, git)'
id: versions
run: |
Expand Down
6 changes: 6 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn="$(find ./.yarn/releases/ -name 'yarn-*.cjs')"
echo "$yarn"
"$yarn" pre-commit
449 changes: 225 additions & 224 deletions .yarn/releases/yarn-3.5.1.cjs → .yarn/releases/yarn-3.6.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
nmHoistingLimits: workspaces
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-3.5.1.cjs
yarnPath: .yarn/releases/yarn-3.6.1.cjs
defaultSemverRangePrefix: ''
131 changes: 79 additions & 52 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
# exit script when any command fails
set -e

# Use tput for enhanced styling only if terminal type is set and a tty.
# ESC is directly included in the string to avoid the -e flag on echo calls.
if [[ -z "$TERM" ]] || [[ ! -t 1 ]]; then
normal=""
bold=""
blue=""
green=""
else
normal=$(tput -T "$TERM" sgr0)
bold=$(tput -T "$TERM" bold)
blue=$(tput -T "$TERM" setaf 4)
green=$(tput -T "$TERM" setaf 2)
fi

enable_debugging () {
if [[ $DEBUG = true ]]; then
set -x
Expand All @@ -22,10 +36,25 @@ now () {
echo "${timestamp/N/000000000}"
}

ms_elapsed() {
local timestamp_now
timestamp_now=$(now)
echo $(((10#$timestamp_now - 10#$1) / 1000000))ms
}

print_start_message() {
echo "${bold}${blue}### $1 ###${normal}"
}

print_end_message() {
echo "${bold}${green}=== $1: $(ms_elapsed "$2") [$(date +"%Y-%m-%d %H:%M:%S %Z")] ===${normal}"
}


# default values of variables set from params
_RUN_STEP_NODE=false
_RUN_STEP_YARN_SETUP=false
_RUN_STEP_YARN_SYMLINK=false
_RUN_STEP_VERSIONS=false
_RUN_STEP_YARN_INSTALL=false
_RUN_STEP_BROWSERSLIST=false
Expand All @@ -47,6 +76,7 @@ while :; do
case "${1-}" in
--node) _RUN_STEP_NODE=true ;;
--yarn_setup) _RUN_STEP_YARN_SETUP=true ;;
--yarn_symlink) _RUN_STEP_YARN_SYMLINK=true ;;
--versions) _RUN_STEP_VERSIONS=true ;;
--yarn_install) _RUN_STEP_YARN_INSTALL=true ;;
--browserslist) _RUN_STEP_BROWSERSLIST=true ;;
Expand All @@ -72,9 +102,14 @@ while :; do
_RUN_STEP_ESLINT=true
_RUN_STEP_TSC=true
_RUN_STEP_WEBPACK=true ;;
--pre-commit)
_RUN_STEP_FORMAT=true
_RUN_STEP_ESLINT=true
_RUN_STEP_TSC=true ;;
--full)
_RUN_STEP_NODE=true
_RUN_STEP_YARN_SETUP=true
_RUN_STEP_YARN_SYMLINK=true
_RUN_STEP_VERSIONS=true
_RUN_STEP_YARN_INSTALL=true
_RUN_STEP_BROWSERSLIST=true
Expand All @@ -99,7 +134,7 @@ while :; do
shift
done

total_start_time=$(date +%s%N)
total_start_time=$(now)

NODE_VERSION=$(grep '"node":' ./package.json | awk -F: '{ print $2 }' | sed 's/[",]//g' | sed 's/\^v//g' | tr -d '[:space:]')
YARN_VERSION=$(grep '"packageManager":' ./package.json | awk -F: '{ print $2 }' | sed 's/[",]//g' | sed 's/yarn@//g' | tr -d '[:space:]')
Expand All @@ -122,7 +157,7 @@ fi
# [⬆️] Setup Node.js
if [[ $_RUN_STEP_NODE = true ]]; then
start_time=$(now)
echo "### [⬆️] Setup Node.js ###"
print_start_message "[⬆️] Setup Node.js"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
if [[ -n "${NVM_DIR-}" ]]; then
NVM_DIR="$NVM_DIR"
Expand All @@ -133,59 +168,64 @@ if [[ $_RUN_STEP_NODE = true ]]; then
fi
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install "$NODE_VERSION"
end_time=$(now)
echo "=== [⬆️] Setup Node.js: $(((10#$end_time - 10#$start_time) / 1000000))ms ==="
print_end_message "[⬆️] Setup Node.js" "$start_time"
fi

# [⬆] setup yarn
if [[ $_RUN_STEP_YARN_SETUP = true ]]; then
start_time=$(now)
echo "### [⬆] setup yarn ###"
print_start_message "[⬆] setup yarn"
enable_debugging
corepack enable
yarn set version "$YARN_VERSION"
disable_debugging
end_time=$(now)
echo "=== [⬆] setup yarn: $(((10#$end_time - 10#$start_time) / 1000000))ms ==="
print_end_message "[⬆] setup yarn" "$start_time"
fi

# [🔗] symlink yarn executable
if [[ $_RUN_STEP_YARN_SYMLINK = true ]]; then
start_time=$(now)
print_start_message "[🔗] symlink yarn executable"
enable_debugging
ln -sf "$(find ./.yarn/releases/ -name 'yarn-*.cjs')" ./yarn
disable_debugging
print_end_message "[🔗] symlink yarn executable" "$start_time"
fi

# [ℹ] print versions (node, yarn, git)
if [[ $_RUN_STEP_VERSIONS = true ]]; then
start_time=$(now)
echo "### [ℹ] print versions (node, yarn, git) ###"
print_start_message "[ℹ] print versions (node, yarn, git)"
enable_debugging
echo "node: $(node -v) – yarn: $(yarn -v) – git: $(git --version)"
disable_debugging
end_time=$(now)
echo "=== [ℹ] print versions (node, yarn, git): $(((10#$end_time - 10#$start_time) / 1000000))ms ==="
print_end_message "[ℹ] print versions (node, yarn, git)" "$start_time"
fi

# [🍱] yarn install
if [[ $_RUN_STEP_YARN_INSTALL = true ]]; then
start_time=$(now)
echo "### [🍱] yarn install ###"
print_start_message "[🍱] yarn install"
enable_debugging
yarn install --immutable
disable_debugging
end_time=$(now)
echo "=== [🍱] yarn install: $(((10#$end_time - 10#$start_time) / 1000000))ms ==="
print_end_message "[🍱] yarn install" "$start_time"
fi

# [⬆] update browserslist
if [[ $_RUN_STEP_BROWSERSLIST = true ]]; then
start_time=$(now)
echo "### [⬆] update browserslist ###"
print_start_message "[⬆] update browserslist"
enable_debugging
npx -y browserslist@latest --update-db
disable_debugging
end_time=$(now)
echo "=== [⬆] update browserslist: $(((10#$end_time - 10#$start_time) / 1000000))ms ==="
print_end_message "[⬆] update browserslist" "$start_time"
fi

# [🌳] set env variables
if [[ $_RUN_STEP_ENV = true ]]; then
start_time=$(now)
echo "### [🌳] set env variables ###"
print_start_message "[🌳] set env variables"
enable_debugging
ref="$REF"
BRANCH="dummy"
Expand All @@ -203,36 +243,33 @@ if [[ $_RUN_STEP_ENV = true ]]; then
BRANCH="${BRANCH//"/"/"-"}"
fi
disable_debugging
end_time=$(now)
echo "=== [🌳] set env variables: $(((10#$end_time - 10#$start_time) / 1000000))ms ==="
print_end_message "[🌳] set env variables" "$start_time"
fi

# [⬆] update emojis
if [[ $_RUN_STEP_UPDATE_EMOJIS = true ]]; then
start_time=$(now)
echo "### [⬆] update emojis ###"
print_start_message "[⬆] update emojis"
enable_debugging
yarn ts-node scripts/utils/fetchEmojis.ts
disable_debugging
end_time=$(now)
echo "=== [⬆] update emojis: $(((10#$end_time - 10#$start_time) / 1000000))ms ==="
print_end_message "[⬆] update emojis" "$start_time"
fi

# [🎨] format files not covered by ESLint
if [[ $_RUN_STEP_FORMAT = true ]]; then
start_time=$(now)
echo "### [🎨] format files not covered by ESLint ###"
print_start_message "[🎨] format files not covered by ESLint"
enable_debugging
yarn ts-node scripts/format.ts || exit 1
disable_debugging
end_time=$(now)
echo "=== [🎨] format files not covered by ESLint: $(((10#$end_time - 10#$start_time) / 1000000))ms ==="
print_end_message "[🎨] format files not covered by ESLint" "$start_time"
fi

# [🚨] run ESLint
if [[ $_RUN_STEP_ESLINT = true ]]; then
start_time=$(now)
echo "### [🚨] run ESLint ###"
print_start_message "[🚨] run ESLint"
enable_debugging
yarn eslint \
./docs/.vuepress/ \
Expand All @@ -250,92 +287,82 @@ if [[ $_RUN_STEP_ESLINT = true ]]; then
--fix \
|| exit 1
disable_debugging
end_time=$(now)
echo "=== [🚨] run ESLint: $(((10#$end_time - 10#$start_time) / 1000000))ms ==="
print_end_message "[🚨] run ESLint" "$start_time"
fi

# [🚨] check TypeScript
if [[ $_RUN_STEP_TSC = true ]]; then
start_time=$(now)
echo "### [🚨] check TypeScript ###"
print_start_message "[🚨] check TypeScript"
enable_debugging
yarn tsc -b --pretty "./" || exit 1
disable_debugging
end_time=$(now)
echo "=== [🚨] check TypeScript: $(((10#$end_time - 10#$start_time) / 1000000))ms ==="
print_end_message "[🚨] check TypeScript" "$start_time"
fi

# [📜] build userscript
if [[ $_RUN_STEP_USERSCRIPT = true ]]; then
start_time=$(now)
echo "### [📜] build userscript ###"
print_start_message "[📜] build userscript"
enable_debugging
yarn tsc --pretty --project "src/tsconfig.userscript.json" || exit 1
disable_debugging
end_time=$(now)
echo "=== [📜] build userscript: $(((10#$end_time - 10#$start_time) / 1000000))ms ==="
print_end_message "[📜] build userscript" "$start_time"
fi

# [📜] build buildscript
if [[ $_RUN_STEP_BUILDSCRIPT = true ]]; then
start_time=$(now)
echo "### [📜] build buildscript ###"
print_start_message "[📜] build buildscript"
enable_debugging
yarn ts-node scripts/createBuildScript.ts || exit 1
disable_debugging
end_time=$(now)
echo "=== [📜] build buildscript: $(((10#$end_time - 10#$start_time) / 1000000))ms ==="
print_end_message "[📜] build buildscript" "$start_time"
fi

# [🚧] run prebuild
if [[ $_RUN_STEP_PREBUILD = true ]]; then
start_time=$(now)
echo "### [🚧] run prebuild ###"
print_start_message "[🚧] run prebuild"
enable_debugging
yarn ts-node prebuild/index.ts "$MODE" "$BRANCH" "🦄 branch label" || exit 1
disable_debugging
end_time=$(now)
echo "=== [🚧] run prebuild: $(((10#$end_time - 10#$start_time) / 1000000))ms ==="
print_end_message "[🚧] run prebuild" "$start_time"
fi

# [👷] webpack
if [[ $_RUN_STEP_WEBPACK = true ]]; then
start_time=$(now)
echo "### [👷] webpack ###"
print_start_message "[👷] webpack"
enable_debugging
yarn ts-node build/index.ts --esModuleInterop "$MODE" "$BRANCH" "🦄 branch label" || exit 1
disable_debugging
end_time=$(now)
echo "=== [👷] webpack: $(((10#$end_time - 10#$start_time) / 1000000))ms ==="
print_end_message "[👷] webpack" "$start_time"
fi

# [📝] build docs
if [[ $_RUN_STEP_DOCS = true ]]; then
start_time=$(now)
echo "### [📝] build docs ###"
print_start_message "[📝] build docs"
enable_debugging
"$(yarn workspace lss-manager-v4-docs bin vuepress)" build docs || exit 1
mkdir -p ./dist/docs
rm -rdf ./dist/docs/*
cp -r ./docs/.vuepress/dist/* ./dist/docs
disable_debugging
end_time=$(now)
echo "=== [📝] build docs: $(((10#$end_time - 10#$start_time) / 1000000))ms ==="
print_end_message "[📝] build docs" "$start_time"
fi

# [ℹ️] git diff
if [[ $_RUN_STEP_GIT_DIFF = true ]] && [[ $GIT_REPO = true ]]; then
start_time=$(now)
echo "### [ℹ️] git diff ###"
print_start_message "[ℹ️] git diff"
enable_debugging
git --no-pager diff --color-words
disable_debugging
end_time=$(now)
echo "=== [ℹ️] git diff: $(((10#$end_time - 10#$start_time) / 1000000))ms ==="
print_end_message "[ℹ️] git diff" "$start_time"
fi

total_end_time=$(date +%s%N)

echo "=== Total: $(((10#$total_end_time - 10#$total_start_time) / 1000000))ms ==="
print_end_message "Total" "$total_start_time"

exit 0
18 changes: 9 additions & 9 deletions docs/.vuepress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
"name": "lss-manager-v4-docs",
"license": "CC-BY-NC-SA-4.0",
"dependencies": {
"@primer/octicons": "19.2.0",
"@vuepress/client": "2.0.0-beta.63",
"@vuepress/plugin-pwa": "2.0.0-beta.63",
"@vuepress/plugin-pwa-popup": "2.0.0-beta.63",
"@vuepress/plugin-register-components": "2.0.0-beta.63",
"@vuepress/plugin-search": "2.0.0-beta.63",
"@primer/octicons": "19.4.0",
"@vuepress/client": "2.0.0-beta.64",
"@vuepress/plugin-pwa": "2.0.0-beta.64",
"@vuepress/plugin-pwa-popup": "2.0.0-beta.64",
"@vuepress/plugin-register-components": "2.0.0-beta.64",
"@vuepress/plugin-search": "2.0.0-beta.64",
"cloc": "2.11.0",
"moment": "2.29.4",
"showdown": "2.1.0",
"simple-git": "3.19.0",
"simple-git": "3.19.1",
"vue": "3.3.4",
"vuepress": "2.0.0-beta.63",
"vuepress": "2.0.0-beta.64",
"vuepress-plugin-clipboard": "2.1.5",
"vuepress-plugin-sitemap2": "2.0.0-beta.225"
"vuepress-plugin-sitemap2": "2.0.0-beta.230"
}
}
1 change: 1 addition & 0 deletions docs/.vuepress/utils/addCommonLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const commonLinks = {
'lssm.donations': config.urls.donations,
// Docs
'docs': config.urls.docs,
'docs.home': (lang: Locale) => `/${lang}/`,
'docs.apps': (lang: Locale) => `/${lang}/apps.md`,
'docs.appstore': (lang: Locale) => `/${lang}/appstore.md`,
'docs.bugs': (lang: Locale) => `/${lang}/bugs.md`,
Expand Down
1 change: 1 addition & 0 deletions docs/cs_CZ/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Pokud máte jakékoli problémy, neváhejte kontaktovat [Podporu][docs.support].
[lssm.userscript]: https://v4.lss-manager.de/lssm-v4.user.js
[lssm.donations]: https://donate.lss-manager.de/
[docs]: https://docs.lss-manager.de/
[docs.home]: /cs_CZ/
[docs.apps]: /cs_CZ/apps.md
[docs.appstore]: /cs_CZ/appstore.md
[docs.bugs]: /cs_CZ/bugs.md
Expand Down
1 change: 1 addition & 0 deletions docs/cs_CZ/apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ These Modules are new in V4.
[lssm.userscript]: https://v4.lss-manager.de/lssm-v4.user.js
[lssm.donations]: https://donate.lss-manager.de/
[docs]: https://docs.lss-manager.de/
[docs.home]: /cs_CZ/
[docs.apps]: /cs_CZ/apps.md
[docs.appstore]: /cs_CZ/appstore.md
[docs.bugs]: /cs_CZ/bugs.md
Expand Down
Loading

0 comments on commit f0fe32d

Please sign in to comment.