Skip to content

Commit

Permalink
deps: upgrade to vite-2.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ElMassimo committed Oct 28, 2021
1 parent b5a07b0 commit beb6c7d
Show file tree
Hide file tree
Showing 8 changed files with 248 additions and 283 deletions.
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"postcss-nesting": "^8.0.1",
"preact-render-to-string": "^5.1.19",
"unplugin-icons": "^0.12.9",
"vite": "^2.6.10",
"vite": "^2.7.0-beta.0",
"vite-plugin-inspect": "^0.3.9",
"vite-plugin-windicss": "^1.4.1",
"vue-tsc": "^0.28.7"
Expand Down
2 changes: 1 addition & 1 deletion packages/hydration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"svelte": "^3.44",
"tsup": "5.5.0",
"typescript": "^4.4.4",
"vite": "^2.6.10",
"vite": "^2.7.0-beta.0",
"vue": "3.2.20"
}
}
6 changes: 3 additions & 3 deletions packages/iles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
"@islands/prerender": "workspace:^0.3.0",
"@nuxt/devalue": "^2.0.0",
"@rollup/plugin-virtual": "^2.0.3",
"@vitejs/plugin-vue": "^1.8.1",
"@vitejs/plugin-vue-jsx": "^1.1.8",
"@vitejs/plugin-vue": "^1.10.0-beta.0",
"@vitejs/plugin-vue-jsx": "^1.3.0-beta.0",
"@vue/compiler-sfc": "3.2.20",
"@vue/devtools-api": "^6.0.0-beta.15",
"@vue/server-renderer": "3.2.20",
Expand All @@ -71,7 +71,7 @@
"remark-frontmatter": "^4.0.0",
"unist-util-visit": "^2.0.3",
"unplugin-vue-components": "^0.16.0",
"vite": "^2.6.10",
"vite": "^2.7.0-beta.0",
"vite-plugin-pages": "npm:@mussi/vite-plugin-pages@0.18.3-beta.2",
"vite-plugin-xdm": "^0.2.0",
"vue": "3.2.20",
Expand Down
62 changes: 37 additions & 25 deletions packages/iles/src/node/cli.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/* eslint-disable @typescript-eslint/no-var-requires */
import { red, cyan, yellow, green } from 'nanocolors'
import minimist from 'minimist'
import { build } from './build/build'
import { createServer } from './server'

const argv: any = minimist(process.argv.slice(2))

const command = argv._[0]
Expand All @@ -15,30 +12,45 @@ const getVersion = () => cyan(`iles v${require('../../package.json').version}`)

const printVersion = () => console.info(getVersion())

if (!command || command === 'dev' || command === 'serve') {
createServer(root, argv)
.then(async ({ server }) => {
await server.listen()
const { config: { logger } } = server
logger.info(getVersion() + green(' dev server running at:\n'), { clear: !logger.hasWarned })
server.printUrls()
executeCommand(!command || command === 'dev' ? 'serve' : command)
.catch(error => { throw error })

async function executeCommand (command: string) {
if (command === 'serve') {
const { createServer } = await import('./server')
createServer(root, argv)
.then(async ({ server }) => {
await server.listen()
const { config: { logger } } = server
logger.info(getVersion() + green(' dev server running at:\n'), { clear: !logger.hasWarned })
server.printUrls()
})
.catch((err: any) => {
console.error(red('error starting server:\n'), err)
process.exit(1)
})
}
else if (command === 'build') {
printVersion()
const { build } = await import('./build/build')
build(root).catch((err: any) => {
console.error(red('build error:\n'), err)
process.exit(1)
})
.catch((err: any) => {
console.error(red('error starting server:\n'), err)
}
else if (command === 'preview') {
printVersion()
const { preview } = await import('./preview')
preview(root, argv).catch((err: any) => {
console.error(red('error starting preview:\n'), err)
process.exit(1)
})
}
else if (command === 'build') {
printVersion()
build(root).catch((err: any) => {
console.error(red('build error:\n'), err)
}
else if (command === 'info') {
printVersion()
}
else {
console.error(red(`unknown command "${command}".`))
process.exit(1)
})
}
else if (command === 'info') {
printVersion()
}
else {
console.error(red(`unknown command "${command}".`))
process.exit(1)
}
}
13 changes: 13 additions & 0 deletions packages/iles/src/node/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { ServerOptions, UserConfig as ViteUserConfig } from 'vite'
import { preview as vitePreview, mergeConfig } from 'vite'
import { resolveConfig } from './config'

export async function preview (root: string = process.cwd(), serverOptions: ServerOptions = {}) {
const config = await resolveConfig(root)
const viteConfig = mergeConfig(config.vite, {
server: serverOptions,
} as ViteUserConfig)

const server = await vitePreview(viteConfig)
server.printUrls()
}
2 changes: 1 addition & 1 deletion packages/prerender/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"svelte": "^3.44",
"tsup": "5.5.0",
"typescript": "^4.4.4",
"vite": "^2.6.10",
"vite": "^2.7.0-beta.0",
"vue": "3.2.20"
}
}
3 changes: 1 addition & 2 deletions playground/the-vue-point/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
"scripts": {
"dev": "iles --open",
"build": "iles build",
"preview": "vite preview --open"
"preview": "iles preview --open"
},
"devDependencies": {
"@iconify-json/carbon": "^1.0.7",
"@mapbox/rehype-prism": "^0.8.0",
"feed": "^4.2.1",
"iles": "workspace:*",
"unplugin-icons": "^0.12.15",
"vite": "^2.6.10",
"vite-plugin-windicss": "^1.4.1"
}
}
Loading

0 comments on commit beb6c7d

Please sign in to comment.