@jarwizz/create-jarshop 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/cli.d.ts +14 -0
- package/dist/cli.js +27 -3
- package/dist/cli.js.map +1 -1
- package/dist/template/README.md +1 -1
- package/dist/template/i18n/dashboard/sk.po +6018 -0
- package/dist/template/package.json +5 -2
- package/dist/template/patches/@vendure__dashboard@3.7.1.patch +6535 -0
- package/dist/template/pnpm-lock.yaml +63 -7
- package/dist/template/pnpm-workspace.yaml +2 -0
- package/dist/template/src/plugins/jarshop-checkout/cod-payment-core.ts +102 -0
- package/dist/template/src/plugins/jarshop-checkout/cod-payment.test.ts +71 -1
- package/dist/template/src/plugins/jarshop-checkout/cod-payment.ts +13 -8
- package/dist/template/src/plugins/jarshop-checkout/dashboard/index.tsx +4 -0
- package/dist/template/src/plugins/jarshop-checkout/dashboard/login-branding.tsx +49 -0
- package/dist/template/src/plugins/jarshop-checkout/shipping-rates.ts +13 -0
- package/dist/template/src/seed.ts +34 -3
- package/dist/template/src/vendure-config.ts +9 -1
- package/dist/template/static/email/templates/partials/footer.hbs +1 -1
- package/dist/template/static/email/templates/partials/header.hbs +3 -1
- package/dist/template/turbo.json +1 -0
- package/dist/template/vite.config.mts +41 -3
- package/dist/template/vitest.config.ts +11 -0
- package/dist/template-manifest.json +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
import { vendureDashboardPlugin } from "@vendure/dashboard/vite";
|
|
2
|
-
import {
|
|
2
|
+
import { LanguageCode } from "@vendure/core";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { dirname, join, resolve } from "node:path";
|
|
3
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
6
|
import { defineConfig } from "vite";
|
|
5
7
|
|
|
6
8
|
const projectRoot = fileURLToPath(new URL(".", import.meta.url));
|
|
9
|
+
const requireFromRoot = createRequire(import.meta.url);
|
|
10
|
+
|
|
11
|
+
function packageDirectory(name: string): string {
|
|
12
|
+
return dirname(requireFromRoot.resolve(`${name}/package.json`));
|
|
13
|
+
}
|
|
7
14
|
|
|
8
15
|
export default defineConfig({
|
|
9
16
|
base: "/dashboard",
|
|
10
|
-
build: {
|
|
17
|
+
build: {
|
|
18
|
+
outDir: join(projectRoot, "dist/dashboard"),
|
|
19
|
+
// The output directory is named by an absolute path, which is outside the
|
|
20
|
+
// Vite root, and Vite will not empty such a directory unless asked. Without
|
|
21
|
+
// this, every dashboard build layers its hashed assets on top of the last
|
|
22
|
+
// one: the directory grows without bound and the served chunk graph can mix
|
|
23
|
+
// two builds, which fails at runtime as a null React dispatcher.
|
|
24
|
+
emptyOutDir: true,
|
|
25
|
+
},
|
|
11
26
|
plugins: [
|
|
12
27
|
vendureDashboardPlugin({
|
|
13
28
|
vendureConfigPath: pathToFileURL(
|
|
@@ -20,10 +35,33 @@ export default defineConfig({
|
|
|
20
35
|
host: "http://localhost",
|
|
21
36
|
port: Number(process.env.PORT ?? 3000),
|
|
22
37
|
},
|
|
38
|
+
// JarShop ships its own Slovak catalogue through a patch on
|
|
39
|
+
// @vendure/dashboard. Vendure's own default language list has no Slovak
|
|
40
|
+
// in it, so the display-language dialog has to be told about it here.
|
|
41
|
+
i18n: {
|
|
42
|
+
defaultLanguage: LanguageCode.sk,
|
|
43
|
+
defaultLocale: "SK",
|
|
44
|
+
availableLanguages: [LanguageCode.sk, LanguageCode.en],
|
|
45
|
+
availableLocales: ["SK", "CZ", "AT", "GB", "US"],
|
|
46
|
+
},
|
|
23
47
|
gqlOutputPath: "./src/gql",
|
|
48
|
+
// Dashboard extensions shipped by an installed Feature Package are found by
|
|
49
|
+
// scanning node_modules. The default guess is derived from wherever
|
|
50
|
+
// `@vendure/core` resolves, which under pnpm is a directory inside
|
|
51
|
+
// `node_modules/.pnpm` that holds Vendure alone — every other installed
|
|
52
|
+
// package is invisible from there. Point the scanner at this project's own
|
|
53
|
+
// `node_modules` so package-provided extensions are discovered.
|
|
54
|
+
pluginPackageScanner: {
|
|
55
|
+
nodeModulesRoot: resolve(projectRoot, "node_modules"),
|
|
56
|
+
},
|
|
24
57
|
}),
|
|
25
58
|
],
|
|
26
59
|
resolve: {
|
|
27
|
-
|
|
60
|
+
// Extensions and the Dashboard must share React, including JSX subpaths.
|
|
61
|
+
alias: {
|
|
62
|
+
"react-dom": packageDirectory("react-dom"),
|
|
63
|
+
react: packageDirectory("react"),
|
|
64
|
+
"@/gql": resolve(projectRoot, "src/gql/graphql.ts"),
|
|
65
|
+
},
|
|
28
66
|
},
|
|
29
67
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
|
|
3
|
+
// A bare `vitest run` would pick up `vite.config.mts`, which loads the
|
|
4
|
+
// Dashboard build plugin and the whole Vendure config just to run unit tests.
|
|
5
|
+
// This file keeps the Vendure-side plugin tests on a plain Node runner.
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
test: {
|
|
8
|
+
environment: "node",
|
|
9
|
+
include: ["src/**/*.test.ts"],
|
|
10
|
+
},
|
|
11
|
+
});
|