Skip to content

Commit 615a54e

Browse files
committed
feat: create a script when skipping startup
1 parent 054d9c8 commit 615a54e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/commands/lightning/dev/site.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77
import fs from 'node:fs';
8+
import path from 'node:path';
89
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
910
import { Messages } from '@salesforce/core';
1011
import { expDev } from '@lwrjs/api';
@@ -87,7 +88,13 @@ export default class LightningDevSite extends SfCommand<void> {
8788

8889
// For testing purposes, allow skipping startup of the dev server
8990
if (process.env.SKIP_STARTUP === 'true') {
90-
this.log(`Skipping local server startup with parameters: '${JSON.stringify(params)}'`);
91+
this.log('Skipping startup...');
92+
const scriptToRun = `import { expDev } from '@lwrjs/api';
93+
const params = ${JSON.stringify(params, null, 2)};
94+
await expDev(params);`;
95+
const pathToScript = path.join(selectedSite.getSiteDirectory(), 'launchServer.js');
96+
fs.writeFileSync(pathToScript, scriptToRun, 'utf-8');
97+
this.log(`Launch server from the following script: ${pathToScript}`);
9198
} else {
9299
await expDev(params);
93100
}

0 commit comments

Comments
 (0)