Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/DSI-HUG/ngx-schematics-utilities
π Useful utilities for Angular Schematics
https://github.com/DSI-HUG/ngx-schematics-utilities
angular angular-cli angular-devkit ast blueprints code-generation devkit helpers scaffolding schematics sdk template tooling tools typescript utilities utils
Last synced: 2 months ago
JSON representation
π Useful utilities for Angular Schematics
- Host: GitHub
- URL: https://github.com/DSI-HUG/ngx-schematics-utilities
- Owner: DSI-HUG
- License: gpl-3.0
- Created: 2021-11-23T17:39:07.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-09T19:12:35.000Z (3 months ago)
- Last Synced: 2024-09-09T23:04:41.252Z (3 months ago)
- Topics: angular, angular-cli, angular-devkit, ast, blueprints, code-generation, devkit, helpers, scaffolding, schematics, sdk, template, tooling, tools, typescript, utilities, utils
- Language: TypeScript
- Homepage:
- Size: 5.91 MB
- Stars: 7
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-angular - ngx-schematics-utilities - Useful utilities for Angular Schematics. (Table of contents / Angular)
- fucking-awesome-angular - ngx-schematics-utilities - Useful utilities for Angular Schematics. (Table of contents / Angular)
README
@hug/ngx-schematics-utilities
Useful utilities for Angular Schematics
#### Schematics
> Schematics are generators that transform an existing filesystem.
> They can create files, refactor existing files, or move files around.[More info][schematics]
## 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][docs-site].
#### Example
![preview](preview.gif "Preview")
```ts
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][developer].
## 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][contributing], and learn about submission process, coding rules and more.
#### > Code of Conduct
Please read and follow the [Code of Conduct][codeofconduct], and help us keep this project open and inclusive.
## Credits
Copyright (C) 2021 [HUG - Hôpitaux Universitaires Genève][dsi-hug]
[![love@hug](https://img.shields.io/badge/@hug-%E2%9D%A4%EF%B8%8Flove-magenta)][dsi-hug]
[developer]: https://github.com/dsi-hug/ngx-schematics-utilities/blob/main/DEVELOPER.md
[contributing]: https://github.com/dsi-hug/ngx-schematics-utilities/blob/main/CONTRIBUTING.md
[codeofconduct]: https://github.com/dsi-hug/ngx-schematics-utilities/blob/main/CODE_OF_CONDUCT.md
[dsi-hug]: https://github.com/dsi-hug
[schematics]: https://angular.io/guide/schematics
[docs-site]: https://dsi-hug.github.io/ngx-schematics-utilities