Skip to content

Commit

Permalink
remove util
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed May 31, 2024
1 parent 2750d23 commit a29ef4f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ const unstorageDrivers = {
github: githubDriver
}

export function getBaseDir (nuxt: Nuxt) {
return (nuxt.options.future as unknown as { compatibilityVersion: number }).compatibilityVersion === 4
? nuxt.options.rootDir
: nuxt.options.srcDir
}
/**
* Resolve driver of a mount.
*/
Expand All @@ -80,14 +75,15 @@ export async function getMountDriver (mount: MountOptions) {
*/
export function useContentMounts (nuxt: Nuxt, storages: Array<string | MountOptions> | Record<string, MountOptions>) {
const key = (path: string, prefix = '') => `${MOUNT_PREFIX}${path.replace(/[/:]/g, '_')}${prefix.replace(/\//g, ':')}`
const baseDir = getBaseDir(nuxt)
const baseDir = (nuxt.options.future as unknown as { compatibilityVersion: number }).compatibilityVersion === 4

Check failure on line 78 in src/utils.ts

View workflow job for this annotation

GitHub Actions / ubuntu

test/module.test.ts > module > [sources] [array] Relative path

TypeError: Cannot read properties of undefined (reading 'compatibilityVersion') ❯ Module.useContentMounts src/utils.ts:78:88 ❯ test/module.test.ts:9:20

Check failure on line 78 in src/utils.ts

View workflow job for this annotation

GitHub Actions / ubuntu

test/module.test.ts > module > [sources] [array] Absolute path

TypeError: Cannot read properties of undefined (reading 'compatibilityVersion') ❯ Module.useContentMounts src/utils.ts:78:88 ❯ test/module.test.ts:18:20

Check failure on line 78 in src/utils.ts

View workflow job for this annotation

GitHub Actions / ubuntu

test/module.test.ts > module > [sources] [array] Custom driver

TypeError: Cannot read properties of undefined (reading 'compatibilityVersion') ❯ Module.useContentMounts src/utils.ts:78:88 ❯ test/module.test.ts:27:20

Check failure on line 78 in src/utils.ts

View workflow job for this annotation

GitHub Actions / ubuntu

test/module.test.ts > module > [sources] [array] Multiple storages

TypeError: Cannot read properties of undefined (reading 'compatibilityVersion') ❯ Module.useContentMounts src/utils.ts:78:88 ❯ test/module.test.ts:41:20

Check failure on line 78 in src/utils.ts

View workflow job for this annotation

GitHub Actions / ubuntu

test/module.test.ts > module > [sources] [array] overwrite default source

TypeError: Cannot read properties of undefined (reading 'compatibilityVersion') ❯ Module.useContentMounts src/utils.ts:78:88 ❯ test/module.test.ts:62:20

Check failure on line 78 in src/utils.ts

View workflow job for this annotation

GitHub Actions / ubuntu

test/module.test.ts > module > [sources] [object] overwrite default source

TypeError: Cannot read properties of undefined (reading 'compatibilityVersion') ❯ Module.useContentMounts src/utils.ts:78:88 ❯ test/module.test.ts:78:20

Check failure on line 78 in src/utils.ts

View workflow job for this annotation

GitHub Actions / ubuntu

test/module.test.ts > module > [sources] [object] secondary source

TypeError: Cannot read properties of undefined (reading 'compatibilityVersion') ❯ Module.useContentMounts src/utils.ts:78:88 ❯ test/module.test.ts:91:20
? nuxt.options.rootDir
: nuxt.options.srcDir
const storageKeys = Object.keys(storages)
if (
Array.isArray(storages) ||
// Detect object representation of array `{ '0': 'source1' }`. Nuxt converts this array to object when using `nuxt.config.ts`
(storageKeys.length > 0 && storageKeys.every(i => i === String(+i)))
) {

storages = Object.values(storages)
logger.warn('Using array syntax to define sources is deprecated. Consider using object syntax.')
storages = storages.reduce((mounts, storage) => {
Expand Down

0 comments on commit a29ef4f

Please sign in to comment.