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
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish to NPM

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'

- name: Install root dependencies
run: npm ci

- name: Install admin-frame dependencies
run: cd admin-frame && npm ci --legacy-peer-deps

- name: Install app-bridge dependencies
run: cd app-bridge && npm ci

- name: Build
run: npm run build

- name: Publish to NPM
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,9 @@ pids/
# Temporary files
tmp/
temp/

# Mock bridge configuration
dev.mock-bridge.json

# Test screenshots
*.png
28 changes: 28 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Mock Bridge

Shopify embedded app testing solution - test locally without real credentials.

## Quick Start
- `npm install` - Install dependencies
- `npm run build` - Build TypeScript
- `npx ts-node src/cli/index.ts <app-url>` - Run dev server

## Architecture
- `src/server/` - Express server (MockShopifyAdminServer)
- `src/auth/` - JWT token generation/validation
- `src/client/` - Browser-side mock detection
- `src/cli/` - Commander.js CLI

## Key Files
- `src/server/index.ts` - Core server, routes, admin UI HTML
- `src/auth/token-generator.ts` - JWT creation/verification
- `src/auth/validateSessionToken.ts` - Universal token validator
- `src/client/mock-detector.ts` - Client environment detection

## Testing
Server runs on port 3080 by default. Navigate to http://localhost:3080 to see mock admin.

## Default Config
- Port: 3080
- Shop: test-shop.myshopify.com
- Client ID: shopify-mock-dev-client-2024
24 changes: 24 additions & 0 deletions admin-frame/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
4 changes: 4 additions & 0 deletions admin-frame/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Admin frame

This app is intended to provide a pseudo-Shopify admin interface to wrap Shopify apps in development.
It should house app bridge method implementations.
27 changes: 27 additions & 0 deletions admin-frame/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'

export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs['recommended-latest'],
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'off',
}
},
])
14 changes: 14 additions & 0 deletions admin-frame/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Mock Bridge</title>
<script src="https://cdn.shopify.com/shopifycloud/polaris.js"></script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading