Skip to content
Merged
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
5 changes: 2 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ module.exports = {
parser: "@typescript-eslint/parser",
extends: [
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint", // Disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"prettier" // Make sure this is always the last configuration in the extends array.
"plugin:prettier/recommended" // Make sure this is always the last configuration in the extends array.
],
plugins: ["prettier", "@typescript-eslint", "header", "import"],
parserOptions: {
Expand Down Expand Up @@ -70,6 +69,7 @@ module.exports = {
}
],

"arrow-parens": ["warn", "as-needed"],
"no-constant-condition": ["warn", { checkLoops: false }],
"no-else-return": "warn",
"no-empty": ["warn", { allowEmptyCatch: true }],
Expand All @@ -95,7 +95,6 @@ module.exports = {
"no-var": "error",
"no-with": "error",
"prefer-const": "error",
"prefer-arrow-callback": "error",
"prefer-numeric-literals": "error",
"prefer-object-spread": "error",
"prefer-rest-params": "error",
Expand Down
46 changes: 24 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,12 @@ on:
- master
workflow_dispatch: {}
jobs:
cleanup-runs: # automatically cancel CI runs on pushes to the same branch
runs-on: ubuntu-latest
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
build:
name: Node.js v${{ matrix.node-version }} on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node-version: [10.x, 12.x]
node-version: [12.x, 14.x]
os: [ubuntu-latest, macOS-latest, windows-latest]
runs-on: ${{ matrix.os }}
env:
Expand All @@ -39,13 +32,16 @@ jobs:
run: echo ${{ github.ref }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Use NPM 7
run: npm install -g npm@7

- name: Set version number of package.json and build artifact
id: version_step
if: runner.os == 'Linux'
if: runner.os == 'macOS'
env:
RUN_NUMBER: ${{ github.run_number }}
run: |
Expand All @@ -61,30 +57,36 @@ jobs:
VERSION_STRING=${PACKAGE_VERSION}-nightly-$(git rev-parse --short HEAD)
fi

yarn version --no-git-tag-version --new-version $VERSION_STRING
npm version --no-git-tag-version $VERSION_STRING
echo "::set-output name=version_build::${VERSION_STRING}+${RUN_NUMBER}"

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"

- uses: actions/cache@v2
id: cache
id: npm-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('./yarn.lock') }}
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node-version }}-yarn-
${{ runner.os }}-node-${{ matrix.node-version }}-

- name: Install dependencies
run: "yarn install --frozen-lockfile --ignore-engines"
run: "npm ci"

- name: Lint, compile and test
run: "node node_modules/gulp/bin/gulp.js lint test"
if: runner.os != 'macOS'

- name: Build VSIX package
- name: Lint, compile, test and package
run: "node node_modules/gulp/bin/gulp.js package"
if: runner.os == 'macOS'

- name: Publish code coverage report
uses: codecov/codecov-action@v1
if: runner.os == 'Linux'
if: runner.os == 'macOS'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: "**/coverage/*.json"
Expand All @@ -93,7 +95,7 @@ jobs:

- name: Upload artifact
uses: actions/upload-artifact@v2
if: runner.os == 'Linux'
if: runner.os == 'macOS'
with:
name: vrealize-developer-tools-${{steps.version_step.outputs.version_build}}.vsix
path: "*.vsix"
6 changes: 3 additions & 3 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
run: echo ${{ github.ref }}

- name: Use Node.js 12.x
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: 12.x

Expand All @@ -29,7 +29,7 @@ jobs:
echo "::set-output name=version::${PACKAGE_VERSION}"

- name: Install dependencies
run: "yarn install --frozen-lockfile"
run: "npm ci"

- name: Build VSIX package
run: "node node_modules/gulp/bin/gulp.js package"
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Get previous tag
run: |
PREV_TAG=$(git describe --abbrev=0 --tags "${{ github.ref }}^")
echo "::set-env name=baseRef::$PREV_TAG"
echo "baseRef=$PREV_TAG" >> $GITHUB_ENV

- name: Generate release notes
id: generate_changelog
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Use Node.js 12
uses: actions/setup-node@v2
with:
node-version: 12.x

- name: Use NPM 7
run: npm install -g npm@7

- name: reviewdog
uses: reviewdog/action-eslint@v1
with:
Expand Down
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
.DS_Store

logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
*.log*
*.tsbuildinfo

out/
dist/
coverage/
node_modules/

Expand Down
4 changes: 3 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
registry=https://registry.yarnpkg.com
registry=https://registry.npmjs.org
@types:registry=https://registry.npmjs.org
@protobufjs:registry=https://registry.npmjs.org
1 change: 1 addition & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module.exports = {
printWidth: 120,
endOfLine: "lf",
proseWrap: "preserve",
arrowParens: "avoid",
semi: false,
trailingComma: "none",
singleQuote: false,
Expand Down
12 changes: 7 additions & 5 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ wiki/**
tools/**
**/src/**
**/out/__tests__/**
**/coverage

**/*.ts
**/*.map
**/*.config.js
**/*.eslint.json
**/*.tsbuildinfo
**/tsconfig.json

.editorconfig
.gitignore
.gitattributes
.yarnrc
.npmrc
.eslintignore
.eslintrc*
.prettierrc*
Expand All @@ -27,10 +32,7 @@ CODE_OF_CONDUCT.md
CONTRIBUTING.md

*.vsix
**/tsconfig.json
gulpfile.js
yarn.lock
yarn-debug.log
yarn-error.log
package-lock.json

!node_modules/**
10 changes: 0 additions & 10 deletions .yarnrc

This file was deleted.

21 changes: 10 additions & 11 deletions build/preinstall.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
/*
* Copyright 2018-2019 VMware, Inc.
* Copyright 2018-2021 VMware, Inc.
* SPDX-License-Identifier: MIT
*/

const major = parseInt(/^(\d+)\./.exec(process.versions.node)[1]);

if (major < 10) {
console.error('\033[1;31m*** Please use node >=10.0.0.\033[0;0m');
if (major < 12) {
console.error('\033[1;31m*** Please use node >=12.0.0.\033[0;0m');
process.exit(1);
}

const cp = require('child_process');
const yarnVersion = cp.execSync('yarn -v', {
const npmVersion = cp.execSync('npm -v', {
encoding: 'utf8'
}).trim();

const parsedYarnVersion = /^(\d+)\.(\d+)\./.exec(yarnVersion);
const majorYarnVersion = parseInt(parsedYarnVersion[1]);
const minorYarnVersion = parseInt(parsedYarnVersion[2]);
const parsedNpmVersion = /^(\d+)\.(\d+)\./.exec(npmVersion);
const majorNpmVersion = parseInt(parsedNpmVersion[1]);

if (majorYarnVersion < 1 || minorYarnVersion < 10) {
console.error('\033[1;31m*** Please use yarn >=1.10.1.\033[0;0m');
if (majorNpmVersion < 7) {
console.error('\033[1;31m*** Please use npm >=7.0.0.\033[0;0m');
process.exit(1);
}

if (!/yarn(\.js|pkg)?$/.test(process.env['npm_execpath'])) {
console.error('\033[1;31m*** Please use yarn to install dependencies.\033[0;0m');
if (!/npm(\-cli\.js)?$/.test(process.env['npm_execpath'])) {
console.error('\033[1;31m*** Please use npm to install dependencies.\033[0;0m');
process.exit(1);
}
2 changes: 1 addition & 1 deletion common/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class Logger {
private static logLevel: LogLevel = "info"
private static logChannel: LogChannel

constructor(private className: string) { }
constructor(private className: string) {}

/**
* Get a logger instance.
Expand Down
16 changes: 9 additions & 7 deletions common/src/maven/MavenCliProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,32 +150,34 @@ export class MavenCliProxy {
decodedToken = jwt_decode(token.value)
} catch (e) {
this.logger.warn(`Invalid local SSO authentication token format!`)
return true;
return true
}

// token (stored locally) details
const tokenUserQualifier = decodedToken.prn // user@TENANT
if (!tokenUserQualifier) {
return true;
return true
}
const tokenUsername = tokenUserQualifier.match(/.+?(?=@)/)
if (!tokenUsername) {
return true;
return true
}
const tokenTenant = tokenUserQualifier.match(/(?<=@).+[^\s]/)
if (!tokenTenant) {
return true;
return true
}
const tokenDomain = decodedToken.domain
if (!tokenDomain) {
return true;
return true
}

// Maven active profile details
const vroUsername = this.environment.getVroUsername() // user@domain
const vroTenant = this.environment.getVroTenant()

return (`${tokenUsername[0]}@${tokenDomain}`.toUpperCase() != vroUsername.toUpperCase() ||
tokenTenant[0].toUpperCase() != vroTenant.toUpperCase());
return (
`${tokenUsername[0]}@${tokenDomain}`.toUpperCase() != vroUsername.toUpperCase() ||
tokenTenant[0].toUpperCase() != vroTenant.toUpperCase()
)
}
}
3 changes: 2 additions & 1 deletion common/src/platform/WorkspaceFolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

import * as path from "path"

import { URI, UriComponents } from "vscode-uri"
import { URI } from "vscode-uri"
import { UriComponents } from "vscode-uri/lib/umd/uri"

import { default as Logger } from "../logger"
import { PomFile } from "../maven"
Expand Down
12 changes: 10 additions & 2 deletions common/src/rest/VraNgRestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,19 @@ export class VraNgRestClient {
return this.unwrapPages(blueprints, "/blueprint/api/blueprints")
}

async createBlueprint(body: { name: string; projectId: string; content: string, description: string }): Promise<any> {
async createBlueprint(body: {
name: string
projectId: string
content: string
description: string
}): Promise<any> {
return this.send("POST", "/blueprint/api/blueprints", { body })
}

async updateBlueprint(id: string, body: { name: string; projectId: string; content: string, description: string }): Promise<void> {
async updateBlueprint(
id: string,
body: { name: string; projectId: string; content: string; description: string }
): Promise<void> {
return this.send("PUT", `/blueprint/api/blueprints/${id}`, { body })
}

Expand Down
4 changes: 1 addition & 3 deletions common/src/rest/VroRestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,7 @@ export class VroRestClient {
for (const log of response.logs) {
const e = log.entry
const description = e["long-description"] ? e["long-description"] : e["short-description"]
if (description.indexOf("*** End of execution stack.") > 0 ||
description.startsWith("__item_stack:/")
) {
if (description.indexOf("*** End of execution stack.") > 0 || description.startsWith("__item_stack:/")) {
continue
}

Expand Down
2 changes: 1 addition & 1 deletion common/src/rest/vra-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export type Project = {
export interface PagedResult<T> {
content: T[]
pageable: {
sort: {sorted: boolean; unsorted: boolean; empty: boolean}
sort: { sorted: boolean; unsorted: boolean; empty: boolean }
offset: number
pageSize: number
pageNumber: number
Expand Down
Loading