Skip to content

Commit 39206a1

Browse files
committed
feat(cli): start writes to _site-dev and only clears that folder
1 parent cbfb0f9 commit 39206a1

5 files changed

Lines changed: 19 additions & 5 deletions

File tree

.changeset/heavy-jars-stare.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@rocket/cli': patch
3+
---
4+
5+
`rocket start` now outputs to `_site-dev` instead of `_site`.

.changeset/heavy-jars-stare2.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@rocket/cli': patch
3+
---
4+
5+
`rocket start` clears only its output folder (defaults to `_site-dev`)

packages/cli/src/RocketBuild.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ export class RocketBuild {
8888

8989
async build() {
9090
await this.cli.events.dispatchEventDone('build-start');
91-
await this.cli.clearOutputDirs();
91+
await this.cli.clearOutputDir();
92+
await this.cli.clearOutputDevDir();
9293

9394
this.engine = new Engine();
9495
this.engine.setOptions({

packages/cli/src/RocketCli.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,13 @@ export class RocketCli {
234234
}
235235
}
236236

237-
async clearOutputDirs() {
237+
async clearOutputDir() {
238238
if (this.options.outputDir && existsSync(this.options.outputDir)) {
239239
await rm(this.options.outputDir, { recursive: true, force: true });
240240
}
241+
}
242+
243+
async clearOutputDevDir() {
241244
if (this.options.outputDevDir && existsSync(this.options.outputDevDir)) {
242245
await rm(this.options.outputDevDir, { recursive: true, force: true });
243246
}

packages/cli/src/RocketStart.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ export class RocketStart {
3131
if (!this.cli) {
3232
return;
3333
}
34-
await this.cli.clearOutputDirs();
34+
await this.cli.clearOutputDevDir();
3535

3636
// TODO: enable URL support in the Engine and remove this "workaround"
3737
if (
3838
typeof this.cli.options.inputDir !== 'string' ||
39-
typeof this.cli.options.outputDir !== 'string'
39+
typeof this.cli.options.outputDevDir !== 'string'
4040
) {
4141
return;
4242
}
@@ -51,7 +51,7 @@ export class RocketStart {
5151
this.engine = new Engine();
5252
this.engine.setOptions({
5353
docsDir: this.cli.options.inputDir,
54-
outputDir: this.cli.options.outputDir,
54+
outputDir: this.cli.options.outputDevDir,
5555
setupPlugins: this.cli.options.setupEnginePlugins,
5656
open: this.cli.options.open,
5757
longFileHeaderWidth: this.cli.options.longFileHeaderWidth,

0 commit comments

Comments
 (0)