@shipsite.dev/cli 0.1.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +7 -18
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/dev.d.ts +0 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +5 -626
- package/dist/commands/dev.js.map +1 -1
- package/dist/index.js +0 -0
- package/dist/workspace/clean.d.ts +2 -0
- package/dist/workspace/clean.d.ts.map +1 -0
- package/dist/workspace/clean.js +6 -0
- package/dist/workspace/clean.js.map +1 -0
- package/dist/workspace/generators/content-collections.d.ts +3 -0
- package/dist/workspace/generators/content-collections.d.ts.map +1 -0
- package/dist/workspace/generators/content-collections.js +8 -0
- package/dist/workspace/generators/content-collections.js.map +1 -0
- package/dist/workspace/generators/i18n.d.ts +3 -0
- package/dist/workspace/generators/i18n.d.ts.map +1 -0
- package/dist/workspace/generators/i18n.js +30 -0
- package/dist/workspace/generators/i18n.js.map +1 -0
- package/dist/workspace/generators/layout.d.ts +3 -0
- package/dist/workspace/generators/layout.d.ts.map +1 -0
- package/dist/workspace/generators/layout.js +85 -0
- package/dist/workspace/generators/layout.js.map +1 -0
- package/dist/workspace/generators/next-config.d.ts +3 -0
- package/dist/workspace/generators/next-config.d.ts.map +1 -0
- package/dist/workspace/generators/next-config.js +33 -0
- package/dist/workspace/generators/next-config.js.map +1 -0
- package/dist/workspace/generators/page.d.ts +3 -0
- package/dist/workspace/generators/page.d.ts.map +1 -0
- package/dist/workspace/generators/page.js +83 -0
- package/dist/workspace/generators/page.js.map +1 -0
- package/dist/workspace/generators/project-files.d.ts +3 -0
- package/dist/workspace/generators/project-files.d.ts.map +1 -0
- package/dist/workspace/generators/project-files.js +49 -0
- package/dist/workspace/generators/project-files.js.map +1 -0
- package/dist/workspace/generators/proxy.d.ts +3 -0
- package/dist/workspace/generators/proxy.d.ts.map +1 -0
- package/dist/workspace/generators/proxy.js +25 -0
- package/dist/workspace/generators/proxy.js.map +1 -0
- package/dist/workspace/generators/sitemap-robots.d.ts +3 -0
- package/dist/workspace/generators/sitemap-robots.d.ts.map +1 -0
- package/dist/workspace/generators/sitemap-robots.js +28 -0
- package/dist/workspace/generators/sitemap-robots.js.map +1 -0
- package/dist/workspace/index.d.ts +6 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +51 -0
- package/dist/workspace/index.js.map +1 -0
- package/dist/workspace/resolve-next.d.ts +9 -0
- package/dist/workspace/resolve-next.d.ts.map +1 -0
- package/dist/workspace/resolve-next.js +21 -0
- package/dist/workspace/resolve-next.js.map +1 -0
- package/dist/workspace/styles.d.ts +3 -0
- package/dist/workspace/styles.d.ts.map +1 -0
- package/dist/workspace/styles.js +150 -0
- package/dist/workspace/styles.js.map +1 -0
- package/dist/workspace/symlinks.d.ts +2 -0
- package/dist/workspace/symlinks.d.ts.map +1 -0
- package/dist/workspace/symlinks.js +20 -0
- package/dist/workspace/symlinks.js.map +1 -0
- package/dist/workspace/types.d.ts +8 -0
- package/dist/workspace/types.d.ts.map +1 -0
- package/dist/workspace/types.js +2 -0
- package/dist/workspace/types.js.map +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean.js","sourceRoot":"","sources":["../../src/workspace/clean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAEvC,MAAM,UAAU,cAAc,CAAC,WAAmB;IAChD,MAAM,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,SAAS,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-collections.d.ts","sourceRoot":"","sources":["../../../src/workspace/generators/content-collections.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAOtE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import { writeFileSync } from 'fs';
|
|
3
|
+
export function generateContentCollections(ctx) {
|
|
4
|
+
writeFileSync(join(ctx.shipSiteDir, 'content-collections.ts'), `import { createContentCollectionsConfig } from '@shipsite.dev/core/content-collections';
|
|
5
|
+
export default createContentCollectionsConfig();
|
|
6
|
+
`);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=content-collections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-collections.js","sourceRoot":"","sources":["../../../src/workspace/generators/content-collections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAGnC,MAAM,UAAU,0BAA0B,CAAC,GAAqB;IAC9D,aAAa,CACX,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,wBAAwB,CAAC,EAC/C;;CAEH,CACE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/workspace/generators/i18n.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wBAAgB,YAAY,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAkCxD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import { writeFileSync } from 'fs';
|
|
3
|
+
export function generateI18n(ctx) {
|
|
4
|
+
const locales = ctx.config.i18n?.locales || ['en'];
|
|
5
|
+
const defaultLocale = ctx.config.i18n?.defaultLocale || 'en';
|
|
6
|
+
const localePrefix = ctx.config.i18n?.localePrefix || 'as-needed';
|
|
7
|
+
writeFileSync(join(ctx.srcDir, 'i18n', 'routing.ts'), `import { defineRouting } from 'next-intl/routing';
|
|
8
|
+
import { createNavigation } from 'next-intl/navigation';
|
|
9
|
+
|
|
10
|
+
export const routing = defineRouting({
|
|
11
|
+
locales: ${JSON.stringify(locales)},
|
|
12
|
+
defaultLocale: '${defaultLocale}',
|
|
13
|
+
localePrefix: '${localePrefix}',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const { Link, redirect, usePathname, useRouter, getPathname } = createNavigation(routing);
|
|
17
|
+
`);
|
|
18
|
+
writeFileSync(join(ctx.srcDir, 'i18n', 'request.ts'), `import { getRequestConfig } from 'next-intl/server';
|
|
19
|
+
import { routing } from './routing';
|
|
20
|
+
|
|
21
|
+
export default getRequestConfig(async ({ requestLocale }) => {
|
|
22
|
+
let locale = await requestLocale;
|
|
23
|
+
if (!locale || !(routing.locales as readonly string[]).includes(locale)) {
|
|
24
|
+
locale = routing.defaultLocale;
|
|
25
|
+
}
|
|
26
|
+
return { locale, messages: {} };
|
|
27
|
+
});
|
|
28
|
+
`);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=i18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../../src/workspace/generators/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAGnC,MAAM,UAAU,YAAY,CAAC,GAAqB;IAChD,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,IAAI,IAAI,CAAC;IAC7D,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,IAAI,WAAW,CAAC;IAElE,aAAa,CACX,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EACtC;;;;aAIS,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;oBAChB,aAAa;mBACd,YAAY;;;;CAI9B,CACE,CAAC;IAEF,aAAa,CACX,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EACtC;;;;;;;;;;CAUH,CACE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/workspace/generators/layout.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wBAAgB,cAAc,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAqF1D"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import { writeFileSync } from 'fs';
|
|
3
|
+
export function generateLayout(ctx) {
|
|
4
|
+
// Build icons metadata from config
|
|
5
|
+
const favicon = ctx.config.favicon;
|
|
6
|
+
let iconsBlock = '';
|
|
7
|
+
if (favicon) {
|
|
8
|
+
iconsBlock = `
|
|
9
|
+
icons: {
|
|
10
|
+
icon: '${favicon}',
|
|
11
|
+
apple: '/apple-touch-icon.png',
|
|
12
|
+
},`;
|
|
13
|
+
}
|
|
14
|
+
writeFileSync(join(ctx.srcDir, 'app', '[locale]', 'layout.tsx'), `import { notFound } from 'next/navigation';
|
|
15
|
+
import { routing } from '../../i18n/routing';
|
|
16
|
+
import { ShipSiteProvider } from '@shipsite.dev/components/context';
|
|
17
|
+
import { ThemeProvider } from '@shipsite.dev/components/theme';
|
|
18
|
+
import { Header, Footer } from '@shipsite.dev/components';
|
|
19
|
+
import { generateNavLinks, generateAlternatePathMap, getConfig, getSiteUrl } from '@shipsite.dev/core';
|
|
20
|
+
import '../../styles/globals.css';
|
|
21
|
+
import type { Metadata, Viewport } from 'next';
|
|
22
|
+
|
|
23
|
+
const config = getConfig();
|
|
24
|
+
|
|
25
|
+
export function generateStaticParams() {
|
|
26
|
+
return routing.locales.map((locale) => ({ locale }));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const metadata: Metadata = {
|
|
30
|
+
metadataBase: new URL(getSiteUrl()),
|
|
31
|
+
title: { default: config.name, template: '%s | ' + config.name },${iconsBlock}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const viewport: Viewport = {
|
|
35
|
+
width: 'device-width',
|
|
36
|
+
initialScale: 1,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
interface LayoutProps {
|
|
40
|
+
children: React.ReactNode;
|
|
41
|
+
params: Promise<{ locale: string }>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default async function LocaleLayout({ children, params }: LayoutProps) {
|
|
45
|
+
const { locale } = await params;
|
|
46
|
+
if (!(routing.locales as readonly string[]).includes(locale)) notFound();
|
|
47
|
+
|
|
48
|
+
const navLinks = generateNavLinks(locale);
|
|
49
|
+
const alternatePathMap = generateAlternatePathMap();
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<html lang={locale} suppressHydrationWarning>
|
|
53
|
+
<body>
|
|
54
|
+
<ThemeProvider>
|
|
55
|
+
<ShipSiteProvider value={{
|
|
56
|
+
siteName: config.name,
|
|
57
|
+
siteUrl: config.url,
|
|
58
|
+
logo: config.logo,
|
|
59
|
+
ogImage: config.ogImage,
|
|
60
|
+
colors: {
|
|
61
|
+
primary: config.colors?.primary || '#5d5bd4',
|
|
62
|
+
accent: config.colors?.accent || '#067647',
|
|
63
|
+
background: config.colors?.background || '#ffffff',
|
|
64
|
+
text: config.colors?.text || '#1f2a37',
|
|
65
|
+
},
|
|
66
|
+
navigation: config.navigation || { items: [] },
|
|
67
|
+
footer: config.footer || {},
|
|
68
|
+
navLinks,
|
|
69
|
+
alternatePathMap,
|
|
70
|
+
locale,
|
|
71
|
+
locales: config.i18n?.locales || ['en'],
|
|
72
|
+
defaultLocale: config.i18n?.defaultLocale || 'en',
|
|
73
|
+
}}>
|
|
74
|
+
<Header />
|
|
75
|
+
<main id="main-content">{children}</main>
|
|
76
|
+
<Footer />
|
|
77
|
+
</ShipSiteProvider>
|
|
78
|
+
</ThemeProvider>
|
|
79
|
+
</body>
|
|
80
|
+
</html>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
`);
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../src/workspace/generators/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAGnC,MAAM,UAAU,cAAc,CAAC,GAAqB;IAClD,mCAAmC;IACnC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC;IACnC,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,IAAI,OAAO,EAAE,CAAC;QACZ,UAAU,GAAG;;aAEJ,OAAO;;KAEf,CAAC;IACJ,CAAC;IAED,aAAa,CACX,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,CAAC,EACjD;;;;;;;;;;;;;;;;;qEAiBiE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoD9E,CACE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next-config.d.ts","sourceRoot":"","sources":["../../../src/workspace/generators/next-config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAoC9D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import { existsSync, writeFileSync } from 'fs';
|
|
3
|
+
export function generateNextConfig(ctx) {
|
|
4
|
+
const userNextConfigExtensions = ['ts', 'mjs', 'js'];
|
|
5
|
+
const userNextConfig = userNextConfigExtensions.find((ext) => existsSync(join(ctx.rootDir, `next.config.${ext}`)));
|
|
6
|
+
const userConfigImportPath = userNextConfig === 'ts'
|
|
7
|
+
? '../next.config'
|
|
8
|
+
: `../next.config.${userNextConfig}`;
|
|
9
|
+
const userConfigImport = userNextConfig
|
|
10
|
+
? `import userConfig from '${userConfigImportPath}';\n`
|
|
11
|
+
: '';
|
|
12
|
+
const userConfigSpread = userNextConfig ? ' ...userConfig,\n' : '';
|
|
13
|
+
const distDirLine = ctx.mode === 'build' ? " distDir: '../.next',\n" : '';
|
|
14
|
+
writeFileSync(join(ctx.shipSiteDir, 'next.config.ts'), `import createNextIntlPlugin from 'next-intl/plugin';
|
|
15
|
+
import { withContentCollections } from '@content-collections/next';
|
|
16
|
+
import type { NextConfig } from 'next';
|
|
17
|
+
${userConfigImport}
|
|
18
|
+
const withNextIntl = createNextIntlPlugin('./src/i18n/request.ts');
|
|
19
|
+
|
|
20
|
+
const nextConfig: NextConfig = {
|
|
21
|
+
${userConfigSpread}${distDirLine} reactStrictMode: true,
|
|
22
|
+
poweredByHeader: false,
|
|
23
|
+
turbopack: {
|
|
24
|
+
resolveAlias: {
|
|
25
|
+
'content-collections': './.content-collections/generated',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default withContentCollections(withNextIntl(nextConfig));
|
|
31
|
+
`);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=next-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next-config.js","sourceRoot":"","sources":["../../../src/workspace/generators/next-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAG/C,MAAM,UAAU,kBAAkB,CAAC,GAAqB;IACtD,MAAM,wBAAwB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAC3D,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,eAAe,GAAG,EAAE,CAAC,CAAC,CACpD,CAAC;IAEF,MAAM,oBAAoB,GAAG,cAAc,KAAK,IAAI;QAClD,CAAC,CAAC,gBAAgB;QAClB,CAAC,CAAC,kBAAkB,cAAc,EAAE,CAAC;IACvC,MAAM,gBAAgB,GAAG,cAAc;QACrC,CAAC,CAAC,2BAA2B,oBAAoB,MAAM;QACvD,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,gBAAgB,GAAG,cAAc,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC;IACpE,MAAM,WAAW,GAAG,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,CAAC;IAE3E,aAAa,CACX,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,gBAAgB,CAAC,EACvC;;;EAGF,gBAAgB;;;;EAIhB,gBAAgB,GAAG,WAAW;;;;;;;;;;CAU/B,CACE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/workspace/generators/page.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wBAAgB,YAAY,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAmFxD"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import { existsSync, writeFileSync } from 'fs';
|
|
3
|
+
export function generatePage(ctx) {
|
|
4
|
+
const hasCustomComponents = existsSync(join(ctx.rootDir, 'components'));
|
|
5
|
+
const customComponentsImport = hasCustomComponents
|
|
6
|
+
? `import * as CustomComponents from '../../../../components';\n`
|
|
7
|
+
: '';
|
|
8
|
+
const allComponentsMerge = hasCustomComponents
|
|
9
|
+
? 'const AllComponents = { ...Components, ...CustomComponents };\n'
|
|
10
|
+
: 'const AllComponents = Components;\n';
|
|
11
|
+
writeFileSync(join(ctx.srcDir, 'app', '[locale]', '[[...slug]]', 'page.tsx'), `import { setRequestLocale } from 'next-intl/server';
|
|
12
|
+
import { notFound } from 'next/navigation';
|
|
13
|
+
import { getPageContent } from '@shipsite.dev/core/mdx';
|
|
14
|
+
import { getPageBySlug, generateAllStaticParams, buildCanonicalUrl, getAlternateUrls, isNoIndexPage } from '@shipsite.dev/core/pages';
|
|
15
|
+
import { resolveAuthor } from '@shipsite.dev/core/blog';
|
|
16
|
+
import { getConfig, getSiteUrl } from '@shipsite.dev/core/config';
|
|
17
|
+
import * as Components from '@shipsite.dev/components';
|
|
18
|
+
${customComponentsImport}import type { Metadata } from 'next';
|
|
19
|
+
|
|
20
|
+
${allComponentsMerge}
|
|
21
|
+
interface PageProps {
|
|
22
|
+
params: Promise<{ locale: string; slug?: string[] }>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function generateStaticParams() {
|
|
26
|
+
return generateAllStaticParams();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const dynamicParams = false;
|
|
30
|
+
|
|
31
|
+
export async function generateMetadata({ params }: PageProps): Promise<Metadata> {
|
|
32
|
+
const { locale, slug } = await params;
|
|
33
|
+
const slugPath = slug?.join('/') || '';
|
|
34
|
+
const pageConfig = getPageBySlug(slugPath, locale);
|
|
35
|
+
if (!pageConfig) return {};
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
const { frontmatter } = await getPageContent(pageConfig.content, locale, AllComponents);
|
|
39
|
+
const canonicalUrl = buildCanonicalUrl(locale, slugPath);
|
|
40
|
+
const config = getConfig();
|
|
41
|
+
const languages = getAlternateUrls(pageConfig);
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
title: slugPath === '' ? { absolute: frontmatter.title } : frontmatter.title,
|
|
45
|
+
description: frontmatter.description,
|
|
46
|
+
...(isNoIndexPage(pageConfig) && { robots: { index: false, follow: true } }),
|
|
47
|
+
alternates: { canonical: canonicalUrl, languages },
|
|
48
|
+
openGraph: {
|
|
49
|
+
title: frontmatter.title,
|
|
50
|
+
description: frontmatter.description,
|
|
51
|
+
url: canonicalUrl,
|
|
52
|
+
siteName: config.name,
|
|
53
|
+
locale,
|
|
54
|
+
type: pageConfig.type === 'blog-article' ? 'article' : 'website',
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
} catch {
|
|
58
|
+
return {};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default async function DynamicPage({ params }: PageProps) {
|
|
63
|
+
const { locale, slug } = await params;
|
|
64
|
+
const slugPath = slug?.join('/') || '';
|
|
65
|
+
setRequestLocale(locale);
|
|
66
|
+
|
|
67
|
+
const pageConfig = getPageBySlug(slugPath, locale);
|
|
68
|
+
if (!pageConfig) notFound();
|
|
69
|
+
|
|
70
|
+
let content;
|
|
71
|
+
try {
|
|
72
|
+
const result = await getPageContent(pageConfig.content, locale, AllComponents);
|
|
73
|
+
content = result.content;
|
|
74
|
+
} catch (error) {
|
|
75
|
+
console.error('MDX content error:', error);
|
|
76
|
+
notFound();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return <div className="page-prose">{content}</div>;
|
|
80
|
+
}
|
|
81
|
+
`);
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../../src/workspace/generators/page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAG/C,MAAM,UAAU,YAAY,CAAC,GAAqB;IAChD,MAAM,mBAAmB,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;IACxE,MAAM,sBAAsB,GAAG,mBAAmB;QAChD,CAAC,CAAC,+DAA+D;QACjE,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,kBAAkB,GAAG,mBAAmB;QAC5C,CAAC,CAAC,iEAAiE;QACnE,CAAC,CAAC,qCAAqC,CAAC;IAE1C,aAAa,CACX,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,CAAC,EAC9D;;;;;;;EAOF,sBAAsB;;EAEtB,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DnB,CACE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-files.d.ts","sourceRoot":"","sources":["../../../src/workspace/generators/project-files.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAgEhE"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import { writeFileSync } from 'fs';
|
|
3
|
+
export function generateProjectFiles(ctx) {
|
|
4
|
+
// tsconfig.json
|
|
5
|
+
writeFileSync(join(ctx.shipSiteDir, 'tsconfig.json'), JSON.stringify({
|
|
6
|
+
compilerOptions: {
|
|
7
|
+
target: 'ES2022',
|
|
8
|
+
lib: ['dom', 'dom.iterable', 'esnext'],
|
|
9
|
+
allowJs: true,
|
|
10
|
+
skipLibCheck: true,
|
|
11
|
+
strict: true,
|
|
12
|
+
noEmit: true,
|
|
13
|
+
esModuleInterop: true,
|
|
14
|
+
module: 'esnext',
|
|
15
|
+
moduleResolution: 'bundler',
|
|
16
|
+
resolveJsonModule: true,
|
|
17
|
+
isolatedModules: true,
|
|
18
|
+
jsx: 'react-jsx',
|
|
19
|
+
incremental: true,
|
|
20
|
+
plugins: [{ name: 'next' }],
|
|
21
|
+
paths: {
|
|
22
|
+
'@/*': ['./src/*'],
|
|
23
|
+
'content-collections': ['./.content-collections/generated'],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
include: [
|
|
27
|
+
'next-env.d.ts',
|
|
28
|
+
'**/*.ts',
|
|
29
|
+
'**/*.tsx',
|
|
30
|
+
'.next/types/**/*.ts',
|
|
31
|
+
'.next/dev/types/**/*.ts',
|
|
32
|
+
],
|
|
33
|
+
exclude: ['node_modules'],
|
|
34
|
+
}, null, 2));
|
|
35
|
+
// package.json
|
|
36
|
+
writeFileSync(join(ctx.shipSiteDir, 'package.json'), JSON.stringify({
|
|
37
|
+
name: 'shipsite-workspace',
|
|
38
|
+
private: true,
|
|
39
|
+
type: 'module',
|
|
40
|
+
}, null, 2));
|
|
41
|
+
// postcss.config.mjs
|
|
42
|
+
writeFileSync(join(ctx.shipSiteDir, 'postcss.config.mjs'), `export default {
|
|
43
|
+
plugins: {
|
|
44
|
+
'@tailwindcss/postcss': {},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
`);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=project-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-files.js","sourceRoot":"","sources":["../../../src/workspace/generators/project-files.ts"],"names":[],"mappings":"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C,WAAW,EAAE,oBAAoB,CAAC,EAC3C;;;;;CAKH,CACE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../src/workspace/generators/proxy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wBAAgB,aAAa,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAyBzD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import { writeFileSync } from 'fs';
|
|
3
|
+
export function generateProxy(ctx) {
|
|
4
|
+
const locales = ctx.config.i18n?.locales || ['en'];
|
|
5
|
+
const defaultLocale = ctx.config.i18n?.defaultLocale || 'en';
|
|
6
|
+
const localePrefix = ctx.config.i18n?.localePrefix || 'as-needed';
|
|
7
|
+
writeFileSync(join(ctx.srcDir, 'proxy.ts'), `import { createShipSiteProxy } from '@shipsite.dev/core/proxy';
|
|
8
|
+
import slugMap from '../slug-map.json';
|
|
9
|
+
|
|
10
|
+
const proxy = createShipSiteProxy({
|
|
11
|
+
locales: ${JSON.stringify(locales)},
|
|
12
|
+
defaultLocale: '${defaultLocale}',
|
|
13
|
+
localePrefix: '${localePrefix}',
|
|
14
|
+
slugMap: slugMap as Record<string, Record<string, string>>,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export default proxy;
|
|
18
|
+
|
|
19
|
+
// Next.js requires config to be a static object literal (not imported)
|
|
20
|
+
export const config = {
|
|
21
|
+
matcher: ['/((?!api|_next|_vercel|.*\\\\..*).*)'],
|
|
22
|
+
};
|
|
23
|
+
`);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=proxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../src/workspace/generators/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAGnC,MAAM,UAAU,aAAa,CAAC,GAAqB;IACjD,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,IAAI,IAAI,CAAC;IAC7D,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,IAAI,WAAW,CAAC;IAElE,aAAa,CACX,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EAC5B;;;;aAIS,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;oBAChB,aAAa;mBACd,YAAY;;;;;;;;;;CAU9B,CACE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sitemap-robots.d.ts","sourceRoot":"","sources":["../../../src/workspace/generators/sitemap-robots.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,CA+BpE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import { writeFileSync } from 'fs';
|
|
3
|
+
export function generateSitemapAndRobots(ctx) {
|
|
4
|
+
writeFileSync(join(ctx.srcDir, 'app', 'sitemap.ts'), `import sitemap from '@shipsite.dev/core/sitemap';
|
|
5
|
+
export default sitemap;
|
|
6
|
+
`);
|
|
7
|
+
writeFileSync(join(ctx.srcDir, 'app', 'robots.ts'), `import type { MetadataRoute } from 'next';
|
|
8
|
+
import { getSiteUrl } from '@shipsite.dev/core/config';
|
|
9
|
+
|
|
10
|
+
export default function robots(): MetadataRoute.Robots {
|
|
11
|
+
return {
|
|
12
|
+
rules: [
|
|
13
|
+
{ userAgent: '*', allow: '/' },
|
|
14
|
+
{ userAgent: 'GPTBot', allow: '/' },
|
|
15
|
+
{ userAgent: 'ChatGPT-User', allow: '/' },
|
|
16
|
+
{ userAgent: 'ClaudeBot', allow: '/' },
|
|
17
|
+
{ userAgent: 'Claude-Web', allow: '/' },
|
|
18
|
+
{ userAgent: 'PerplexityBot', allow: '/' },
|
|
19
|
+
{ userAgent: 'Applebot-Extended', allow: '/' },
|
|
20
|
+
{ userAgent: 'GoogleOther', allow: '/' },
|
|
21
|
+
{ userAgent: 'cohere-ai', allow: '/' },
|
|
22
|
+
],
|
|
23
|
+
sitemap: getSiteUrl() + '/sitemap.xml',
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
`);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=sitemap-robots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sitemap-robots.js","sourceRoot":"","sources":["../../../src/workspace/generators/sitemap-robots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAGnC,MAAM,UAAU,wBAAwB,CAAC,GAAqB;IAC5D,aAAa,CACX,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC,EACrC;;CAEH,CACE,CAAC;IAEF,aAAa,CACX,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,EACpC;;;;;;;;;;;;;;;;;;;CAmBH,CACE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workspace/index.ts"],"names":[],"mappings":"AAeA,wBAAgB,iBAAiB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,KAAK,GAAG,OAAO,CAAA;CAAE,GAAG,IAAI,CA2BrG;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAiB9F"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import { mkdirSync, readFileSync, writeFileSync, existsSync } from 'fs';
|
|
3
|
+
import { cleanWorkspace } from './clean.js';
|
|
4
|
+
import { createSymlinks } from './symlinks.js';
|
|
5
|
+
import { generateStyles } from './styles.js';
|
|
6
|
+
import { generateNextConfig } from './generators/next-config.js';
|
|
7
|
+
import { generateContentCollections } from './generators/content-collections.js';
|
|
8
|
+
import { generateI18n } from './generators/i18n.js';
|
|
9
|
+
import { generateProxy } from './generators/proxy.js';
|
|
10
|
+
import { generateLayout } from './generators/layout.js';
|
|
11
|
+
import { generatePage } from './generators/page.js';
|
|
12
|
+
import { generateSitemapAndRobots } from './generators/sitemap-robots.js';
|
|
13
|
+
import { generateProjectFiles } from './generators/project-files.js';
|
|
14
|
+
export function generateWorkspace({ rootDir, mode }) {
|
|
15
|
+
const config = JSON.parse(readFileSync(join(rootDir, 'shipsite.json'), 'utf-8'));
|
|
16
|
+
const shipSiteDir = join(rootDir, '.shipsite');
|
|
17
|
+
const srcDir = join(shipSiteDir, 'src');
|
|
18
|
+
cleanWorkspace(shipSiteDir);
|
|
19
|
+
// Create directory structure
|
|
20
|
+
mkdirSync(join(srcDir, 'i18n'), { recursive: true });
|
|
21
|
+
mkdirSync(join(srcDir, 'app', '[locale]', '[[...slug]]'), { recursive: true });
|
|
22
|
+
mkdirSync(join(srcDir, 'styles'), { recursive: true });
|
|
23
|
+
createSymlinks(rootDir, shipSiteDir);
|
|
24
|
+
const ctx = { rootDir, shipSiteDir, srcDir, config, mode };
|
|
25
|
+
generateNextConfig(ctx);
|
|
26
|
+
generateContentCollections(ctx);
|
|
27
|
+
generateI18n(ctx);
|
|
28
|
+
generateProxy(ctx);
|
|
29
|
+
generateStyles(ctx);
|
|
30
|
+
generateLayout(ctx);
|
|
31
|
+
generatePage(ctx);
|
|
32
|
+
generateSitemapAndRobots(ctx);
|
|
33
|
+
generateProjectFiles(ctx);
|
|
34
|
+
console.log(' Generated .shipsite workspace');
|
|
35
|
+
}
|
|
36
|
+
export async function prepareWorkspace(rootDir, mode) {
|
|
37
|
+
const configPath = join(rootDir, 'shipsite.json');
|
|
38
|
+
if (!existsSync(configPath)) {
|
|
39
|
+
console.error('Error: shipsite.json not found in current directory');
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
generateWorkspace({ rootDir, mode });
|
|
43
|
+
// Generate slug map
|
|
44
|
+
const { generateSlugMap } = await import('@shipsite.dev/core/generate-slug-map');
|
|
45
|
+
const shipSiteDir = join(rootDir, '.shipsite');
|
|
46
|
+
const slugMap = generateSlugMap(rootDir);
|
|
47
|
+
writeFileSync(join(shipSiteDir, 'slug-map.json'), JSON.stringify(slugMap, null, 2));
|
|
48
|
+
console.log(` Generated slug-map.json (${Object.keys(slugMap).length} entries)`);
|
|
49
|
+
return shipSiteDir;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workspace/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CA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C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the next binary path by walking up from rootDir.
|
|
3
|
+
* Returns the absolute path to the next binary, or falls back to 'npx'.
|
|
4
|
+
*/
|
|
5
|
+
export declare function resolveNextBin(rootDir: string): {
|
|
6
|
+
command: string;
|
|
7
|
+
args: string[];
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=resolve-next.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-next.d.ts","sourceRoot":"","sources":["../../src/workspace/resolve-next.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAYnF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { join, dirname } from 'path';
|
|
2
|
+
import { existsSync } from 'fs';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the next binary path by walking up from rootDir.
|
|
5
|
+
* Returns the absolute path to the next binary, or falls back to 'npx'.
|
|
6
|
+
*/
|
|
7
|
+
export function resolveNextBin(rootDir) {
|
|
8
|
+
let searchDir = rootDir;
|
|
9
|
+
for (let i = 0; i < 10; i++) {
|
|
10
|
+
const candidate = join(searchDir, 'node_modules', '.bin', 'next');
|
|
11
|
+
if (existsSync(candidate)) {
|
|
12
|
+
return { command: candidate, args: [] };
|
|
13
|
+
}
|
|
14
|
+
const parent = dirname(searchDir);
|
|
15
|
+
if (parent === searchDir)
|
|
16
|
+
break;
|
|
17
|
+
searchDir = parent;
|
|
18
|
+
}
|
|
19
|
+
return { command: 'npx', args: ['next'] };
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=resolve-next.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-next.js","sourceRoot":"","sources":["../../src/workspace/resolve-next.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEhC;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,IAAI,SAAS,GAAG,OAAO,CAAC;IACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5B,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAClE,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC1B,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAC1C,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QAClC,IAAI,MAAM,KAAK,SAAS;YAAE,MAAM;QAChC,SAAS,GAAG,MAAM,CAAC;IACrB,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/workspace/styles.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AA2BnD,wBAAgB,cAAc,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,CA4H1D"}
|