Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add command to add files to staging after eject #5960

Merged
merged 6 commits into from
Mar 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/react-scripts/scripts/eject.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,22 @@ function getGitStatus() {
}
}

function tryGitAdd(appPath) {
try {
spawnSync(
'git',
['add', path.join(appPath, 'config'), path.join(appPath, 'scripts')],
{
stdio: 'inherit',
}
);

return true;
} catch (e) {
return false;
}
}

console.log(
chalk.cyan.bold(
'NOTE: Create React App 2 supports TypeScript, Sass, CSS Modules and more without ejecting: ' +
Expand Down Expand Up @@ -310,6 +326,11 @@ inquirer
console.log(green('Ejected successfully!'));
console.log();

if (tryGitAdd(appPath)) {
console.log(cyan('Staged ejected files for commit.'));
console.log();
}

console.log(
green('Please consider sharing why you ejected in this survey:')
);
Expand Down
3 changes: 3 additions & 0 deletions tasks/e2e-simple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ verify_module_scope
# Eject...
echo yes | npm run eject

# Test ejected files were staged
test -n "$(git diff --staged --name-only)"

# Test the build
yarn build
# Check for expected output
Expand Down