Skip to content

Commit

Permalink
docs(blog): release-1.5 (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
uhyo authored Dec 13, 2023
1 parent ded62f6 commit 1d90335
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 0 deletions.
2 changes: 2 additions & 0 deletions website/src/app/blog/_articles/articles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import { blogPostRelease1_1 } from "./release-1.1";
import { blogPostRelease1_2 } from "./release-1.2";
import { blogPostRelease1_3 } from "./release-1.3";
import { blogPostRelease1_4 } from "./release-1.4";
import { blogPostRelease1_5 } from "./release-1.5";

export const articles = [
blogPostRelease1_5,
blogPostRelease1_4,
blogPostRelease1_3,
blogPostRelease1_2,
Expand Down
103 changes: 103 additions & 0 deletions website/src/app/blog/_articles/release-1.5.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import { Highlight } from "@/app/_utils/Highlight";
import { ArticleMetadata } from "./_meta";
import Link from "next/link";

export const blogPostRelease1_5: ArticleMetadata = {
slug: "release-1.5",
title: "nitrogql 1.5 release: We know you better now, fragments",
shortDescription: `In nitrogql 1.5, we added an option named "fragmentTypeSuffix" to the nitrogql CLI.
This option allows you to customize the suffix of the name of the type that is generated for each fragment.`,
publishDate: new Date("2023-12-13T00:00Z"),
render,
};

function render() {
return (
<>
<p>
Today, we are happy to announce release of <strong>nitrogql 1.5</strong>
!
</p>
<p>
<b>nitrogql</b> is a toolchain for using GraphQL in TypeScript projects.
In 1.5, we added a new option <code>fragmentTypeSuffix</code> to the
nitrogql CLI. This option allows you to customize the suffix of the name
of the type that is generated for each fragment.
</p>

<h3 id="the-fragmenttypesuffix-option">
The <code>fragmentTypeSuffix</code> option
</h3>
<p>
Prior to 1.5, nitrogql did not allow you to customize the name of the
types generated for fragments. The name of the type was always the same
as the name of the fragment. For example:
</p>
<Highlight language="graphql">{`fragment PartialUser on User {
name
email
iconUrl
}`}</Highlight>
<p>
The type generated for the above fragment was always{" "}
<code>PartialUser</code>. In 1.5, you can customize the suffix of the
type name by using the{" "}
<Link href="/configuration/options#generate.name.fragmentTypeSuffix">
<code>fragmentTypeSuffix</code>
</Link>{" "}
option. An example configuration is:
</p>
<Highlight language="yaml">{`
generate:
name:
fragmentTypeSuffix: Fragment
# ...`}</Highlight>
<p>
With the above configuration, the type generated for the fragment above
will be <code>PartialUserFragment</code>.
</p>

<h3 id="why-is-this-useful">Why is this useful?</h3>
<p>
Having a meaningful suffix for a specific kind of types is generally
useful. As such, we&apos;ve already had similar options for other kinds
of types and variables. Lack of such an option for fragments was our
oversight.
</p>
<p>
As you might remember, we added support for importing fragments from
other GraphQL documents in the previous release. It was the beginning of
the process of enlightening ourselves about Fragments and their use
cases. This release comes as another step towards that goal.
</p>
<p>
In addition, the ability to customize the suffix of the type name has
been necessary for migrating from other tools that have different naming
conventions. Whilst migration is not an easy task, we want to make it as
easy as possible.
</p>

<h3 id="conclusion">Conclusion</h3>
<p>
nitrogql 1.5 is a small release that adds a new option to the nitrogql
CLI. The change was contributed by{" "}
<a href="https://github.com/tomocrafter" target="_blank">
tomocrafter
</a>{" "}
and we thank him for his contribution!
</p>

<hr />

<p>
<em>
nitrogql is developed by{" "}
<a href="https://x.com/uhyo_" target="_blank">
uhyo
</a>
. Contribution is more than welcome!
</em>
</p>
</>
);
}

0 comments on commit 1d90335

Please sign in to comment.