-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[STEP-10]: Remove expo cli eject method (#13)
* Remove beta tags * Remove unused commands from eject * Remove EjectMethod * Update step.yml * Line breaks * Review findings * Leftover * Missed comma * Removed unnecessary s
- Loading branch information
Showing
5 changed files
with
210 additions
and
275 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 |
---|---|---|
|
@@ -3,115 +3,89 @@ default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git | |
|
||
app: | ||
envs: | ||
- BITRISE_STEP_GIT_CLONE_URL: https://github.com/bitrise-steplib/steps-expo-detach.git | ||
- BITRISE_STEP_GIT_CLONE_URL: https://github.com/bitrise-steplib/steps-expo-detach.git | ||
|
||
- ORIGIN_SOURCE_DIR: $BITRISE_SOURCE_DIR | ||
- SAMPLE_APP_URL: https://github.com/bitrise-samples/react-native-expo.git | ||
- BRANCH: "SDK_34" | ||
|
||
# Define it in .bitrise.secrets.yml | ||
- USER_NAME: $USER_NAME | ||
- PASSWORD: $PASSWORD | ||
- ORIGIN_SOURCE_DIR: $BITRISE_SOURCE_DIR | ||
- SAMPLE_APP_URL: https://github.com/bitrise-samples/react-native-expo.git | ||
- BRANCH: "SDK39" | ||
|
||
workflows: | ||
test: | ||
before_run: | ||
- audit-this-step | ||
- audit-this-step | ||
steps: | ||
- go-list: | ||
- golint: | ||
- errcheck: | ||
- go-test: | ||
- go-list: | ||
- golint: | ||
- errcheck: | ||
- go-test: | ||
after_run: | ||
- bare | ||
- expo_kit | ||
- eject | ||
|
||
bare: | ||
before_run: | ||
- _clear_workdir | ||
steps: | ||
- script: | ||
title: Clone sample app | ||
inputs: | ||
- content: git clone $SAMPLE_APP_URL . -b $BRANCH && cd | ||
- [email protected]: | ||
title: Install node modules for the expo project | ||
inputs: | ||
- command: install | ||
- path::./: | ||
title: Step Test | ||
run_if: true | ||
inputs: | ||
- project_path: $BITRISE_SOURCE_DIR | ||
- expo_cli_verson: "latest" | ||
- override_react_native_version: 0.55.4 | ||
|
||
expo_kit: | ||
eject: | ||
before_run: | ||
- _clear_workdir | ||
- _clear_workdir | ||
steps: | ||
- script: | ||
title: Clone sample app | ||
inputs: | ||
- content: git clone -b expo_sdk $SAMPLE_APP_URL . && cd | ||
- [email protected]: | ||
title: Install node modules for the expo project | ||
inputs: | ||
- command: install | ||
- path::./: | ||
title: Step Test | ||
run_if: true | ||
inputs: | ||
- project_path: $BITRISE_SOURCE_DIR | ||
- expo_cli_verson: "latest" | ||
- user_name: $USER_NAME | ||
- password: $PASSWORD | ||
- script: | ||
title: Clone sample app | ||
inputs: | ||
- content: git clone $SAMPLE_APP_URL . -b $BRANCH && cd | ||
- [email protected]: | ||
title: Install node modules for the Expo project | ||
inputs: | ||
- command: install | ||
- path::./: | ||
title: Step Test | ||
run_if: true | ||
inputs: | ||
- project_path: $BITRISE_SOURCE_DIR | ||
- expo_cli_verson: "latest" | ||
- override_react_native_version: 0.61.0 | ||
|
||
_clear_workdir: | ||
envs: | ||
steps: | ||
- script: | ||
inputs: | ||
- content: |- | ||
#!/bin/bash | ||
set -ex | ||
cd ${ORIGIN_SOURCE_DIR} | ||
rm -rf "./_tmp" | ||
mkdir "_tmp" | ||
- change-workdir: | ||
title: Switch working dir to test / _tmp dir | ||
description: |- | ||
To prevent step testing issues, like referencing relative | ||
files with just './some-file' in the step's code, which would | ||
work for testing the step from this directory directly | ||
but would break if the step is included in another `bitrise.yml`. | ||
run_if: true | ||
inputs: | ||
- path: ${ORIGIN_SOURCE_DIR}/_tmp | ||
- is_create_path: true | ||
- script: | ||
inputs: | ||
- content: |- | ||
#!/bin/bash | ||
set -ex | ||
cd ${ORIGIN_SOURCE_DIR} | ||
rm -rf "./_tmp" | ||
mkdir "_tmp" | ||
- change-workdir: | ||
title: Switch working dir to test / _tmp dir | ||
description: |- | ||
To prevent Step testing issues, like referencing relative | ||
files with just './some-file' in the Step's code, which would | ||
work for testing the step from this directory directly | ||
but would break if the step is included in another `bitrise.yml`. | ||
run_if: true | ||
inputs: | ||
- path: ${ORIGIN_SOURCE_DIR}/_tmp | ||
- is_create_path: true | ||
|
||
dep-update: | ||
title: Dep update | ||
description: | | ||
Used for updating bitrise dependencies with dep | ||
steps: | ||
- script: | ||
title: Dependency update | ||
inputs: | ||
- content: |- | ||
#!/bin/bash | ||
set -ex | ||
go get -u -v github.com/golang/dep/cmd/dep | ||
dep ensure -v | ||
dep ensure -v -update | ||
- script: | ||
title: Dependency update | ||
inputs: | ||
- content: |- | ||
#!/bin/bash | ||
set -ex | ||
go get -u -v github.com/golang/dep/cmd/dep | ||
dep ensure -v | ||
dep ensure -v -update | ||
# ---------------------------------------------------------------- | ||
# --- workflows to Share this step into a Step Library | ||
audit-this-step: | ||
steps: | ||
- script: | ||
inputs: | ||
- content: |- | ||
#!/bin/bash | ||
set -ex | ||
stepman audit --step-yml ./step.yml | ||
- script: | ||
inputs: | ||
- content: |- | ||
#!/bin/bash | ||
set -ex | ||
stepman audit --step-yml ./step.yml |
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,87 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"strings" | ||
|
||
"github.com/bitrise-io/go-utils/command" | ||
"github.com/bitrise-io/go-utils/log" | ||
"github.com/bitrise-tools/go-steputils/stepconf" | ||
) | ||
|
||
// Expo ... | ||
type Expo struct { | ||
Version string | ||
Workdir string | ||
} | ||
|
||
// installExpoCLI runs the install npm command to install the expo-cli | ||
func (e Expo) installExpoCLI() error { | ||
args := []string{"install", "-g"} | ||
if e.Version != "latest" { | ||
args = append(args, "expo-cli@"+e.Version) | ||
} else { | ||
args = append(args, "expo-cli") | ||
} | ||
|
||
cmd := command.New("npm", args...) | ||
cmd.SetStdout(os.Stdout) | ||
cmd.SetStderr(os.Stderr) | ||
|
||
log.Donef("$ %s", cmd.PrintableCommandArgs()) | ||
return cmd.Run() | ||
} | ||
|
||
// Login with your Expo account | ||
func (e Expo) login(userName string, password stepconf.Secret) error { | ||
args := []string{"login", "--non-interactive", "-u", userName, "-p", string(password)} | ||
|
||
cmd := command.New("expo", args...) | ||
cmd.SetStdout(os.Stdout) | ||
cmd.SetStderr(os.Stderr) | ||
|
||
nonFilteredArgs := ("$ " + cmd.PrintableCommandArgs()) | ||
fileredArgs := strings.Replace(nonFilteredArgs, string(password), "[REDACTED]", -1) | ||
log.Printf(fileredArgs) | ||
|
||
return cmd.Run() | ||
} | ||
|
||
// Logout from your Expo account | ||
func (e Expo) logout() error { | ||
cmd := command.New("expo", "logout", "--non-interactive") | ||
cmd.SetStdout(os.Stdout) | ||
cmd.SetStderr(os.Stderr) | ||
|
||
log.Donef("$ %s", cmd.PrintableCommandArgs()) | ||
return cmd.Run() | ||
} | ||
|
||
// Eject command creates Xcode and Android Studio projects for your app. | ||
func (e Expo) eject() error { | ||
args := []string{"eject", "--non-interactive"} | ||
|
||
cmd := command.New("expo", args...) | ||
cmd.SetStdout(os.Stdout) | ||
cmd.SetStderr(os.Stderr) | ||
if e.Workdir != "" { | ||
cmd.SetDir(e.Workdir) | ||
} | ||
|
||
log.Donef("$ %s", cmd.PrintableCommandArgs()) | ||
return cmd.Run() | ||
} | ||
|
||
func (e Expo) publish() error { | ||
args := []string{"publish", "--non-interactive"} | ||
|
||
cmd := command.New("expo", args...) | ||
cmd.SetStdout(os.Stdout) | ||
cmd.SetStderr(os.Stderr) | ||
if e.Workdir != "" { | ||
cmd.SetDir(e.Workdir) | ||
} | ||
|
||
log.Donef("$ %s", cmd.PrintableCommandArgs()) | ||
return cmd.Run() | ||
} |
Oops, something went wrong.