Skip to content

Commit

Permalink
Merge pull request #968 from ryan-richards-aligent/feature/MO-322-add…
Browse files Browse the repository at this point in the history
…-check-types-command-to-service-generator

MO-322 adding check-types command to base monorepo targets as well as…
  • Loading branch information
tvhees authored Jun 7, 2024
2 parents 9f4a1ab + e6569a9 commit 5d40b62
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ Libraries are generated by `@nx/js` plugin. For more information, check out thei

`npx nx g library <library-name>`

Shared library will need to have the `check-types` command added manually to ensure proper type checking. This is because the the `@nx/js` plugin does not add it by default.
```json
"check-types": {
"executor": "nx:run-commands",
"options": {
"cwd": "{projectRoot}",
"color": true,
"command": "tsc --noEmit --pretty"
},
}
```

### General Nx. commands

Below are some example of general Nx. commands. For more information, check out their [document](https://nx.dev/packages/nx/documents).
Expand Down
3 changes: 3 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"outputs": ["{projectRoot}/.serverless"],
"cache": true
},
"check-types": {
"cache": true
},
"lint": {
"inputs": [
"default",
Expand Down
8 changes: 8 additions & 0 deletions tools/serverless-plugin/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
"generatePackageJson": true
}
},
"check-types": {
"executor": "nx:run-commands",
"options": {
"cwd": "{projectRoot}",
"color": true,
"command": "tsc --noEmit --pretty"
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
Expand Down
8 changes: 8 additions & 0 deletions tools/serverless-plugin/src/generators/service/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ export async function serviceGenerator(
remove: {
...buildRunCommandConfig(projectRoot, 'sls remove'),
},
'check-types': {
'executor': 'nx:run-commands',
'options': {
'cwd': '{projectRoot}',
'color': true,
'command': 'tsc --noEmit --pretty'
}
},
lint: {
executor: '@nx/linter:eslint',
outputs: ['{options.outputFile}'],
Expand Down

0 comments on commit 5d40b62

Please sign in to comment.