@inkdropapp/theme-dev-helpers 0.3.1 → 0.3.3
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 +9 -0
- package/bin/dev-server +6 -0
- package/package.json +3 -3
- package/src/dev-server.tsx +7 -10
- package/src/vite-env.d.ts +10 -0
- package/vite.config.ts +15 -3
package/README.md
CHANGED
package/bin/dev-server
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkdropapp/theme-dev-helpers",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A helper module for creating themes for Inkdrop",
|
|
6
6
|
"keywords": [
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
"markdown"
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
|
-
"dev-server": "bunx --bun vite",
|
|
12
11
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
13
12
|
},
|
|
14
13
|
"repository": {
|
|
@@ -18,7 +17,8 @@
|
|
|
18
17
|
"author": "Takuya Matsuyama<t@inkdrop.app>",
|
|
19
18
|
"license": "MIT",
|
|
20
19
|
"bin": {
|
|
21
|
-
"generate-palette": "./bin/generate-palette"
|
|
20
|
+
"generate-palette": "./bin/generate-palette",
|
|
21
|
+
"dev-server": "./bin/dev-server"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@inkdropapp/base-ui-theme": "^0.3.1",
|
package/src/dev-server.tsx
CHANGED
|
@@ -6,21 +6,18 @@ import "./dev-server.css";
|
|
|
6
6
|
import "@inkdropapp/css/reset.css";
|
|
7
7
|
import "@inkdropapp/css/tokens.css";
|
|
8
8
|
import "@inkdropapp/base-ui-theme/styles/theme.css";
|
|
9
|
-
import "@/styles/tokens.css";
|
|
10
|
-
import "@/styles/theme.css";
|
|
11
9
|
|
|
12
10
|
import { ColorTokensPage } from "./dev-server/color-tokens";
|
|
13
11
|
import { VariablesPage } from "./dev-server/variables";
|
|
14
12
|
import { ComponentsPage } from "./dev-server/components";
|
|
13
|
+
const baseProjectPath = import.meta.env.BASE_PROJECT_PATH || ''
|
|
14
|
+
const styleSheets: string[] = import.meta.env.STYLE_SHEETS || []
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// cssFiles.forEach((file) => {
|
|
22
|
-
// import(/* @vite-ignore */ file);
|
|
23
|
-
// });
|
|
16
|
+
const cssFiles = styleSheets.map(ss => `${baseProjectPath}/styles/${ss}`)
|
|
17
|
+
|
|
18
|
+
cssFiles.forEach((file) => {
|
|
19
|
+
import(file);
|
|
20
|
+
});
|
|
24
21
|
|
|
25
22
|
const router = createBrowserRouter([
|
|
26
23
|
{
|
package/vite.config.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { fileURLToPath, URL } from 'url'
|
|
2
1
|
import { defineConfig } from 'vite'
|
|
3
2
|
import react from '@vitejs/plugin-react'
|
|
4
3
|
|
|
5
|
-
const baseProjectPath = process.env.BASE_PROJECT_PATH ||
|
|
4
|
+
const baseProjectPath = process.env.BASE_PROJECT_PATH || process.cwd()
|
|
6
5
|
console.log('Base project path:', baseProjectPath)
|
|
6
|
+
const packageJson = await import(`${baseProjectPath}/package.json`, {
|
|
7
|
+
with: {
|
|
8
|
+
type: "json",
|
|
9
|
+
}
|
|
10
|
+
})
|
|
11
|
+
const { styleSheets } = packageJson
|
|
7
12
|
|
|
8
13
|
// https://vitejs.dev/config/
|
|
9
14
|
export default defineConfig({
|
|
@@ -16,9 +21,16 @@ export default defineConfig({
|
|
|
16
21
|
}
|
|
17
22
|
]
|
|
18
23
|
},
|
|
24
|
+
define: {
|
|
25
|
+
'import.meta.env.BASE_PROJECT_PATH': JSON.stringify(baseProjectPath),
|
|
26
|
+
'import.meta.env.STYLE_SHEETS': JSON.stringify(styleSheets)
|
|
27
|
+
},
|
|
19
28
|
server: {
|
|
20
29
|
fs: {
|
|
21
|
-
|
|
30
|
+
strict: false
|
|
22
31
|
}
|
|
32
|
+
},
|
|
33
|
+
optimizeDeps: {
|
|
34
|
+
include: ['react', 'react-dom', 'react-dom/client', 'react/jsx-dev-runtime', 'react/jsx-runtime']
|
|
23
35
|
}
|
|
24
36
|
})
|