Skip to content

Commit

Permalink
Auto-merge for PR #743 via VersionBot
Browse files Browse the repository at this point in the history
Start seriously converting the CLI to TypeScript
  • Loading branch information
resin-io-versionbot[bot] authored Jan 9, 2018
2 parents 158d471 + 4b74e8e commit 29145df
Show file tree
Hide file tree
Showing 64 changed files with 1,351 additions and 857 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/).

## v6.12.3 - 2018-01-09

* Lint TypeScript and CoffeeScript with resin-lint #743 [Tim Perry]
* Move documentation generation to TypeScript #743 [Tim Perry]
* Convert most of utils to TypeScript #743 [Tim Perry]

## v6.12.2 - 2018-01-09

* Convert windows paths to posix when passing to tar #748 [Andrew Shirley]
Expand Down
14 changes: 7 additions & 7 deletions automation/custom-types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ declare module 'filehound' {

declare module 'publish-release' {
interface PublishOptions {
token: string,
owner: string,
repo: string,
tag: string,
name: string,
reuseRelease?: boolean
assets: string[]
token: string;
owner: string;
repo: string;
tag: string;
name: string;
reuseRelease?: boolean;
assets: string[];
}

interface Release {
Expand Down
7 changes: 4 additions & 3 deletions automation/deploy-bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ import * as fs from 'fs-extra';
import * as mkdirp from 'mkdirp';
import * as publishRelease from 'publish-release';
import * as archiver from 'archiver';
import * as packageJSON from '../package.json';

const publishReleaseAsync = Promise.promisify(publishRelease);
const mkdirpAsync = Promise.promisify<string | null, string>(mkdirp);

const { GITHUB_TOKEN } = process.env;
const ROOT = path.join(__dirname, '..');

const version = 'v' + require('../package.json').version;
const version = 'v' + packageJSON.version;
const outputFile = path.join(ROOT, 'build-zip', `resin-cli-${version}-${os.platform()}-${os.arch()}.zip`);

mkdirpAsync(path.dirname(outputFile)).then(() => new Promise((resolve, reject) => {
console.log('Zipping build...');

let archive = archiver('zip', {
zlib: { level: 7 }
zlib: { level: 7 },
});
archive.directory(path.join(ROOT, 'build-bin'), 'resin-cli');

Expand All @@ -44,7 +45,7 @@ mkdirpAsync(path.dirname(outputFile)).then(() => new Promise((resolve, reject) =
tag: version,
name: `Resin-CLI ${version}`,
reuseRelease: true,
assets: [outputFile]
assets: [outputFile],
});
}).then((release) => {
console.log(`Release ${version} successful: ${release.html_url}`);
Expand Down
3 changes: 2 additions & 1 deletion automation/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"sourceMap": true
},
"include": [
"./**/*.ts"
"./**/*.ts",
"../typings/*.d.ts"
]
}
114 changes: 114 additions & 0 deletions capitanodoc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
export = {
title: 'Resin CLI Documentation',
introduction: `\
This tool allows you to interact with the resin.io api from the comfort of your command line.
Please make sure your system meets the requirements as specified in the [README](https://github.com/resin-io/resin-cli).
To get started download the CLI from npm.
$ npm install resin-cli -g
Then authenticate yourself:
$ resin login
Now you have access to all the commands referenced below.
## Proxy support
The CLI does support HTTP(S) proxies.
You can configure the proxy using several methods (in order of their precedence):
* set the \`RESINRC_PROXY\` environment variable in the URL format (with protocol, host, port, and optionally the basic auth),
* use the [resin config file](https://www.npmjs.com/package/resin-settings-client#documentation) (project-specific or user-level)
and set the \`proxy\` setting. This can be:
* a string in the URL format,
* or an object following [this format](https://www.npmjs.com/package/global-tunnel-ng#options), which allows more control,
* or set the conventional \`https_proxy\` / \`HTTPS_PROXY\` / \`http_proxy\` / \`HTTP_PROXY\`
environment variable (in the same standard URL format).\
`,

categories: [
{
title: 'Application',
files: [ 'build/actions/app.js' ]
},
{
title: 'Authentication',
files: [ 'build/actions/auth.js' ]
},
{
title: 'Device',
files: [ 'build/actions/device.js' ]
},
{
title: 'Environment Variables',
files: [ 'build/actions/environment-variables.js' ]
},
{
title: 'Help',
files: [ 'build/actions/help.js' ]
},
{
title: 'Information',
files: [ 'build/actions/info.js' ]
},
{
title: 'Keys',
files: [ 'build/actions/keys.js' ]
},
{
title: 'Logs',
files: [ 'build/actions/logs.js' ]
},
{
title: 'Sync',
files: [ 'build/actions/sync.js' ]
},
{
title: 'SSH',
files: [ 'build/actions/ssh.js' ]
},
{
title: 'Notes',
files: [ 'build/actions/notes.js' ]
},
{
title: 'OS',
files: [ 'build/actions/os.js' ]
},
{
title: 'Config',
files: [ 'build/actions/config.js' ]
},
{
title: 'Preload',
files: [ 'build/actions/preload.js' ]
},
{
title: 'Settings',
files: [ 'build/actions/settings.js' ]
},
{
title: 'Wizard',
files: [ 'build/actions/wizard.js' ]
},
{
title: 'Local',
files: [ 'build/actions/local/index.js' ]
},
{
title: 'Deploy',
files: [
'build/actions/build.js',
'build/actions/deploy.js'
]
},
{
title: 'Utilities',
files: [ 'build/actions/util.js' ]
},
]
};
18 changes: 9 additions & 9 deletions doc/cli.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ web-based login

credential-based login

#### --email, --e,u, --e,u &#60;email&#62;
#### --email, -e, -u &#60;email&#62;

email

Expand Down Expand Up @@ -310,7 +310,7 @@ Examples:

### Options

#### --application, --a,app, --a,app &#60;application&#62;
#### --application, -a, --app &#60;application&#62;

application name

Expand Down Expand Up @@ -464,7 +464,7 @@ Examples:

### Options

#### --application, --a,app, --a,app &#60;application&#62;
#### --application, -a, --app &#60;application&#62;

application name

Expand All @@ -482,7 +482,7 @@ Examples:

### Options

#### --application, --a,app, --a,app &#60;application&#62;
#### --application, -a, --app &#60;application&#62;

application name

Expand Down Expand Up @@ -529,7 +529,7 @@ Example:

### Options

#### --application, --a,app, --a,app &#60;application&#62;
#### --application, -a, --app &#60;application&#62;

application name

Expand Down Expand Up @@ -589,7 +589,7 @@ Examples:

### Options

#### --application, --a,app, --a,app &#60;application&#62;
#### --application, -a, --app &#60;application&#62;

application name

Expand Down Expand Up @@ -845,7 +845,7 @@ Examples:

### Options

#### --device, --d,dev, --d,dev &#60;device&#62;
#### --device, -d, --dev &#60;device&#62;

device uuid

Expand Down Expand Up @@ -937,7 +937,7 @@ Examples:

show advanced configuration options

#### --application, --a,app, --a,app &#60;application&#62;
#### --application, -a, --app &#60;application&#62;

application name

Expand Down Expand Up @@ -1081,7 +1081,7 @@ Examples:

### Options

#### --application, --a,app, --a,app &#60;application&#62;
#### --application, -a, --app &#60;application&#62;

application name

Expand Down
14 changes: 14 additions & 0 deletions extras/capitanodoc/doc-types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { CommandDefinition } from 'capitano';

export interface Document {
title: string;
introduction: string;
categories: Category[];
}

export interface Category {
title: string;
commands: CommandDefinition[];
}

export { CommandDefinition as Command };
46 changes: 0 additions & 46 deletions extras/capitanodoc/index.coffee

This file was deleted.

34 changes: 34 additions & 0 deletions extras/capitanodoc/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import capitanodoc = require('../../capitanodoc');
import * as _ from 'lodash';
import * as path from 'path';
import * as markdown from './markdown';
import { Document, Category } from './doc-types';

const result = <Document> {};
result.title = capitanodoc.title;
result.introduction = capitanodoc.introduction;
result.categories = [];

for (let commandCategory of capitanodoc.categories) {
const category = <Category> {};
category.title = commandCategory.title;
category.commands = [];

for (let file of commandCategory.files) {
// tslint:disable-next-line:no-var-requires
const actions: any = require(path.join(process.cwd(), file));

if (actions.signature) {
category.commands.push(_.omit(actions, 'action'));
} else {
for (let actionName of Object.keys(actions)) {
const actionCommand = actions[actionName];
category.commands.push(_.omit(actionCommand, 'action'));
}
}
}

result.categories.push(category);
}

console.log(markdown.render(result));
Loading

0 comments on commit 29145df

Please sign in to comment.