Skip to content

Pass Identity token to LWC Dev Server #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/lwc-dev-server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import process from 'node:process';
import { LWCServer, LogLevel, ServerConfig, startLwcDevServer } from '@lwc/lwc-dev-server';
import { Logger } from '@salesforce/core';
import { LwcDevServerUtils } from '../shared/lwcDevServerUtils.js';
import { IdentityUtils } from '../shared/identityUtils.js';

/**
* Map sf cli log level to lwc dev server log level
Expand Down Expand Up @@ -39,6 +40,7 @@ function mapLogLevel(cliLogLevel: number): number {
}

async function createLWCServerConfig(rootDir: string, logger: Logger): Promise<ServerConfig> {
const identityToken = await IdentityUtils.getOrCreateIdentityToken();
const sfdxConfig = path.resolve(rootDir, 'sfdx-project.json');

if (!existsSync(sfdxConfig) || !lstatSync(sfdxConfig).isFile()) {
Expand Down Expand Up @@ -72,6 +74,7 @@ async function createLWCServerConfig(rootDir: string, logger: Logger): Promise<S
paths: namespacePaths,
workspace: await LwcDevServerUtils.getLocalDevServerWorkspace(),
targets: ['LEX'], // should this be something else?
identityToken,
Copy link
Contributor

@maliroteh-sf maliroteh-sf Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in order to be aligned with the way we pass the params, maybe we should update this to identityToken: identityToken instead?

logLevel: mapLogLevel(logger.getLevel()),
};
}
Expand Down