Skip to content

Commit 87a8e97

Browse files
initial checkin
0 parents  commit 87a8e97

26 files changed

+6828
-0
lines changed

.circleci/config.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: 2
2+
3+
jobs:
4+
build:
5+
6+
docker:
7+
- image: circleci/node:12-browsers
8+
9+
steps:
10+
- checkout
11+
12+
- restore_cache:
13+
key: dependency-cache-{{ checksum "src/package.json" }}
14+
- run: cd src && npm i --silent
15+
- save_cache:
16+
key: dependency-cache-{{ checksum "src/package.json" }}
17+
paths:
18+
- src/node_modules
19+
- run: cd src && npm run build
20+
- run: cd src && npm run test
21+
- run: cd src/dist && sudo npm link
22+
23+
- run: sudo -E npm install -g @angular/cli@next
24+
- run: sudo -E ng new your-angular-project --defaults
25+
- run: cd your-angular-project && sudo -E npm link ngx-deploy-starter
26+
- run: cd your-angular-project && sudo -E ng add ngx-deploy-starter
27+
- run: cd your-angular-project && sudo -E ng deploy

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Editor configuration, see http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
max_line_length = off
13+
trim_trailing_whitespace = false

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
node_modules
2+
.tmp
3+
.sass-cache
4+
.DS_Store
5+
.bash_history
6+
*.swp
7+
*.swo
8+
*.d.ts
9+
10+
*.classpath
11+
*.project
12+
*.settings/
13+
*.classpath
14+
*.project
15+
*.settings/
16+
17+
.vim/bundle
18+
nvim/autoload
19+
nvim/plugged
20+
nvim/doc
21+
nvim/swaps
22+
nvim/colors
23+
dist
24+
25+
/src/mini-testdrive/404.html
26+
/src/mini-testdrive/CNAME
27+
.angulardoc.json

.vscode/launch.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Debug Jest Tests",
6+
"type": "node",
7+
"request": "launch",
8+
"runtimeArgs": [
9+
"--inspect-brk",
10+
"${workspaceRoot}/src/node_modules/.bin/jest",
11+
"--runInBand"
12+
],
13+
"cwd": "${workspaceFolder}/src",
14+
"console": "integratedTerminal",
15+
"internalConsoleOptions": "neverOpen",
16+
"port": 9229
17+
}
18+
]
19+
}

.vscode/tasks.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "npm",
8+
"script": "build",
9+
"path": "src/",
10+
"label": "npm build"
11+
}
12+
]
13+
}

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019 Minko Gechev, Johannes Hoppe
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# @angular-schule/ngx-deploy-starter 🚀
2+
[![NPM version][npm-image]][npm-url]
3+
[![The MIT License](https://img.shields.io/badge/license-MIT-orange.svg?color=blue&style=flat-square)](http://opensource.org/licenses/MIT)
4+
5+
![Banner](docs/ng-deploy-starter-project.jpg)
6+
7+
## About
8+
9+
This is a sample project that helps you to implement your own __deployment builder__ (`ng deploy`) for the Angular CLI.
10+
The groundwork of this starter was provided by Minko Gechev's [ngx-gh project](https://github.com/mgechev/ngx-gh).
11+
12+
This project has the following purposes:
13+
14+
1. To promote the adoption of `ng deploy`.
15+
2. To clarify various questions and to standardise the experience of the various builders.
16+
17+
We hope for an inspiring discussion, pull requests and questions.
18+
19+
**If you don't know `ng deploy` yet, learn more about this command here:
20+
[👉 Blogpost: All you need to know about `ng deploy`](https://angular.schule/blog/2019-08-ng-deploy)**
21+
22+
## Essential considerations
23+
24+
There are still differences between the existing builders.
25+
Let's find some rules that everyone agrees with. Here are two proposals.
26+
27+
### 1. A deployment builder must always compile the project before the deployment
28+
29+
To reduce the chances to deploy corrupted assets, it's important to build the app right before deploying it. ([source](https://github.com/angular-schule/website-articles/pull/3#discussion_r315802100))
30+
31+
**Current state:**
32+
Currently there are existing deployment builders that only build in production mode.
33+
This might be not enough.
34+
There is also the approach not to perform the build step at all.
35+
36+
**Our suggestion:**
37+
By default, a deployment builder **shall** compile in `production` mode, but it **should** be possible to override the default configuration using the option `--configuration`.
38+
39+
Discussion: https://github.com/angular-schule/ngx-deploy-starter/issues/1
40+
41+
### 2. A deployment builder should have an interactive prompt after the "ng add".
42+
43+
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`.
44+
The data should be persisted in the `angular.json` file.
45+
46+
**Note:**
47+
This feature is not implemented for this starter yet, but we are looking forward to your support.
48+
49+
Discussion: https://github.com/angular-schule/ngx-deploy-starter/issues/2
50+
51+
### 3. More to come
52+
53+
What's bothers you about this example?
54+
We appreciate your [feedback](https://github.com/angular-schule/ngx-deploy-starter/issues)!
55+
56+
57+
## How to make your own deploy builder
58+
59+
1. fork this repository
60+
2. adjust the `package.json`
61+
3. search and replace for the string `@angular-schule/ngx-deploy-starter` and `ngx-deploy-starter` and choose your own name.
62+
4. search and replace for the string `to the file system` and name your deploy target.
63+
5. add your deployment code to `src/engine/engine.ts`, take care of the tests
64+
6. follow the instructions from the [contributors README](docs/README_contributors.md) for build, test and publishing.
65+
66+
67+
You are free to customise this project according to your needs.
68+
Please keep the spirit of Open Source alive and use the MIT or a compatible license.
69+
70+
71+
## Projects based on ngx-deploy-starter
72+
73+
* [ngx-deploy-npm](https://github.com/bikecoders/ngx-deploy-npm) – Deploy your Angular Package to NPM directly from the Angular CLI! 🚀
74+
* [angular-cli-ghpages](https://github.com/angular-schule/angular-cli-ghpages) – Deploy your Angular app to GitHub pages directly from the Angular CLI! 🚀
75+
76+
77+
78+
79+
## License
80+
Code released under the [MIT license](LICENSE).
81+
82+
83+
[npm-url]: https://www.npmjs.com/package/@angular-schule/ngx-deploy-starter
84+
[npm-image]: https://badge.fury.io/js/%40angular-schule%2Fngx-deploy-starter.svg

docs/README_contributors.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# @angular-schule/ngx-deploy-starter: README for contributors
2+
3+
## How to start <a name="start"></a>
4+
5+
tl;dr – execute this:
6+
7+
```
8+
cd src
9+
npm i
10+
npm run build
11+
npm test
12+
```
13+
14+
15+
## Local development
16+
17+
If you want to try the latest package locally without installing it from NPM, use the following instructions.
18+
This may be useful when you want to try the latest non-published version of this library or you want to make a contribution.
19+
20+
Follow the instructions for [checking and updating the Angular CLI version](#angular-cli) and then link the package.
21+
22+
23+
### 1. Angular CLI
24+
25+
1. Install the next version of the Angular CLI.
26+
27+
```sh
28+
npm install -g @angular/cli
29+
```
30+
31+
2. Run `ng version`, make sure you have installed Angular CLI v8.3.0 or greater.
32+
33+
3. Update your existing project using the command:
34+
35+
```sh
36+
ng update @angular/cli @angular/core
37+
```
38+
39+
40+
### 2. npm link
41+
42+
Use the following instructions to make `@angular-schule/ngx-deploy-starter` available locally via `npm link`.
43+
44+
1. Clone the project
45+
46+
```sh
47+
git clone https://github.com/angular-schule/ngx-deploy-starter.git
48+
cd ngx-deploy-starter
49+
```
50+
51+
2. Install the dependencies
52+
53+
```sh
54+
cd src
55+
npm install
56+
```
57+
58+
3. Build the project:
59+
60+
```sh
61+
npm run build
62+
```
63+
64+
4. Create a local npm link:
65+
66+
```sh
67+
cd dist
68+
npm link
69+
```
70+
71+
Read more about the `link` feature in the [official NPM documentation](https://docs.npmjs.com/cli/link).
72+
73+
74+
### 3. Adding to an Angular project -- ng add
75+
76+
Once you have completed the previous steps to `npm link` the local copy of `@angular-schule/ngx-deploy-starter`, follow these steps to use it in a local Angular project.
77+
78+
1. Enter the project directory
79+
80+
```sh
81+
cd your-angular-project
82+
```
83+
84+
2. Add the local version of `@angular-schule/ngx-deploy-starter`.
85+
86+
```sh
87+
npm link @angular-schule/ngx-deploy-starter
88+
```
89+
90+
3. Now execute the `ng-add` schematic.
91+
92+
```sh
93+
ng add @angular-schule/ngx-deploy-starter
94+
```
95+
96+
4. You can now deploy your angular app to GitHub pages.
97+
98+
```sh
99+
ng deploy
100+
```
101+
102+
Or with the old builder syntax:
103+
104+
```sh
105+
ng run your-angular-project:deploy
106+
```
107+
108+
5. You can remove the link later by running `npm unlink`
109+
110+
111+
### 4. Testing
112+
113+
Testing is done with [Jest](https://jestjs.io/).
114+
To run the tests:
115+
116+
```sh
117+
cd ngx-deploy-starter/src
118+
npm test
119+
```
120+
121+
122+
123+
## Publish to NPM
124+
125+
```
126+
cd ngx-deploy-starter/src
127+
npm run build
128+
npm run test
129+
npm publish dist --access public
130+
```

docs/ng-deploy-starter-project.jpg

227 KB
Loading

0 commit comments

Comments
 (0)