-
Notifications
You must be signed in to change notification settings - Fork 669
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
205 changed files
with
5,706 additions
and
7,532 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
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
analyzer: | ||
exclude: [_site, site-shared, src, tmp, tool/dartpad_picker, tool/get_dart] | ||
exclude: [_site, site-shared, src, tmp, tool/get_dart] |
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,104 @@ | ||
#!/bin/bash | ||
|
||
REQUIRED_DART_VERSION="3.3" | ||
REQUIRED_NODE_VERSION="20.10" | ||
REQUIRED_PNPM_VERSION="8.14" | ||
|
||
# Check that the 'dart' command is available on the user's path. | ||
if ! command -v dart &> /dev/null; then | ||
echo "Dart not found. To learn how to setup Dart, follow the instructions at https://dart.dev/get-dart." | ||
exit 1 | ||
fi | ||
|
||
# Check that the current version of a tool is the same or | ||
# newer than a required version. | ||
version_is_new_enough() { | ||
required_version="$1" | ||
current_version="$2" | ||
|
||
# Split the version strings into lists based on the dot separators. | ||
IFS='.' read -ra required_list <<< "$required_version" | ||
IFS='.' read -ra current_list <<< "$current_version" | ||
|
||
# Compare each portion of the version number. | ||
for ((i = 0; i < ${#required_list[@]}; i += 1)); do | ||
required_segment="${required_list[i]:-0}" | ||
current_segment="${current_list[i]:-0}" | ||
|
||
if [[ "$required_segment" -gt "$current_segment" ]]; then | ||
# The current version is too low. | ||
return 0 | ||
elif [[ "$required_segment" -lt "$current_segment" ]]; then | ||
# The current version is higher, which is ok. | ||
return 1 | ||
fi | ||
done | ||
|
||
# The current version is (mostly) the same as the required version. | ||
return 1 | ||
} | ||
|
||
|
||
# Determine the available Dart SDK version. | ||
dart_version=$(dart --version | grep -oE 'Dart SDK version: [0-9.]+' | cut -d ' ' -f 4) | ||
|
||
# Validate the version of the installed Dart SDK. | ||
if version_is_new_enough "$REQUIRED_DART_VERSION" "$dart_version"; then | ||
echo "Dart version $dart_version is too low. Version $REQUIRED_DART_VERSION or later is required." | ||
exit 1 | ||
fi | ||
|
||
# Check that the 'node' command is available on the user's path. | ||
if ! command -v node &> /dev/null; then | ||
echo "'node' command not found. To learn how to install and setup Node, reference the repository README." | ||
exit 1 | ||
fi | ||
|
||
# Determine the available Node version. | ||
node_version=$(node --version | cut -d 'v' -f 2) | ||
|
||
# Validate the version of the Node installation. | ||
if version_is_new_enough "$REQUIRED_NODE_VERSION" "$node_version"; then | ||
echo "Node version $node_version is too low. Version $REQUIRED_NODE_VERSION or later is required." | ||
exit 1 | ||
fi | ||
|
||
# Check that the 'npx' command is available on the user's path. | ||
if ! command -v npx &> /dev/null; then | ||
echo "'npx' command from Node not found. Check your Node installation." | ||
exit 1 | ||
fi | ||
|
||
# Run extra logic if the 'pnpm' command is available on the user's path. | ||
if command -v pnpm &> /dev/null; then | ||
# Determine the available pnpm version. | ||
pnpm_version=$(pnpm --version) | ||
|
||
# Validate the version of the pnpm installation. | ||
if version_is_new_enough "$REQUIRED_PNPM_VERSION" "$pnpm_version"; then | ||
echo "pnpm version $pnpm_version is too low. Version $REQUIRED_PNPM_VERSION or later is required." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Verify that Node packages have been installed. | ||
if [[ ! -d "node_modules" ]]; then | ||
if command -v pnpm &> /dev/null; then | ||
echo "Node packages not found. Installing with 'pnpm install'..." | ||
pnpm install | ||
elif command -v npm &> /dev/null; then | ||
echo "Node packages not found. Installing with 'npm install'..." | ||
npm install | ||
else | ||
echo "Neither 'pnpm' nor 'npm' found. To learn how to setup pnpm, reference the repository README." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Verify that Dart dependencies have been retrieved. | ||
if [[ ! -d ".dart_tool" ]]; then | ||
dart pub get | ||
fi | ||
|
||
# Run the Dart site tool and pass through all arguments. | ||
dart run dart_site "$@" |
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
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 |
---|---|---|
|
@@ -19,3 +19,4 @@ void main() { | |
print('Fetching user order...'); | ||
print(createOrderMessage()); | ||
} | ||
// #enddocregion no-warning |
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
Oops, something went wrong.