Skip to content

Update CLI and template packages

Viktor Aladzhov edited this page Sep 26, 2023 · 18 revisions

update yarn

  1. Follow step-by-step guide to upgrade Yarn to Yarn Berry (Yarn 2).
  2. Add yargs with the yarn add yargs command.

update CLI packages with yarn

  1. Update lerna: yarn up lerna
  2. Update lerna-changelog: yarn up lerna-changelog
  3. Update yargs: lerna exec -- yarn up yargs

Note: yarn docs

Note: lerna docs

Note: lerna exec executes a command for all the projects in the mono repo. lerna exec -- yarn up yargs, executed on a root level, will update all the yargs dependencies in all the projects at once. Other usage of lerna in the CLI.

Note: some CLI packages are also used in the templates and can be updated accordingly.

update templates

  • on a generated project with all the components run an automatic migration tool, like ng cli, and update template files
  • compare the latest project from a framework with existing templates in the CLI (with WinMerge) and update template files

update angular templates

  • compare ng new with ig new
  • ng update for project with all components and then move changes to templates

Notes: typescript update for CLI and all framework templates

Some frequently encountered problems while updating

In the tests:

  • Lambda functions are already allowed in javascript so there's no need write workarounds for them (- Unhandled promise rejection: TypeError: target is not a constructor). image
  • async functions with done are no longer support, either one has to be removed.
    • Error: require() of ES Module D:\repos\igniteui-cli\node_modules\inquirer\lib\inquirer.js from D:\repos\igniteui-cli\spec\unit\PromptSession-spec.js not supported. Instead change the require of inquirer.js in D:\repos\igniteui-cli\spec\unit\PromptSession-spec.js to a dynamic import() which is available in all CommonJS modules. - The import(some_module) syntax is being transplied to require(some_module) which is no longer permitted: image A possible solution might be to wrap the import() in eval(): const inquirer = await eval('import("inquirer")'); which is transplied to const inquirer = yield eval('import("inquirer")');