-
-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update dependencies and add npm setup script
- Introduce `fresh-npm-install.sh` to automate clean npm environment setup. - Revert workaround 924b326, resolved by updating Font Awesome. - Remove `vue-template-compiler` and `@vue/test-utils` from dependencies, they're obsolete in 2.7. - Update anchor references to start with lower case in line with MD051/link-fragments, introduced by updated `markdownlint`. - Upgrade cypress to > 10, which includes: - Change spec extensions from `*.spec.js` to `*.cy.js`. - Change configuration file from `cypress.json` to `cypress.config.ts`. - Remove most configurations from `cypress/plugins/index.js`. These configurations were initially generated by Vue CLI but obsoleted in newer cypress versions. - Lock Typescript version to 4.6.x due to lack of support in unmaintained Vue CLI TypeScript plugin (see vuejs/vue-cli#7401). - Use `setWindowOpenHandler` on Electron, replacing deprecated `new-event` event. - Document inability to upgrade `typescript-eslint` dependencies because `@vue/eslint-config-typescript` does not support them. See vuejs/eslint-config-typescript#60, vuejs/eslint-config-typescript#59, vuejs/eslint-config-typescript#57. - Fix `typescript` version to 4.6.X and `tslib` version to 2.4.x, unit tests exit with a maximum call stack size exceeded error: ``` ... MOCHA Testing... RUNTIME EXCEPTION Exception occurred while loading your tests [=========================] 100% (completed) RangeError: Maximum call stack size exceeded at RegExp.exec (<anonymous>) at retrieveSourceMapURL (/project/node_modules/source-map-support/source-map-support.js:174:21) at Array.<anonymous> (/project/node_modules/source-map-support/source-map-support.js:186:26) at /project/node_modules/source-map-support/source-map-support.js:85:24 at mapSourcePosition (/project/node_modules/source-map-support/source-map-support.js:216:21) ... ``` Issue has been reported but not fixed, suggested solutions did not work, see evanw/node-source-map-support#252.
- Loading branch information
1 parent
8b374a3
commit f35ccce
Showing
12 changed files
with
5,793 additions
and
3,899 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { defineConfig } from 'cypress' | ||
|
||
export default defineConfig({ | ||
fixturesFolder: 'tests/e2e/fixtures', | ||
screenshotsFolder: 'tests/e2e/screenshots', | ||
videosFolder: 'tests/e2e/videos', | ||
e2e: { | ||
setupNodeEvents(on, config) { | ||
return require('./tests/e2e/plugins/index.js')(on, config) | ||
}, | ||
specPattern: 'tests/e2e/specs/**/*.cy.{js,jsx,ts,tsx}', | ||
supportFile: 'tests/e2e/support/index.js', | ||
}, | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Description: | ||
# This script ensures npm is available, removes existing node modules, optionally | ||
# removes package-lock.json (when -n flag is used), installs dependencies and runs unit tests. | ||
# Usage: | ||
# ./fresh-npm-install.sh # Regular execution | ||
# ./fresh-npm-install.sh -n # Non-deterministic mode (removes package-lock.json) | ||
|
||
declare NON_DETERMINISTIC_FLAG=0 | ||
|
||
|
||
main() { | ||
parse_args "$@" | ||
ensure_npm_is_available | ||
ensure_npm_root | ||
remove_existing_modules | ||
if [[ $NON_DETERMINISTIC_FLAG -eq 1 ]]; then | ||
remove_package_lock_json | ||
fi | ||
install_dependencies | ||
run_unit_tests | ||
} | ||
|
||
ensure_npm_is_available() { | ||
if ! command -v npm &> /dev/null; then | ||
log::fatal 'npm could not be found, please install it first.' | ||
fi | ||
} | ||
|
||
ensure_npm_root() { | ||
if [ ! -f package.json ]; then | ||
log::fatal 'Current directory is not a npm root. Please run the script in a npm root directory.' | ||
fi | ||
} | ||
|
||
remove_existing_modules() { | ||
if [ -d ./node_modules ]; then | ||
log::info 'Removing existing node modules...' | ||
if ! rm -rf ./node_modules; then | ||
log::fatal 'Could not remove existing node modules.' | ||
fi | ||
fi | ||
} | ||
|
||
install_dependencies() { | ||
log::info 'Installing dependencies...' | ||
if ! npm install; then | ||
log::fatal 'Failed to install dependencies.' | ||
fi | ||
} | ||
|
||
remove_package_lock_json() { | ||
if [ -f ./package-lock.json ]; then | ||
log::info 'Removing package-lock.json...' | ||
if ! rm -rf ./package-lock.json; then | ||
log::fatal 'Could not remove package-lock.json.' | ||
fi | ||
fi | ||
} | ||
|
||
run_unit_tests() { | ||
log::info 'Running unit tests...' | ||
if ! npm run test:unit; then | ||
pwd | ||
log::fatal 'Failed to run unit tests.' | ||
fi | ||
} | ||
|
||
log::info() { | ||
local -r message="$1" | ||
echo "📣 ${message}" | ||
} | ||
|
||
log::fatal() { | ||
local -r message="$1" | ||
echo "❌ ${message}" >&2 | ||
exit 1 | ||
} | ||
|
||
parse_args() { | ||
while getopts "n" opt; do | ||
case ${opt} in | ||
n) | ||
NON_DETERMINISTIC_FLAG=1 | ||
;; | ||
\?) | ||
echo "Invalid option: $OPTARG" 1>&2 | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
} | ||
|
||
main "$1" |
Oops, something went wrong.