Skip to content

Commit

Permalink
Remove git and test operations
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Barton committed Jun 12, 2018
1 parent 651323a commit f26a139
Showing 1 changed file with 5 additions and 38 deletions.
43 changes: 5 additions & 38 deletions src/index.js
Expand Up @@ -8,25 +8,7 @@ const editJsonFile = require('edit-json-file');


module.exports = () => {
console.log(chalk.magenta('\nnpm2yarn.js...\n'));

// Git setup.
console.log(chalk.blue('\nGit setup...'));
console.log(chalk.blue('Checking out master'));
spawnSync('git', ['checkout', 'master'], {
// Write to this process's stdout.
stdio: 'inherit'
});

console.log(chalk.blue('Pulling the latest changes'));
spawnSync('git', ['pull'], {
stdio: 'inherit'
});

console.log(chalk.blue('Checking out `deyarnify`'));
spawnSync('git', ['checkout', '-B', 'deyarnify'], {
stdio: 'inherit'
});
console.log(chalk.magenta('\ndeyarn...\n'));

const yarnLockPath = `${process.cwd()}/yarn.lock`;
if (fs.existsSync(yarnLockPath)) {
Expand Down Expand Up @@ -64,38 +46,23 @@ module.exports = () => {
stdio: 'inherit'
});

// Run tests.
console.log(chalk.blue('\nRunning `npm test`.'));
spawnSync('npm', ['test'], {
stdio: 'inherit'
});

// Require that users of this package use npm rather than Yarn since it's easy to forget :).
const packageJsonPath = `${process.cwd()}/package.json`;
const packageJson = editJsonFile(packageJsonPath, {
autosave: true
});
packageJson.set('engines.yarn', 'YARN NO LONGER USED - use npm instead.');

// Stage changes.
console.log(chalk.blue('\nStaging changes.'));
spawnSync('git', ['add', '.'], {
stdio: 'inherit'
});
spawnSync('git', ['status'], {
stdio: 'inherit'
});

// Output success.

console.log(chalk.green('\n\nSuccess!\n'));
console.log('NEXT STEPS:');
console.log(' 1. Update package.json scripts to use npm if necessary:');
console.log(' 1. Perform any testing to ensure that package updates were not problematic.');
console.log(' 2. Update package.json scripts to use npm if necessary:');
console.log(' ', chalk.cyan(JSON.stringify(packageJson.get('scripts'))));
console.log(' 2. Update the README if necessary');
console.log(' 3. Update your CI configuration if necessary');
console.log(' 4. Update the README if necessary');
console.log(' - Add preferred npm-install instruction');
console.log(' - Update any other Yarn commands to use npm instead');
console.log(' 3. Update your CI configuration if necessary');
console.log(' 4. Perform any additional testing to ensure that package updates were not problematic.');
console.log(' 5. Commit the made changes');
};

0 comments on commit f26a139

Please sign in to comment.