@shop-on/theme-config 0.0.0-stage → 0.2.0
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/dist/LICENSE.md +39 -0
- package/dist/server-stubs.d.ts +4 -0
- package/dist/server-stubs.js +13 -0
- package/dist/vite.d.ts +10 -0
- package/dist/vite.js +54 -0
- package/dist/vitest.d.ts +9 -0
- package/dist/vitest.js +17 -0
- package/package.json +39 -3
- package/README.md +0 -3
package/dist/LICENSE.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Cody Theme Development License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Cody LLC. All rights reserved except as granted below.
|
|
4
|
+
|
|
5
|
+
"The Software" is this package, its source, and its documentation. "The
|
|
6
|
+
Platform" is Cody, the commerce platform operated by Cody LLC.
|
|
7
|
+
|
|
8
|
+
## 1. Grant
|
|
9
|
+
|
|
10
|
+
You may use, copy and modify the Software, and distribute modified copies, solely
|
|
11
|
+
to develop, test, and distribute themes, apps and other extensions that run on
|
|
12
|
+
the Platform.
|
|
13
|
+
|
|
14
|
+
## 2. Restrictions
|
|
15
|
+
|
|
16
|
+
You may not:
|
|
17
|
+
|
|
18
|
+
1. use the Software, or anything derived from it, with any commerce platform,
|
|
19
|
+
storefront or hosting service other than the Platform;
|
|
20
|
+
2. use the Software to build a product that competes with the Platform;
|
|
21
|
+
3. sublicense the Software, or distribute it other than as part of a theme,
|
|
22
|
+
app or extension for the Platform;
|
|
23
|
+
4. remove or alter this license or any copyright notice in the Software.
|
|
24
|
+
|
|
25
|
+
## 3. Your work
|
|
26
|
+
|
|
27
|
+
Themes, apps and extensions you build with the Software are yours. The parts of
|
|
28
|
+
the Software they include stay under this license.
|
|
29
|
+
|
|
30
|
+
## 4. Termination
|
|
31
|
+
|
|
32
|
+
This license ends automatically if you break any of its terms. You must then
|
|
33
|
+
stop using the Software and delete your copies of it.
|
|
34
|
+
|
|
35
|
+
## 5. No warranty
|
|
36
|
+
|
|
37
|
+
The Software is provided "as is", without warranty of any kind. Cody LLC is not
|
|
38
|
+
liable for any claim, damages or other liability arising from the Software or
|
|
39
|
+
its use.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
//#region src/server-stubs.ts
|
|
3
|
+
const SERVER_STUBS = { motion: fileURLToPath(new URL("./stubs/motion.ts", import.meta.url)) };
|
|
4
|
+
function serverStubs() {
|
|
5
|
+
return {
|
|
6
|
+
name: "shop-on:server-stubs",
|
|
7
|
+
enforce: "pre",
|
|
8
|
+
applyToEnvironment: (environment) => environment.config.consumer === "server",
|
|
9
|
+
resolveId: (id) => SERVER_STUBS[id] ?? null
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { serverStubs };
|
package/dist/vite.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UserConfig } from "vite";
|
|
2
|
+
//#region src/vite.d.ts
|
|
3
|
+
export interface ThemeViteConfigOptions {
|
|
4
|
+
/** Dev-server port. Keep it a NUMERIC LITERAL at the call site: two
|
|
5
|
+
* generators regex-sniff `/port:\s*(\d+)/` out of `themes/<name>/vite.config.ts`
|
|
6
|
+
* (`turbo/generators/config.ts`, `packages/theme-dev-host/src/launch.ts`). */
|
|
7
|
+
port: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function createThemeViteConfig({ port }: ThemeViteConfigOptions): UserConfig;
|
|
10
|
+
//#endregion
|
package/dist/vite.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { serverStubs } from "./server-stubs.js";
|
|
2
|
+
import svgSpritemap from "@spiriit/vite-plugin-svg-spritemap";
|
|
3
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
4
|
+
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
|
|
5
|
+
import viteReact from "@vitejs/plugin-react";
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import { config } from "dotenv";
|
|
8
|
+
import { nitro } from "nitro/vite";
|
|
9
|
+
import { defineConfig } from "vite";
|
|
10
|
+
//#region src/vite.ts
|
|
11
|
+
const BROWSER_ONLY_IMPORTS = [
|
|
12
|
+
"hls.js/light",
|
|
13
|
+
"photoswipe",
|
|
14
|
+
"photoswipe/lightbox",
|
|
15
|
+
"simple-parallax-js/vanilla"
|
|
16
|
+
];
|
|
17
|
+
function createThemeViteConfig({ port }) {
|
|
18
|
+
const inWorkspace = existsSync("../../pnpm-workspace.yaml");
|
|
19
|
+
config({ path: inWorkspace ? [".env", "../../.env"] : [".env"] });
|
|
20
|
+
const hmrHost = process.env.THEME_HMR_HOST;
|
|
21
|
+
return defineConfig({
|
|
22
|
+
server: {
|
|
23
|
+
port,
|
|
24
|
+
host: true,
|
|
25
|
+
hmr: hmrHost ? {
|
|
26
|
+
host: hmrHost,
|
|
27
|
+
clientPort: port,
|
|
28
|
+
protocol: "ws"
|
|
29
|
+
} : { clientPort: port }
|
|
30
|
+
},
|
|
31
|
+
resolve: { tsconfigPaths: true },
|
|
32
|
+
build: {
|
|
33
|
+
manifest: true,
|
|
34
|
+
assetsInlineLimit: (filePath) => filePath.includes("theme-placeholder") ? false : void 0
|
|
35
|
+
},
|
|
36
|
+
optimizeDeps: { include: ["@shop-on/i18n > use-intl"] },
|
|
37
|
+
plugins: [
|
|
38
|
+
serverStubs(),
|
|
39
|
+
tanstackStart(),
|
|
40
|
+
nitro({
|
|
41
|
+
rollupConfig: { external: BROWSER_ONLY_IMPORTS },
|
|
42
|
+
rolldownConfig: { onLog(level, log, handler) {
|
|
43
|
+
if (log.code === "MODULE_LEVEL_DIRECTIVE" && log.message.includes("\"use client\"")) return;
|
|
44
|
+
handler(level, log);
|
|
45
|
+
} }
|
|
46
|
+
}),
|
|
47
|
+
viteReact(),
|
|
48
|
+
tailwindcss(),
|
|
49
|
+
svgSpritemap("./src/assets/icons/*.svg", { svgo: false })
|
|
50
|
+
]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { createThemeViteConfig };
|
package/dist/vitest.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/vitest.d.ts
|
|
2
|
+
export interface ThemeVitestConfigOptions {
|
|
3
|
+
/** The theme root. Passed in (rather than derived here) because a package-local
|
|
4
|
+
* `import.meta.dirname` would resolve to this package, not the theme whose
|
|
5
|
+
* `@/…` alias we're defining. Call sites pass `import.meta.dirname`. */
|
|
6
|
+
dirname: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function createThemeVitestConfig({ dirname }: ThemeVitestConfigOptions): import("vite").UserConfig;
|
|
9
|
+
//#endregion
|
package/dist/vitest.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import viteReact from "@vitejs/plugin-react";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { defineConfig } from "vitest/config";
|
|
4
|
+
//#region src/vitest.ts
|
|
5
|
+
function createThemeVitestConfig({ dirname }) {
|
|
6
|
+
return defineConfig({
|
|
7
|
+
plugins: [viteReact()],
|
|
8
|
+
test: {
|
|
9
|
+
include: ["src/**/*.test.{ts,tsx}", "test/**/*.test.{ts,tsx}"],
|
|
10
|
+
environment: "node",
|
|
11
|
+
testTimeout: 15e3
|
|
12
|
+
},
|
|
13
|
+
resolve: { alias: { "@": path.resolve(dirname) } }
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { createThemeVitestConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shop-on/theme-config",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"license": "SEE LICENSE IN dist/LICENSE.md",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
"./server-stubs": "./dist/server-stubs.js",
|
|
11
|
+
"./vite": "./dist/vite.js",
|
|
12
|
+
"./vitest": "./dist/vitest.js",
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"dotenv": "18.0.8"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@spiriit/vite-plugin-svg-spritemap": "7.2.0",
|
|
20
|
+
"@tailwindcss/vite": "4.3.3",
|
|
21
|
+
"@tanstack/react-start": "1.169.3",
|
|
22
|
+
"@types/node": "26.6.5",
|
|
23
|
+
"@vitejs/plugin-react": "6.1.2",
|
|
24
|
+
"nitro": "3.0.260903-beta",
|
|
25
|
+
"typescript": "7.0.2",
|
|
26
|
+
"vite": "8.3.5",
|
|
27
|
+
"vitest": "5.0.5"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@spiriit/vite-plugin-svg-spritemap": "*",
|
|
31
|
+
"@tailwindcss/vite": "*",
|
|
32
|
+
"@tanstack/react-start": "~1.169.3",
|
|
33
|
+
"@vitejs/plugin-react": "*",
|
|
34
|
+
"nitro": "*",
|
|
35
|
+
"vite": "*",
|
|
36
|
+
"vitest": "*"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"check-types": "tsc --noEmit",
|
|
40
|
+
"test": "vitest run --maxWorkers=2"
|
|
41
|
+
}
|
|
6
42
|
}
|
package/README.md
DELETED