Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Oct 28, 2024
1 parent 42c6e5a commit 7142389
Show file tree
Hide file tree
Showing 17 changed files with 52 additions and 51 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Release

permissions:
id-token: write
contents: write

on:
push:
tags:
Expand All @@ -9,18 +13,15 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Set node
uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: lts/*
registry-url: https://registry.npmjs.org/

- run: npx changelogithub
- run: pnpm dlx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@ Following [Pinia's guide](https://pinia.esm.dev/ssr), you will to adapt your `ma
like this:

```ts
// main.ts
import { ViteSSG } from 'vite-ssg'
import { createPinia } from 'pinia'
import routes from 'virtual:generated-pages'
// main.ts
import { ViteSSG } from 'vite-ssg'

import App from './App.vue'
// use any store you configured that you need data from on start-up
import { useRootStore } from './store/root'
import App from './App.vue'

export const createApp = ViteSSG(
App,
Expand Down Expand Up @@ -211,9 +211,9 @@ export const createApp = ViteSSG(
<p>

```ts
import routes from 'virtual:generated-pages'
// main.ts
import { ViteSSG } from 'vite-ssg'
import routes from 'virtual:generated-pages'
import { createStore } from 'vuex'
import App from './App.vue'

Expand Down
2 changes: 1 addition & 1 deletion examples/multiple-pages-pwa/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import routes from '~pages'
import { ViteSSG } from 'vite-ssg'
import App from './App.vue'
import routes from '~pages'

export const createApp = ViteSSG(App, {
base: import.meta.env.BASE_URL,
Expand Down
2 changes: 1 addition & 1 deletion examples/multiple-pages-pwa/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { UserConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import Pages from 'vite-plugin-pages'
import { VitePWA } from 'vite-plugin-pwa'
import Vue from '@vitejs/plugin-vue'

const config: UserConfig = {
plugins: [
Expand Down
6 changes: 3 additions & 3 deletions examples/multiple-pages-with-store/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import devalue from '@nuxt/devalue'
import { ViteSSG } from 'vite-ssg'
import routes from '~pages'
import { createPinia } from 'pinia'
import { useRootStore } from './store/root'
import { ViteSSG } from 'vite-ssg'
import App from './App.vue'
import routes from '~pages'
import { useRootStore } from './store/root'

export const createApp = ViteSSG(
App,
Expand Down
2 changes: 1 addition & 1 deletion examples/multiple-pages-with-store/src/pages/b.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { computed } from 'vue'
import { useHead } from '@unhead/vue'
import { computed } from 'vue'
import { useRootStore } from '../store/root'
export default {
Expand Down
4 changes: 2 additions & 2 deletions examples/multiple-pages-with-store/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { UserConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import Markdown from 'unplugin-vue-markdown/vite'
import Pages from 'vite-plugin-pages'
import Components from 'unplugin-vue-components/vite'
import Vue from '@vitejs/plugin-vue'
import 'vite-ssg'

const config: UserConfig = {
Expand Down
2 changes: 1 addition & 1 deletion examples/multiple-pages/src/entry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import routes from '~pages'
import { ViteSSG } from 'vite-ssg'
import App from './App.vue'
import routes from '~pages'

export const createApp = ViteSSG(App, {
base: import.meta.env.BASE_URL,
Expand Down
6 changes: 3 additions & 3 deletions examples/multiple-pages/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { UserConfig } from 'vite'
import Pages from 'vite-plugin-pages'
import Markdown from 'unplugin-vue-markdown/vite'
import Components from 'unplugin-vue-components/vite'
import Vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import Markdown from 'unplugin-vue-markdown/vite'
import Pages from 'vite-plugin-pages'

const config: UserConfig = {
plugins: [
Expand Down
2 changes: 1 addition & 1 deletion examples/single-page/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createPinia } from 'pinia'
import { ViteSSG } from 'vite-ssg/single-page'
import { useRootStore } from './store/root'
import App from './App.vue'
import { useRootStore } from './store/root'

export const createApp = ViteSSG(
App,
Expand Down
8 changes: 4 additions & 4 deletions src/client/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { MergeHead, VueHeadClient } from '@unhead/vue'
import type { Component } from 'vue'
import type { RouterOptions, ViteSSGClientOptions, ViteSSGContext } from '../types'
import { createHead } from '@unhead/vue'
import { createApp as createClientApp, createSSRApp } from 'vue'
import { createMemoryHistory, createRouter, createWebHistory } from 'vue-router'
import type { MergeHead, VueHeadClient } from '@unhead/vue'
import { createHead } from '@unhead/vue'
import { deserializeState } from '../utils/state'
import { documentReady } from '../utils/document-ready'
import type { RouterOptions, ViteSSGClientOptions, ViteSSGContext } from '../types'
import { deserializeState } from '../utils/state'
import { ClientOnly } from './components/ClientOnly'

export * from '../types'
Expand Down
8 changes: 4 additions & 4 deletions src/client/single-page.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Component } from 'vue'
import { createApp as createClientApp, createSSRApp } from 'vue'
import type { MergeHead, VueHeadClient } from '@unhead/vue'
import { createHead } from '@unhead/vue'
import type { Component } from 'vue'
import type { ViteSSGClientOptions, ViteSSGContext } from '../types'
import { deserializeState } from '../utils/state'
import { createHead } from '@unhead/vue'
import { createApp as createClientApp, createSSRApp } from 'vue'
import { documentReady } from '../utils/document-ready'
import { deserializeState } from '../utils/state'
import { ClientOnly } from './components/ClientOnly'

export * from '../types'
Expand Down
22 changes: 11 additions & 11 deletions src/node/build.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import type { InlineConfig, ResolvedConfig } from 'vite'
import type { VitePluginPWAAPI } from 'vite-plugin-pwa'
import type { SSRContext } from 'vue/server-renderer'
import type { RouteRecordRaw } from 'vue-router'
import type { ViteSSGContext, ViteSSGOptions } from '../types'
import { createRequire } from 'node:module'
/* eslint-disable no-console */
import { dirname, isAbsolute, join, parse } from 'node:path'
import process from 'node:process'
import { createRequire } from 'node:module'
import PQueue from 'p-queue'
import { blue, cyan, dim, gray, green, red, yellow } from 'kolorist'
import { renderDOMHead } from '@unhead/dom'
import fs from 'fs-extra'
import type { InlineConfig, ResolvedConfig } from 'vite'
import { mergeConfig, resolveConfig, build as viteBuild } from 'vite'
import type { SSRContext } from 'vue/server-renderer'
import { JSDOM } from 'jsdom'
import type { VitePluginPWAAPI } from 'vite-plugin-pwa'
import type { RouteRecordRaw } from 'vue-router'
import { renderDOMHead } from '@unhead/dom'
import type { ViteSSGContext, ViteSSGOptions } from '../types'
import { blue, cyan, dim, gray, green, red, yellow } from 'kolorist'
import PQueue from 'p-queue'
import { mergeConfig, resolveConfig, build as viteBuild } from 'vite'
import { serializeState } from '../utils/state'
import { getBeastiesOrCritters } from './critical'
import { renderPreloadLinks } from './preload-links'
import { buildLog, getSize, routesToPaths } from './utils'
import { getBeastiesOrCritters } from './critical'

export type Manifest = Record<string, string[]>

Expand Down
2 changes: 1 addition & 1 deletion src/node/critical.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type Critters from 'critters'
import type Beasties from 'beasties'
import type { Options } from 'beasties'
import type Critters from 'critters'

export async function getBeastiesOrCritters(outDir: string, options: Options = {}): Promise<Critters | Beasties | undefined> {
try {
Expand Down
2 changes: 1 addition & 1 deletion src/node/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { blue, gray, yellow } from 'kolorist'
import type { RouteRecordRaw } from 'vue-router'
import { blue, gray, yellow } from 'kolorist'

export function buildLog(text: string, count?: number) {
// eslint-disable-next-line no-console
Expand Down
6 changes: 3 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { App } from 'vue'
import type { RouteRecordRaw, Router, RouterOptions as VueRouterOptions } from 'vue-router'
import type { MergeHead, VueHeadClient } from '@unhead/vue'
import type { Options as CrittersOptions } from 'critters'
import type { Options as BeastiesOptions } from 'beasties'
import type { Options as CrittersOptions } from 'critters'
import type { App } from 'vue'
import type { Router, RouteRecordRaw, RouterOptions as VueRouterOptions } from 'vue-router'

export interface ViteSSGOptions {
/**
Expand Down
2 changes: 1 addition & 1 deletion test/asset.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'node:fs/promises'
import { describe, expect, it } from 'vitest'
import fg from 'fast-glob'
import { describe, expect, it } from 'vitest'

describe('multiple-pages', () => {
it('generates list', async () => {
Expand Down

0 comments on commit 7142389

Please sign in to comment.