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

feat: updated tests and functionality #58

Merged
merged 18 commits into from Jun 27, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
@@ -1,5 +1,6 @@
.DS_Store
dist
node_modules
reports
*.tgz
.idea
40 changes: 25 additions & 15 deletions examples/src/releases/create-and-deploy-release.ts
@@ -1,19 +1,29 @@
import { Client, ClientConfiguration, Repository } from '@octopusdeploy/api-client';
import { ChannelResource, DeploymentProcessResource, DeploymentResource, EnvironmentResource, NewDeploymentResource, NewReleaseResource, ProjectResource, ReleaseResource, ReleaseTemplateResource } from '@octopusdeploy/message-contracts';
import { Client, ClientConfiguration, Repository } from "@octopusdeploy/api-client";
import {
ChannelResource,
DeploymentProcessResource,
DeploymentResource,
EnvironmentResource,
NewDeploymentResource,
NewReleaseResource,
ProjectResource,
ReleaseResource,
ReleaseTemplateResource,
} from "@octopusdeploy/message-contracts";

const main = async () => {
const configuration: ClientConfiguration = {
apiKey: 'api-key', // required
apiUri: 'api-uri', // required
autoConnect: true
apiKey: "api-key", // required
apiUri: "api-uri", // required
autoConnect: true,
};

let client: Client | undefined;

try {
client = await Client.create(configuration);
} catch (error) {
console.error('The TypeScript API client could not be constructed.');
console.error("The TypeScript API client could not be constructed.");
return;
}

Expand All @@ -22,9 +32,9 @@ const main = async () => {
}

const repository = new Repository(client);
const projectNameOrId = 'project-name-or-id';
const channelNameOrId = 'channel-name-or-id';
const environmentNameOrId = 'environment-name-or-id';
const projectNameOrId = "project-name-or-id";
const channelNameOrId = "channel-name-or-id";
const environmentNameOrId = "environment-name-or-id";

let project: ProjectResource | undefined;

Expand Down Expand Up @@ -108,8 +118,8 @@ const main = async () => {
let newRelease: NewReleaseResource = {
ChannelId: channel.Id,
ProjectId: project.Id,
Version: releaseTemplate.NextVersionIncrement
}
Version: releaseTemplate.NextVersionIncrement,
};

console.log(`Creating release with version, "${newRelease.Version}"...`);

Expand All @@ -126,8 +136,8 @@ const main = async () => {

let newDeployment: NewDeploymentResource = {
EnvironmentId: environment.Id,
ReleaseId: release.Id
}
ReleaseId: release.Id,
};

console.log(`Creating deployment for release ${release.Version} of project ${project.Name} to environment ${environment.Name}...`);

Expand All @@ -141,6 +151,6 @@ const main = async () => {
}

console.log(`Deployment created, "${deployment.Id}"`);
}
};

main();
main();
46 changes: 15 additions & 31 deletions package-lock.json

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

7 changes: 3 additions & 4 deletions package.json
Expand Up @@ -39,16 +39,15 @@
"jest-environment-jsdom": "^28.1.1",
"jest-expect-message": "^1.0.2",
"jest-extended": "^2.0.0",
"jest-junit": "^13.2.0",
"jest-junit": "^14.0.0",
"jest-runner-eslint": "^1.0.1",
"prettier": "^2.7.1",
"process": "^0.11.10",
"prop-types": "^15.8.1",
"ts-jest": "^28.0.5",
"ts-node": "^10.8.1",
"typedoc": "^0.22.17",
"typescript": "^4.7.4",
"unique-names-generator": "^4.7.1"
"typedoc": "^0.22.18",
"typescript": "^4.7.4"
},
"files": [
"dist/**/*"
Expand Down