'use strict';

const chalk = require('chalk');

const tools = require('../../scripts/utils/tools');


const helpOutput = `
  ${chalk.yellow('eUI SCRIPTS - COMMANDS')}
  ----------------------

  - Initialization of existing project / packages

    ${chalk.green('npm run init')}
      => interactive initialization of project, project and team can be selected from a list based on your global config

    ${chalk.green('npm run init -- --project <project-name>')}
      => initialize the <project-name> with all the dependent packages as defined in the global config

    ${chalk.green('npm run init -- --project <project-name> --prjOnly')}
      => initialize ONLY the <project-name> without any other packages

    ${chalk.green('npm run init -- --pkg <package-name>')}
      => initalize the <package-name> and re-clone/re-pull all others repositories (project+packages) already present in your local env

    ${chalk.green('npm run init -- --pkg <package-name> --pkgOnly')}
      => initialize the <package-name> and only this package will be clone/pull


  - PACKAGE operations

    ${chalk.green('npm run pkg:init')}
      => New package creation, interactive where Scope / Package name and type can be selected
      => this implies that dev team is sending a Pull Request on the root package with the additional configuration updates
         for this package to be able to be known, by other teams and also the CI operations

    ${chalk.green('npm run pkg:build <package-name>')}
      => Local build of <package-name> = folder name of package in /packages folder
      => Linting the package
      => Testing the package, with Karma/Jasmine for Angular / maven test for Java / Jest for NodeJS package
      => Compile the package into Angular v7 format / maven clean package / others, dependending on the package type

    ${chalk.green('npm run pkg:build <package-name> -- --deps')}
      => same as the generic command with pre-building all packages dependencies in the graph
      => dependencies between packages are defined into the [deps] array in the global package config file
      => graph is scanning dependencies of dependencies along the dependency tree

    ${chalk.green('npm run pkg:build <package-name> -- --skipLint')}
      => same as the generic command but skipping the linting operation

    ${chalk.green('npm run pkg:build <package-name> -- --skipTest')}
      => same as the generic command but skipping the testing operation

    ${chalk.green('npm run pkg:build <package-name> -- --skipLint --skipTest')}
      => same as the generic command but skipping both linting and testing operations

    ${chalk.green('npm run pkg:build-all')}
      => build all packages installed locally, in dependencies order



  - APPLICATION operations : INIT

    ${chalk.green('npm run app:init')}
    => New application creation, interactive where Scope / app name
    => this implies that dev team is sending a Pull Request on the root package with the additional configuration updates
      for this application to be able to be known, by other teams and also the CI operations



  - APPLICATION operations : SERVE

    ${chalk.green('npm run app:serve <project-name>')}
      => Serve your application, using default Angular CLI "ng serve" app will be serverd on localhost:4200



  - APPLICATION operations : BUILD

    ${chalk.green('npm run app:build <project-name>')}
      => Build the <project-name> with default build configuration as defined in the angular-config.json file of the app

    ${chalk.green('npm run app:build <project-name> -- --configuration=<configuration-name>')}
      => Build the <project-name> with the build configuration provided, it should be defined in the angular-config.json file of the app
      => Default configurations of a default CSDR app skeleton are :
        => "production": run with AOT and with production files replacement (very fast / bigger bundles)
        => "production-optimized": run with AOT and with optimized build flag on (takes longer / smaller bundles)



  - Re-synchronization - proper to CSDR local dev

  ${chalk.green('npm run sync')}
    => Re-sync your local dev env, all previously generated files will be re-generated against the global config
    => Upgrade of dependencies will occur after the sync (npm run upgrade:deps)

  ${chalk.green('npm run sync-only ----> equivalent to npm run sync -- --skipInstall')}
    => Only do the re-sync operation without upgrading the dependencies

  ${chalk.green('npm run upgrade:deps')}
    => Only do the upgrade of dependencies operation, scanning of all the projects/packages present in your local will be done
        dependencies for each will then be injected in the package.json root and then installed against their latest snapshot versions

`;

console.log(helpOutput);
