Skip to content

Commit 16317be

Browse files
feat(VEG-4340): Bootstrap a new package to onboard CLI commands for Connector SDK
1 parent 174bb63 commit 16317be

11 files changed

Lines changed: 166 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file.
4+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5+
6+
# [1.0.0-beta.1](https://github.com/zendesk/zcli/compare/v1.0.0-beta.0...v1.0.0-beta.1) (2026-01-12)
7+
8+
**Note:** Initial version for zcli-connectors package

packages/zcli-connectors/bin/run

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env node
2+
3+
const oclif = require('@oclif/core')
4+
5+
oclif.run().catch(require('@oclif/core/handle'))
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
3+
node "%~dp0\run" %*
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"name": "@zendesk/zcli-connectors",
3+
"description": "zcli connectors commands live here",
4+
"version": "1.0.0-beta.1",
5+
"author": "@vegemite",
6+
"npmRegistry": "https://registry.npmjs.org",
7+
"publishConfig": {
8+
"access": "public"
9+
},
10+
"bin": {
11+
"zcli-connectors": "./bin/run"
12+
},
13+
"scripts": {
14+
"build": "tsc",
15+
"prepack": "tsc && ../../scripts/prepack.sh",
16+
"postpack": "rm -f oclif.manifest.json npm-shrinkwrap.json && rm -rf ./dist && git checkout ./package.json",
17+
"type:check": "tsc"
18+
},
19+
"dependencies": {
20+
"adm-zip": "0.5.10",
21+
"archiver": "^5.3.1",
22+
"axios": "^1.7.5",
23+
"chalk": "^4.1.2",
24+
"fs-extra": "^10.0.0",
25+
"rimraf": "^3.0.2",
26+
"tslib": "^2.4.0"
27+
},
28+
"devDependencies": {
29+
"@oclif/test": "=2.1.0",
30+
"@types/adm-zip": "^0.5.5",
31+
"@types/archiver": "^5.3.1",
32+
"@types/chai": "^4",
33+
"@types/mocha": "^9.1.1",
34+
"@types/rimraf": "^3.0.2",
35+
"chai": "^4",
36+
"eslint": "^8.18.0",
37+
"eslint-config-oclif": "^4.0.0",
38+
"eslint-config-oclif-typescript": "^1.0.2",
39+
"lerna": "^5.6.2",
40+
"mocha": "^10.8.2",
41+
"sinon": "^14.0.0"
42+
},
43+
"files": [
44+
"/bin",
45+
"/dist",
46+
"/oclif.manifest.json",
47+
"/npm-shrinkwrap.json"
48+
],
49+
"keywords": [
50+
"zcli",
51+
"zendesk",
52+
"cli",
53+
"command"
54+
],
55+
"license": "MIT",
56+
"main": "src/index.js",
57+
"oclif": {
58+
"commands": "./src/commands",
59+
"bin": "zcli-connectors"
60+
},
61+
"types": "lib/index.d.ts"
62+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Command } from '@oclif/core'
2+
import * as path from 'path'
3+
import * as chalk from 'chalk'
4+
5+
export default class Bundle extends Command {
6+
static description = 'bundles your connector package (Note: This command is not yet available for customers)'
7+
8+
static args = [
9+
{ name: 'connectorDirectory', default: '.', description: 'connector path where configuration exists' }
10+
]
11+
12+
static examples = [
13+
'$ zcli connectors:bundle .',
14+
'$ zcli connectors:bundle ./connector1'
15+
]
16+
17+
async run () {
18+
const { args } = await this.parse(Bundle)
19+
const { connectorDirectory } = args
20+
21+
const connectorPath = path.resolve(connectorDirectory)
22+
23+
this.log(chalk.yellow(`Bundling connector from: ${connectorPath}`))
24+
// Placeholder for actual bundling logic
25+
this.log(chalk.green('Connector bundle created successfully!'))
26+
}
27+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const DEFAULT_CONNECTORS_CONFIG_FILE = 'zcli.connectors.config.json'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default {}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export interface ConfigParameters {
2+
[parameterKey: string]: string | number | boolean;
3+
}
4+
5+
export interface ZcliConfigFileContent {
6+
connection_id?: string;
7+
parameters?: ConfigParameters;
8+
}
9+
10+
export type Dictionary<T> = {
11+
[key: string]: T;
12+
}
13+
14+
export interface FileList {
15+
name: string;
16+
time: number;
17+
}
18+
19+
export interface FsExtraError extends Error {
20+
code: string;
21+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { test } from '@oclif/test'
2+
import BundleCommand from '../../src/commands/connectors/bundle'
3+
4+
describe('bundle', () => {
5+
describe('with default directory', () => {
6+
test
7+
.it('should run bundle command with default directory', async () => {
8+
await BundleCommand.run(['.'])
9+
// Test passes if no error is thrown
10+
})
11+
})
12+
13+
describe('with custom directory', () => {
14+
test
15+
.it('should run bundle command with custom directory', async () => {
16+
await BundleCommand.run(['./custom'])
17+
// Test passes if no error is thrown
18+
})
19+
})
20+
})
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"compilerOptions": {
3+
"declaration": true,
4+
"importHelpers": true,
5+
"module": "commonjs",
6+
"outDir": "dist",
7+
"rootDir": "src",
8+
"strict": true,
9+
"target": "es2017",
10+
"skipLibCheck": true,
11+
"esModuleInterop": true
12+
},
13+
"include": [
14+
"src/**/*"
15+
]
16+
}

0 commit comments

Comments
 (0)