function registerTask(name, taskFunction) {
  const disabledTasks = getDisabledTasks();

  task(
    name,
    disabledTasks.includes(name)
      ? () => {
          logger.info(`${name} task is disabled in package.json`);
        }
      : taskFunction
  );
}
registerTask('ts:esm', ts.esm);
registerTask('ts:amd', ts.amd);
registerTask('tslint', tslint);
registerTask('ts:commonjs-only', ts.commonjsOnly);
registerTask('webpack', webpack);
registerTask('webpack-dev-server', webpackDevServer);
registerTask('verify-api-extractor', verifyApiExtractor);
registerTask('update-api-extractor', updateApiExtractor);
registerTask('build-codepen-examples', buildCodepenExamples);
registerTask('lint-imports', lintImports);
registerTask('prettier', prettier);
registerTask('bundle-size-collect', bundleSizeCollect);
registerTask('check-for-modified-files', checkForModifiedFiles);
registerTask('generate-version-files', generateVersionFiles);

task('ts', parallel('ts:commonjs', 'ts:esm', condition('ts:amd', () => argv().production && !argv().min && !argv().prdeploy)));

task(
  'build',
  series(
    'clean',
    'copy',
    'sass',
    parallel(
      condition('tslint', () => !argv().min && !argv().prdeploy),
      condition('jest', () => !argv().min && !argv().prdeploy),
      series(
        'ts',
        'build-codepen-examples',
        condition('lint-imports', () => !argv().min && !argv().prdeploy),
        parallel(condition('webpack', () => !argv().min), condition('verify-api-extractor', () => !argv().min && !argv().prdeploy))