Skip to content

Commit

Permalink
(fix): express generation resolves mime library (#3302)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi committed Apr 1, 2024
1 parent 5b45493 commit 4405e01
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 8 deletions.
2 changes: 1 addition & 1 deletion generators/commons/src/AbstractGeneratorContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export abstract class AbstractGeneratorContext {

public constructor(
public readonly config: FernGeneratorExec.config.GeneratorConfig,
public readonly generatorNotificationService: GeneratorNotificationService,
public readonly generatorNotificationService: GeneratorNotificationService
) {
this.logger = createLogger((level, ...message) => {
CONSOLE_LOGGER.log(level, ...message);
Expand Down
2 changes: 1 addition & 1 deletion generators/csharp/codegen/src/utils/CSharpFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class CSharpFile extends File {
}

public async tryWrite(directoryPrefix: AbsoluteFilePath): Promise<void> {
await this.write(directoryPrefix);
await this.write(directoryPrefix);
}

public static getFilePathFromFernFilePath(fernFilePath: FernFilepath): RelativeFilePath {
Expand Down
14 changes: 14 additions & 0 deletions generators/typescript/express/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.9.9] - 2024-03-22
- Fix: Compile started failing for express generators with the following error:

```
error TS2688: Cannot find type definition file for 'mime'.
The file is in the program because:
Entry point for implicit type library 'mime'
```

The root cause is because a breaking change was released in v4 of the mime library.
This is now fixed because the generator resolves to v3 of the library as
specified in this GitHub [issue](https://github.com/firebase/firebase-admin-node/issues/2512).

## [0.9.8] - 2024-03-22
- Improvement: Enhance serde performance by reducing reliance on async behavior and lazy async dynamic imports.
- Internal: Shared generator notification and config parsing logic.
Expand Down
2 changes: 1 addition & 1 deletion generators/typescript/express/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.8
0.9.9
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,10 @@ export class ExpressGenerator {
extraDependencies: {},
extraDevDependencies: {},
extraFiles: {},
extraScripts: {}
extraScripts: {},
resolutions: {
"@types/mime": "3.0.4"
}
});
}

Expand Down
3 changes: 2 additions & 1 deletion generators/typescript/sdk/generator/src/SdkGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ module.exports = {
extraDependencies: this.config.extraDependencies,
extraDevDependencies: this.config.extraDevDependencies,
extraFiles: this.extraFiles,
extraScripts: this.extraScripts
extraScripts: this.extraScripts,
resolutions: {}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export declare namespace SimpleTypescriptProject {
npmPackage: NpmPackage | undefined;
dependencies: PackageDependencies;
outputEsm: boolean;
resolutions: Record<string, string>;
}
}

Expand All @@ -25,12 +26,14 @@ export class SimpleTypescriptProject extends TypescriptProject {
private npmPackage: NpmPackage | undefined;
private dependencies: PackageDependencies;
private outputEsm: boolean;
private resolutions: Record<string, string>;

constructor({ npmPackage, dependencies, outputEsm, ...superInit }: SimpleTypescriptProject.Init) {
constructor({ npmPackage, dependencies, outputEsm, resolutions, ...superInit }: SimpleTypescriptProject.Init) {
super(superInit);
this.npmPackage = npmPackage;
this.dependencies = dependencies;
this.outputEsm = outputEsm;
this.resolutions = resolutions;
}

protected async addFilesToVolume(): Promise<void> {
Expand Down Expand Up @@ -138,6 +141,13 @@ export class SimpleTypescriptProject extends TypescriptProject {
};
}

if (Object.entries(this.resolutions).length > 0) {
packageJson = {
...packageJson,
resolutions: this.resolutions
};
}

packageJson = {
...packageJson,
main: "./index.js",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4405e01

Please sign in to comment.