-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from contentlayerdev/windows-filepaths
fixed windows paths
- Loading branch information
Showing
58 changed files
with
714 additions
and
346 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
packages/_archive/* | ||
**/dist/* | ||
**/dist/* | ||
**/.nyc_output/* |
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
import { withContentlayer } from 'next-contentlayer' | ||
|
||
export default withContentlayer()({}) |
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
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,30 +1,36 @@ | ||
import type { PosixFilePath } from '@contentlayer/utils' | ||
import { filePathJoin } from '@contentlayer/utils' | ||
import type { OT } from '@contentlayer/utils/effect' | ||
import { pipe, T } from '@contentlayer/utils/effect' | ||
import type { GetContentlayerVersionError } from '@contentlayer/utils/node' | ||
import { fs, getContentlayerVersion } from '@contentlayer/utils/node' | ||
|
||
import type { HasCwd } from './cwd.js' | ||
import { getCwd } from './cwd.js' | ||
// import utilsPkg from '@contentlayer/utils/package.json' | ||
import * as path from 'path' | ||
|
||
export namespace ArtifactsDir { | ||
export const getDirPath = ({ cwd }: { cwd: string }): string => path.join(cwd, 'node_modules', '.contentlayer') | ||
export const getDirPath = ({ cwd }: { cwd: PosixFilePath }): PosixFilePath => | ||
filePathJoin(cwd, 'node_modules' as PosixFilePath, '.contentlayer' as PosixFilePath) | ||
|
||
export const mkdir: T.Effect<OT.HasTracer & HasCwd, fs.MkdirError, PosixFilePath> = T.gen(function* ($) { | ||
const cwd = yield* $(getCwd) | ||
const dirPath = getDirPath({ cwd }) | ||
yield* $(fs.mkdirp(dirPath)) | ||
|
||
export const mkdir = ({ cwd }: { cwd: string }): T.Effect<OT.HasTracer, fs.MkdirError, string> => | ||
pipe(T.succeed(getDirPath({ cwd })), T.tap(fs.mkdirp)) | ||
return dirPath | ||
}) | ||
|
||
export const getCacheDirPath = ({ | ||
cwd, | ||
}: { | ||
cwd: string | ||
}): T.Effect<OT.HasTracer, GetContentlayerVersionError, string> => | ||
pipe( | ||
getContentlayerVersion(), | ||
T.map((contentlayerVersion) => path.join(getDirPath({ cwd }), '.cache', `v${contentlayerVersion}`)), | ||
) | ||
export const getCacheDirPath: T.Effect<OT.HasTracer & HasCwd, GetContentlayerVersionError, PosixFilePath> = pipe( | ||
T.struct({ | ||
contentlayerVersion: getContentlayerVersion(), | ||
cwd: getCwd, | ||
}), | ||
T.map(({ contentlayerVersion, cwd }) => | ||
filePathJoin(getDirPath({ cwd }), '.cache' as PosixFilePath, `v${contentlayerVersion}` as PosixFilePath), | ||
), | ||
) | ||
|
||
export const mkdirCache = ({ | ||
cwd, | ||
}: { | ||
cwd: string | ||
}): T.Effect<OT.HasTracer, fs.MkdirError | GetContentlayerVersionError, string> => | ||
pipe(getCacheDirPath({ cwd }), T.tap(fs.mkdirp)) | ||
export const mkdirCache: T.Effect<OT.HasTracer & HasCwd, fs.MkdirError | GetContentlayerVersionError, PosixFilePath> = | ||
pipe(getCacheDirPath, T.tap(fs.mkdirp)) | ||
} |
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,20 @@ | ||
import { unknownToPosixFilePath } from '@contentlayer/utils' | ||
import type { Has } from '@contentlayer/utils/effect' | ||
import { T, tag } from '@contentlayer/utils/effect' | ||
|
||
const CwdSymbol = Symbol() | ||
|
||
export const makeCwd = T.gen(function* (_) { | ||
const cwd = yield* _(T.succeedWith(() => unknownToPosixFilePath(process.cwd()))) | ||
|
||
return { serviceId: CwdSymbol, cwd } as const | ||
}) | ||
|
||
export interface Cwd extends T.OutputOf<typeof makeCwd> {} | ||
export const Cwd = tag<Cwd>() | ||
|
||
export const provideCwd = T.provideServiceM(Cwd)(makeCwd) | ||
|
||
export const getCwd = T.accessService(Cwd)((_) => _.cwd) | ||
|
||
export type HasCwd = Has<Cwd> |
Oops, something went wrong.