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
10 changes: 8 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,18 @@
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
"rules": {
"@typescript-eslint/no-extra-semi": "error",
"no-extra-semi": "off"
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
"rules": {
"@typescript-eslint/no-extra-semi": "error",
"no-extra-semi": "off"
}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
Expand Down
25 changes: 17 additions & 8 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,24 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- run: npm run test
- run: npm publish
fetch-depth: 0

- uses: pnpm/action-setup@v2
with:
version: 9.4.0

- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'

- run: pnpm install --frozen-lockfile
- run: pnpm run build
- run: pnpm run test
- run: pnpm publish
working-directory: ./dist/libs/ngx-http-request-state
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
30 changes: 18 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,23 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
if: ${{ github.base_ref == 'main' }}
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
- uses: actions/checkout@v2
- name: Use Node.js 18.x
uses: actions/setup-node@v2
fetch-depth: 0

- uses: pnpm/action-setup@v2
with:
version: 9.4.0

- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- run: npm ci
- run: npm run build
- run: npm run test
- run: npm run format:check
- run: npm run lint
node-version: 20
cache: 'pnpm'

- run: pnpm install --frozen-lockfile
- uses: nrwl/nx-set-shas@v4
- run: pnpm run build
- run: pnpm run test
- run: pnpm run format:check
- run: pnpm run lint
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ Thumbs.db

.angular

.nx/cache
.nx/cache
.nx/workspace-data
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
/coverage
.angular

/.nx/cache
/.nx/cache
/.nx/workspace-data
9 changes: 4 additions & 5 deletions apps/examples-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/examples-e2e/src",
"projectType": "application",
"tags": [],
"implicitDependencies": ["examples"],
"targets": {
"e2e": {
"executor": "@nx/cypress:cypress",
Expand All @@ -21,10 +23,7 @@
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
"executor": "@nx/eslint:lint"
}
},
"tags": [],
"implicitDependencies": ["examples"]
}
}
3 changes: 1 addition & 2 deletions apps/examples/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
"executor": "@nx/eslint:lint"
},
"test": {
"executor": "@nx/jest:jest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ describe('BasicSmartComponent', () => {
}) as jest.Mocked<RandomBreweryService>;

const injectSpy = jest.spyOn(angularCore, 'inject');
injectSpy.mockImplementation((providerToken: unknown) => {
injectSpy.mockImplementation(((providerToken: unknown) => {
if (providerToken === RandomBreweryService) {
return mockService;
}
throw new Error(`Unexpected inject token: ` + providerToken);
});
}) as typeof angularCore.inject);

const component = new BasicSmartComponent();
return {
Expand All @@ -48,17 +48,19 @@ describe('BasicSmartComponent', () => {
responses: (Brewery | HttpErrorResponse)[],
delay = '--'
) {
responses.forEach((next) => {
mockService.randomBrewery.mockImplementationOnce(() => {
responses
.map((next) => {
if (next instanceof HttpErrorResponse) {
return cold(`${delay}#`, undefined, next);
}
const response = new HttpResponse({
body: next,
});
return cold(`${delay}(r|)`, { r: response });
})
.forEach((next) => {
mockService.randomBrewery.mockImplementationOnce(() => next);
});
});
}

describe('#brewery$', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
jest.mock('@angular/core');

import * as angularCore from '@angular/core';
import { MultipleSourcesContainerComponent } from './multiple-sources-container.component';
import { PunkApiService } from '../service/punk-api.service';
Expand All @@ -12,8 +14,6 @@ import {
} from 'ngx-http-request-state';
import { HttpErrorResponse } from '@angular/common/http';

jest.mock('@angular/core');

describe('MultipleSourcesContainerComponent', () => {
function setup(): {
component: MultipleSourcesContainerComponent;
Expand All @@ -23,12 +23,12 @@ describe('MultipleSourcesContainerComponent', () => {
brewedBefore: jest.fn(),
brewedAfter: jest.fn(),
} as unknown as jest.Mocked<PunkApiService>;
jest.spyOn(angularCore, 'inject').mockImplementation((token) => {
jest.spyOn(angularCore, 'inject').mockImplementation(((token: unknown) => {
if (token === PunkApiService) {
return service;
}
throw new Error('No provider for ' + token);
});
}) as typeof angularCore.inject);
const component = new MultipleSourcesContainerComponent();
return { component, service };
}
Expand Down
1 change: 1 addition & 0 deletions libs/ngx-http-request-state/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ support its development:

## Versions

Version `^3.2.0` supports Angular 14 - 18.
Version `^3.1.0` supports Angular 14 - 17.
Version `3.0.0` supports Angular 14, 15 & 16.
Version `^2.1.0` supports Angular 14 & 15.
Expand Down
4 changes: 2 additions & 2 deletions libs/ngx-http-request-state/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"loading",
"error"
],
"version": "3.1.0",
"version": "3.2.0",
"peerDependencies": {
"rxjs": "^6.2.0 || ^7.4.0",
"@angular/common": "^14.2.10 || ^15.0.1 || ^16.0.0 || ^17.0.0"
"@angular/common": "^14.2.10 || ^15.0.1 || ^16.0.0 || ^17.0.0 || ^18.0.0"
},
"dependencies": {
"tslib": "^2.3.0"
Expand Down
3 changes: 1 addition & 2 deletions libs/ngx-http-request-state/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"defaultConfiguration": "production"
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
"executor": "@nx/eslint:lint"
},
"test": {
"executor": "@nx/jest:jest",
Expand Down
23 changes: 11 additions & 12 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"affected": {
"defaultBase": "origin/main"
},
"generators": {
"@nx/angular:application": {
"style": "css",
Expand All @@ -24,14 +21,6 @@
"inputs": ["default", "^production"],
"cache": true
},
"lint": {
"inputs": [
"default",
"{workspaceRoot}/.eslintrc.json",
"{workspaceRoot}/.eslintignore"
],
"cache": true
},
"build": {
"dependsOn": ["^build"],
"inputs": ["production", "^production"],
Expand All @@ -49,6 +38,14 @@
"codeCoverage": true
}
}
},
"@nx/eslint:lint": {
"inputs": [
"default",
"{workspaceRoot}/.eslintrc.json",
"{workspaceRoot}/.eslintignore"
],
"cache": true
}
},
"namedInputs": {
Expand All @@ -62,5 +59,7 @@
"!{projectRoot}/src/test-setup.[jt]s"
],
"sharedGlobals": []
}
},
"useInferencePlugins": false,
"defaultBase": "origin/main"
}
Loading