Skip to content

Commit c2893b2

Browse files
author
Dave Syer
committed
Move client code up to top level
IDE assumes it will be there (e.g. using VSCode)
1 parent f34c334 commit c2893b2

33 files changed

+60
-66
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"apps": [
77
{
88
"root": "src",
9-
"outDir": "../../../target/classes/static",
9+
"outDir": "target/classes/static",
1010
"assets": [
1111
"assets",
1212
"favicon.ico"
@@ -63,7 +63,7 @@
6363
"spec": false
6464
},
6565
"component": {
66-
66+
6767
}
6868
}
6969
}

.gitignore

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,47 @@ build/
2222
nbbuild/
2323
dist/
2424
nbdist/
25-
.nb-gradle/
25+
.nb-gradle/# See http://help.github.com/ignore-files/ for more about ignoring files.
26+
27+
# compiled output
28+
/target
29+
/dist
30+
/tmp
31+
/out-tsc
32+
33+
# dependencies
34+
/node
35+
/node_modules
36+
37+
# IDEs and editors
38+
/.idea
39+
.project
40+
.classpath
41+
.c9/
42+
*.launch
43+
.settings/
44+
*.sublime-workspace
45+
46+
# IDE - VSCode
47+
.vscode/*
48+
!.vscode/settings.json
49+
!.vscode/tasks.json
50+
!.vscode/launch.json
51+
!.vscode/extensions.json
52+
53+
# misc
54+
/.sass-cache
55+
/connect.lock
56+
/coverage
57+
/libpeerconnection.log
58+
npm-debug.log
59+
testem.log
60+
/typings
61+
62+
# e2e
63+
/e2e/*.js
64+
/e2e/*.map
65+
66+
# System Files
67+
.DS_Store
68+
Thumbs.db

README.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ PATH="$PWD/node/":$PWD:$PATH
8888
node_modules/@angular/cli/bin/ng "$@"
8989
$ chmod +x ng
9090
$ ./ng --version
91-
_ _ ____ _ ___
91+
_ _ ____ _ ___
9292
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
9393
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
9494
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
@@ -101,29 +101,25 @@ os: linux x64
101101

102102
## Create an Angular App
103103

104-
The Angular CLI can be used to generate new application scaffolding, as well as other things. It's a useful starting point, but you could at this point grab any existing Angular app and put it in the same place. We want to work with the Angular app in a subdirectory of `src/main`, just to keep the source code tidy and make it look like a regular Maven build.
104+
The Angular CLI can be used to generate new application scaffolding, as well as other things. It's a useful starting point, but you could at this point grab any existing Angular app and put it in the same place. We want to work with the Angular app in the top level directory to keep all the tools and IDEs happy, but we also want make it look like a regular Maven build.
105105

106-
Create the app with the CLI and move it to `src/main`:
106+
Create the app with the CLI and move it to the top level:
107107

108108
```
109109
$ ./ng new client
110110
$ rm -rf client/node* client/src/favicon.ico
111-
$ mv client src/main
112-
$ sed -i -e 's,dist,../../../target/classes/static,' src/main/client/.angular-cli.json
113-
$ mv ng npm src/main/client
111+
$ cat client/.gitignore >> gitignore
112+
$ rm client/.gitignore
113+
$ cp -rf client/* .
114+
$ cp client/.??* .
115+
$ sed -i -e 's,dist,target/classes/static,' .angular-cli.json
114116
```
115117

116-
We discarded the node modules that the CLI installed because we want the frontend plugin to do that work for us in an automated build. We also edited the `.angular-cli.json` (a bit like a `pom.cxml` for the Angular CLI app) to point the output from the ANgular build to a location that will be packaged in our JAR file.
118+
We discarded the node modules that the CLI installed because we want the frontend plugin to do that work for us in an automated build. We also edited the `.angular-cli.json` (a bit like a `pom.xml` for the Angular CLI app) to point the output from the ANgular build to a location that will be packaged in our JAR file.
117119

118120
## Building
119121

120-
Add this to the frontend plugin configuration:
121-
122-
```
123-
<workingDirectory>src/main/client</workingDirectory>
124-
```
125-
126-
and add an execution to install the modules used in the application:
122+
Add an execution to install the modules used in the application:
127123

128124
```
129125
<execution>
@@ -137,7 +133,7 @@ and add an execution to install the modules used in the application:
137133
Install the modules again using `./mvnw generate-resources`.
138134

139135
```
140-
$ src/main/client/ng version
136+
$ ng version
141137
_ _ ____ _ ___
142138
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
143139
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
@@ -165,7 +161,7 @@ typescript: 2.3.4
165161
At this point, the tests work:
166162

167163
```
168-
$ src/main/client/ng e2e
164+
$ ./ng e2e
169165
..
170166
[13:59:46] I/direct - Using ChromeDriver directly...
171167
Jasmine started
@@ -199,7 +195,7 @@ then the client app will be compiled during the Maven build.
199195
You can build continuously with
200196

201197
```
202-
$ src/main/client/ng build --watch
198+
$ ./ng build --watch
203199
```
204200

205201
Updates are built (quickly) and pushed to `target/classes` where they can be picked up by Spring Boot. Your IDE might need to be tweaked to pick up the changes automatically (Spring Tool Suite does it out of the box).
@@ -237,7 +233,7 @@ With that in place your `Tasks->Run Task...` menu should include the `ng-watch`
237233
You can add basic Twitter Bootstrap features to make the app look a bit less dull (taken from [this blog](https://medium.com/codingthesmartway-com-blog/using-bootstrap-with-angular-c83c3cee3f4a)):
238234

239235
```
240-
$ src/main/client/npm install bootstrap@3 jquery --save
236+
$ ./npm install bootstrap@3 jquery --save
241237
```
242238

243239
and update `.angular-cli.json` to add the new content:
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)