Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/site/Application-generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ lb4 [app] [options] [<name>]
`--loopbackBuild` : Add @loopback/build module's script set to LoopBack4
application project.

`--vscode`: Add VSCode config files to LoopBack4 application project

{% include_relative includes/CLI-std-options.md %}

### Arguments
Expand Down Expand Up @@ -66,6 +68,7 @@ The tool will prompt you for:
- [`prettier`](https://www.npmjs.com/package/prettier)
- [`mocha`](https://www.npmjs.com/package/mocha)
- [`@loopback/build`](https://www.npmjs.com/package/@loopback/build)
- [`vscode`](https://code.visualstudio.com/)

### Output

Expand Down
3 changes: 3 additions & 0 deletions docs/site/Extension-generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ lb4 extension [options] [<name>]
`--loopbackBuild` : Add @loopback/build module's script set to LoopBack4
extension project.

`--vscode`: Add VSCode config files to LoopBack4 application project

{% include_relative includes/CLI-std-options.md %}

### Arguments
Expand Down Expand Up @@ -60,3 +62,4 @@ The tool will prompt you for:
- [`prettier`](https://www.npmjs.com/package/prettier)
- [`mocha`](https://www.npmjs.com/package/mocha)
- [`@loopback/build`](https://www.npmjs.com/package/@loopback/build)
- [`vscode`](https://code.visualstudio.com/)
2 changes: 1 addition & 1 deletion docs/site/Getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Answer the prompts as follows:
? Project description: Getting started tutorial
? Project root directory: (getting-started)
? Application class name: StarterApplication
? Select project build settings: Enable tslint, Enable prettier, Enable mocha, Enable loopbackBuild
? Select project build settings: Enable tslint, Enable prettier, Enable mocha, Enable loopbackBuild, Enable vscode
```

### Starting the project
Expand Down
43 changes: 22 additions & 21 deletions docs/site/todo-tutorial-scaffolding.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ $ lb4 app
◉ Enable prettier
◉ Enable mocha
◉ Enable loopbackBuild
◉ Enable vscode
# npm will install dependencies now
Application todo-list is now created in todo-list.
```
Expand Down Expand Up @@ -72,27 +73,27 @@ tslint.build.json
tslint.json
```

| File | Purpose |
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| index.ts | Allows importing contents of the `src` folder (for use elsewhere) |
| index.js | Top-level wireup for execution of the application. |
| package.json | Your application's package manifest. See [package.json](https://docs.npmjs.com/files/package.json) for details. |
| tsconfig.json | The TypeScript project configuration. See [tsconfig.json](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) for details. |
| tslint.json | [TSLint configuration](https://palantir.github.io/tslint/usage/tslint-json/) |
| tslint.build.json | [TSLint configuration (build only)](https://palantir.github.io/tslint/usage/tslint-json/) |
| README.md | The Markdown-based README generated for your application. |
| LICENSE | A copy of the MIT license. If you do not wish to use this license, please delete this file. |
| src/application.ts | The application class, which extends [`RestApplication`](http://apidocs.strongloop.com/@loopback%2frest/#RestApplication) by default. This is the root of your application, and is where your application will be configured. |
| src/index.ts | The starting point of your microservice. This file creates an instance of your application, runs the booter, then attempts to start the [`RestServer`](http://apidocs.strongloop.com/@loopback%2frest/#RestServer) instance bound to the application. |
| src/sequence.ts | An extension of the [Sequence](Sequence.md) class used to define the set of actions to take during a REST request/response. |
| src/controllers/README.md | Provides information about the controller directory, how to generate new controllers, and where to find more information. |
| src/controllers/ping.controller.ts | A basic controller that responds to GET requests at `/ping`. |
| src/datasources/README.md | Provides information about the datasources directory, how to generate new datasources, and where to find more information. |
| src/models/README.md | Provides information about the datasources directory, how to generate new datasources, and where to find more information. |
| src/repositories/README.md | Provides information about the repositories directory, how to generate new repositories, and where to find more information. |
| test/README.md | Please place your tests in this folder. |
| test/mocha.opts | [Mocha](https://mochajs.org/) configuration for running your application's tests. |
| test/acceptance/ping.controller.acceptance.ts | An example test to go with the ping controller in `src/controllers`. |
| File | Purpose |
| --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| index.ts | Allows importing contents of the `src` folder (for use elsewhere) |
| index.js | Top-level wireup for execution of the application. |
| package.json | Your application's package manifest. See [package.json](https://docs.npmjs.com/files/package.json) for details. |
| tsconfig.json | The TypeScript project configuration. See [tsconfig.json](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) for details. |
| tslint.json | [TSLint configuration](https://palantir.github.io/tslint/usage/tslint-json/) |
| tslint.build.json | [TSLint configuration (build only)](https://palantir.github.io/tslint/usage/tslint-json/) |
| README.md | The Markdown-based README generated for your application. |
| LICENSE | A copy of the MIT license. If you do not wish to use this license, please delete this file. |
| src/application.ts | The application class, which extends [`RestApplication`](http://apidocs.strongloop.com/@loopback%2frest/#RestApplication) by default. This is the root of your application, and is where your application will be configured. |
| src/index.ts | The starting point of your microservice. This file creates an instance of your application, runs the booter, then attempts to start the [`RestServer`](http://apidocs.strongloop.com/@loopback%2frest/#RestServer) instance bound to the application. |
| src/sequence.ts | An extension of the [Sequence](Sequence.md) class used to define the set of actions to take during a REST request/response. |
| src/controllers/README.md | Provides information about the controller directory, how to generate new controllers, and where to find more information. |
| src/controllers/ping.controller.ts | A basic controller that responds to GET requests at `/ping`. |
| src/datasources/README.md | Provides information about the datasources directory, how to generate new datasources, and where to find more information. |
| src/models/README.md | Provides information about the datasources directory, how to generate new datasources, and where to find more information. |
| src/repositories/README.md | Provides information about the repositories directory, how to generate new repositories, and where to find more information. |
| test/README.md | Please place your tests in this folder. |
| test/mocha.opts | [Mocha](https://mochajs.org/) configuration for running your application's tests. |
| test/acceptance/ping.controller.acceptance.ts | An example test to go with the ping controller in `src/controllers`. |

### Navigation

Expand Down
2 changes: 2 additions & 0 deletions examples/hello-world/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist*
*.json
6 changes: 6 additions & 0 deletions examples/hello-world/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"bracketSpacing": false,
"singleQuote": true,
"printWidth": 80,
"trailingComma": "all"
}
21 changes: 21 additions & 0 deletions examples/hello-world/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"editor.rulers": [80],
"editor.tabCompletion": true,
"editor.tabSize": 2,
"editor.trimAutoWhitespace": true,
"editor.formatOnSave": true,

"files.exclude": {
"**/.DS_Store": true,
"**/.git": true,
"**/.hg": true,
"**/.svn": true,
"**/CVS": true,
"dist*": true,
},
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,

"tslint.ignoreDefinitionFiles": true,
"typescript.tsdk": "./node_modules/typescript/lib"
}
29 changes: 29 additions & 0 deletions examples/hello-world/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Watch and Compile Project",
"type": "shell",
"command": "npm",
"args": ["--silent", "run", "build:watch"],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no matching build:watch in package.json.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$tsc-watch"
},
{
"label": "Build, Test and Lint",
"type": "shell",
"command": "npm",
"args": ["--silent", "run", "test:dev"],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be test?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'advocated' development pattern according to DEVELOPING.md was to have build:watch running and then running the tests without building (since build:watch takes care of that). test:dev is just npm t without the build step

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok. Makes sense. 👍

"group": {
"kind": "test",
"isDefault": true
},
"problemMatcher": ["$tsc", "$tslint5"]
}
]
}
15 changes: 14 additions & 1 deletion examples/hello-world/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,23 @@
"build:current": "lb-tsc",
"build:dist8": "lb-tsc es2017",
"build:dist10": "lb-tsc es2018",
"build:watch": "lb-tsc --watch",
"clean": "lb-clean *example-hello-world*.tgz dist* package api-docs",
"verify": "npm pack && tar xf *example-hello-world*.tgz && tree package && npm run clean",
"lint": "npm run prettier:check && npm run tslint",
"lint:fix": "npm run prettier:fix && npm run tslint:fix",
"prettier:cli": "lb-prettier \"**/*.ts\" \"**/*.js\"",
"prettier:check": "npm run prettier:cli -- -l",
"prettier:fix": "npm run prettier:cli -- --write",
"tslint": "lb-tslint",
"tslint:fix": "npm run tslint -- --fix",
"pretest": "npm run clean && npm run build:current",
"test": "lb-mocha --allow-console-logs \"DIST/test\"",
"posttest": "npm run lint",
"test:dev": "lb-mocha --allow-console-logs DIST/test/**/*.js && npm run posttest",
"prestart": "npm run build:current",
"start": "node ."
"start": "node .",
"prepublishOnly": "npm run test"
},
"repository": {
"type": "git",
Expand Down
4 changes: 4 additions & 0 deletions examples/hello-world/tslint.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "http://json.schemastore.org/tslint",
"extends": ["./node_modules/@loopback/build/config/tslint.build.json"]
}
4 changes: 4 additions & 0 deletions examples/hello-world/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "http://json.schemastore.org/tslint",
"extends": ["./node_modules/@loopback/build/config/tslint.common.json"]
}
4 changes: 2 additions & 2 deletions examples/log-extension/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dist
dist6
dist*
*.json
6 changes: 6 additions & 0 deletions examples/log-extension/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"bracketSpacing": false,
"singleQuote": true,
"printWidth": 80,
"trailingComma": "all"
}
21 changes: 21 additions & 0 deletions examples/log-extension/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"editor.rulers": [80],
"editor.tabCompletion": true,
"editor.tabSize": 2,
"editor.trimAutoWhitespace": true,
"editor.formatOnSave": true,

"files.exclude": {
"**/.DS_Store": true,
"**/.git": true,
"**/.hg": true,
"**/.svn": true,
"**/CVS": true,
"dist*": true,
},
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,

"tslint.ignoreDefinitionFiles": true,
"typescript.tsdk": "./node_modules/typescript/lib"
}
29 changes: 29 additions & 0 deletions examples/log-extension/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Watch and Compile Project",
"type": "shell",
"command": "npm",
"args": ["--silent", "run", "build:watch"],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$tsc-watch"
},
{
"label": "Build, Test and Lint",
"type": "shell",
"command": "npm",
"args": ["--silent", "run", "test:dev"],
"group": {
"kind": "test",
"isDefault": true
},
"problemMatcher": ["$tsc", "$tslint5"]
}
]
}
1 change: 1 addition & 0 deletions examples/log-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"pretest": "npm run clean && npm run build:current",
"test": "lb-mocha \"DIST/test/unit/**/*.js\" \"DIST/test/acceptance/**/*.js\"",
"posttest": "npm run lint",
"test:dev": "lb-mocha --allow-console-logs DIST/test/**/*.js && npm run posttest",
"verify": "npm pack && tar xf *example-log-extension*.tgz && tree package && npm run clean"
},
"repository": {
Expand Down
4 changes: 4 additions & 0 deletions examples/log-extension/tslint.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "http://json.schemastore.org/tslint",
"extends": ["./node_modules/@loopback/build/config/tslint.build.json"]
}
4 changes: 4 additions & 0 deletions examples/log-extension/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "http://json.schemastore.org/tslint",
"extends": ["./node_modules/@loopback/build/config/tslint.common.json"]
}
4 changes: 2 additions & 2 deletions examples/rpc-server/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
*.js
*.d.ts
dist*
*.json
6 changes: 6 additions & 0 deletions examples/rpc-server/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"bracketSpacing": false,
"singleQuote": true,
"printWidth": 80,
"trailingComma": "all"
}
21 changes: 21 additions & 0 deletions examples/rpc-server/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"editor.rulers": [80],
"editor.tabCompletion": true,
"editor.tabSize": 2,
"editor.trimAutoWhitespace": true,
"editor.formatOnSave": true,

"files.exclude": {
"**/.DS_Store": true,
"**/.git": true,
"**/.hg": true,
"**/.svn": true,
"**/CVS": true,
"dist*": true,
},
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,

"tslint.ignoreDefinitionFiles": true,
"typescript.tsdk": "./node_modules/typescript/lib"
}
Loading