Skip to content

Commit 3738b9c

Browse files
committed
feat(cli): add vscode config files
1 parent 37aba50 commit 3738b9c

42 files changed

Lines changed: 472 additions & 33 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/site/Application-generator.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ lb4 [app] [options] [<name>]
3333
`--loopbackBuild` : Add @loopback/build module's script set to LoopBack4
3434
application project.
3535

36+
`--vscode`: Add VSCode config files to LoopBack4 application project
37+
3638
{% include_relative includes/CLI-std-options.md %}
3739

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

7073
### Output
7174

docs/site/Extension-generator.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ lb4 extension [options] [<name>]
3131
`--loopbackBuild` : Add @loopback/build module's script set to LoopBack4
3232
extension project.
3333

34+
`--vscode`: Add VSCode config files to LoopBack4 application project
35+
3436
{% include_relative includes/CLI-std-options.md %}
3537

3638
### Arguments
@@ -60,3 +62,4 @@ The tool will prompt you for:
6062
- [`prettier`](https://www.npmjs.com/package/prettier)
6163
- [`mocha`](https://www.npmjs.com/package/mocha)
6264
- [`@loopback/build`](https://www.npmjs.com/package/@loopback/build)
65+
- [`vscode`](https://code.visualstudio.com/)

docs/site/Getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Answer the prompts as follows:
4242
? Project description: Getting started tutorial
4343
? Project root directory: (getting-started)
4444
? Application class name: StarterApplication
45-
? Select project build settings: Enable tslint, Enable prettier, Enable mocha, Enable loopbackBuild
45+
? Select project build settings: Enable tslint, Enable prettier, Enable mocha, Enable loopbackBuild, Enable vscode
4646
```
4747

4848
### Starting the project

docs/site/todo-tutorial-scaffolding.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ $ lb4 app
2828
◉ Enable prettier
2929
◉ Enable mocha
3030
◉ Enable loopbackBuild
31+
◉ Enable vscode
3132
# npm will install dependencies now
3233
Application todo-list is now created in todo-list.
3334
```
@@ -72,27 +73,27 @@ tslint.build.json
7273
tslint.json
7374
```
7475

75-
| File | Purpose |
76-
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
77-
| index.ts | Allows importing contents of the `src` folder (for use elsewhere) |
78-
| index.js | Top-level wireup for execution of the application. |
79-
| package.json | Your application's package manifest. See [package.json](https://docs.npmjs.com/files/package.json) for details. |
80-
| tsconfig.json | The TypeScript project configuration. See [tsconfig.json](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) for details. |
81-
| tslint.json | [TSLint configuration](https://palantir.github.io/tslint/usage/tslint-json/) |
82-
| tslint.build.json | [TSLint configuration (build only)](https://palantir.github.io/tslint/usage/tslint-json/) |
83-
| README.md | The Markdown-based README generated for your application. |
84-
| LICENSE | A copy of the MIT license. If you do not wish to use this license, please delete this file. |
85-
| 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. |
86-
| 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. |
87-
| 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. |
88-
| src/controllers/README.md | Provides information about the controller directory, how to generate new controllers, and where to find more information. |
89-
| src/controllers/ping.controller.ts | A basic controller that responds to GET requests at `/ping`. |
90-
| src/datasources/README.md | Provides information about the datasources directory, how to generate new datasources, and where to find more information. |
91-
| src/models/README.md | Provides information about the datasources directory, how to generate new datasources, and where to find more information. |
92-
| src/repositories/README.md | Provides information about the repositories directory, how to generate new repositories, and where to find more information. |
93-
| test/README.md | Please place your tests in this folder. |
94-
| test/mocha.opts | [Mocha](https://mochajs.org/) configuration for running your application's tests. |
95-
| test/acceptance/ping.controller.acceptance.ts | An example test to go with the ping controller in `src/controllers`. |
76+
| File | Purpose |
77+
| --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
78+
| index.ts | Allows importing contents of the `src` folder (for use elsewhere) |
79+
| index.js | Top-level wireup for execution of the application. |
80+
| package.json | Your application's package manifest. See [package.json](https://docs.npmjs.com/files/package.json) for details. |
81+
| tsconfig.json | The TypeScript project configuration. See [tsconfig.json](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) for details. |
82+
| tslint.json | [TSLint configuration](https://palantir.github.io/tslint/usage/tslint-json/) |
83+
| tslint.build.json | [TSLint configuration (build only)](https://palantir.github.io/tslint/usage/tslint-json/) |
84+
| README.md | The Markdown-based README generated for your application. |
85+
| LICENSE | A copy of the MIT license. If you do not wish to use this license, please delete this file. |
86+
| 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. |
87+
| 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. |
88+
| 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. |
89+
| src/controllers/README.md | Provides information about the controller directory, how to generate new controllers, and where to find more information. |
90+
| src/controllers/ping.controller.ts | A basic controller that responds to GET requests at `/ping`. |
91+
| src/datasources/README.md | Provides information about the datasources directory, how to generate new datasources, and where to find more information. |
92+
| src/models/README.md | Provides information about the datasources directory, how to generate new datasources, and where to find more information. |
93+
| src/repositories/README.md | Provides information about the repositories directory, how to generate new repositories, and where to find more information. |
94+
| test/README.md | Please place your tests in this folder. |
95+
| test/mocha.opts | [Mocha](https://mochajs.org/) configuration for running your application's tests. |
96+
| test/acceptance/ping.controller.acceptance.ts | An example test to go with the ping controller in `src/controllers`. |
9697

9798
### Navigation
9899

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist*
2+
*.json

examples/hello-world/.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"bracketSpacing": false,
3+
"singleQuote": true,
4+
"printWidth": 80,
5+
"trailingComma": "all"
6+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"editor.rulers": [80],
3+
"editor.tabCompletion": true,
4+
"editor.tabSize": 2,
5+
"editor.trimAutoWhitespace": true,
6+
"editor.formatOnSave": true,
7+
8+
"files.exclude": {
9+
"**/.DS_Store": true,
10+
"**/.git": true,
11+
"**/.hg": true,
12+
"**/.svn": true,
13+
"**/CVS": true,
14+
"dist*": true,
15+
},
16+
"files.insertFinalNewline": true,
17+
"files.trimTrailingWhitespace": true,
18+
19+
"tslint.ignoreDefinitionFiles": true,
20+
"typescript.tsdk": "./node_modules/typescript/lib"
21+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
"label": "Watch and Compile Project",
8+
"type": "shell",
9+
"command": "npm",
10+
"args": ["--silent", "run", "build:watch"],
11+
"group": {
12+
"kind": "build",
13+
"isDefault": true
14+
},
15+
"problemMatcher": "$tsc-watch"
16+
},
17+
{
18+
"label": "Build, Test and Lint",
19+
"type": "shell",
20+
"command": "npm",
21+
"args": ["--silent", "run", "test:dev"],
22+
"group": {
23+
"kind": "test",
24+
"isDefault": true
25+
},
26+
"problemMatcher": ["$tsc", "$tslint5"]
27+
}
28+
]
29+
}

examples/hello-world/package.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,23 @@
1313
"build:current": "lb-tsc",
1414
"build:dist8": "lb-tsc es2017",
1515
"build:dist10": "lb-tsc es2018",
16+
"build:watch": "lb-tsc --watch",
1617
"clean": "lb-clean *example-hello-world*.tgz dist* package api-docs",
1718
"verify": "npm pack && tar xf *example-hello-world*.tgz && tree package && npm run clean",
19+
"lint": "npm run prettier:check && npm run tslint",
20+
"lint:fix": "npm run prettier:fix && npm run tslint:fix",
21+
"prettier:cli": "lb-prettier \"**/*.ts\" \"**/*.js\"",
22+
"prettier:check": "npm run prettier:cli -- -l",
23+
"prettier:fix": "npm run prettier:cli -- --write",
24+
"tslint": "lb-tslint",
25+
"tslint:fix": "npm run tslint -- --fix",
26+
"pretest": "npm run clean && npm run build:current",
27+
"test": "lb-mocha --allow-console-logs \"DIST/test\"",
28+
"posttest": "npm run lint",
29+
"test:dev": "lb-mocha --allow-console-logs DIST/test/**/*.js && npm run posttest",
1830
"prestart": "npm run build:current",
19-
"start": "node ."
31+
"start": "node .",
32+
"prepublishOnly": "npm run test"
2033
},
2134
"repository": {
2235
"type": "git",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "http://json.schemastore.org/tslint",
3+
"extends": ["./node_modules/@loopback/build/config/tslint.build.json"]
4+
}

0 commit comments

Comments
 (0)