Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 97434e4

Browse files
committed
add core file descriptions
1 parent 374127e commit 97434e4

File tree

1 file changed

+78
-43
lines changed

1 file changed

+78
-43
lines changed

public/docs/ts/latest/cookbook/third-party-lib.jade

Lines changed: 78 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -92,49 +92,64 @@ code-example(language="sh" class="code-shell").
9292
a#seed
9393
.l-main-section
9494
:marked
95-
## What's in the QuickStart seed?
95+
## What's in the QuickStart Library seed?
9696

97-
block qs-seed
98-
:marked
99-
The **QuickStart seed** contains the same application as the QuickStart playground.
100-
But its true purpose is to provide a solid foundation for _local_ development.
101-
Consequently, there are _many more files_ in the project folder on your machine,
102-
most of which you can [learn about later](setup-systemjs-anatomy.html "Setup Anatomy").
97+
The **QuickStart Library seed** contains a similar structure to the **Quickstart seed*.
98+
It's modified to build and test a library instead of an application.
99+
100+
Consequently, there are _many different files_ in the project,
101+
most of which you can [learn about later](library-setup-anatomy.html "Library Setup Anatomy").
103102

104-
block core-files
105-
a#app-files
106-
:marked
107-
Focus on the following three TypeScript (`.ts`) files in the **`/src`** folder.
103+
Focus on the following TypeScript (`.ts`) files in the **`/src`** folder.
108104

109-
.filetree
110-
.file src
105+
.filetree
106+
.file src
107+
.children
108+
.file demo
111109
.children
112110
.file app
113111
.children
114112
.file app.component.ts
115113
.file app.module.ts
116-
.file main.ts
117-
118-
+makeTabs(`
119-
setup/ts/src/app/app.component.ts,
120-
setup/ts/src/app/app.module.ts,
121-
setup/ts/src/main.ts
122-
`, '', `
123-
src/app/app.component.ts,
124-
src/app/app.module.ts,
125-
src/main.ts
126-
`)(format='.')
114+
.file lib
115+
.children
116+
.file component
117+
.children
118+
.file lib.component.ts
119+
.file service
120+
.children
121+
.file lib.service.ts
122+
.file index.ts
123+
.file module.ts
124+
125+
+makeTabs(`
126+
quickstart-lib/ts/src/demo/app/app.component.ts,
127+
quickstart-lib/ts/src/demo/app/app.module.ts,
128+
quickstart-lib/ts/src/lib/component/lib.component.ts,
129+
quickstart-lib/ts/src/lib/service/lib.service.ts,
130+
quickstart-lib/ts/src/lib/index.ts,
131+
quickstart-lib/ts/src/lib/module.ts
132+
`, '', `
133+
src/demo/app/app.component.ts,
134+
src/demo/app/app.module.ts,
135+
src/lib/component/lib.component.ts,
136+
src/lib/service/lib.service.ts,
137+
src/lib/index.ts,
138+
src/lib/module.ts
139+
`)(format='.')
127140

128141
:marked
129142
Each file has a distinct purpose and evolves independently as the application grows.
130143

131144
Files outside `src/` concern building, deploying, and testing your app.
132145
They include configuration files and external dependencies.
133146

134-
Files inside `src/` "belong" to your app.
135-
Add new Typescript, HTML and CSS files inside the `src/` directory, most of them inside `src/app`,
136-
unless told to do otherwise.
147+
Files inside `src/lib` "belong" to your library, while `src/demo` contains a demo application
148+
that loads your library.
137149

150+
Libraries do not run by themselves, so it's very useful to have this "demo" app while developing
151+
to see how your library would look like to consumers.
152+
138153
The following are all in `src/`
139154

140155
style td, th {vertical-align: top}
@@ -145,29 +160,36 @@ table(width="100%")
145160
th File
146161
th Purpose
147162
tr
148-
td <ngio-ex>app/app.component.ts</ngio-ex>
163+
td <ngio-ex>demo/app/app.component.ts</ngio-ex>
149164
td
150165
:marked
151-
Defines the same `AppComponent` as the one in the QuickStart.
152-
It is the **root** component of what will become a tree of nested components
153-
as the application evolves.
154-
tr(if-docs="ts")
155-
td <code>app/app.module.ts</code>
166+
A demo component that renders the library component and a value from the library service.
167+
tr
168+
td <code>demo/app/app.module.ts</code>
169+
td
170+
:marked
171+
A demo `NgModule` that imports the Library `LibModule`.
172+
tr
173+
td <ngio-ex>lib/component/app.component.ts</ngio-ex>
174+
td
175+
:marked
176+
A sample library component that renders an `h2` tag.
177+
tr
178+
td <code>lib/service/lib.service.ts</code>
156179
td
157180
:marked
158-
Defines `AppModule`, the [root module](appmodule.html "AppModule: the root module") that tells Angular how to assemble the application.
159-
Right now it declares only the `AppComponent`.
160-
Soon there will be more components to declare.
181+
A sample library service that exports a value.
161182
tr
162-
td <ngio-ex>main.ts</ngio-ex>
183+
td <code>lib/index.ts</code>
163184
td
164185
:marked
165-
Compiles the application with the [JIT compiler](../glossary.html#jit) and
166-
[bootstraps](appmodule.html#main "bootstrap the application")
167-
the application's main module (`AppModule`) to run in the browser.
168-
The JIT compiler is a reasonable choice during the development of most projects and
169-
it's the only viable choice for a sample running in a _live-coding_ environment like Plunker.
170-
You'll learn about alternative compiling and [deployment](deployment.html) options later in the documentation.
186+
The public API of your library, where you choose what to export to consumers.
187+
tr
188+
td <code>lib/module.ts</code>
189+
td
190+
:marked
191+
The library's main `NgModule`, `LibModule`.
192+
171193

172194

173195
.l-main-section
@@ -184,6 +206,19 @@ table(width="100%")
184206

185207
If you're new to Angular, we recommend staying on the [learning path](learning-angular.html "Angular learning path").
186208

209+
210+
.l-main-section
211+
:marked
212+
## Appendix: library-setup-anatomy
213+
214+
content
215+
216+
.l-main-section
217+
:marked
218+
## Appendix: testing libraries
219+
220+
content
221+
187222
=============
188223

189224
.l-main-section

0 commit comments

Comments
 (0)