Skip to content

Commit

Permalink
spaces > notes
Browse files Browse the repository at this point in the history
  • Loading branch information
chen56 committed Mar 31, 2024
1 parent 48c36fa commit 2a7f5a0
Show file tree
Hide file tree
Showing 320 changed files with 139 additions and 74 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ FROM nginx:1.23.4 as nginx
# ref:
# https://github.com/nginxinc/docker-nginx/blob/master/mainline

COPY --from=ci /home/flutter/note/spaces/flutter_note/build/web /usr/share/nginx/html/note
COPY --from=ci /home/flutter/notes/flutter_note/build/web /usr/share/nginx/html/note

# The port that your application listens to.
EXPOSE 443
Expand Down
171 changes: 125 additions & 46 deletions bake
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,81 @@ fi
# include common script
source "$SCRIPT_DIR/vendor/bake.bash"



##########################################
# 应用的命令脚本 , 公共函数和全局变量
##########################################

# run一条命令,先print上下文信息,再执行
# Usage: run <some cmd>
# Example:
# ------------------------------------
# $ ./bake run pwd
# /Users/x/git/younpc/bake:733 -> bake.go() ▶︎【pwd】
# /Users/x/git/younpc
# ------------------------------------

declare -A _pkgs=(
["learn_dart"]="$SCRIPT_DIR/learn_dart"
["note"]="$SCRIPT_DIR/note"
["mate"]="$SCRIPT_DIR/mate"
["mate_flutter"]="$SCRIPT_DIR/mate_flutter"
["note_test"]="$SCRIPT_DIR/note_test"
["note_tools"]="$SCRIPT_DIR/note_tools"
["flutter"]="$SCRIPT_DIR/notes/flutter_note"
["qwik"]="$SCRIPT_DIR/notes/qwik"
["shell"]="$SCRIPT_DIR/notes/shell"
)

pkgs.ls(){
for pkg in ${!_pkgs[*]} ; do
echo "$pkg:${_pkgs[$pkg]}"
done
}
pkgs.run(){
for pkg in ${!_pkgs[*]} ; do
# 子shell内执行,防止环境感染
( cd "${_pkgs[$pkg]}"; run "$@" ; )
done
}

pkgs.run_subcmd() {
local subcmd="$1"
if [[ "$subcmd" == "" ]] ; then
echo "缺subcmd参数 Usage:pkgs.run_subcmd <subcmd>";
return 100;
fi
for pkg in "${!_pkgs[@]}"; do
if _func_exists "$pkg.$subcmd" ; then "$pkg.$subcmd" ; fi
done
}


run() {
local caller_line=$(caller 0 | awk '{print $1}')
local project
# home目录替换为"~"符号
# ${PWD#$HOME}可以删掉home目录前缀, 类似$(echo $PWD | sed "s|^$HOME||"),比sed简单高效,而且sed处理变量总有特殊字符问题
local current="~${PWD/#$HOME}"
echo "$SCRIPT_PATH:$caller_line -> ${FUNCNAME[1]} ▶︎ 【$current$ $*"
"$@"
return $?
}

## if function not exist return 1;
# Usage: _func_exists <function>
# Example: _func_exists app.build
# => return 0
_func_exists(){
local func="$1"
if ! ( declare -F "$func" | grep "$func" &>/dev/null 2>&1; ) then
return 1;
fi
}



##########################################
# app cmd script
# 应用的命令脚本
Expand Down Expand Up @@ -68,24 +143,6 @@ Examples:
EOF
)"

# run一条命令,先print上下文信息,再执行
# Usage: run <some cmd>
# Example:
# ------------------------------------
# $ ./bake run pwd
# /Users/x/git/younpc/bake:733 -> bake.go() ▶︎【pwd】
# /Users/x/git/younpc
# ------------------------------------
run() {
local caller_line=$(caller 0 | awk '{print $1}')
local project
project=$(basename "$PWD")
# [[ "$PWD" == "$SCRIPT_DIR" ]] && project="_root"
echo "$SCRIPT_PATH:$caller_line -> ${FUNCNAME[1]} ▶︎【$@"
"$@"
return $?
}


# flutter_note flutter create --platforms=macos .
install() {
Expand All @@ -108,54 +165,76 @@ p.all() {
(cd mate && run "$@")
(cd note_test && run "$@")
(cd note_tools && run "$@")
(cd spaces/flutter_note && run "$@")
(cd notes/flutter_note && run "$@")
}

p.note() (cd note && run "$@")
p.flutter_note() (cd spaces/flutter_note && run "$@")
p.mate() (cd mate && run "$@")
p.mate_flutter() (cd mate_flutter && run "$@")
p.note_test() (cd note_test && run "$@")
p.note_tools() (cd note_tools && run "$@")

get() { run p.all flutter pub get; }

test() { ./test/bake2_test.bash test ; run p.all flutter test ;}
test.bake() { ./test/bake2_test.bash test ; }
note.run() ( cd note && run "$@")
note.install() ( note.run flutter pub get)
note.clean() ( note.run flutter clean; rm -rf build;)

flutter.run() ( cd notes/flutter_note && run "$@")
flutter.install() ( flutter.run flutter pub get)
flutter.clean() ( flutter.run flutter clean; rm -rf build;)
flutter.gen() ( flutter.run dart run tools/gen.dart; )
# get ip only work on macos
# shellcheck disable=SC2155
# local ip=$(ifconfig -l | xargs -n1 ipconfig getifaddr) || true
run.web() { p.flutter_note flutter run --web-port 8888 --web-renderer html --device-id chrome "$@"; }
run.macos() { p.flutter_note flutter run --device-id macos "$@"; }

flutter.dev_web() { flutter.run flutter run --web-port 8888 --web-renderer html --device-id chrome "$@"; }
flutter.dev() { flutter.run flutter run --device-id macos "$@"; }
# skwasm无法运行
build.macos() { run p.flutter_note flutter build macos -v --release --tree-shake-icons "$@"; }
build.web_skwasm() { p.flutter_note flutter build web -v --release --tree-shake-icons --web-renderer skwasm "$@" ; }
build.web_canvaskit() { p.flutter_note flutter build web -v --release --tree-shake-icons --web-renderer canvaskit "$@" ; }
build() { p.flutter_note flutter build web -v --release --tree-shake-icons --web-renderer html "$@" ; }

flutter.build_macos() { flutter.run flutter build macos -v --release --tree-shake-icons "$@"; }
flutter.build_web_skwasm() { flutter.run flutter build web -v --release --tree-shake-icons --web-renderer skwasm "$@" ; }
flutter.build_web_canvaskit() { flutter.run flutter build web -v --release --tree-shake-icons --web-renderer canvaskit "$@" ; }
flutter.build() { flutter.run flutter build web -v --release --tree-shake-icons --web-renderer html "$@" ; }
# http-server 不支持base href设置,所以单独build,并设置base-href为"/",而github-pages的base-href必须是repository名
# npx http-server ./flutter_note/build/web --port 8000
# flutter pub global activate dhttpd
# run p.flutter_note dhttpd --path ./build/web --port 8080 '--headers=Cross-Origin-Embedder-Policy=credentialless;Cross-Origin-Opener-Policy=same-origin'
preview.web() { run p.flutter_note deno run --allow-env --allow-read --allow-sys --allow-net npm:http-server ./build/web --port 8000 -g --brotli; }
preview.macos() ( run p.flutter_note open build/macos/Build/Products/Release/flutter_note.app ; )
flutter.preview() { flutter.run deno run --allow-env --allow-read --allow-sys --allow-net npm:http-server ./build/web --port 8000 -g --brotli; }

mate.run() ( cd mate && run "$@")
mate.install() (mate.run flutter pub get)
mate.clean() ( mate.run flutter clean; rm -rf build;)

mate_flutter.run() ( cd mate_flutter && run "$@")
mate_flutter.install() (mate_flutter.run flutter pub get)
mate_flutter.clean() ( mate_flutter.run flutter clean; rm -rf build;)
mate_flutter.gen() ( mate_flutter.run dart run tools/gen_mates.dart; mate_flutter.run dart run tools/gen_mate_icons.dart ; )

clean() { p.all flutter clean; rm -rf build;}
note_test.run() ( cd note_test && run "$@")
note_test.install() (note_test.run flutter pub get)
note_test.clean() ( note_test.run flutter clean; rm -rf build;)

gen.all() { gen.note; } # gen.mate;不再用了
gen.note() { run p.flutter_note dart run tools/gen.dart; run p.flutter_note flutter pub get; }
gen.mate() ( run p.mate_flutter dart run tools/gen_mates.dart; run p.mate_flutter dart run tools/gen_mate_icons.dart ; )
gen.clean() { run rm -f p.flutter_note/lib/pages.g.dart; run rm -rf mate_flutter/lib; }
note_tools.run() ( cd note_tools && run "$@")
note_tools.install() (note_tools.run flutter pub get)
note_tools.clean() ( note_tools.run flutter clean; rm -rf build;)


install(){
_install_bake
run git lfs install

# 执行 note.install、mate.install等命令
pkgs.run_subcmd install;
}


# 执行 note.test、mate.test等命令
test() { pkgs.run_subcmd test; }


# 执行 note.clean、mate.clean等命令
clean() { pkgs.run_subcmd clean; }

gen.all() ( flutter.gen; ) # mate_flutter.gen;暂时不用了
gen.clean() ( flutter.run rm -f ./lib/pages.g.dart; run rm -rf mate_flutter/lib; )

docker.build() ( run docker build --progress plain --tag younpc/note:latest . ; run mkdir -p build/flutter_note/web; run sh -c "docker run --rm --workdir /usr/share/nginx/html/note younpc/note tar cf - ./ | ( cd build/flutter_note/web; tar xf -)";)
docker.run() { run echo "note preview http://localhost:8888/note/"; run docker run --rm --name note -p 8888:80 -u root:root younpc/note;}
docker.preview() { run docker build --progress plain --build-arg test=off --tag younpc/note:latest . ; docker.run; }
docker.debug() { run docker run -v $PWD:/home/flutter/note --workdir /home/flutter/note --rm -it fischerscode/flutter:3.10.0-1.3.pre bash ; }
docker.push() { docker image push younpc/note:latest ; }


info() {
echo "\$PWD : $PWD"
echo "\$SCRIPT_PATH: $SCRIPT_PATH"
Expand Down
1 change: 0 additions & 1 deletion learn_dart/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@ analyzer:
# https://dart.dev/tools/experiment-flags#using-experiment-flags-with-the-dart-analyzer-command-line-and-ide
# https://github.com/dart-lang/sdk/blob/3.0.0-315.0.dev/tools/experimental_features.yaml
enable-experiment:
- records
- macros
1 change: 0 additions & 1 deletion mate_flutter/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,4 @@ analyzer:
# https://dart.dev/tools/experiment-flags#using-experiment-flags-with-the-dart-analyzer-command-line-and-ide
# https://github.com/dart-lang/sdk/blob/3.0.0-315.0.dev/tools/experimental_features.yaml
enable-experiment:
- records
- macros
1 change: 0 additions & 1 deletion mate_flutter/lib/src/foundation/math.dart

This file was deleted.

2 changes: 1 addition & 1 deletion mate_flutter/lib/src/material/text_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:flutter/src/painting/text_style.dart' as _i3;

/// class TextTheme with Diagnosticable
class TextTheme$Mate extends _i1.TextTheme with _i2.Mate {
/// TextTheme TextTheme({TextStyle? displayLarge, TextStyle? displayMedium, TextStyle? displaySmall, TextStyle? headlineLarge, TextStyle? headlineMedium, TextStyle? headlineSmall, TextStyle? titleLarge, TextStyle? titleMedium, TextStyle? titleSmall, TextStyle? bodyLarge, TextStyle? bodyMedium, TextStyle? bodySmall, TextStyle? labelLarge, TextStyle? labelMedium, TextStyle? labelSmall, TextStyle? headline1, TextStyle? headline2, TextStyle? headline3, TextStyle? headline4, TextStyle? headline5, TextStyle? headline6, TextStyle? subtitle1, TextStyle? subtitle2, TextStyle? bodyText1, TextStyle? bodyText2, TextStyle? caption, TextStyle? overview, TextStyle? overline})
/// TextTheme TextTheme({TextStyle? displayLarge, TextStyle? displayMedium, TextStyle? displaySmall, TextStyle? headlineLarge, TextStyle? headlineMedium, TextStyle? headlineSmall, TextStyle? titleLarge, TextStyle? titleMedium, TextStyle? titleSmall, TextStyle? bodyLarge, TextStyle? bodyMedium, TextStyle? bodySmall, TextStyle? labelLarge, TextStyle? labelMedium, TextStyle? labelSmall, TextStyle? headline1, TextStyle? headline2, TextStyle? headline3, TextStyle? headline4, TextStyle? headline5, TextStyle? headline6, TextStyle? subtitle1, TextStyle? subtitle2, TextStyle? bodyText1, TextStyle? bodyText2, TextStyle? caption, TextStyle? button, TextStyle? overline})
TextTheme$Mate({
/// optionalParameters: {TextStyle? displayLarge} , default:none
super.displayLarge,
Expand Down
10 changes: 5 additions & 5 deletions mate_flutter/lib/src/semantics/semantics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ class SemanticsHintOverrides$Mate extends _i1.SemanticsHintOverrides with _i2.Ma

/// class SemanticsProperties extends DiagnosticableTree
class SemanticsProperties$Mate extends _i1.SemanticsProperties with _i2.Mate {
/// SemanticsProperties SemanticsProperties({bool? enabled, bool? checked, bool? mixed, bool? expanded, bool? selected, bool? toggled, bool? overview, bool? link, bool? header, bool? textField, bool? slider, bool? keyboardKey, bool? readOnly, bool? focusable, bool? focused, bool? inMutuallyExclusiveGroup, bool? hidden, bool? obscured, bool? multiline, bool? scopesRoute, bool? namesRoute, bool? image, bool? liveRegion, int? maxValueLength, int? currentValueLength, String? identifier, String? label, AttributedString? attributedLabel, String? value, AttributedString? attributedValue, String? increasedValue, AttributedString? attributedIncreasedValue, String? decreasedValue, AttributedString? attributedDecreasedValue, String? hint, String? tooltip, AttributedString? attributedHint, SemanticsHintOverrides? hintOverrides, TextDirection? textDirection, SemanticsSortKey? sortKey, SemanticsTag? tagForChildren, void Function()? onTap, void Function()? onLongPress, void Function()? onScrollLeft, void Function()? onScrollRight, void Function()? onScrollUp, void Function()? onScrollDown, void Function()? onIncrease, void Function()? onDecrease, void Function()? onCopy, void Function()? onCut, void Function()? onPaste, void Function(bool)? onMoveCursorForwardByCharacter, void Function(bool)? onMoveCursorBackwardByCharacter, void Function(bool)? onMoveCursorForwardByWord, void Function(bool)? onMoveCursorBackwardByWord, void Function(TextSelection)? onSetSelection, void Function(String)? onSetText, void Function()? onDidGainAccessibilityFocus, void Function()? onDidLoseAccessibilityFocus, void Function()? onDismiss, Map<CustomSemanticsAction, void Function()>? customSemanticsActions})
/// SemanticsProperties SemanticsProperties({bool? enabled, bool? checked, bool? mixed, bool? expanded, bool? selected, bool? toggled, bool? button, bool? link, bool? header, bool? textField, bool? slider, bool? keyboardKey, bool? readOnly, bool? focusable, bool? focused, bool? inMutuallyExclusiveGroup, bool? hidden, bool? obscured, bool? multiline, bool? scopesRoute, bool? namesRoute, bool? image, bool? liveRegion, int? maxValueLength, int? currentValueLength, String? identifier, String? label, AttributedString? attributedLabel, String? value, AttributedString? attributedValue, String? increasedValue, AttributedString? attributedIncreasedValue, String? decreasedValue, AttributedString? attributedDecreasedValue, String? hint, String? tooltip, AttributedString? attributedHint, SemanticsHintOverrides? hintOverrides, TextDirection? textDirection, SemanticsSortKey? sortKey, SemanticsTag? tagForChildren, void Function()? onTap, void Function()? onLongPress, void Function()? onScrollLeft, void Function()? onScrollRight, void Function()? onScrollUp, void Function()? onScrollDown, void Function()? onIncrease, void Function()? onDecrease, void Function()? onCopy, void Function()? onCut, void Function()? onPaste, void Function(bool)? onMoveCursorForwardByCharacter, void Function(bool)? onMoveCursorBackwardByCharacter, void Function(bool)? onMoveCursorForwardByWord, void Function(bool)? onMoveCursorBackwardByWord, void Function(TextSelection)? onSetSelection, void Function(String)? onSetText, void Function()? onDidGainAccessibilityFocus, void Function()? onDidLoseAccessibilityFocus, void Function()? onDismiss, Map<CustomSemanticsAction, void Function()>? customSemanticsActions})
SemanticsProperties$Mate({
/// optionalParameters: {bool? enabled} , default:none
super.enabled,
Expand All @@ -497,7 +497,7 @@ class SemanticsProperties$Mate extends _i1.SemanticsProperties with _i2.Mate {
/// optionalParameters: {bool? toggled} , default:none
super.toggled,

/// optionalParameters: {bool? overview} , default:none
/// optionalParameters: {bool? button} , default:none
super.button,

/// optionalParameters: {bool? link} , default:none
Expand Down Expand Up @@ -695,8 +695,8 @@ class SemanticsProperties$Mate extends _i1.SemanticsProperties with _i2.Mate {
init: toggled,
isNamed: true,
),
'overview': _i2.BuilderArg<bool?>(
name: 'overview',
'button': _i2.BuilderArg<bool?>(
name: 'button',
init: button,
isNamed: true,
),
Expand Down Expand Up @@ -986,7 +986,7 @@ class SemanticsProperties$Mate extends _i1.SemanticsProperties with _i2.Mate {
expanded: p.get('expanded').build(),
selected: p.get('selected').build(),
toggled: p.get('toggled').build(),
button: p.get('overview').build(),
button: p.get('button').build(),
link: p.get('link').build(),
header: p.get('header').build(),
textField: p.get('textField').build(),
Expand Down
Loading

0 comments on commit 2a7f5a0

Please sign in to comment.