Skip to content

Commit

Permalink
Merge pull request #51 from Shopify/fix-header-bugs-for-typescript
Browse files Browse the repository at this point in the history
Fix header bugs for TypeScript.
  • Loading branch information
samrmur authored Sep 21, 2021
2 parents 7dc0ff1 + dad90b6 commit 5e53022
Show file tree
Hide file tree
Showing 70 changed files with 147 additions and 10 deletions.
3 changes: 1 addition & 2 deletions Templates/TypeScript/EnumType.stencil
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% if header %}
{{ header }}
{% if header %}{{ header }}

{% endif %}export enum {{ enumType.name }} {
{% for enumValue in enumType.values %}
Expand Down
4 changes: 3 additions & 1 deletion Templates/TypeScript/EnumTypeBarrel.stencil
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{% if enumNames.count > 0 %}{% for enumName in enumNames %}export { {{ enumName }} } from "./{{ enumName }}"
{% if header %}{{ header }}

{% endif %}{% if enumNames.count > 0 %}{% for enumName in enumNames %}export { {{ enumName }} } from "./{{ enumName }}"
{% endfor %}
{% else %}export {}
{% endif %}
4 changes: 3 additions & 1 deletion Templates/TypeScript/FragmentBarrel.stencil
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{% if fragmentNames.count > 0 %}{% for name in fragmentNames %}export type { {{ name }}FragmentData } from "./{{ name }}"
{% if header %}{{ header }}

{% endif %}{% if fragmentNames.count > 0 %}{% for name in fragmentNames %}export type { {{ name }}FragmentData } from "./{{ name }}"
export { {{ name|lowercasedFirstLetter }}Selections } from "./{{ name }}"
{% endfor %}
{% else %}export {}
Expand Down
4 changes: 3 additions & 1 deletion Templates/TypeScript/Helpers/Imports.stencil
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{% if header %}{{ header }}\n{% endif %}import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"
{% if header %}{{ header }}

{% endif %}import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"
{% if allReferencedFragments and allReferencedFragments.count > 0 %}import {
{% for name in allReferencedFragments %}{{ name }}FragmentData,
{{ name|lowercasedFirstLetter }}Selections,
Expand Down
5 changes: 3 additions & 2 deletions Templates/TypeScript/InputType.stencil
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ID } from "../GraphApi"
{{ header }}
{% if header %}{{ header }}

{% endif %}import { ID } from "../GraphApi"
{% if enumImports.count > 0 %}import {
{% for enum in enumImports %}{{ enum }},
{% endfor %}
Expand Down
4 changes: 3 additions & 1 deletion Templates/TypeScript/InputTypeBarrel.stencil
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{% if inputNames.count > 0 %}{% for inputName in inputNames %}export type { {{ inputName }} } from "./{{ inputName }}"
{% if header %}{{ header }}

{% endif %}{% if inputNames.count > 0 %}{% for inputName in inputNames %}export type { {{ inputName }} } from "./{{ inputName }}"
{% endfor %}
{% else %}export {}
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export enum CollectionRuleColumn {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export enum CollectionRuleRelation {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export enum CollectionSortOrder {

/**
Expand Down
2 changes: 2 additions & 0 deletions Tests/Resources/ExpectedTypeScriptCode/Enums/CountryCode.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export enum CountryCode {

/**
Expand Down
2 changes: 2 additions & 0 deletions Tests/Resources/ExpectedTypeScriptCode/Enums/CurrencyCode.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export enum CurrencyCode {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export enum CustomerMarketingOptInLevel {

/**
Expand Down
2 changes: 2 additions & 0 deletions Tests/Resources/ExpectedTypeScriptCode/Enums/DigitalWallet.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export enum DigitalWallet {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export enum FulfillmentDisplayStatus {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export enum FulfillmentEventStatus {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export enum MetafieldValueType {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export enum OrderDisplayFulfillmentStatus {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export enum PrivateMetafieldValueType {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export enum ProductVariantInventoryManagement {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export enum ProductVariantInventoryPolicy {

/**
Expand Down
2 changes: 2 additions & 0 deletions Tests/Resources/ExpectedTypeScriptCode/Enums/TaxExemption.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export enum TaxExemption {

/**
Expand Down
2 changes: 2 additions & 0 deletions Tests/Resources/ExpectedTypeScriptCode/Enums/WeightUnit.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export enum WeightUnit {

/**
Expand Down
2 changes: 2 additions & 0 deletions Tests/Resources/ExpectedTypeScriptCode/Enums/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export { CollectionRuleColumn } from "./CollectionRuleColumn"
export { CollectionRuleRelation } from "./CollectionRuleRelation"
export { CollectionSortOrder } from "./CollectionSortOrder"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"

export namespace BasicFragmentFragmentData {
Expand Down
2 changes: 2 additions & 0 deletions Tests/Resources/ExpectedTypeScriptCode/Fragments/NodeId.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"

export namespace NodeIdFragmentData {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"

export namespace ProductNodeTitleFragmentData {
Expand Down
2 changes: 2 additions & 0 deletions Tests/Resources/ExpectedTypeScriptCode/Fragments/Shop.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"

export namespace ShopFragmentData {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"

export namespace TimelineBasicEventFragmentFragmentData {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"

export namespace TimelineCommentEventFragmentFragmentData {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"

export namespace TimelineEventFragmentFragmentData {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"

export namespace TimelineFragmentFragmentData {
Expand Down
2 changes: 2 additions & 0 deletions Tests/Resources/ExpectedTypeScriptCode/Fragments/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export type { BasicFragmentFragmentData } from "./BasicFragment"
export { basicFragmentSelections } from "./BasicFragment"
export type { NodeIdFragmentData } from "./NodeId"
Expand Down
3 changes: 2 additions & 1 deletion Tests/Resources/ExpectedTypeScriptCode/GraphApi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { SimpleDocument } from "graphql-typed"
// Syrup auto-generated file
\nimport { SimpleDocument } from "graphql-typed"

export type ID = string

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID } from "../GraphApi"
import {
CollectionSortOrder,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID } from "../GraphApi"

export interface CollectionPublicationInput {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID } from "../GraphApi"
import {
CollectionRuleColumn,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID } from "../GraphApi"
import { CollectionRuleInput } from "./CollectionRuleInput"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID } from "../GraphApi"
import {
CustomerMarketingOptInLevel,
Expand Down
2 changes: 2 additions & 0 deletions Tests/Resources/ExpectedTypeScriptCode/Inputs/ImageInput.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID } from "../GraphApi"

export interface ImageInput {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID } from "../GraphApi"

export interface InventoryItemInput {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID } from "../GraphApi"

export interface InventoryLevelInput {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID } from "../GraphApi"
import {
CountryCode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID } from "../GraphApi"
import {
MetafieldValueType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID } from "../GraphApi"
import { PrivateMetafieldValueInput } from "./PrivateMetafieldValueInput"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID } from "../GraphApi"
import {
PrivateMetafieldValueType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID } from "../GraphApi"
import {
ProductVariantInventoryManagement,
Expand Down
2 changes: 2 additions & 0 deletions Tests/Resources/ExpectedTypeScriptCode/Inputs/SEOInput.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID } from "../GraphApi"

export interface SEOInput {
Expand Down
2 changes: 2 additions & 0 deletions Tests/Resources/ExpectedTypeScriptCode/Inputs/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

export type { CollectionInput } from "./CollectionInput"
export type { CollectionPublicationInput } from "./CollectionPublicationInput"
export type { CollectionRuleInput } from "./CollectionRuleInput"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"
import {
CollectionInput,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"
import {
ProductVariantInput,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"
import {
CustomerInput,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"
import {
TimelineBasicEventFragmentFragmentData,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"
import {
NodeIdFragmentData,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"

export namespace ProductsListQueryData {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"
import {
CurrencyCode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"
import {
ShopFragmentData,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"

export namespace TestDeprecatedFieldsQueryData {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"

export namespace TestQuery0QueryData {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"

export namespace TestQuery10QueryData {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"

export namespace TestQuery11QueryData {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"
import {
CurrencyCode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"

export namespace TestQuery2QueryData {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"

export namespace TestQuery3QueryData {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Syrup auto-generated file

import { ID, GraphSelection, SyrupOperation, copyWithTypeCondition } from "../GraphApi"

export namespace TestQuery4QueryData {
Expand Down
Loading

0 comments on commit 5e53022

Please sign in to comment.