Skip to content

Commit 240ab10

Browse files
authored
feat: add initial command stubs (#18)
* feat: generate stubs * fix: package.json * chore: update snapshots * chore: update schemas
1 parent 62507ea commit 240ab10

17 files changed

+518
-0
lines changed

command-snapshot.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,29 @@
66
"flagChars": ["n"],
77
"flags": ["flags-dir", "json", "name"],
88
"plugin": "@salesforce/plugin-lightning-dev"
9+
},
10+
{
11+
"alias": [],
12+
"command": "lightning:preview:component",
13+
"flagAliases": [],
14+
"flagChars": ["n"],
15+
"flags": ["flags-dir", "json", "name"],
16+
"plugin": "@salesforce/plugin-lightning-dev"
17+
},
18+
{
19+
"alias": [],
20+
"command": "lightning:preview:org",
21+
"flagAliases": [],
22+
"flagChars": ["n"],
23+
"flags": ["flags-dir", "json", "name"],
24+
"plugin": "@salesforce/plugin-lightning-dev"
25+
},
26+
{
27+
"alias": [],
28+
"command": "lightning:preview:site",
29+
"flagAliases": [],
30+
"flagChars": ["n"],
31+
"flags": ["flags-dir", "json", "name"],
32+
"plugin": "@salesforce/plugin-lightning-dev"
933
}
1034
]
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# summary
2+
3+
Preview LWC component in insolation.
4+
5+
# description
6+
7+
Preview components, org, and sites. If no topic is specified, the default action is to preview the org.
8+
9+
In dev preview mode, you can edit local files and see these changes to your Lightning Web Components (LWC) within your {org name} org:
10+
11+
- Basic HTML and CSS edits
12+
- Importing new CSS-only LWC
13+
- JS edits in-service component library
14+
- JS method changes in the LWC component that don't alter its public API.
15+
16+
Other local changes require deployment to your org. However, changes made directly in your org (like modifying component properties and saving) are immediately live and won't show in your local files until you retrieve them from the org.
17+
18+
This feature enables developers to quickly iterate on their components and pages, seeing the impact of changes in real-time without needing to deploy or refresh manually. Live reload is enabled by default to automatically refresh the preview when source code changes are detected.
19+
20+
Use the appropriate topic to preview specific aspects of the development environment.
21+
22+
# flags.name.summary
23+
24+
Description of a flag.
25+
26+
# flags.name.description
27+
28+
More information about a flag. Don't repeat the summary.
29+
30+
# examples
31+
32+
- <%= config.bin %> <%= command.id %>

messages/lightning.preview.org.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# summary
2+
3+
Preview LWC components in context of your Salesforce Org.
4+
5+
# description
6+
7+
Preview components, org, and sites. If no topic is specified, the default action is to preview the org.
8+
9+
In dev preview mode, you can edit local files and see these changes to your Lightning Web Components (LWC) within your {org name} org:
10+
11+
- Basic HTML and CSS edits
12+
- Importing new CSS-only LWC
13+
- JS edits in-service component library
14+
- JS method changes in the LWC component that don't alter its public API.
15+
16+
Other local changes require deployment to your org. However, changes made directly in your org (like modifying component properties and saving) are immediately live and won't show in your local files until you retrieve them from the org.
17+
18+
This feature enables developers to quickly iterate on their components and pages, seeing the impact of changes in real-time without needing to deploy or refresh manually. Live reload is enabled by default to automatically refresh the preview when source code changes are detected.
19+
20+
Use the appropriate topic to preview specific aspects of the development environment.
21+
22+
# flags.name.summary
23+
24+
Description of a flag.
25+
26+
# flags.name.description
27+
28+
More information about a flag. Don't repeat the summary.
29+
30+
# examples
31+
32+
- <%= config.bin %> <%= command.id %>

messages/lightning.preview.site.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# summary
2+
3+
Preview LWC components in context of Experience Cloud on Experience Delivery site.
4+
5+
# description
6+
7+
Preview components, org, and sites. If no topic is specified, the default action is to preview the org.
8+
9+
In dev preview mode, you can edit local files and see these changes to your Lightning Web Components (LWC) within your {org name} org:
10+
11+
- Basic HTML and CSS edits
12+
- Importing new CSS-only LWC
13+
- JS edits in-service component library
14+
- JS method changes in the LWC component that don't alter its public API.
15+
16+
Other local changes require deployment to your org. However, changes made directly in your org (like modifying component properties and saving) are immediately live and won't show in your local files until you retrieve them from the org.
17+
18+
This feature enables developers to quickly iterate on their components and pages, seeing the impact of changes in real-time without needing to deploy or refresh manually. Live reload is enabled by default to automatically refresh the preview when source code changes are detected.
19+
20+
Use the appropriate topic to preview specific aspects of the development environment.
21+
22+
# flags.name.summary
23+
24+
Description of a flag.
25+
26+
# flags.name.description
27+
28+
More information about a flag. Don't repeat the summary.
29+
30+
# examples
31+
32+
- <%= config.bin %> <%= command.id %>

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@
5656
"topics": {
5757
"hello": {
5858
"description": "Commands to say hello."
59+
},
60+
"lightning": {
61+
"external": true,
62+
"subtopics": {
63+
"preview": {
64+
"description": "Preview components, org, and, sites in real-time."
65+
}
66+
}
5967
}
6068
},
6169
"flexibleTaxonomy": true
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$ref": "#/definitions/LightningPreviewComponentResult",
4+
"definitions": {
5+
"LightningPreviewComponentResult": {
6+
"type": "object",
7+
"properties": {
8+
"path": {
9+
"type": "string"
10+
}
11+
},
12+
"required": ["path"],
13+
"additionalProperties": false
14+
}
15+
}
16+
}

schemas/lightning-preview-org.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$ref": "#/definitions/LightningPreviewOrgResult",
4+
"definitions": {
5+
"LightningPreviewOrgResult": {
6+
"type": "object",
7+
"properties": {
8+
"path": {
9+
"type": "string"
10+
}
11+
},
12+
"required": ["path"],
13+
"additionalProperties": false
14+
}
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$ref": "#/definitions/LightningPreviewSiteResult",
4+
"definitions": {
5+
"LightningPreviewSiteResult": {
6+
"type": "object",
7+
"properties": {
8+
"path": {
9+
"type": "string"
10+
}
11+
},
12+
"required": ["path"],
13+
"additionalProperties": false
14+
}
15+
}
16+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2023, salesforce.com, inc.
3+
* All rights reserved.
4+
* Licensed under the BSD 3-Clause license.
5+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6+
*/
7+
8+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
9+
import { Messages } from '@salesforce/core';
10+
11+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
12+
const messages = Messages.loadMessages('@salesforce/plugin-lightning-dev', 'lightning.preview.component');
13+
14+
export type LightningPreviewComponentResult = {
15+
path: string;
16+
};
17+
18+
export default class LightningPreviewComponent extends SfCommand<LightningPreviewComponentResult> {
19+
public static readonly summary = messages.getMessage('summary');
20+
public static readonly description = messages.getMessage('description');
21+
public static readonly examples = messages.getMessages('examples');
22+
23+
public static readonly flags = {
24+
name: Flags.string({
25+
summary: messages.getMessage('flags.name.summary'),
26+
description: messages.getMessage('flags.name.description'),
27+
char: 'n',
28+
required: false,
29+
}),
30+
};
31+
32+
public async run(): Promise<LightningPreviewComponentResult> {
33+
const { flags } = await this.parse(LightningPreviewComponent);
34+
35+
const name = flags.name ?? 'world';
36+
this.log(`hello ${name} from /Users/nkruk/git/plugin-lightning-dev/src/commands/lightning/preview/component.ts`);
37+
return {
38+
path: '/Users/nkruk/git/plugin-lightning-dev/src/commands/lightning/preview/component.ts',
39+
};
40+
}
41+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2023, salesforce.com, inc.
3+
* All rights reserved.
4+
* Licensed under the BSD 3-Clause license.
5+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6+
*/
7+
8+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
9+
import { Messages } from '@salesforce/core';
10+
11+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
12+
const messages = Messages.loadMessages('@salesforce/plugin-lightning-dev', 'lightning.preview.org');
13+
14+
export type LightningPreviewOrgResult = {
15+
path: string;
16+
};
17+
18+
export default class LightningPreviewOrg extends SfCommand<LightningPreviewOrgResult> {
19+
public static readonly summary = messages.getMessage('summary');
20+
public static readonly description = messages.getMessage('description');
21+
public static readonly examples = messages.getMessages('examples');
22+
23+
public static readonly flags = {
24+
name: Flags.string({
25+
summary: messages.getMessage('flags.name.summary'),
26+
description: messages.getMessage('flags.name.description'),
27+
char: 'n',
28+
required: false,
29+
}),
30+
};
31+
32+
public async run(): Promise<LightningPreviewOrgResult> {
33+
const { flags } = await this.parse(LightningPreviewOrg);
34+
35+
const name = flags.name ?? 'world';
36+
this.log(`hello ${name} from /Users/nkruk/git/plugin-lightning-dev/src/commands/lightning/preview/org.ts`);
37+
return {
38+
path: '/Users/nkruk/git/plugin-lightning-dev/src/commands/lightning/preview/org.ts',
39+
};
40+
}
41+
}

0 commit comments

Comments
 (0)