#!/usr/bin/env node /** * Run this script (from root directory): npx @babel/node scripts/sync * * This script is used to propagate any change to root package.json to * all exercises and keep them in sync. * There is a CI step which checks that package.json in root & exercises match * (see checksum script for more info). */ const shell = require('shelljs'); const assignment = shell.env['ASSIGNMENT']; const helpers = require('./helpers'); function copyConfig(destination) { helpers.createExercisePackageJson(); shell.cat('exercise-package.json').to(destination + '/package.json'); shell.rm('exercise-package.json'); shell.cp('babel.config.js', destination); shell.cp('.eslintrc', destination); } if(assignment) { shell.echo('Syncing ' + assignment + '...'); copyConfig('exercises/' + assignment); } else { shell.echo('Syncing all assignments...'); helpers.assignments.forEach(assignment => copyConfig('exercises/' + assignment)); }