Skip to content
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

chore: set up root tsconfig as "solution", avoid compilation for lints and tests #6748

Merged
merged 8 commits into from
Jul 5, 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
47 changes: 2 additions & 45 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ jobs:
githubToken: ${{ secrets.GITHUB_TOKEN }}

- name: Compile TypeScript code
run: |
# yarn clean $TURBO_FLAGS
yarn build $TURBO_FLAGS
run: yarn build $TURBO_FLAGS

- name: Save Turbo Cache between jobs
uses: ./.github/actions/build-cache-upload
Expand Down Expand Up @@ -118,8 +116,6 @@ jobs:
# ===================

lint:
needs: [build]

runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -129,20 +125,12 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Restore Turbo Cache from previous jobs
uses: ./.github/actions/build-cache-download

- name: Prepare testing environment
uses: ./.github/actions/prepare-env
with:
node-version: ${{ matrix.node-version }}
githubToken: ${{ secrets.GITHUB_TOKEN }}

# For linting to succeed, we need to build the eslint plugin first.
# Thanks to caching from the previous job, this should be almost a no-op
- name: Compile TypeScript code
run: yarn build $TURBO_FLAGS

- name: Run linters
run: yarn run lint $TURBO_FLAGS

Expand Down Expand Up @@ -179,8 +167,6 @@ jobs:
# ===================

lint-zwave:
needs: [build]

runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -190,9 +176,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Restore Turbo Cache from previous jobs
uses: ./.github/actions/build-cache-download

- name: Prepare testing environment
uses: ./.github/actions/prepare-env
with:
Expand All @@ -205,8 +188,6 @@ jobs:
# ===================
# Runs unit tests on all supported node versions and OSes
unit-tests:
needs: [build]

runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -217,20 +198,12 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Restore Turbo Cache from previous jobs
uses: ./.github/actions/build-cache-download

- name: Prepare testing environment
uses: ./.github/actions/prepare-env
with:
node-version: ${{ matrix.node-version }}
githubToken: ${{ secrets.GITHUB_TOKEN }}

# For the partial tests to succeed, we need to build the packages first.
# Thanks to caching from the previous job, this should be almost a no-op
- name: Compile TypeScript code
run: yarn build $TURBO_FLAGS

# For pull requests, only run tests for changed files
- name: Run component tests (changes)
if: github.event_name == 'pull_request'
Expand Down Expand Up @@ -300,8 +273,6 @@ jobs:
github.ref == 'refs/heads/master' &&
github.event_name == 'push'

needs: [build]

runs-on: ubuntu-latest

strategy:
Expand All @@ -312,18 +283,12 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Restore Turbo Cache from previous jobs
uses: ./.github/actions/build-cache-download

- name: Prepare testing environment
uses: ./.github/actions/prepare-env
with:
node-version: ${{ matrix.node-version }}
githubToken: ${{ secrets.GITHUB_TOKEN }}

- name: Compile TypeScript code
run: yarn build $TURBO_FLAGS

- name: Update CC table # (maybe)
uses: actions/github-script@v7
with:
Expand All @@ -343,8 +308,6 @@ jobs:
github.ref == 'refs/heads/master' &&
github.event_name == 'push'

needs: [build]

runs-on: ubuntu-latest

strategy:
Expand All @@ -355,18 +318,12 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Restore Turbo Cache from previous jobs
uses: ./.github/actions/build-cache-download

- name: Prepare testing environment
uses: ./.github/actions/prepare-env
with:
node-version: ${{ matrix.node-version }}
githubToken: ${{ secrets.GITHUB_TOKEN }}

- name: Compile TypeScript code
run: yarn build $TURBO_FLAGS

- name: Update overview
uses: actions/github-script@v7
with:
Expand All @@ -386,7 +343,7 @@ jobs:
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags/v')

needs: [lint, lint-zwave, unit-tests, test-packages]
needs: [build, lint, lint-zwave, unit-tests, test-packages]

runs-on: ubuntu-latest
strategy:
Expand Down
52 changes: 16 additions & 36 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
"type": "node",
"request": "launch",
"name": "Debug locally",
"port": 9229,
"runtimeExecutable": "yarn",
"runtimeArgs": [
"node",
"--async-stack-traces",
"-r",
"./maintenance/esbuild-register.js",
"--conditions=@@dev",
"${workspaceFolder}/test/run.ts"
],
"env": {
Expand All @@ -43,64 +43,46 @@
},
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**"],
"sourceMaps": true,
"preLaunchTask": "npm: build"
"sourceMaps": true
// "preLaunchTask": "npm: build"
},
{
"type": "node",
"request": "launch",
"name": "Test network mock",
"port": 9229,
"name": "Generate typed docs",
"runtimeExecutable": "yarn",
"runtimeArgs": [
"node",
"--async-stack-traces",
"--inspect-brk=9229",
"-r",
"./maintenance/esbuild-register.js",
"${workspaceFolder}/test/mock.ts"
"${workspaceFolder}/packages/maintenance/src/generateTypedDocs.ts"
],
"env": {
"NO_CACHE": "true"
},
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**"],
"sourceMaps": true,
// This needs the compiled sources (I think)
"preLaunchTask": "npm: build"
},
{
"type": "node",
"request": "launch",
"name": "Generate typed docs",
"port": 9229,
"name": "Decode message",
"runtimeExecutable": "yarn",
"runtimeArgs": [
"node",
"--async-stack-traces",
"--inspect-brk=9229",
"-r",
"./maintenance/esbuild-register.js",
"${workspaceFolder}/packages/maintenance/src/generateTypedDocs.ts"
"--conditions=@@dev",
"${workspaceFolder}/test/decodeMessage.ts"
],
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**"],
"sourceMaps": true
},
{
"type": "node",
"request": "launch",
"name": "Decode message",
"port": 9229,
"runtimeExecutable": "yarn",
"runtimeArgs": [
"node",
"--async-stack-traces",
"--inspect-brk=9229",
"${workspaceFolder}/test/debug.js"
],
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**"],
"sourceMaps": true,
"preLaunchTask": "npm: build"
// "preLaunchTask": "npm: build"
},
{
"type": "node",
Expand All @@ -114,34 +96,32 @@
"--inspect=9229",
"-r",
"./maintenance/esbuild-register.js",
"--conditions=@@dev",
"${workspaceFolder}/packages/config/maintenance/importConfig.ts",
"-dm -s zwa"
],
"console": "integratedTerminal",
"disableOptimisticBPs": true
"console": "integratedTerminal"
},
{
"type": "node",
"request": "launch",
"name": "Run Zniffer",
"port": 9229,
"runtimeExecutable": "yarn",
"runtimeArgs": [
"node",
"--async-stack-traces",
"-r",
"./maintenance/esbuild-register.js",
"--conditions=@@dev",
"${workspaceFolder}/test/run_zniffer.ts"
],
"env": {
"NODE_ENV": "development"
// "NO_CACHE": "true"
// "LOGLEVEL": "info"
},
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**"],
"sourceMaps": true,
"preLaunchTask": "npm: build"
"sourceMaps": true
// "preLaunchTask": "npm: build"
}
]
}
3 changes: 3 additions & 0 deletions ava.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ module.exports = {
extensions: ["ts"],
files: ["test/**", "**/*.test.ts", "!build/**"],
require: [path.join(__dirname, "./maintenance/esbuild-register.js")],
nodeArguments: [
"--conditions=@@dev",
],
};
24 changes: 20 additions & 4 deletions docs/api/CCs/Meter.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@
### `get`

```ts
async get(options?: MeterCCGetOptions): Promise<{ rateType: RateType; value: number; previousValue: MaybeNotKnown<number>; deltaTime: MaybeUnknown<number>; type: number; scale: MeterScale; } | undefined>;
async get(options?: MeterCCGetOptions): Promise<{ rateType: RateType; value: number; previousValue: MaybeNotKnown<number>; deltaTime: MaybeUnknown<number>; type: number; scale: import("/home/dominic/Repositories/node-zwave-js/packages/core/build/index").MeterScale; } | undefined>;
```

### `sendReport`

```ts
async sendReport(
options: MeterCCReportOptions,
): Promise<SupervisionResult | undefined>;
```

### `getAll`

```ts
async getAll(): Promise<{ rateType: RateType; value: number; previousValue: MaybeNotKnown<number>; deltaTime: MaybeUnknown<number>; type: number; scale: MeterScale; }[]>;
async getAll(accumulatedOnly: boolean = false): Promise<{ rateType: RateType; value: number; previousValue: MaybeNotKnown<number>; deltaTime: MaybeUnknown<number>; type: number; scale: import("/home/dominic/Repositories/node-zwave-js/packages/core/build/index").MeterScale; }[]>;
```

### `getSupported`
Expand All @@ -22,6 +30,14 @@ async getAll(): Promise<{ rateType: RateType; value: number; previousValue: Mayb
async getSupported(): Promise<Pick<MeterCCSupportedReport, "type" | "supportsReset" | "supportedScales" | "supportedRateTypes"> | undefined>;
```

### `sendSupportedReport`

```ts
async sendSupportedReport(
options: MeterCCSupportedReportOptions,
): Promise<void>;
```

### `reset`

```ts
Expand Down Expand Up @@ -50,7 +66,7 @@ async reset(
- **secret:** false
- **value type:** `"boolean"`

### `resetSingle(meterType: number)`
### `resetSingle(meterType: number, rateType: RateType, scale: number)`

```ts
{
Expand All @@ -61,7 +77,7 @@ async reset(
}
```

- **label:** `Reset (${string})`
- **label:** `Reset (${string})` | `Reset (Consumption, ${string})` | `Reset (Production, ${string})`
- **min. CC version:** 1
- **readable:** false
- **writeable:** true
Expand Down
1 change: 1 addition & 0 deletions docs/api/driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,7 @@ interface ZWaveOptions extends ZWaveHostOptions {
*/
watchdog?: boolean;
};

preferences: {
/**
* The preferred scales to use when querying sensors. The key is either:
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"colors": "1.4.0"
},
"scripts": {
"ts": "node -r source-map-support/register -r ./maintenance/esbuild-register.js",
"ts": "node -r source-map-support/register -r ./maintenance/esbuild-register.js --conditions=@@dev",
"w": "yarn ts maintenance/watch.ts",
"foreach": "yarn workspaces foreach -pvi --exclude @zwave-js/repo",
"clean": "yarn turbo run clean",
Expand All @@ -122,7 +122,7 @@
"commit": "git-cz",
"release": "release-script",
"release:all": "release-script --publish-all",
"postinstall": "ts-patch install -s && yarn node maintenance/patch-tsserver.js",
"postinstall": "ts-patch install -s && yarn node maintenance/patch-tsserver.js && yarn turbo run bootstrap",
"prepare": "husky && ts-patch install -s",
"config": "yarn ts packages/config/maintenance/importConfig.ts",
"docs": "docsify serve docs",
Expand All @@ -137,8 +137,8 @@
"extract-api": "FORCE_COLOR=1 yarn turbo run extract-api",
"accept-api": "yarn extract-api -- --local",
"monopack": "yarn exec monopack",
"check-references": "workspaces-to-typescript-project-references --check && workspaces-to-typescript-project-references --check --tsconfigPath tsconfig.build.json",
"sync-references": "workspaces-to-typescript-project-references && workspaces-to-typescript-project-references --tsconfigPath tsconfig.build.json && yarn fmt > /dev/null"
"check-references": "workspaces-to-typescript-project-references --check --tsconfigPath tsconfig.build.json",
"sync-references": "workspaces-to-typescript-project-references --tsconfigPath tsconfig.build.json && yarn fmt > /dev/null"
},
"readme": "README.md",
"config": {
Expand Down
Loading