function prepareForPublish(done) {
  const releaseDir = 'dist';

  // Delete the release directory if it exists.
  if (fs.existsSync(releaseDir)) {
    console.log('Removing previous `dist/` directory.');
    rimraf.sync(releaseDir);
  }

  // Clone a fresh copy of blockly-samples.
  console.log(
    `Checking out a fresh copy of blockly-samples under ` +
      `${path.resolve(releaseDir)}`,
  );
  execSync(
    `git clone https://github.com/google/blockly-samples ${releaseDir}`,
    {stdio: 'pipe'},
  );

  // Run npm ci.
  console.log('Running npm ci to install.');
  execSync(`npm ci`, {cwd: releaseDir, stdio: 'inherit'});

  // Build all plugins.
  console.log('Building all plugins.');
  execSync('npm run build', {cwd: releaseDir, stdio: 'inherit'});

  // Test all plugins.
  console.log('Testing all plugins.');
  execSync('npm run test', {cwd: releaseDir, stdio: 'inherit'});

  // Login to npm.
  console.log('Logging in to npm.');
  execSync(`npm login --registry https://wombat-dressing-room.appspot.com`, {
    stdio: 'inherit',
  });
  done();
}
Prepare for publishing. Must be run before any manual publish command.

Clones blockly-samples, runs build and tests, logs into npm publish service.
@param {Function} done Completed callback.