Update card production workflow and workspaces
This commit is contained in:
@@ -1,9 +1,23 @@
|
||||
import { createReadStream } from 'node:fs'
|
||||
import { stat } from 'node:fs/promises'
|
||||
import { relative, sep } from 'node:path'
|
||||
import { defineConfig } from 'vite'
|
||||
import { acceptedCardsRoot, resolveCardAssetRequest, scanCardCatalog } from './scripts/card-catalog.mjs'
|
||||
import { readSurfaceDefaults, surfaceDefaultsPath, updateSurfaceDefaults } from './scripts/surface-defaults.mjs'
|
||||
|
||||
const resolutionDirectories = new Set(['low', 'med', 'high'])
|
||||
|
||||
function ignoreGeneratedCardArtifact(path) {
|
||||
const fromCardsRoot = relative(acceptedCardsRoot, path)
|
||||
if (!fromCardsRoot || fromCardsRoot === '..' || fromCardsRoot.startsWith(`..${sep}`)) return false
|
||||
const parts = fromCardsRoot.split(sep)
|
||||
if (parts.length === 1) return false // Keep card directories to discover new cards.
|
||||
if (parts.length === 2) {
|
||||
return !['card.json', 'manifest.json'].includes(parts[1]) && !resolutionDirectories.has(parts[1])
|
||||
}
|
||||
return parts.length !== 3 || !resolutionDirectories.has(parts[1]) || parts[2] !== 'manifest.json'
|
||||
}
|
||||
|
||||
function json(response, status, value) {
|
||||
response.statusCode = status
|
||||
response.setHeader('Content-Type', 'application/json')
|
||||
@@ -91,4 +105,7 @@ function cardLibraryPlugin() {
|
||||
configurePreviewServer(server) { installRoutes(server, false) },
|
||||
}
|
||||
}
|
||||
export default defineConfig({ plugins: [cardLibraryPlugin()] })
|
||||
export default defineConfig({
|
||||
plugins: [cardLibraryPlugin()],
|
||||
server: { watch: { ignored: ignoreGeneratedCardArtifact } },
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user