Skip to content

Commit

Permalink
Merge branch 'develop' into feat/sc-table-migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperkristensen authored Jan 24, 2025
2 parents d0c099b + cdfde0d commit 3a8498f
Show file tree
Hide file tree
Showing 50 changed files with 6,613 additions and 295 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-dancers-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---

fix(dashboard): Format i18n schema with Prettier
6 changes: 6 additions & 0 deletions .changeset/dry-insects-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@medusajs/medusa": patch
"@medusajs/framework": patch
---

fix: switch from tsc watch to chokidar
5 changes: 5 additions & 0 deletions .changeset/fluffy-cars-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/admin-bundler": patch
---

fix(admin-bundler): Optimize tanstack/react-query
5 changes: 5 additions & 0 deletions .changeset/six-walls-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/fulfillment": patch
---

Fix shipping option rules migration to mikro-orm v6
1 change: 1 addition & 0 deletions packages/admin/admin-bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@medusajs/admin-shared": "2.3.1",
"@medusajs/admin-vite-plugin": "2.3.1",
"@medusajs/dashboard": "2.3.1",
"@rollup/plugin-node-resolve": "^16.0.0",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.16",
"compression": "^1.7.4",
Expand Down
1 change: 1 addition & 0 deletions packages/admin/admin-bundler/src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export async function getViteConfig(
"react-router-dom",
"@medusajs/ui",
"@medusajs/dashboard",
"@tanstack/react-query",
],
exclude: [...VIRTUAL_MODULES],
},
Expand Down
6 changes: 5 additions & 1 deletion packages/admin/admin-bundler/src/lib/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface PluginOptions {
export async function plugin(options: PluginOptions) {
const vite = await import("vite")
const react = (await import("@vitejs/plugin-react")).default
const { nodeResolve } = await import("@rollup/plugin-node-resolve")
const entries = await glob(`${options.root}/src/admin/**/*.{ts,tsx,js,jsx}`)

/**
Expand All @@ -36,11 +37,13 @@ export async function plugin(options: PluginOptions) {
const external = new Set([
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
...Object.keys(pkg.devDependencies || {}),
"react",
"react-dom",
"react/jsx-runtime",
"react-router-dom",
"@medusajs/admin-sdk",
"@tanstack/react-query",
])

/**
Expand All @@ -60,7 +63,8 @@ export async function plugin(options: PluginOptions) {
minify: false,
outDir: path.resolve(options.root, options.outDir),
rollupOptions: {
external: [...external],
plugins: [nodeResolve() as any],
external: [...external, /node_modules/],
output: {
globals: {
react: "React",
Expand Down
4 changes: 2 additions & 2 deletions packages/admin/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"dist"
],
"dependencies": {
"@ariakit/react": "^0.4.1",
"@ariakit/react": "^0.4.15",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/sortable": "^8.0.0",
"@hookform/error-message": "^2.0.1",
Expand All @@ -50,7 +50,7 @@
"@medusajs/js-sdk": "2.3.1",
"@medusajs/ui": "4.0.3",
"@radix-ui/react-collapsible": "1.1.0",
"@tanstack/react-query": "^5.28.14",
"@tanstack/react-query": "5.64.2",
"@tanstack/react-table": "8.20.5",
"@tanstack/react-virtual": "^3.8.3",
"@uiw/react-json-view": "^2.0.0-alpha.17",
Expand Down
31 changes: 23 additions & 8 deletions packages/admin/dashboard/scripts/i18n/generate-schema.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require("fs")
const fs = require("fs/promises")
const path = require("path")
const prettier = require("prettier")

const translationsDir = path.join(__dirname, "../../src/i18n/translations")
const enPath = path.join(translationsDir, "en.json")
Expand Down Expand Up @@ -33,17 +34,31 @@ function generateSchemaFromObject(obj) {
}
}

try {
const enJson = JSON.parse(fs.readFileSync(enPath, "utf-8"))
async function outputSchema() {
const enContent = await fs.readFile(enPath, "utf-8")
const enJson = JSON.parse(enContent)

const schema = {
$schema: "http://json-schema.org/draft-07/schema#",
...generateSchemaFromObject(enJson),
}

fs.writeFileSync(schemaPath, JSON.stringify(schema, null, 2))
console.log("Schema generated successfully at:", schemaPath)
} catch (error) {
console.error("Error generating schema:", error.message)
process.exit(1)
const formattedSchema = await prettier.format(
JSON.stringify(schema, null, 2),
{
parser: "json",
}
)

await fs
.writeFile(schemaPath, formattedSchema)
.then(() => {
console.log("Schema generated successfully at:", schemaPath)
})
.catch((error) => {
console.error("Error generating schema:", error.message)
process.exit(1)
})
}

outputSchema()
17 changes: 15 additions & 2 deletions packages/admin/dashboard/src/i18n/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import {
mk,
mn,
ar,
zhCN
zhCN,
faIR,
cs
} from "date-fns/locale"

import { Language } from "./types"

export const languages: Language[] = [
Expand Down Expand Up @@ -116,4 +117,16 @@ export const languages: Language[] = [
ltr: true,
date_locale: zhCN,
},
{
code: "fa",
display_name: "فارسی",
ltr: false,
date_locale: faIR,
},
{
code: "cs",
display_name: "Čeština",
ltr: true,
date_locale: cs,
},
]
Loading

0 comments on commit 3a8498f

Please sign in to comment.