/ngx-deploy-starter

Starter repository to create a new builder to utilize the `ng deploy` command 🚀

Primary LanguageTypeScriptMIT LicenseMIT

@angular-schule/ngx-deploy-starter 🚀

NPM version The MIT License

Banner

About

This is a sample project that helps you to implement your own deployment builder (ng deploy) for the Angular CLI. The groundwork of this starter was provided by Minko Gechev's ngx-gh project.

This project has the following purposes:

  1. To promote the adoption of ng deploy.
  2. To clarify various questions and to standardise the experience of the various builders.

We hope for an inspiring discussion, pull requests and questions.

If you don't know ng deploy yet, learn more about this command here:
👉 Blogpost: All you need to know about ng deploy

Essential considerations

There are still differences between the existing builders. Let's find some rules that everyone agrees with. Here are two proposals.

1. A deployment builder must always compile the project before the deployment

To reduce the chances to deploy corrupted assets, it's important to build the app right before deploying it. (source)

Current state:
Currently there are existing deployment builders that only build in production mode. This might be not enough. There is also the approach not to perform the build step at all.

Our suggestion:
By default, a deployment builder shall compile in production mode, but it should be possible to override the default configuration using the option --configuration.

Discussion: angular-schule#1

2. A deployment builder should have an interactive prompt after the "ng add".

To make it easier for the end user to get started, a deployment builder should ask for all the mandatory questions immediately after the ng add. The data should be persisted in the angular.json file.

Note:
This feature is not implemented for this starter yet, but we are looking forward to your support.

Discussion: angular-schule#2

3. More to come

What's bothers you about this example? We appreciate your feedback!

How to make your own deploy builder

  1. fork this repository
  2. adjust the package.json
  3. search and replace for the string @angular-schule/ngx-deploy-starter and ngx-deploy-starter and choose your own name.
  4. search and replace for the string to the file system and name your deploy target.
  5. add your deployment code to src/engine/engine.ts, take care of the tests
  6. follow the instructions from the contributors README for build, test and publishing.

You are free to customise this project according to your needs. Please keep the spirit of Open Source alive and use the MIT or a compatible license.

License

Code released under the MIT license.