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
2 changes: 1 addition & 1 deletion integrations/sample-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@aws-sdk/client-s3": "^3.689.0",
"@aws-sdk/credential-providers": "^3.687.0",
"@aws-sdk/s3-request-presigner": "^3.689.0",
"@intentjs/core": "*",
"@intentjs/core": "workspace:*",
"bcrypt": "^5.1.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
Expand Down
1 change: 1 addition & 0 deletions packages/cli/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./start-server.js";
export * from "./build.js";
export * from "./new-project.js";
14 changes: 9 additions & 5 deletions packages/cli/lib/codegen/ast/inject-config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { join } from "path";
import { format, resolveConfig, resolveConfigFile } from "prettier";
import { format, Options, resolveConfig, resolveConfigFile } from "prettier";
import {
Project,
SourceFile,
SyntaxKind,
ObjectLiteralExpression,
Node,
} from "ts-morph";
import { pathExists } from "fs-extra/esm";

export class InjectConfig {
private project: Project;
Expand Down Expand Up @@ -146,13 +147,16 @@ export class InjectConfig {
const updatedText = objects.getText().replace(/,\s*,/g, ",");
objects.replaceWithText(updatedText);

const prettierConfig = await resolveConfig(this.projectRoot, {
config: join(this.projectRoot, ".prettierrc"),
});
let prettierConfig = null;
if (await pathExists(join(this.projectRoot, ".prettierrc"))) {
prettierConfig = await resolveConfig(this.projectRoot, {
config: join(this.projectRoot, ".prettierrc"),
});
}

const formatted = await format(this.sourceFile.getFullText(), {
parser: "typescript",
...prettierConfig,
...(prettierConfig || {}),
});

this.sourceFile.replaceWithText(formatted);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@intentjs/cli",
"version": "0.0.18",
"version": "0.0.19",
"description": "Helper commands for building Intent application.",
"repository": {
"type": "git",
Expand Down
Loading