Skip to content

Commit

Permalink
Merge branch 'main' into kg-vscode-ui-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kgartland-rstudio authored Jun 26, 2024
2 parents 78a3517 + 0d4bad8 commit 4a5047e
Show file tree
Hide file tree
Showing 42 changed files with 550 additions and 167 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/contract.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ jobs:
- run: just bats test common
- run: just bats test init
- run: just bats test deploy

# vscode ui tests
- run: just package
- run: just vscode configure
- run: just vscode-ui install
- run: just vscode-ui test

2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: extractions/setup-just@v2
- uses: actions/setup-node@v4
with:
node-version: "18.x"
node-version: "20"
- uses: actions/download-artifact@v4
with:
name: dist
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vscode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: ./.github/actions/setup
- uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: "20"
- id: get-date
run: echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
shell: bash
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extensions/vscode/assets/walkthroughs/deploy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions extensions/vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 64 additions & 0 deletions extensions/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,69 @@
"contents": "Scanning folder for a Posit project...",
"when": "workbenchState == folder && posit.publish.state == 'uninitialized'"
}
],
"walkthroughs": [
{
"id": "posit.publisher.walkthrough.gettingStarted",
"title": "Get Started with Posit Publisher",
"description": "Deploy your First Project",
"steps": [
{
"id": "posit.publisher.walkthrough.gettingStarted.openProject",
"title": "Open project",
"description": "Open the folder containing your project.",
"media": {
"image": "assets/walkthroughs/open-folder.png",
"altText": "Posit Publisher"
}
},
{
"id": "posit.publisher.walkthrough.gettingStarted.activateExtension",
"title": "Activate Posit Publisher Extension",
"description": "Click on the Posit Publisher icon in the left taskbar.",
"media": {
"image": "assets/walkthroughs/activate-extension.png",
"altText": "Posit Publisher"
}
},
{
"id": "posit.publisher.walkthrough.gettingStarted.createDeployment",
"title": "Create a Deployment",
"description": "A deployment represents a single piece of content on a Posit Connect server. You can iterate on it locally and redeploy it at any time.",
"media": {
"image": "assets/walkthroughs/create-new-deployment.png",
"altText": "Posit Publisher"
}
},
{
"id": "posit.publisher.walkthrough.gettingStarted.editConfig",
"title": "Edit your deployment's configuration",
"description": "Each deployment is deployed using a configuration file. Edit the configuration before deploying.",
"media": {
"image": "assets/walkthroughs/edit-configuration.png",
"altText": "Posit Publisher"
}
},
{
"id": "posit.publisher.walkthrough.gettingStarted.publishContent",
"title": "Deploy your content to Posit Connect",
"description": "Once you have configured your deployment, you are ready to deploy your latest code changes up to the Posit Connect server. Click the Deploy button to proceed.",
"media": {
"image": "assets/walkthroughs/deploy.png",
"altText": "Posit Publisher"
}
},
{
"id": "posit.publisher.walkthrough.gettingStarted.accessContent",
"title": "View your content on Posit Connect",
"description": "Click on the button to view your content running on the Posit Connect server.",
"media": {
"image": "assets/walkthroughs/visit-content.png",
"altText": "Posit Publisher"
}
}
]
}
]
},
"scripts": {
Expand Down Expand Up @@ -627,6 +690,7 @@
"@hypersphere/omnibus": "0.1.6",
"@vscode/codicons": "^0.0.36",
"axios": "^1.6.0",
"debounce": "^2.1.0",
"eventsource": "^2.0.2",
"get-port": "5.1.1",
"mutexify": "^1.4.0",
Expand Down
12 changes: 10 additions & 2 deletions extensions/vscode/src/views/homeView.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (C) 2024 by Posit Software, PBC.

import debounce from "debounce";

import {
CancellationToken,
Disposable,
Expand Down Expand Up @@ -74,6 +76,8 @@ enum HomeViewInitialized {

const lastSelectionState = "posit.publisher.homeView.lastSelectionState.v2";

const fileEventDebounce = 200;

export class HomeViewProvider implements WebviewViewProvider, Disposable {
private _disposables: Disposable[] = [];
private _contentRecords: (
Expand Down Expand Up @@ -1230,7 +1234,11 @@ export class HomeViewProvider implements WebviewViewProvider, Disposable {
watchers.contentRecords?.onDidDelete(this.refreshContentRecords, this);
watchers.contentRecords?.onDidChange(this.refreshContentRecords, this);

watchers.allFiles?.onDidCreate(this.sendRefreshedFilesLists, this);
watchers.allFiles?.onDidDelete(this.sendRefreshedFilesLists, this);
const fileEventCallback = debounce(
this.sendRefreshedFilesLists,
fileEventDebounce,
);
watchers.allFiles?.onDidCreate(fileEventCallback, this);
watchers.allFiles?.onDidDelete(fileEventCallback, this);
}
}
7 changes: 7 additions & 0 deletions extensions/vscode/src/views/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ export class LogsTreeDataProvider implements TreeDataProvider<LogsTreeItem> {

private resetStages() {
this.stages = new Map([
[
"publish/getRPackageDescriptions",
createLogStage(
"Get Package Descriptions",
"Getting Package Descriptions",
),
],
[
"publish/checkCapabilities",
createLogStage("Check Capabilities", "Checking Capabilities"),
Expand Down
10 changes: 5 additions & 5 deletions extensions/vscode/webviews/homeView/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion extensions/vscode/webviews/homeView/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"vue": "^3.4.21"
},
"devDependencies": {
"@tsconfig/node18": "^18.2.4",
"@tsconfig/node20": "^20.1.4",
"@types/node": "^20.14.2",
"@types/vscode-webview": "^1.57.5",
"@vitejs/plugin-vue": "^5.0.4",
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/webviews/homeView/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": [
"@tsconfig/node18/tsconfig.json",
"@tsconfig/node20/tsconfig.json",
"@vue/tsconfig/tsconfig.dom.json"
],
"include": ["src/**/*", "src/**/*.vue"],
Expand Down
10 changes: 3 additions & 7 deletions internal/bundles/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,9 @@ func ReadManifestFile(path util.Path) (*Manifest, error) {

func NewManifest() *Manifest {
return &Manifest{
Version: 1,
Python: &Python{},
Quarto: &Quarto{},
Jupyter: &Jupyter{},
Environment: &Environment{},
Packages: make(PackageMap),
Files: make(ManifestFileMap),
Version: 1,
Packages: make(PackageMap),
Files: make(ManifestFileMap),
}
}

Expand Down
24 changes: 8 additions & 16 deletions internal/bundles/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,10 @@ func (s *ManifestSuite) TestReadManifest() {
manifest, err := ReadManifest(reader)
s.Nil(err)
s.Equal(&Manifest{
Version: 1,
Platform: "4.1.0",
Python: &Python{},
Quarto: &Quarto{},
Jupyter: &Jupyter{},
Environment: &Environment{},
Packages: PackageMap{},
Files: ManifestFileMap{},
Version: 1,
Platform: "4.1.0",
Packages: PackageMap{},
Files: ManifestFileMap{},
}, manifest)
}

Expand Down Expand Up @@ -102,14 +98,10 @@ func (s *ManifestSuite) TestReadManifestFile() {
manifest, err := ReadManifestFile(manifestPath)
s.Nil(err)
s.Equal(&Manifest{
Version: 1,
Platform: "4.1.0",
Python: &Python{},
Quarto: &Quarto{},
Jupyter: &Jupyter{},
Environment: &Environment{},
Packages: PackageMap{},
Files: ManifestFileMap{},
Version: 1,
Platform: "4.1.0",
Packages: PackageMap{},
Files: ManifestFileMap{},
}, manifest)
}

Expand Down
4 changes: 3 additions & 1 deletion internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (s *ConfigSuite) TestWriteFile() {
s.NoError(err)
}

func (s *ConfigSuite) TestWriteFileEmptyEntrypoing() {
func (s *ConfigSuite) TestWriteFileEmptyEntrypoint() {
configFile := GetConfigPath(s.cwd, "myConfig")
cfg := New()
cfg.Type = ContentTypeHTML
Expand All @@ -114,6 +114,8 @@ func (s *ConfigSuite) TestWriteFileEmptyEntrypoing() {
s.NoError(err)
lines := strings.Split(string(contents), "\n")
s.Contains(lines, "entrypoint = ''")

s.NotContains(contents, []byte("has_parameters"))
}

func (s *ConfigSuite) TestWriteFileErr() {
Expand Down
2 changes: 1 addition & 1 deletion internal/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ type Config struct {
Type ContentType `toml:"type" json:"type"`
Entrypoint string `toml:"entrypoint" json:"entrypoint,omitempty"`
Validate bool `toml:"validate" json:"validate"`
HasParameters bool `toml:"has_parameters" json:"hasParameters"`
HasParameters bool `toml:"has_parameters,omitempty" json:"hasParameters"`
Files []string `toml:"files" json:"files"`
Title string `toml:"title,omitempty" json:"title,omitempty"`
Description string `toml:"description,multiline,omitempty" json:"description,omitempty"`
Expand Down
27 changes: 14 additions & 13 deletions internal/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,20 @@ const (
const (
AgentOp Operation = "agent"

PublishCheckCapabilitiesOp Operation = "publish/checkCapabilities"
PublishCreateNewDeploymentOp Operation = "publish/createNewDeployment"
PublishSetEnvVarsOp Operation = "publish/setEnvVars"
PublishCreateBundleOp Operation = "publish/createBundle"
PublishUpdateDeploymentOp Operation = "publish/createDeployment"
PublishUploadBundleOp Operation = "publish/uploadBundle"
PublishDeployBundleOp Operation = "publish/deployBundle"
PublishRestorePythonEnvOp Operation = "publish/restorePythonEnv"
PublishRestoreREnvOp Operation = "publish/restoreREnv"
PublishRunContentOp Operation = "publish/runContent"
PublishSetVanityUrlOp Operation = "publish/setVanityURL"
PublishValidateDeploymentOp Operation = "publish/validateDeployment"
PublishOp Operation = "publish"
PublishCheckCapabilitiesOp Operation = "publish/checkCapabilities"
PublishGetRPackageDescriptionsOp Operation = "publish/getRPackageDescriptions"
PublishCreateNewDeploymentOp Operation = "publish/createNewDeployment"
PublishSetEnvVarsOp Operation = "publish/setEnvVars"
PublishCreateBundleOp Operation = "publish/createBundle"
PublishUpdateDeploymentOp Operation = "publish/createDeployment"
PublishUploadBundleOp Operation = "publish/uploadBundle"
PublishDeployBundleOp Operation = "publish/deployBundle"
PublishRestorePythonEnvOp Operation = "publish/restorePythonEnv"
PublishRestoreREnvOp Operation = "publish/restoreREnv"
PublishRunContentOp Operation = "publish/runContent"
PublishSetVanityUrlOp Operation = "publish/setVanityURL"
PublishValidateDeploymentOp Operation = "publish/validateDeployment"
PublishOp Operation = "publish"
)

func New(op Operation, phase Phase, errCode ErrorCode, data any) *Event {
Expand Down
Loading

0 comments on commit 4a5047e

Please sign in to comment.