File tree Expand file tree Collapse file tree 5 files changed +776
-566
lines changed
Expand file tree Collapse file tree 5 files changed +776
-566
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "modules" : [
3+ {
4+ "npm" : " lightning-base-components"
5+ }
6+ ]
7+ }
Original file line number Diff line number Diff line change 99 "@inquirer/select" : " ^2.4.7" ,
1010 "@lwc/lwc-dev-server" : " ~11.5.0" ,
1111 "@lwc/sfdc-lwc-compiler" : " ~11.5.0" ,
12- "@lwrjs/api" : " 0.16.10 " ,
12+ "@lwrjs/api" : " 0.18.1 " ,
1313 "@oclif/core" : " ^4.1.0" ,
1414 "@salesforce/core" : " ^8.6.2" ,
1515 "@salesforce/kit" : " ^3.1.6" ,
1616 "@salesforce/lwc-dev-mobile-core" : " 4.0.0-alpha.9" ,
1717 "@salesforce/sf-plugins-core" : " ^11.2.4" ,
1818 "axios" : " ^1.7.9" ,
1919 "glob" : " ^10.4.5" ,
20+ "lightning-base-components" : " 1.27.2-alpha" ,
2021 "lwc" : " ~8.12.5" ,
2122 "node-fetch" : " ^3.3.2" ,
2223 "xml2js" : " ^0.6.2"
Original file line number Diff line number Diff line change 66 */
77
88import path from 'node:path' ;
9+ import url from 'node:url' ;
910import { SfCommand , Flags } from '@salesforce/sf-plugins-core' ;
1011import { Messages , SfProject } from '@salesforce/core' ;
1112import { cmpDev } from '@lwrjs/api' ;
@@ -72,9 +73,12 @@ export default class LightningDevComponent extends SfCommand<void> {
7273 let name = flags . name ;
7374 if ( name ) {
7475 // validate that the component exists before launching the server
75- if ( ! components . find ( ( component ) => name === component . name ) ) {
76+ const match = components . find ( ( component ) => name === component . name || name === component . label ) ;
77+ if ( ! match ) {
7678 throw new Error ( messages . getMessage ( 'error.component-not-found' , [ name ] ) ) ;
7779 }
80+
81+ name = match . name ;
7882 } else {
7983 // prompt the user for a name if one was not provided
8084 name = await PromptUtils . promptUserToSelectComponent ( components ) ;
@@ -83,12 +87,16 @@ export default class LightningDevComponent extends SfCommand<void> {
8387 }
8488 }
8589
90+ const dirname = path . dirname ( url . fileURLToPath ( import . meta. url ) ) ;
91+ const rootDir = path . resolve ( dirname , '../../../..' ) ;
8692 const port = parseInt ( process . env . PORT ?? '3000' , 10 ) ;
8793
8894 await cmpDev ( {
95+ rootDir,
8996 mode : 'dev' ,
9097 port,
9198 name : `c/${ name } ` ,
99+ namespacePaths,
92100 } ) ;
93101 }
94102}
Original file line number Diff line number Diff line change @@ -57,10 +57,31 @@ export class ComponentUtils {
5757 return undefined ;
5858 }
5959
60+ if ( parsedData . LightningComponentBundle ) {
61+ parsedData . LightningComponentBundle . masterLabel = this . normalizeMetaProperty (
62+ parsedData . LightningComponentBundle . masterLabel
63+ ) ;
64+ parsedData . LightningComponentBundle . description = this . normalizeMetaProperty (
65+ parsedData . LightningComponentBundle . description
66+ ) ;
67+ }
68+
6069 return parsedData ;
6170 }
6271
6372 private static isLwcMetadata ( obj : unknown ) : obj is LwcMetadata {
6473 return ( obj && typeof obj === 'object' && 'LightningComponentBundle' in obj ) === true ;
6574 }
75+
76+ private static normalizeMetaProperty ( prop : string [ ] | string | undefined ) : string | undefined {
77+ if ( ! prop || typeof prop === 'string' ) {
78+ return prop ;
79+ }
80+
81+ if ( Array . isArray ( prop ) && prop . length > 0 ) {
82+ return prop [ 0 ] ;
83+ }
84+
85+ return undefined ;
86+ }
6687}
You can’t perform that action at this time.
0 commit comments