Skip to content

Commit 4a93c96

Browse files
committed
feat: using npm instead of pnpm for book builder
1 parent 7fe2f85 commit 4a93c96

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

apps/book-server/books/base/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
"@types/react-dom": "18",
2424
"typescript": "5"
2525
}
26-
}
26+
}

apps/book-server/src/services/BookBuildService/index.mts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,13 @@ export class BookBuildService implements Service {
7272
const src = path.resolve(process.cwd(), 'books/base')
7373
await fs.copy(src, dest, { dereference: true })
7474

75-
// nextra install
76-
const installStdout = await this.installDependencies(dest)
77-
78-
if (installStdout) {
75+
const stdout = await this.installDependencies('npm install', dest)
76+
if (stdout) {
7977
this.mq.publish({
8078
topicParameter: bookId,
8179
payload: {
8280
bookBuildInstalled: {
83-
message: installStdout,
81+
message: stdout,
8482
},
8583
},
8684
})
@@ -110,21 +108,21 @@ export class BookBuildService implements Service {
110108
})
111109
}
112110
}
113-
private async installDependencies(dest: string) {
114-
const command = 'pnpm install --frozen-lockfile'
111+
private async installDependencies(command: string, dest: string): Promise<string> {
115112
try {
116113
const { stdout, stderr } = await exec(command, { cwd: dest })
117114
if (stderr) {
118115
console.error(`stderr: ${stderr}`)
116+
throw new Error(stderr)
119117
}
120118
return stdout
121119
} catch (error) {
122-
console.error(`exec error: ${error}`)
120+
throw new Error(`exec error: ${error}`)
123121
}
124122
}
125123
private async buildTsToJs(dest: string) {
126124
try {
127-
const { stdout, stderr } = await exec('pnpm build', { cwd: dest })
125+
const { stdout, stderr } = await exec('pnpm next build', { cwd: dest })
128126
if (stderr) {
129127
console.error(`stderr: ${stderr}`)
130128
}

pnpm-workspace.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
packages:
22
- 'packages/*'
33
- 'apps/*'
4-
- 'apps/book-server/books/*'
5-
- '!apps/book-server/books/base'
64
- 'infrastructure/'

0 commit comments

Comments
 (0)