mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-01 22:38:10 +08:00
* Automate screencast recordings * **screencast.js**: Automate screencast.sh, asciinema, svg-term-cli. Removes progress-bar, npm tree data from cast * **screencast.sh**: Simulate user input, trigger demoed commands * **screencast-start.js**: Start a shell command and end the process log patterns have been observed
33 lines
989 B
Bash
33 lines
989 B
Bash
#!/bin/zsh
|
|
# Copyright (c) 2015-present, Facebook, Inc.
|
|
#
|
|
# This source code is licensed under the MIT license found in the
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
# ******************************************************************************
|
|
# This is an end-to-end test intended to be run via screencast.js
|
|
# Dependencies: asciinema, pv, core-utils
|
|
# ******************************************************************************
|
|
set -e
|
|
|
|
printf '\e[32m%s\e[m' "λ "
|
|
echo "npx create-react-app my-app" | pv -qL $[10+(-2 + RANDOM%5)]
|
|
npx create-react-app my-app
|
|
|
|
printf '\e[32m%s\e[m' "λ "
|
|
sleep 1
|
|
echo "cd my-app" | pv -qL $[10+(-2 + RANDOM%5)]
|
|
cd my-app
|
|
|
|
printf '\e[32m%s\e[m' "λ "
|
|
sleep 1
|
|
echo "npm start" | pv -qL $[10+(-2 + RANDOM%5)]
|
|
|
|
BROWSER="none" node "$(dirname $0)/screencast-start.js" \
|
|
--command "npm start" \
|
|
--pattern="Compiled successfully*" \
|
|
--pattern-count 2 \
|
|
--error-pattern="*already running on port" \
|
|
--timeout 10
|
|
|
|
echo "" |