🚀 Useful utilities for Angular Schematics | Read-only mirror of https://github.com/DSI-HUG/ngx-schematics-utilities — Hôpitaux universitaires de Genève. Issues & pull requests at the source.
  • TypeScript 89.5%
  • MDX 4.4%
  • JavaScript 3.2%
  • CSS 2.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-23 21:26:37 +02:00
.github ci(tests): drop node20 2026-05-15 19:29:32 +02:00
.husky fix(husky): auto-fixed lint files are staged after commit 2024-09-09 20:37:24 +02:00
.vscode chore(vscode): add scss default formatter 2024-05-17 01:21:37 +02:00
projects chore: v12.2.3 2026-10-23 21:26:37 +02:00
.editorconfig First commit 2021-11-23 18:43:22 +01:00
.gitignore feat(hug-cli) 2023-03-10 20:40:11 +01:00
CODE_OF_CONDUCT.md First commit 2021-11-23 18:43:22 +01:00
CONTRIBUTING.md fix(links): links should now points to main instead of master 2022-01-08 13:55:09 +01:00
DEVELOPER.md feat(tests): add a test project 2024-07-14 00:50:17 +02:00
eslint.config.mjs refactor: major improvements 2026-07-12 23:42:55 +02:00
LICENSE First commit 2021-11-23 18:43:22 +01:00
package-lock.json chore: v12.2.3 2026-10-23 21:26:37 +02:00
package.json chore(deps): upgrade dependencies 2026-10-23 21:19:54 +02:00
preview.gif chore: preview 2024-08-09 00:35:46 +02:00
README.md docs: readme 2024-09-09 20:37:37 +02:00
tsconfig.base.json fix: resolve bundler issues introduced in tsdown@0.23 upgrade 2026-09-21 14:34:26 +02:00
tsconfig.hug.json feat(hug-cli) 2023-03-10 20:40:11 +01:00
tsconfig.json refactor: tsconfig 2026-07-13 15:32:39 +02:00

@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

preview

export default (options: MySchematicOptions): Rule =>
  schematic('my-schematic', [
    modifyJsonFile('tsconfig.json', ['compilerOptions', 'strict'], true),
    rule((tree, context): Rule => {
      ... return renameFile('old-file', 'new-file');
      ... return chain([]);
      ... return noop();
    }),

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

    application(options.project)
      .deployFiles(options)
      .addProviderToBootstrapApplication('__MAIN__', 'provideAnimations()', '@angular/platform-browser/animations'),
      .addImportToFile('__SRC__/file.ts', 'environment', './environments/environment')
      .deleteFiles(['karma.conf.js'])
      .rule(({ project }: ChainableApplicationContext) => {
        return createOrUpdateFile(project.pathFromRoot('README.md'), project.name);
      })
      .toRule(),

    library(options.project)
      .downloadFile('https://my-cdn.com/icons/icon.png', '__SRC__/assets/icons/icon.png')
      .toRule(),

    runAtEnd(logAction('Have a look at `./package.json` file and make modifications as needed.'))

  ], 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