Skip to content

Commit 3021498

Browse files
committed
do a simple substitution instead of having a separate file
1 parent 556b727 commit 3021498

File tree

3 files changed

+16
-121
lines changed

3 files changed

+16
-121
lines changed

packages/cli/src/commands/setup/realtime/realtimeHandler.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,18 @@ export async function handler({ force, includeExamples, verbose }) {
6868
'templates',
6969
'subscriptions',
7070
'countdown',
71-
projectIsEsm()
72-
? 'esm-countdown.ts.template'
73-
: `countdown.ts.template`,
71+
`countdown.ts.template`,
7472
),
7573
'utf-8',
7674
)
7775

76+
if (projectIsEsm()) {
77+
exampleSubscriptionTemplateContent.replace(
78+
"import gql from 'graphql-tag'",
79+
"import { gql } from 'graphql-tag'",
80+
)
81+
}
82+
7883
const exampleFile = path.join(
7984
redwoodPaths.api.subscriptions,
8085
'countdown',
@@ -151,13 +156,18 @@ export async function handler({ force, includeExamples, verbose }) {
151156
'templates',
152157
'subscriptions',
153158
'newMessage',
154-
projectIsEsm()
155-
? 'esm-newMessage.ts.template'
156-
: 'newMessage.ts.template',
159+
'newMessage.ts.template',
157160
),
158161
'utf-8',
159162
)
160163

164+
if (projectIsEsm()) {
165+
exampleSubscriptionTemplateContent.replace(
166+
"import gql from 'graphql-tag'",
167+
"import { gql } from 'graphql-tag'",
168+
)
169+
}
170+
161171
const exampleFile = path.join(
162172
redwoodPaths.api.subscriptions,
163173
'newMessage',

packages/cli/src/commands/setup/realtime/templates/subscriptions/countdown/esm-countdown.ts.template

Lines changed: 0 additions & 58 deletions
This file was deleted.

packages/cli/src/commands/setup/realtime/templates/subscriptions/newMessage/esm-newMessage.ts.template

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)