Skip to content

revert to tsc build and add lint rules to set cli dependencies #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2024
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
5 changes: 5 additions & 0 deletions .github/workflows/composite/verify/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ runs:
registry-url: 'https://registry.npmjs.org'
- run: npm install --force
shell: bash

- run: npm run lint:cli
shell: bash

- run: npm run build
shell: bash

- run: npm run test
shell: bash
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,17 @@ npx nx generate @nx/js:library --name=libs/[topic]/[command] --projectNameAndRoo
```
npx nx generate @nx/js:library --name=libs/[command] --projectNameAndRootFormat=as-provided --no-interactive
```

## Adding a library

When adding a library to the monorepo, remember to update the CLI's lint rules to ignore the new library.

path to the cli lint rules: apps/cli/.eslintrc.json

## Lint Failures

To fix lint failures run:

```
npm run lint:cli:fix
```
18 changes: 17 additions & 1 deletion apps/cli/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,23 @@
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
"@nx/dependency-checks": [
"error",
{
"includeTransitiveDependencies": true,
"useLocalPathsForWorkspaceDependencies": true,
"ignoredDependencies": [
"@herodevs/report-committers",
"@herodevs/report-diagnostics",
"@herodevs/tracker-init",
"@herodevs/tracker-run",
"@herodevs/nes-init",
"@herodevs/utility",
"@herodevs/core-types",
"@herodevs/tracker-shared"
]
}
]
}
}
]
Expand Down
15 changes: 12 additions & 3 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
{
"name": "@herodevs/cli",
"version": "0.0.0",
"bin": "./hd-cli.js",
"bin": "./src/main.js",
"dependencies": {
"tslib": "^2.3.0"
"tslib": "^2.3.0",
"yargs": "^17.7.2",
"get-json": "^1.0.1",
"date-fns": "^3.6.0",
"@inquirer/prompts": "^5.0.2",
"git-last-commit": "^1.0.1",
"sloc": "^0.3.2",
"@apollo/client": "^3.10.1",
"ora": "5.3.0"
},
"type": "commonjs",
"main": "./hd-cli.js"
"main": "./src/main.js",
"typings": "./src/main.d.ts"
}
23 changes: 12 additions & 11 deletions apps/cli/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,21 @@
"tags": [],
"targets": {
"build": {
"executor": "@nx/esbuild:esbuild",
"executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/cli",
"main": "apps/cli/src/lib/cli.ts",
"main": "apps/cli/src/main.ts",
"tsConfig": "apps/cli/tsconfig.lib.json",
"format": ["cjs"],
"generatePackageJson": true,
"assets": [
{
"input": "apps/cli/src/",
"glob": "hd-cli.js",
"output": "/"
}
]
"assets": ["apps/cli/*.md"],
"external": "none"
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/cli/**/*.{ts,tsx,js,jsx}", "apps/cli/package.json"]
}
},
"nx-release-publish": {
Expand Down
1 change: 0 additions & 1 deletion apps/cli/src/hd-cli.js

This file was deleted.

3 changes: 3 additions & 0 deletions apps/cli/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { cli } from './lib/cli';

cli();
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"build": "nx run-many --target=build --all",
"test": "nx run-many --target=test --all",
"x": "nx affected:test --watch",
"lint": "nx run-many --target=lint --all"
"lint": "nx run-many --target=lint --all",
"lint:cli": "nx lint cli",
"lint:cli:fix": "nx lint cli --fix"
},
"private": true,
"dependencies": {
Expand Down
Loading