Skip to content

Commit cb16be5

Browse files
authored
Merge pull request #11 from TzviPM/nulls
🐛 fix: Update tsconfig, fix null values
2 parents 6d6d3f2 + 2777ea2 commit cb16be5

17 files changed

+62
-28
lines changed

CHANGELOG.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.2.2] - 2023-10-30
11+
12+
### Fixed
13+
- Fix null values propagating through the code ([#11](https://github.com/TzviPM/laravel-deploy/pull/11)).
14+
- Use stricter settings in TS Config ([#11](https://github.com/TzviPM/laravel-deploy/pull/11)).
15+
1016
## [1.2.1] - 2023-10-30
1117

1218
### Fixed
@@ -52,8 +58,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5258

5359
This was the initial release of `laravel-deploy`.
5460

55-
[unreleased]: https://github.com/TzviPM/laravel-deploy/compare/v1.2.0...HEAD
56-
[1.1.0]: https://github.com/TzviPM/laravel-deploy/compare/v1.1.0...v1.2.0
61+
[unreleased]: https://github.com/TzviPM/laravel-deploy/compare/v1.2.2...HEAD
62+
[1.2.2]: https://github.com/TzviPM/laravel-deploy/compare/v1.2.1...v1.2.2
63+
[1.2.1]: https://github.com/TzviPM/laravel-deploy/compare/v1.2.0...v1.2.1
64+
[1.2.0]: https://github.com/TzviPM/laravel-deploy/compare/v1.1.0...v1.2.0
5765
[1.1.0]: https://github.com/TzviPM/laravel-deploy/compare/v1.0.4...v1.1.0
5866
[1.0.4]: https://github.com/TzviPM/laravel-deploy/compare/v1.0.3...v1.0.4
5967
[1.0.3]: https://github.com/TzviPM/laravel-deploy/compare/v1.0.2...v1.0.3

dist/index.js

+1-1
Large diffs are not rendered by default.

package-lock.json

+9-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "laravel-deploy",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "A GitHub Action to create on-demand preview environments for Laravel apps.",
55
"author": "Tzvi Melamed (TzviPM)",
66
"private": true,
@@ -52,6 +52,7 @@
5252
"@types/jest": "^29.5.2",
5353
"@types/node": "^20.3.1",
5454
"@types/supertest": "^2.0.12",
55+
"@types/uuid": "^9.0.6",
5556
"@typescript-eslint/eslint-plugin": "^6.0.0",
5657
"@typescript-eslint/parser": "^6.0.0",
5758
"@vercel/ncc": "^0.38.1",

src/core/deployment/deployment.service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class DeploymentService {
134134
}
135135
this.logger.log(`Checking for SSL Certificate on forge`);
136136
const certs = await site.listCerts();
137-
let cert = certs.find((cert) => cert.domain === site.name);
137+
let cert = certs.find((cert) => cert.domain === site!.name);
138138
if (cert != null) {
139139
this.logger.log('cert exists');
140140
} else {
@@ -299,7 +299,7 @@ function dbBranchName(
299299
branchMappings: Map<string, string>,
300300
): string {
301301
if (branchMappings.has(branchName)) {
302-
return branchMappings.get(branchName);
302+
return branchMappings.get(branchName)!;
303303
}
304304
return kebabCase(branchName);
305305
}

src/core/preview_config/preview_config.service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class PreviewConfigService {
2828
} catch (e: unknown) {
2929
const error = e as Error;
3030
this.logger.error(`Invalid \`servers\` input. ${error.message}`);
31+
throw e;
3132
}
3233
});
3334
}

src/core/pscale/models/backup.ts

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export class Backup {
2424
) {
2525
this.id = data.id;
2626
this.name = data.name;
27+
this.state = data.state;
2728
}
2829

2930
private async refetch() {

src/core/pscale/models/credentials.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export const credentialsSchema = z.object({
1212
export class Credentials {
1313
public id: string;
1414
public name: string;
15-
public username: string;
16-
public password: string;
15+
public username?: string | null;
16+
public password?: string | null;
1717

1818
public get path() {
1919
return `${this.branch.path}/passwords/${this.id}`;

src/errors/handler.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ export abstract class ErrorHandler {
4848
delete error.request.socket;
4949
delete error.request.agent;
5050
delete error.request.res;
51-
delete error.response.config;
52-
delete error.response.request;
51+
delete (error.response as any)?.config;
52+
delete error.response?.request;
5353
this.sanitize(error);
5454
}
5555
if (error instanceof ZodError) {

src/github/actions/env_actions.service.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ export class EnvActionsService implements ActionsService {
1717
*/
1818
public getInput(name: string, options?: InputOptions): string {
1919
const envVariableName = this.constantCase(name);
20-
return this.configService
21-
.getOrThrow<string>(envVariableName, options?.required ? undefined : '')
22-
.trim();
20+
if (options?.required) {
21+
return this.configService.getOrThrow<string>(envVariableName).trim();
22+
}
23+
return this.configService.getOrThrow<string>(envVariableName, '').trim();
2324
}
2425

2526
/**

src/github/comments/comments.service.spec.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import { Test, TestingModule } from '@nestjs/testing';
22
import { CommentsService } from './comments.service';
3+
import { LoggerCommentsService } from './logger_comments.service';
34

45
describe('CommentsService', () => {
56
let service: CommentsService;
67

78
beforeEach(async () => {
89
const module: TestingModule = await Test.createTestingModule({
9-
providers: [CommentsService],
10+
providers: [
11+
{
12+
provide: CommentsService,
13+
useClass: LoggerCommentsService,
14+
},
15+
],
1016
}).compile();
1117

1218
service = module.get<CommentsService>(CommentsService);

src/github/context/context.service.spec.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import { Test, TestingModule } from '@nestjs/testing';
22
import { ContextService } from './context.service';
3+
import { EnvContextService } from './env_context_service';
34

45
describe('ContextService', () => {
56
let service: ContextService;
67

78
beforeEach(async () => {
89
const module: TestingModule = await Test.createTestingModule({
9-
providers: [ContextService],
10+
providers: [
11+
{
12+
provide: ContextService,
13+
useClass: EnvContextService,
14+
},
15+
],
1016
}).compile();
1117

1218
service = module.get<ContextService>(ContextService);

src/logging/logger.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ export abstract class Logger extends ConsoleLogger implements LoggerService {
3838

3939
protected parseArgs(...args: unknown[]) {
4040
if (args.length <= 1) {
41-
return { messages: args, context: this.context };
41+
return { messages: args, context: this.context ?? Logger.name };
4242
}
4343
const lastElement = args[args.length - 1];
4444
const isContext = typeof lastElement === 'string';
4545
if (!isContext) {
46-
return { messages: args, context: this.context };
46+
return { messages: args, context: this.context ?? Logger.name };
4747
}
4848
return {
4949
context: lastElement,

src/logging/tslog.logger.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ export class TSLogger extends Logger {
2222
const oldName = this.logger.settings.name;
2323
this.setContext(name);
2424
fn();
25-
this.setContext(oldName);
25+
if (oldName) {
26+
this.setContext(oldName);
27+
}
2628
}
2729

2830
printLog(context: string, ...messages: unknown[]): void {

src/main.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ async function bootstrap() {
1717
try {
1818
await CommandFactory.runApplication(app);
1919
await app.close();
20-
} catch (e) {
21-
await errorHandler.handle(e);
20+
} catch (e: unknown) {
21+
await errorHandler.handle(e as Error);
2222
}
2323
}
2424
bootstrap();

test/app.e2e-spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Test, TestingModule } from '@nestjs/testing';
22
import { INestApplication } from '@nestjs/common';
3-
import * as request from 'supertest';
3+
import request from 'supertest';
44
import { AppModule } from './../src/app.module';
55

66
describe('AppController (e2e)', () => {

tsconfig.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313
"baseUrl": "./",
1414
"incremental": true,
1515
"skipLibCheck": true,
16-
"strictNullChecks": false,
17-
"noImplicitAny": false,
18-
"strictBindCallApply": false,
19-
"forceConsistentCasingInFileNames": false,
20-
"noFallthroughCasesInSwitch": false
16+
"strictNullChecks": true,
17+
"noImplicitAny": true,
18+
"strictBindCallApply": true,
19+
"forceConsistentCasingInFileNames": true,
20+
"noFallthroughCasesInSwitch": true,
21+
"strict": true
2122
}
2223
}

0 commit comments

Comments
 (0)