-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
335 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import fs from 'fs-extra' | ||
import { copy } from 'fs-extra' | ||
import { globSync } from 'tinyglobby' | ||
|
||
function toDest(file) { | ||
return file.replace(/src\//, 'dist/') | ||
} | ||
|
||
globSync(['src/client/**/!(*.ts|tsconfig.json|*.vue)']).forEach((file) => { | ||
fs.copy(file, toDest(file)).catch(() => {}) | ||
globSync(['src/client/**']).forEach((file) => { | ||
if (/(\.ts|tsconfig\.json)$/.test(file)) return | ||
copy(file, toDest(file)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import fs from 'fs-extra' | ||
import { copy } from 'fs-extra' | ||
import { globSync } from 'tinyglobby' | ||
|
||
globSync(['src/shared/**/*.ts']).forEach((file) => { | ||
fs.copy(file, file.replace(/src\/shared\//, 'src/node/')).catch(() => {}) | ||
fs.copy(file, file.replace(/src\/shared\//, 'src/client/')).catch(() => {}) | ||
globSync(['src/shared/**/*.ts']).forEach(async (file) => { | ||
await Promise.all([ | ||
copy(file, file.replace(/^src\/shared\//, 'src/node/')), | ||
copy(file, file.replace(/^src\/shared\//, 'src/client/')) | ||
]) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
import fs from 'fs-extra' | ||
import chokidar from 'chokidar' | ||
import { copy, remove } from 'fs-extra' | ||
import { watch } from 'chokidar' | ||
import { normalizePath } from 'vite' | ||
|
||
function toClientAndNode (method, file) { | ||
file = normalizePath(file) | ||
if (method === 'copy') { | ||
fs.copy(file, file.replace(/^src\/shared\//, 'src/node/')) | ||
fs.copy(file, file.replace(/^src\/shared\//, 'src/client/')) | ||
copy(file, file.replace(/^src\/shared\//, 'src/node/')) | ||
copy(file, file.replace(/^src\/shared\//, 'src/client/')) | ||
} | ||
else if (method === 'remove') { | ||
fs.remove(file.replace(/^src\/shared\//, 'src/node/')) | ||
fs.remove(file.replace(/^src\/shared\//, 'src/client/')) | ||
remove(file.replace(/^src\/shared\//, 'src/node/')) | ||
remove(file.replace(/^src\/shared\//, 'src/client/')) | ||
} | ||
} | ||
|
||
function toDist (file) { | ||
return file.replace(/^src\//, 'dist/') | ||
return normalizePath(file).replace(/^src\//, 'dist/') | ||
} | ||
|
||
// copy shared files to the client and node directory whenever they change. | ||
chokidar | ||
.watch('src/shared/**/*.ts') | ||
watch('src/shared/**/*.ts') | ||
.on('change', file => toClientAndNode('copy', file)) | ||
.on('add', file => toClientAndNode('copy', file)) | ||
.on('unlink', file => toClientAndNode('remove', file)) | ||
|
||
// copy non ts files, such as an html or css, to the dist directory whenever | ||
// they change. | ||
chokidar | ||
.watch('src/client/**/!(*.ts|tsconfig.json|*.vue)') | ||
.on('change', file => fs.copy(file, toDist(file))) | ||
.on('add', file => fs.copy(file, toDist(file))) | ||
.on('unlink', file => fs.remove(toDist(file))) | ||
watch('src/client/**/!(*.ts|tsconfig.json)') | ||
.on('change', file => copy(file, toDist(file))) | ||
.on('add', file => copy(file, toDist(file))) | ||
.on('unlink', file => remove(toDist(file))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '../../types/client' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"baseUrl": "." | ||
"baseUrl": ".", | ||
"lib": ["esnext", "dom", "dom.iterable"] | ||
}, | ||
"include": [".", "../../**/*.d.ts", "../../types/shared.d.ts"] | ||
"include": ["."] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import type { | ||
PageFrontmatter, | ||
PageMeta, | ||
UserSite, | ||
StaticPath, | ||
Router, | ||
RouteLocationNormalizedLoaded, | ||
} from './shared' | ||
|
||
declare module 'vue-router' { | ||
interface RouteMeta { | ||
layout?: import('vue').Ref<import('vue').DefineComponent | false> | ||
pathVariants?: import('vue').Ref<StaticPath[]> | ||
pathVariantsPromise?: import('vue').ComputedRef<Promise<StaticPath[]>> | ||
} | ||
} | ||
|
||
declare module '@vue/runtime-core' { | ||
export interface ComponentCustomProperties { | ||
/** | ||
* The frontmatter of the current page. | ||
*/ | ||
$frontmatter: PageFrontmatter | ||
/** | ||
* Information about the current page, including href and filename. | ||
*/ | ||
$meta: PageMeta | ||
/** | ||
* Information about the site as exported in src/site.ts | ||
*/ | ||
$site: UserSite | ||
/** | ||
* Normalized current location. See {@link RouteLocationNormalizedLoaded}. | ||
*/ | ||
$route: RouteLocationNormalizedLoaded | ||
/** | ||
* {@link Router} instance used by the application. | ||
*/ | ||
$router: Router | ||
} | ||
} | ||
|
||
declare global { | ||
interface Window {} | ||
} |
Oops, something went wrong.