Skip to content

Commit

Permalink
fix: windows build issue with vite-plugin-static-copy
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinchappell committed Dec 31, 2024
1 parent 60df16d commit 876acaa
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 143 deletions.
108 changes: 0 additions & 108 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"prebuild": "npm run build:lib",
"postbuild": "npm run generate:jsonSchema",
"build:demo": "vite build --mode demo",
"postbuild:demo": "node tools/copy-assets.mjss",
"build:demo:watch": "vite build --mode demo --watch",
"build:icons": "node ./tools/generate-sprite",
"lint": "eslint ./src --ext .js || true",
Expand Down Expand Up @@ -103,7 +104,6 @@
"vite-plugin-banner": "^0.8.0",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-html": "^3.2.2",
"vite-plugin-static-copy": "^2.0.0",
"zod": "^3.23.8",
"zod-to-json-schema": "^3.23.5"
},
Expand Down
8 changes: 5 additions & 3 deletions tools/generate-json-schema.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { join } from 'node:path'
import { join, dirname, resolve } from 'node:path'
import { writeFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url';
import { z } from 'zod'
import { zodToJsonSchema } from 'zod-to-json-schema'

const __dirname = join(new URL('.', import.meta.url).pathname)
const __dirname = dirname(fileURLToPath(import.meta.url));
const projectRoot = resolve(__dirname, '..');

const htmlAttributesSchema = z.record(
z.string(),
Expand Down Expand Up @@ -168,5 +170,5 @@ const reorderSchema = (schema: object) => {

const jsonSchema = zodToJsonSchema(formDataSchema, { name: 'formData', nameStrategy: 'title' })
const orderedJsonSchema = reorderSchema(jsonSchema)
const distDir = join(__dirname, '../dist')
const distDir = join(projectRoot, 'dist')
writeFileSync(join(distDir, 'formData_schema.json'), JSON.stringify(orderedJsonSchema, null, 2))
31 changes: 0 additions & 31 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { defineConfig } from 'vite'
import { languageFileOptions, enUS } from '@draggable/formeo-languages'
import banner from 'vite-plugin-banner'
import compression from 'vite-plugin-compression'
import { viteStaticCopy } from 'vite-plugin-static-copy'
import { createHtmlPlugin } from 'vite-plugin-html'

import pkg from './package.json'
Expand Down Expand Up @@ -103,35 +102,5 @@ export default defineConfig({
ext: '.gz',
threshold: 10240,
}),
viteStaticCopy({
targets: [
{
src: resolve('src/lib/icons/formeo-sprite.svg'),
dest: './assets/img/',
},
{
src: resolve('src/lib/icons/formeo-sprite.svg'),
dest: resolve('dist/'),
},
{
src: resolve('node_modules', '@draggable/formeo-languages/dist/lang/*'),
dest: './assets/lang',
},
{
src: resolve('dist/formeo.umd.js'),
dest: './assets/js/',
rename: 'formeo.min.js',
},
{
src: resolve('dist/formeo.umd.js'),
dest: resolve('dist/'),
rename: 'formeo.min.js',
},
{
src: resolve('dist/formeo.min.css'),
dest: './assets/css/',
},
],
}),
],
})

0 comments on commit 876acaa

Please sign in to comment.