Skip to content

Commit

Permalink
refactor: rename config.basePath to config.base
Browse files Browse the repository at this point in the history
This change provides conformance with the vite setting.
  • Loading branch information
stevenle committed Dec 5, 2023
1 parent 624453f commit b63a573
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/basepath/root.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {defineConfig} from '@blinkk/root';
const rootDir = new URL('.', import.meta.url).pathname;;

export default defineConfig({
basePath: '/foo/',
base: '/foo/',
i18n: {
urlFormat: '/intl/[locale]/[base]/[path]',
locales: ['en', 'de'],
Expand Down
2 changes: 1 addition & 1 deletion packages/root-cms/core/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export async function renderApp(req: Request, res: Response, options: any) {
projectId: cmsConfig.id || 'default',
projectName: cmsConfig.name || cmsConfig.id || '',
domain: rootConfig.domain || 'https://example.com',
basePath: rootConfig.basePath || '/',
base: rootConfig.base || '/',
gci: gci,
i18n: rootConfig.i18n,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/root-cms/ui/ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ declare global {
projectId: string;
projectName: string;
domain: string;
basePath: string;
base: string;
gci: string | boolean;
i18n: {
locales?: string[];
Expand Down
4 changes: 2 additions & 2 deletions packages/root-cms/ui/utils/doc-urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function getDocServingPath(options: DocUrlOptions) {
}

const rootConfig = window.__ROOT_CTX.rootConfig;
const basePath = rootConfig.basePath || '/';
const basePath = rootConfig.base || '/';
let urlFormat = '/[base]/[path]';
if (locale) {
urlFormat = rootConfig.i18n.urlFormat || '/[locale]/[base]/[path]';
Expand Down Expand Up @@ -60,7 +60,7 @@ export function getDocPreviewPath(options: DocUrlOptions) {
}

const rootConfig = window.__ROOT_CTX.rootConfig;
const basePath = rootConfig.basePath || '/';
const basePath = rootConfig.base || '/';
let urlFormat = '/[base]/[path]';
if (locale) {
urlFormat = rootConfig.i18n.urlFormat || '/[locale]/[base]/[path]';
Expand Down
2 changes: 1 addition & 1 deletion packages/root/src/cli/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function dev(rootProjectDir?: string, options?: DevOptions) {
const port = await findOpenPort(defaultPort, defaultPort + 10);
const server = await createDevServer({rootDir, port});
const rootConfig: RootConfig = server.get('rootConfig');
const basePath = rootConfig.basePath || '';
const basePath = rootConfig.base || '';
console.log();
console.log(`${dim('┃')} project: ${rootDir}`);
console.log(`${dim('┃')} server: http://${host}:${port}${basePath}`);
Expand Down
4 changes: 2 additions & 2 deletions packages/root/src/core/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export interface RootUserConfig {
domain?: string;

/**
* The base url path that the site will serve on. Defaults to `/`;
* The base URL path that the site will serve on. Defaults to `/`;
*/
basePath?: string;
base?: string;

/**
* Config for auto-injecting custom element dependencies.
Expand Down
2 changes: 1 addition & 1 deletion packages/root/src/render/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {RouteTrie} from './route-trie';

export function getRoutes(rootConfig: RootConfig) {
const locales = rootConfig.i18n?.locales || [];
const basePath = rootConfig.basePath || '/';
const basePath = rootConfig.base || '/';

const defaultLocale = rootConfig.i18n?.defaultLocale || 'en';

Expand Down

0 comments on commit b63a573

Please sign in to comment.