Skip to content
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

Create npm workspaces #1237

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
- run: just npm-install
- run: just check-format

- run: just vscode deps
- run: just vscode lint

- run: just web install
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/vscode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 18.x
- run: just npm-install
- id: get-date
run: echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
shell: bash
Expand Down
5 changes: 5 additions & 0 deletions extensions/vscode/.vscodeignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Workaround for https://github.com/microsoft/vscode-vsce/issues/580
../..

.*
.*/
.vscode/**
.vscode-test/**
src/**
Expand Down
19 changes: 0 additions & 19 deletions extensions/vscode/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,30 +58,11 @@ clean:
rm -rf out
just ./webviews/homeView/clean


# Install dependencies
deps:
#!/usr/bin/env bash
set -eou pipefail
{{ _with_debug }}

if [ {{ _ci }} = "true" ]; then
npm ci --no-audit --no-fund | sed 's/^/debug: /'
npm --prefix ./webviews/homeView ci --no-audit --no-fund | sed 's/^/debug: /'
else
npm install --no-audit --no-fund | sed 's/^/debug: /'
npm --prefix ./webviews/homeView install --no-audit --no-fund | sed 's/^/debug: /'
fi
just ./webviews/homeView/deps


configure os="$(just ../../os)" arch="$(just ../../arch)":
#!/usr/bin/env bash
set -eou pipefail
{{ _with_debug }}

just deps

echo "info: checking for compatible binary executable..." 1>&2
binary_executable=$(just ../../executable-path {{ os }} {{ arch }})
if ! [ -f "$binary_executable" ]; then
Expand Down
1 change: 1 addition & 0 deletions extensions/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@
},
"dependencies": {
"@hypersphere/omnibus": "0.1.6",
"@publishing-client/api": "^1.0.0",
"@vscode/codicons": "^0.0.35",
"axios": "^1.6.0",
"eventsource": "^2.0.2",
Expand Down
10 changes: 0 additions & 10 deletions extensions/vscode/src/api/axios.d.ts

This file was deleted.

7 changes: 6 additions & 1 deletion extensions/vscode/src/bus.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
// Copyright (C) 2024 by Posit Software, PBC.

import { Omnibus, args } from "@hypersphere/omnibus";
import { Account, Configuration, Deployment, PreDeployment } from "src/api";
import {
Account,
Configuration,
Deployment,
PreDeployment,
} from "@publishing-client/api";

export const bus = Omnibus.builder()
// activeDeploymentChanged: triggered if deployment name or value has changed
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Disposable } from "vscode";
import EventSource from "eventsource";
import { Readable } from "stream";

import { EventStreamMessage } from "src/api";
import { EventStreamMessage } from "@publishing-client/api";

export type EventStreamRegistration = (message: EventStreamMessage) => void;

Expand Down
3 changes: 2 additions & 1 deletion extensions/vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import {
workspace,
} from "vscode";

import { useApi } from "@publishing-client/api";

import * as ports from "src/ports";
import { useApi } from "src/api";
import { Service } from "src/services";
import { ProjectTreeDataProvider } from "src/views/project";
import { DeploymentsTreeDataProvider } from "src/views/deployments";
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/src/multiStepInputs/deployProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
useApi,
isConfigurationError,
Configuration,
} from "src/api";
} from "@publishing-client/api";
import { getSummaryStringFromError } from "src/utils/errors";
import { deployProject } from "src/views/deployProgress";
import { EventStream } from "src/events";
Expand Down
6 changes: 5 additions & 1 deletion extensions/vscode/src/multiStepInputs/initWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ import {
window,
} from "vscode";

import { AccountAuthType, useApi, ConfigurationDetails } from "src/api";
import {
AccountAuthType,
useApi,
ConfigurationDetails,
} from "@publishing-client/api";
import { getSummaryStringFromError } from "src/utils/errors";
import {
untitledConfigurationName,
Expand Down
6 changes: 5 additions & 1 deletion extensions/vscode/src/multiStepInputs/newConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ import {
window,
} from "vscode";

import { useApi, ConfigurationDetails, Configuration } from "src/api";
import {
useApi,
ConfigurationDetails,
Configuration,
} from "@publishing-client/api";
import { getSummaryStringFromError } from "src/utils/errors";
import { untitledConfigurationName } from "src/utils/names";
import { isValidFilename } from "src/utils/files";
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/src/multiStepInputs/newDeployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
PreDeployment,
isConfigurationError,
useApi,
} from "src/api";
} from "@publishing-client/api";
import { EventStream } from "src/events";
import { getSummaryStringFromError } from "src/utils/errors";
import {
Expand Down
3 changes: 2 additions & 1 deletion extensions/vscode/src/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import { ExtensionContext, Disposable } from "vscode";

import { initApi } from "@publishing-client/api";

import { HOST } from "src";
import { initApi } from "src/api";
import { Server } from "src/servers";

export class Service implements Disposable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
Deployment,
DeploymentFile,
PreDeployment,
} from "../../api";
} from "@publishing-client/api";

export enum HostToWebviewMessageType {
// Sent from host to webviewView
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/src/utils/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
commands,
} from "vscode";

import { DeploymentFile } from "../api";
import { DeploymentFile } from "@publishing-client/api";

export async function fileExists(fileUri: Uri): Promise<boolean> {
try {
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/src/utils/names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { InputBoxValidationSeverity } from "vscode";

import { useApi } from "src/api";
import { useApi } from "@publishing-client/api";
import { isValidFilename } from "src/utils/files";

export async function untitledConfigurationName(): Promise<string> {
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/src/views/configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
Configuration,
ConfigurationError,
isConfigurationError,
} from "src/api";
} from "@publishing-client/api";

import { confirmDelete, confirmReplace } from "src/dialogs";
import { getSummaryStringFromError } from "src/utils/errors";
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/src/views/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
window,
} from "vscode";

import { Account, useApi } from "src/api";
import { Account, useApi } from "@publishing-client/api";
import { getSummaryStringFromError } from "src/utils/errors";

const viewName = "posit.publisher.credentials";
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/src/views/deployProgress.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2024 by Posit Software, PBC.

import { ProgressLocation, Uri, env, window } from "vscode";
import { eventTypeToString, EventStreamMessage } from "src/api";
import { eventTypeToString, EventStreamMessage } from "@publishing-client/api";
import { EventStream, UnregisterCallback } from "src/events";

export function deployProject(localID: string, stream: EventStream) {
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/src/views/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
isDeploymentError,
isPreDeployment,
useApi,
} from "src/api";
} from "@publishing-client/api";

import { confirmForget } from "src/dialogs";
import { EventStream } from "src/events";
Expand Down
4 changes: 3 additions & 1 deletion extensions/vscode/src/views/homeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
isConfigurationError,
isDeploymentError,
useApi,
} from "src/api";
} from "@publishing-client/api";
import { useBus } from "src/bus";
import { EventStream } from "src/events";
import { getSummaryStringFromError } from "src/utils/errors";
Expand Down Expand Up @@ -568,6 +568,7 @@ export class HomeViewProvider implements WebviewViewProvider {
Uri.joinPath(this._extensionUri, "webviews", "homeView", "dist"),
Uri.joinPath(
this._extensionUri,
"../..",
"node_modules",
"@vscode",
"codicons",
Expand Down Expand Up @@ -616,6 +617,7 @@ export class HomeViewProvider implements WebviewViewProvider {
]);
// The codicon css (and related tff file) are needing to be loaded for icons
const codiconsUri = getUri(webview, extensionUri, [
"../..",
"node_modules",
"@vscode",
"codicons",
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/src/views/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {

import { EventStream, displayEventStreamMessage } from "src/events";

import { EventStreamMessage } from "src/api";
import { EventStreamMessage } from "@publishing-client/api";

enum LogStageStatus {
notStarted,
Expand Down
13 changes: 0 additions & 13 deletions extensions/vscode/webviews/homeView/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,3 @@ clean:
{{ _with_debug }}

rm -rf node_modules


# Install dependencies
deps:
#!/usr/bin/env bash
set -eou pipefail
{{ _with_debug }}

if [ {{ _ci }} = "true" ]; then
npm ci --no-audit --no-fund | sed 's/^/debug: /'
else
npm install --no-audit --no-fund | sed 's/^/debug: /'
fi
1 change: 1 addition & 0 deletions extensions/vscode/webviews/homeView/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"build": "vue-tsc --noEmit && vite build"
},
"dependencies": {
"@publishing-client/api": "^1.0.0",
"axios": "^1.6.0",
"eventsource": "^2.0.2",
"get-port": "5.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,12 @@
<script setup lang="ts">
import { computed } from "vue";

import {
isPreDeployment,
Account,
Configuration,
} from "@publishing-client/api";
import { formatDateString } from "../../../../../../web/src/utils/date";
import { isPreDeployment } from "../../../../src/api/types/deployments";
import { Account } from "../../../../src/api/types/accounts";
import { Configuration } from "../../../../src/api/types/configurations";
import { WebviewToHostMessageType } from "../../../../src/types/messages/webviewToHostMessages";

import { useHomeStore } from "src/stores/home";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ import {
DeploymentFile,
DeploymentState,
FileMatchSource,
} from "../../../../../src/api";
} from "@publishing-client/api";
import { WebviewToHostMessageType } from "../../../../../src/types/messages/webviewToHostMessages";

import TreeItem from "src/components/TreeItem.vue";
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/webviews/homeView/src/stores/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Account,
Configuration,
DeploymentFile,
} from "../../../../src/api";
} from "@publishing-client/api";
import { WebviewToHostMessageType } from "../../../../src/types/messages/webviewToHostMessages";

export const useHomeStore = defineStore("home", () => {
Expand Down
6 changes: 3 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ npm-install:
{{ _with_debug }}

if [ {{ _ci }} = "true" ]; then
npm ci --no-audit --no-fund
npm ci --no-audit --no-fund | sed 's/^/debug: /'
else
npm install --no-audit --no-fund
npm install --no-audit --no-fund | sed 's/^/debug: /'
fi

# staticcheck, vet, and format check
Expand Down Expand Up @@ -215,7 +215,7 @@ name:

basename {{ _cmd }}

package:
package: npm-install
#!/usr/bin/env bash
set -eou pipefail
{{ _with_debug }}
Expand Down
Loading