@hug/ngx-schematics-utilities
TypeScript icon, indicating that this package has built-in type declarations

9.0.1 • Public • Published

@hug/ngx-schematics-utilities


hug-logo

Useful utilities for Angular Schematics

npm version npm donwloads license GPLv3 docs-site

build status PRs welcome


Schematics

Schematics are generators that transform an existing filesystem.
They can create files, refactor existing files, or move files around.

More info

Getting started

This library provide a large set of utilities that can be used while developing a schematic for Angular.

👉 Learn about it on the docs site.

Example

export default (options: MySchematicOptions): Rule =>
  schematic('my-schematic', [
    modifyJsonFile('tsconfig.json', ['compilerOptions', 'strict'], true),

    workspace()
      .spawn('ng', ['add', '@angular/material', '--skip-confirmation'])
      .addPackageJsonDevDependencies(['eslint'])
      .packageInstallTask()
      .isAngularVersion('<= 11', () => {
        ...
      })
      .toRule(),

    application(options.project)
      .deployFiles(options)
      .addImportToFile('__SRC__/main.ts', 'environment', './environments/environment')
      .deleteFiles(['karma.conf.js'])
      .rule(({ project }: ChainableApplicationContext) => {
        return createOrUpdateFile(project.pathFromRoot('README.md'), project.name);
      })
      .toRule()

  ], options);

Development

See the developer docs.

Contributing

> Want to Help?

Want to file a bug, contribute some code or improve documentation? Excellent!

But please read up first on the guidelines for contributing, and learn about submission process, coding rules and more.

> Code of Conduct

Please read and follow the Code of Conduct, and help us keep this project open and inclusive.

Credits

Copyright (C) 2021 HUG - Hôpitaux Universitaires Genève

love@hug

Package Sidebar

Install

npm i @hug/ngx-schematics-utilities

Weekly Downloads

36

Version

9.0.1

License

GPL-3.0-only

Unpacked Size

162 kB

Total Files

25

Last publish

Collaborators

  • dsi-hug
  • rtrompier
  • badisi