@levino/shipyard-base 0.5.2 → 0.5.4

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.
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  import Footer from './Footer.astro'
3
3
  import '../../src/globals.css'
4
+ import { i18n } from 'astro:config/server'
4
5
  import config from 'virtual:shipyard/config'
5
6
  import { mapObjIndexed } from 'ramda'
6
7
  import type {
@@ -26,7 +27,8 @@ type Props = {
26
27
  const currentPath = Astro.url.pathname
27
28
  const props = Astro.props.frontmatter || Astro.props
28
29
 
29
- const withLocale = (path: string) => `/${Astro.currentLocale}${path}`
30
+ const withLocale = (path: string) =>
31
+ i18n ? `/${Astro.currentLocale}${path}` : path
30
32
  const applyLocaleAndSetActive: (navigation: NavigationTree) => NavigationTree =
31
33
  mapObjIndexed((entry: NavigationEntry) => ({
32
34
  ...entry,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@levino/shipyard-base",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -12,7 +12,7 @@
12
12
  "./components/*": "./astro/components/*"
13
13
  },
14
14
  "peerDependencies": {
15
- "astro": "^5",
15
+ "astro": "^5.7",
16
16
  "daisyui": "^4",
17
17
  "tailwindcss": "^3",
18
18
  "@tailwindcss/typography": "^0.5.10"
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "devDependencies": {
25
25
  "@tailwindcss/typography": "^0.5.10",
26
- "@types/ramda": "^0.29.9",
26
+ "@types/ramda": "^0.31",
27
27
  "daisyui": "^4.6.0",
28
28
  "tailwindcss": "^3.4.0",
29
29
  "typescript": "^5.2.2",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "clsx": "^2.1.0",
34
- "ramda": "^0.29.1",
34
+ "ramda": "^0.31",
35
35
  "tailwind-merge": "^2.2.0"
36
36
  }
37
37
  }
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AstroIntegration } from 'astro'
2
- import type { Config, FinalConfig } from './schemas/config'
2
+ import type { Config } from './schemas/config'
3
3
 
4
4
  export type { Entry } from '../astro/components/types'
5
5
  export type * from './schemas/config'
@@ -12,7 +12,7 @@ const resolveId: Record<string, string | undefined> = {
12
12
  [shipyardConfigId]: `${shipyardConfigId}`,
13
13
  }
14
14
 
15
- const load = (config: FinalConfig) =>
15
+ const load = (config: Config) =>
16
16
  ({
17
17
  [shipyardConfigId]: `export default ${JSON.stringify(config)}`,
18
18
  }) as Record<string, string | undefined>
@@ -20,19 +20,14 @@ const load = (config: FinalConfig) =>
20
20
  export default (config: Config): AstroIntegration => ({
21
21
  name: 'shipyard',
22
22
  hooks: {
23
- 'astro:config:setup': ({ updateConfig, config: { i18n } }) => {
24
- if (!i18n) {
25
- throw new Error(
26
- 'Shipyard cannot be used without i18n. Please set at least one locale.',
27
- )
28
- }
23
+ 'astro:config:setup': ({ updateConfig }) => {
29
24
  updateConfig({
30
25
  vite: {
31
26
  plugins: [
32
27
  {
33
28
  name: 'shipyard',
34
29
  resolveId: (id: string) => resolveId[id],
35
- load: (id: string) => load({ i18n, ...config })[id],
30
+ load: (id: string) => load(config)[id],
36
31
  },
37
32
  ],
38
33
  },
@@ -1,5 +1,3 @@
1
- import type { AstroConfig } from 'astro'
2
-
3
1
  export interface NavigationEntry {
4
2
  label?: string
5
3
  href?: string
@@ -9,18 +7,7 @@ export interface NavigationEntry {
9
7
 
10
8
  export type NavigationTree = Record<string, NavigationEntry>
11
9
 
12
- export interface ScriptConfig {
13
- src: string
14
- async?: boolean
15
- defer?: boolean
16
- type?: string
17
- crossorigin?: string
18
- integrity?: string
19
- referrerpolicy?: string
20
- [key: string]: string | boolean | undefined
21
- }
22
-
23
- export type Script = string | ScriptConfig
10
+ export type Script = string | astroHTML.JSX.IntrinsicElements['script']
24
11
 
25
12
  export interface Config {
26
13
  brand: string
@@ -29,7 +16,3 @@ export interface Config {
29
16
  tagline: string
30
17
  scripts?: Script[]
31
18
  }
32
-
33
- export interface FinalConfig extends Config {
34
- i18n: NonNullable<AstroConfig['i18n']>
35
- }