Skip to content

Commit 7a5254f

Browse files
committed
0.0.32
1 parent 721c3d3 commit 7a5254f

12 files changed

Lines changed: 23 additions & 17 deletions

File tree

packages/@contentlayer/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentlayer/cli",
3-
"version": "0.0.31",
3+
"version": "0.0.32",
44
"type": "module",
55
"exports": "./dist/index.js",
66
"types": "./dist/index.d.ts",

packages/@contentlayer/cli/src/commands/PostInstallCommand.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ArtifactsDir } from '@contentlayer/core'
1+
import { ArtifactsDir, getCwd } from '@contentlayer/core'
22
import { OT, pipe, T } from '@contentlayer/utils/effect'
33
import { fs } from '@contentlayer/utils/node'
44
import * as path from 'path'
@@ -11,13 +11,12 @@ export class PostInstallCommand extends BaseCommand {
1111
executeSafe = pipe(
1212
T.gen(function* ($) {
1313
// `process.env.INIT_CWD` is set by `yarn` or `npm` during installation
14-
const cwd = process.env.INIT_CWD ?? process.cwd()
1514
const artifactsDirPath = yield* $(ArtifactsDir.mkdir)
1615

1716
yield* $(T.forEachPar_(['data', 'types'], (moduleName) => makeModuleStub({ artifactsDirPath, moduleName })))
1817

19-
yield* $(createSymlinkForDotpkg({ artifactsDirPath, cwd }))
20-
yield* $(addToplevelDotpkgToGitignore(cwd))
18+
yield* $(createSymlinkForDotpkg({ artifactsDirPath }))
19+
yield* $(addToplevelDotpkgToGitignore())
2120
}),
2221
OT.withSpan('@contentlayer/cli/commands/PostInstallCommand:executeSafe', { attributes: { cwd: process.cwd() } }),
2322
)
@@ -45,8 +44,9 @@ const moduleStubFile = `\
4544
export {}
4645
`
4746

48-
const createSymlinkForDotpkg = ({ artifactsDirPath, cwd }: { artifactsDirPath: string; cwd: string }) =>
47+
const createSymlinkForDotpkg = ({ artifactsDirPath }: { artifactsDirPath: string }) =>
4948
T.gen(function* ($) {
49+
const cwd = yield* $(getCwd)
5050
const symlinkPath = path.join(cwd, '.contentlayer')
5151
// NOTE dir-symlinks are interpreted as dirs by the OS
5252
const symlinkExists = yield* $(fs.fileOrDirExists(symlinkPath))
@@ -55,8 +55,9 @@ const createSymlinkForDotpkg = ({ artifactsDirPath, cwd }: { artifactsDirPath: s
5555
}
5656
})
5757

58-
const addToplevelDotpkgToGitignore = (cwd: string) =>
58+
const addToplevelDotpkgToGitignore = () =>
5959
T.gen(function* ($) {
60+
const cwd = yield* $(getCwd)
6061
const gitignoreFilePath = path.join(cwd, '.gitignore')
6162
const gitignoreExists = yield* $(fs.fileOrDirExists(gitignoreFilePath))
6263
if (gitignoreExists) {

packages/@contentlayer/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentlayer/client",
3-
"version": "0.0.31",
3+
"version": "0.0.32",
44
"type": "module",
55
"exports": "./dist/index.js",
66
"types": "./dist/index.d.ts",

packages/@contentlayer/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentlayer/core",
3-
"version": "0.0.31",
3+
"version": "0.0.32",
44
"type": "module",
55
"exports": "./dist/index.js",
66
"types": "./dist/index.d.ts",

packages/@contentlayer/core/src/cwd.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ import { T, tag } from '@contentlayer/utils/effect'
55
const CwdSymbol = Symbol()
66

77
export const makeCwd = T.gen(function* (_) {
8-
const cwd = yield* _(T.succeedWith(() => unknownToPosixFilePath(process.cwd())))
8+
const cwd = yield* _(
9+
T.succeedWith(() => {
10+
const cwdValue = process.env.INIT_CWD ?? process.cwd()
11+
return unknownToPosixFilePath(cwdValue)
12+
}),
13+
)
914

1015
return { serviceId: CwdSymbol, cwd } as const
1116
})

packages/@contentlayer/source-contentful/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentlayer/source-contentful",
3-
"version": "0.0.31",
3+
"version": "0.0.32",
44
"type": "module",
55
"exports": "./dist/index.js",
66
"types": "./dist/index.d.ts",

packages/@contentlayer/source-files/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentlayer/source-files",
3-
"version": "0.0.31",
3+
"version": "0.0.32",
44
"type": "module",
55
"exports": {
66
".": {

packages/@contentlayer/source-sanity/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentlayer/source-sanity",
3-
"version": "0.0.31",
3+
"version": "0.0.32",
44
"type": "module",
55
"exports": "./dist/index.js",
66
"types": "./dist/index.d.ts",

packages/@contentlayer/utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentlayer/utils",
3-
"version": "0.0.31",
3+
"version": "0.0.32",
44
"type": "module",
55
"exports": {
66
"./package.json": {

packages/contentlayer-stackbit-yaml-generator/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "contentlayer-stackbit-yaml-generator",
3-
"version": "0.0.31",
3+
"version": "0.0.32",
44
"type": "module",
55
"bin": "./dist/cli/index.js",
66
"exports": "./dist/lib/index.js",

0 commit comments

Comments
 (0)