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 9
9
"@inquirer/select" : " ^2.4.7" ,
10
10
"@lwc/lwc-dev-server" : " ~11.5.0" ,
11
11
"@lwc/sfdc-lwc-compiler" : " ~11.5.0" ,
12
- "@lwrjs/api" : " 0.16.10 " ,
12
+ "@lwrjs/api" : " 0.18.1 " ,
13
13
"@oclif/core" : " ^4.1.0" ,
14
14
"@salesforce/core" : " ^8.6.2" ,
15
15
"@salesforce/kit" : " ^3.1.6" ,
16
16
"@salesforce/lwc-dev-mobile-core" : " 4.0.0-alpha.9" ,
17
17
"@salesforce/sf-plugins-core" : " ^11.2.4" ,
18
18
"axios" : " ^1.7.9" ,
19
19
"glob" : " ^10.4.5" ,
20
+ "lightning-base-components" : " 1.27.2-alpha" ,
20
21
"lwc" : " ~8.12.5" ,
21
22
"node-fetch" : " ^3.3.2" ,
22
23
"xml2js" : " ^0.6.2"
Original file line number Diff line number Diff line change 6
6
*/
7
7
8
8
import path from 'node:path' ;
9
+ import url from 'node:url' ;
9
10
import { SfCommand , Flags } from '@salesforce/sf-plugins-core' ;
10
11
import { Messages , SfProject } from '@salesforce/core' ;
11
12
import { cmpDev } from '@lwrjs/api' ;
@@ -72,9 +73,12 @@ export default class LightningDevComponent extends SfCommand<void> {
72
73
let name = flags . name ;
73
74
if ( name ) {
74
75
// 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 ) {
76
78
throw new Error ( messages . getMessage ( 'error.component-not-found' , [ name ] ) ) ;
77
79
}
80
+
81
+ name = match . name ;
78
82
} else {
79
83
// prompt the user for a name if one was not provided
80
84
name = await PromptUtils . promptUserToSelectComponent ( components ) ;
@@ -83,12 +87,16 @@ export default class LightningDevComponent extends SfCommand<void> {
83
87
}
84
88
}
85
89
90
+ const dirname = path . dirname ( url . fileURLToPath ( import . meta. url ) ) ;
91
+ const rootDir = path . resolve ( dirname , '../../../..' ) ;
86
92
const port = parseInt ( process . env . PORT ?? '3000' , 10 ) ;
87
93
88
94
await cmpDev ( {
95
+ rootDir,
89
96
mode : 'dev' ,
90
97
port,
91
98
name : `c/${ name } ` ,
99
+ namespacePaths,
92
100
} ) ;
93
101
}
94
102
}
Original file line number Diff line number Diff line change @@ -57,10 +57,31 @@ export class ComponentUtils {
57
57
return undefined ;
58
58
}
59
59
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
+
60
69
return parsedData ;
61
70
}
62
71
63
72
private static isLwcMetadata ( obj : unknown ) : obj is LwcMetadata {
64
73
return ( obj && typeof obj === 'object' && 'LightningComponentBundle' in obj ) === true ;
65
74
}
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
+ }
66
87
}
You can’t perform that action at this time.
0 commit comments