Skip to content

Commit 5bff807

Browse files
authored
Merge pull request #265 from Shopify/javascript-cli_updates
[javascript-cli] Convert template to Javascript
2 parents 6028049 + d8cf062 commit 5bff807

9 files changed

Lines changed: 57 additions & 33 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
node: [20.19.0, 22, 24]
11+
node: [22, 24, 26]
1212
manager: ['npm', 'yarn', 'pnpm']
1313
steps:
1414
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -20,20 +20,20 @@ jobs:
2020
if: ${{ matrix.manager == 'pnpm' }}
2121
uses: pnpm/action-setup@v4
2222
with:
23-
version: 8
23+
version: 10
2424

2525
- name: Install dependencies using ${{ matrix.manager }}
2626
run: ${{ matrix.manager }} install
2727

28+
- name: Validate Prisma
29+
run: npx prisma generate && npx prisma validate
30+
2831
- name: Run TypeScript type checking
2932
if: ${{ !startsWith(github.head_ref || github.ref_name, 'javascript') }}
3033
run: npx tsc --noEmit
3134

3235
- name: Run ESLint
3336
run: npm run lint
3437

35-
- name: Validate Prisma
36-
run: npx prisma generate && npx prisma validate
37-
3838
- name: Build application
3939
run: npm run build

.github/workflows/convert-to-javascript.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ jobs:
2828
- name: Setup pnpm
2929
uses: pnpm/action-setup@v4
3030
with:
31-
version: 8
31+
version: 10
3232

3333
- name: Setup Node.js
3434
uses: actions/setup-node@v5
3535
with:
36-
node-version: 20.x
36+
node-version: 24.x
3737

3838
- name: Install dependencies
3939
run: |

.graphqlrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function getConfig() {
66
projects: {
77
default: shopifyApiProject({
88
apiType: ApiType.Admin,
9-
apiVersion: ApiVersion.October25,
9+
apiVersion: ApiVersion.July26,
1010
documents: [
1111
"./app/**/*.{js,ts,jsx,tsx}",
1212
"./app/.server/**/*.{js,ts,jsx,tsx}",

app/routes/app._index.jsx

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,12 @@ export const action = async ({ request }) => {
8080
const variantResponseJson = await variantResponse.json();
8181
const metaobjectResponse = await admin.graphql(
8282
`#graphql
83-
mutation shopifyReactRouterTemplateUpsertMetaobject($handle: MetaobjectHandleInput!, $metaobject: MetaobjectUpsertInput!) {
84-
metaobjectUpsert(handle: $handle, metaobject: $metaobject) {
83+
mutation shopifyReactRouterTemplateUpsertMetaobject($handle: MetaobjectHandleInput!, $values: JSON!) {
84+
metaobjectUpsert(handle: $handle, values: $values) {
8585
metaobject {
8686
id
8787
handle
88-
title: field(key: "title") {
89-
jsonValue
90-
}
91-
description: field(key: "description") {
92-
jsonValue
93-
}
88+
values
9489
}
9590
userErrors {
9691
field
@@ -104,15 +99,10 @@ export const action = async ({ request }) => {
10499
type: "$app:example",
105100
handle: "demo-entry",
106101
},
107-
metaobject: {
108-
fields: [
109-
{ key: "title", value: "Demo Entry" },
110-
{
111-
key: "description",
112-
value:
113-
"This metaobject was created by the Shopify app template to demonstrate the metaobject API.",
114-
},
115-
],
102+
values: {
103+
title: "Demo Entry",
104+
description:
105+
"This metaobject was created by the Shopify app template to demonstrate the metaobject API.",
116106
},
117107
},
118108
},
@@ -223,7 +213,13 @@ export default function Index() {
223213
borderRadius="base"
224214
background="subdued"
225215
>
226-
<pre style={{ margin: 0 }}>
216+
<pre
217+
style={{
218+
margin: 0,
219+
whiteSpace: "pre-wrap",
220+
wordBreak: "break-word",
221+
}}
222+
>
227223
<code>{JSON.stringify(fetcher.data.product, null, 2)}</code>
228224
</pre>
229225
</s-box>
@@ -235,7 +231,13 @@ export default function Index() {
235231
borderRadius="base"
236232
background="subdued"
237233
>
238-
<pre style={{ margin: 0 }}>
234+
<pre
235+
style={{
236+
margin: 0,
237+
whiteSpace: "pre-wrap",
238+
wordBreak: "break-word",
239+
}}
240+
>
239241
<code>{JSON.stringify(fetcher.data.variant, null, 2)}</code>
240242
</pre>
241243
</s-box>
@@ -247,7 +249,13 @@ export default function Index() {
247249
borderRadius="base"
248250
background="subdued"
249251
>
250-
<pre style={{ margin: 0 }}>
252+
<pre
253+
style={{
254+
margin: 0,
255+
whiteSpace: "pre-wrap",
256+
wordBreak: "break-word",
257+
}}
258+
>
251259
<code>
252260
{JSON.stringify(fetcher.data.metaobject, null, 2)}
253261
</code>

app/shopify.server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import prisma from "./db.server";
1010
const shopify = shopifyApp({
1111
apiKey: process.env.SHOPIFY_API_KEY,
1212
apiSecretKey: process.env.SHOPIFY_API_SECRET || "",
13-
apiVersion: ApiVersion.October25,
13+
apiVersion: ApiVersion.July26,
1414
scopes: process.env.SCOPES?.split(","),
1515
appUrl: process.env.SHOPIFY_APP_URL || "",
1616
authPathPrefix: "/auth",
@@ -25,7 +25,7 @@ const shopify = shopifyApp({
2525
});
2626

2727
export default shopify;
28-
export const apiVersion = ApiVersion.October25;
28+
export const apiVersion = ApiVersion.July26;
2929
export const addDocumentResponseHeaders = shopify.addDocumentResponseHeaders;
3030
export const authenticate = shopify.authenticate;
3131
export const unauthenticated = shopify.unauthenticated;

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@react-router/node": "^7.12.0",
3131
"@react-router/serve": "^7.12.0",
3232
"@shopify/app-bridge-react": "^4.2.4",
33-
"@shopify/shopify-app-react-router": "^1.1.0",
33+
"@shopify/shopify-app-react-router": "^1.2.1",
3434
"@shopify/shopify-app-session-storage-prisma": "^9.0.0",
3535
"isbot": "^5.1.31",
3636
"prisma": "^6.16.3",
@@ -41,7 +41,7 @@
4141
},
4242
"devDependencies": {
4343
"@shopify/api-codegen-preset": "^1.2.0",
44-
"@shopify/polaris-types": "1.0.1",
44+
"@shopify/polaris-types": "^1.0.1",
4545
"@types/eslint": "^9.6.1",
4646
"@types/node": "^22.18.8",
4747
"@types/react": "^18.3.25",

pnpm-workspace.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
packages:
2+
- 'extensions/*'
3+
allowBuilds:
4+
'@parcel/watcher': true
5+
'@prisma/client': true
6+
'@prisma/engines': true
7+
esbuild: true
8+
prisma: true
9+
unrs-resolver: true

shopify.app.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ name = "Description"
2828
type = "multi_line_text_field"
2929

3030
[webhooks]
31-
api_version = "2025-10"
31+
api_version = "2026-07"
3232

3333
# Handled by: /app/routes/webhooks.app.uninstalled.tsx
3434
[[webhooks.subscriptions]]

shopify.web.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name = "React Router"
2+
roles = ["frontend", "backend"]
3+
webhooks_path = "/webhooks/app/uninstalled"
4+
5+
[commands]
6+
predev = "npx prisma generate"
7+
dev = "npx prisma migrate deploy && npm exec react-router dev"

0 commit comments

Comments
 (0)