From 13e3e5e8eadf56d6a258637d7b6a83a9c7895b78 Mon Sep 17 00:00:00 2001 From: Paulo Castro Date: Thu, 25 Apr 2019 18:39:16 +0100 Subject: [PATCH] Bump min Node.js version to 8.0, ts-node to 8.1 and typescript to 3.4. Refactor typings folder for use with the tsconfig typeRoots option. Change-type: major Signed-off-by: Paulo Castro --- .travis.yml | 2 +- appveyor.yml | 2 +- automation/custom-types.d.ts | 38 ------------------ automation/tsconfig.json | 16 ++++---- bin/balena-dev | 10 +++-- lib/actions/environment-variables.ts | 6 +-- lib/actions/tunnel.ts | 8 ++-- lib/global.d.ts | 25 ++++++++++++ lib/utils/device/deploy.ts | 3 +- lib/utils/remote-build.ts | 2 +- lib/utils/ssh.ts | 4 +- lib/utils/sudo.ts | 25 +++++++++++- package.json | 14 +++---- tsconfig.json | 17 +++----- typings/@resin-valid-email.d.ts | 1 - .../index.d.ts} | 0 .../index.d.ts} | 1 + typings/balena-sync.d.ts | 5 --- typings/balena-sync/index.d.ts | 22 +++++++++++ .../{capitano.d.ts => capitano/index.d.ts} | 17 ++++++++ .../index.d.ts} | 1 + typings/dockerfile-template.d.ts | 13 ------- typings/dockerfile-template/index.d.ts | 30 ++++++++++++++ typings/ent.d.ts | 1 - typings/ent/index.d.ts | 18 +++++++++ typings/filehound/index.d.ts | 28 +++++++++++++ typings/global.d.ts | 3 -- .../index.d.ts} | 1 + typings/{nplugm.d.ts => nplugm/index.d.ts} | 1 + typings/package.json.d.ts | 4 -- typings/pkg/index.d.ts | 20 ++++++++++ typings/president.d.ts | 6 --- typings/president/index.d.ts | 23 +++++++++++ typings/publish-release/index.d.ts | 39 +++++++++++++++++++ typings/resin-cli-form.d.ts | 1 - typings/resin-cli-form/index.d.ts | 18 +++++++++ typings/resin-cli-visuals.d.ts | 1 - typings/resin-cli-visuals/index.d.ts | 18 +++++++++ typings/resin-image-fs.d.ts | 5 --- typings/resin-image-fs/index.d.ts | 22 +++++++++++ typings/resin.io/index.d.ts | 18 +++++++++ typings/{rindle.d.ts => rindle/index.d.ts} | 1 + .../index.d.ts} | 0 43 files changed, 367 insertions(+), 123 deletions(-) delete mode 100644 automation/custom-types.d.ts create mode 100644 lib/global.d.ts delete mode 100644 typings/@resin-valid-email.d.ts rename typings/{JSONStream.d.ts => JSONStream/index.d.ts} (100%) rename typings/{balena-device-init.d.ts => balena-device-init/index.d.ts} (99%) delete mode 100644 typings/balena-sync.d.ts create mode 100644 typings/balena-sync/index.d.ts rename typings/{capitano.d.ts => capitano/index.d.ts} (65%) rename typings/{color-hash.d.ts => color-hash/index.d.ts} (99%) delete mode 100644 typings/dockerfile-template.d.ts create mode 100644 typings/dockerfile-template/index.d.ts delete mode 100644 typings/ent.d.ts create mode 100644 typings/ent/index.d.ts create mode 100644 typings/filehound/index.d.ts delete mode 100644 typings/global.d.ts rename typings/{inquire-dynamic-list.d.ts => inquirer-dynamic-list/index.d.ts} (99%) rename typings/{nplugm.d.ts => nplugm/index.d.ts} (99%) delete mode 100644 typings/package.json.d.ts create mode 100644 typings/pkg/index.d.ts delete mode 100644 typings/president.d.ts create mode 100644 typings/president/index.d.ts create mode 100644 typings/publish-release/index.d.ts delete mode 100644 typings/resin-cli-form.d.ts create mode 100644 typings/resin-cli-form/index.d.ts delete mode 100644 typings/resin-cli-visuals.d.ts create mode 100644 typings/resin-cli-visuals/index.d.ts delete mode 100644 typings/resin-image-fs.d.ts create mode 100644 typings/resin-image-fs/index.d.ts create mode 100644 typings/resin.io/index.d.ts rename typings/{rindle.d.ts => rindle/index.d.ts} (99%) rename typings/{update-notifier.d.ts => update-notifier/index.d.ts} (100%) diff --git a/.travis.yml b/.travis.yml index cc18cee2..bab23522 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ os: - linux - osx node_js: - - "6" + - "8" before_install: - npm -g install npm@4 script: npm run ci diff --git a/appveyor.yml b/appveyor.yml index ab9ebe80..92f6bf2f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,7 +14,7 @@ matrix: # what combinations to test environment: matrix: - - nodejs_version: 6 + - nodejs_version: 8 install: - ps: Install-Product node $env:nodejs_version x64 diff --git a/automation/custom-types.d.ts b/automation/custom-types.d.ts deleted file mode 100644 index 21ec5fad..00000000 --- a/automation/custom-types.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -declare module 'pkg' { - export function exec(args: string[]): Promise; -} - -declare module 'filehound' { - export function create(): FileHound; - - export interface FileHound { - paths(paths: string[]): FileHound; - paths(...paths: string[]): FileHound; - ext(extensions: string[]): FileHound; - ext(...extensions: string[]): FileHound; - find(): Promise; - } -} - -declare module 'publish-release' { - interface PublishOptions { - token: string; - owner: string; - repo: string; - tag: string; - name: string; - reuseRelease?: boolean; - assets: string[]; - } - - interface Release { - html_url: string; - } - - let publishRelease: ( - args: PublishOptions, - callback: (e: Error, release: Release) => void, - ) => void; - - export = publishRelease; -} diff --git a/automation/tsconfig.json b/automation/tsconfig.json index 938fd3d7..99131ce4 100644 --- a/automation/tsconfig.json +++ b/automation/tsconfig.json @@ -1,16 +1,18 @@ { "compilerOptions": { "module": "commonjs", - "target": "es2015", + "target": "es2017", "strict": true, + "strictPropertyInitialization": false, "noUnusedLocals": true, "noUnusedParameters": true, "preserveConstEnums": true, "removeComments": true, - "sourceMap": true - }, - "include": [ - "./**/*.ts", - "../typings/*.d.ts" - ] + "sourceMap": true, + "skipLibCheck": true, + "typeRoots" : [ + "../node_modules/@types", + "../typings" + ] + } } diff --git a/bin/balena-dev b/bin/balena-dev index c00fc85d..bcd1dd2d 100755 --- a/bin/balena-dev +++ b/bin/balena-dev @@ -12,8 +12,12 @@ process.env.UV_THREADPOOL_SIZE = '64'; // Use fast-boot to cache require lookups, speeding up startup require('fast-boot2').start({ cacheFile: '.fast-boot.json' -}) -process.env['TS_NODE_PROJECT'] = require('path').dirname(__dirname); +}); require('coffeescript/register'); -require('ts-node/register'); +// Note: before ts-node v6.0.0, 'transpile-only' (no type checking) was the +// default option. We upgraded ts-node and found that adding 'transpile-only' +// was necessary to avoid a mysterious 'null' error message. On the plus side, +// it is supposed to run faster. We still benefit from type checking when +// running 'npm run build'. +require('ts-node/register/transpile-only'); require('../lib/app'); diff --git a/lib/actions/environment-variables.ts b/lib/actions/environment-variables.ts index 03b12df7..32ea05cf 100644 --- a/lib/actions/environment-variables.ts +++ b/lib/actions/environment-variables.ts @@ -15,6 +15,7 @@ limitations under the License. */ import { ApplicationVariable, DeviceVariable } from 'balena-sdk'; +import * as Bluebird from 'bluebird'; import { CommandDefinition } from 'capitano'; import { stripIndent } from 'common-tags'; @@ -73,14 +74,13 @@ export const list: CommandDefinition< permission: 'user', async action(_params, options, done) { normalizeUuidProp(options, 'device'); - const Bluebird = await import('bluebird'); const _ = await import('lodash'); const balena = (await import('balena-sdk')).fromSharedOptions(); const visuals = await import('resin-cli-visuals'); const { exitWithExpectedError } = await import('../utils/patterns'); - return Bluebird.try(function(): Promise< + return Bluebird.try(function(): Bluebird< DeviceVariable[] | ApplicationVariable[] > { if (options.application) { @@ -209,7 +209,6 @@ export const add: CommandDefinition< permission: 'user', async action(params, options, done) { normalizeUuidProp(options, 'device'); - const Bluebird = await import('bluebird'); const _ = await import('lodash'); const balena = (await import('balena-sdk')).fromSharedOptions(); @@ -280,7 +279,6 @@ export const rename: CommandDefinition< permission: 'user', options: [commandOptions.booleanDevice], async action(params, options, done) { - const Bluebird = await import('bluebird'); const balena = (await import('balena-sdk')).fromSharedOptions(); return Bluebird.try(function() { diff --git a/lib/actions/tunnel.ts b/lib/actions/tunnel.ts index 7080cb52..f58b64a1 100644 --- a/lib/actions/tunnel.ts +++ b/lib/actions/tunnel.ts @@ -180,8 +180,8 @@ export const tunnel: CommandDefinition = { return handler(client) .then(() => { logConnection( - client.remoteAddress, - client.remotePort, + client.remoteAddress || '', + client.remotePort || 0, client.localAddress, client.localPort, device.vpn_address || '', @@ -190,8 +190,8 @@ export const tunnel: CommandDefinition = { }) .catch(err => logConnection( - client.remoteAddress, - client.remotePort, + client.remoteAddress || '', + client.remotePort || 0, client.localAddress, client.localPort, device.vpn_address || '', diff --git a/lib/global.d.ts b/lib/global.d.ts new file mode 100644 index 00000000..5d702e1a --- /dev/null +++ b/lib/global.d.ts @@ -0,0 +1,25 @@ +/** + * @license + * Copyright 2019 Balena Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +interface Dictionary { + [key: string]: T; +} + +declare module '*/package.json' { + export const name: string; + export const version: string; +} diff --git a/lib/utils/device/deploy.ts b/lib/utils/device/deploy.ts index 7beec4b6..c5059c88 100644 --- a/lib/utils/device/deploy.ts +++ b/lib/utils/device/deploy.ts @@ -228,7 +228,8 @@ export async function deployToDevice(opts: DeviceDeployOptions): Promise { deployOpts: opts, }); - const promises = [livepush.init()]; + globalLogger.logLivepush('Watching for file changes...'); + const promises: Array | Promise> = [livepush.init()]; // Only show logs if we're not detaching if (!opts.detached) { console.log(); diff --git a/lib/utils/remote-build.ts b/lib/utils/remote-build.ts index 9854ce96..4e8f9057 100644 --- a/lib/utils/remote-build.ts +++ b/lib/utils/remote-build.ts @@ -98,7 +98,7 @@ export async function startRemoteBuild(build: RemoteBuild): Promise { output: process.stdout, }); - rl.on('SIGINT', () => process.emit('SIGINT')); + rl.on('SIGINT', () => process.emit('SIGINT' as any)); } return new Bluebird((resolve, reject) => { diff --git a/lib/utils/ssh.ts b/lib/utils/ssh.ts index 1542c063..36e86863 100644 --- a/lib/utils/ssh.ts +++ b/lib/utils/ssh.ts @@ -15,7 +15,7 @@ * limitations under the License. */ import * as Bluebird from 'bluebird'; -import { spawn } from 'child_process'; +import { spawn, StdioOptions } from 'child_process'; import { TypedError } from 'typed-error'; import { getSubShellCommand } from './helpers'; @@ -45,7 +45,7 @@ export async function exec( root@${deviceIp} \ ${cmd}`; - const stdio = ['ignore', stdout ? 'pipe' : 'inherit', 'ignore']; + const stdio: StdioOptions = ['ignore', stdout ? 'pipe' : 'inherit', 'ignore']; const { program, args } = getSubShellCommand(command); const exitCode = await new Bluebird((resolve, reject) => { diff --git a/lib/utils/sudo.ts b/lib/utils/sudo.ts index 2f6cc49f..8c6cd9eb 100644 --- a/lib/utils/sudo.ts +++ b/lib/utils/sudo.ts @@ -1,4 +1,20 @@ -import { spawn } from 'child_process'; +/** + * @license + * Copyright 2019 Balena Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { spawn, StdioOptions } from 'child_process'; import * as Bluebird from 'bluebird'; import * as rindle from 'rindle'; @@ -7,9 +23,14 @@ export async function executeWithPrivileges( command: string[], stderr?: NodeJS.WritableStream, ): Promise { + const stdio: StdioOptions = [ + 'inherit', + 'inherit', + stderr ? 'pipe' : 'inherit', + ]; const opts = { - stdio: ['inherit', 'inherit', stderr ? 'pipe' : 'inherit'], env: process.env, + stdio, }; const args = process.argv diff --git a/package.json b/package.json index 9e2fa0d4..44b8e200 100644 --- a/package.json +++ b/package.json @@ -35,9 +35,9 @@ "build": "npm run build:src && npm run build:bin", "build:src": "npm run prettify && npm run lint && npm run build:fast && npm run build:doc", "build:fast": "gulp build && tsc", - "build:doc": "mkdirp doc/ && ts-node automation/capitanodoc/index.ts > doc/cli.markdown", - "build:bin": "ts-node --type-check -P automation automation/build-bin.ts", - "release": "npm run build && ts-node --type-check -P automation automation/deploy-bin.ts", + "build:doc": "mkdirp doc/ && ts-node --type-check -P automation/tsconfig.json automation/capitanodoc/index.ts > doc/cli.markdown", + "build:bin": "ts-node --type-check -P automation/tsconfig.json automation/build-bin.ts", + "release": "npm run build && ts-node --type-check -P automation/tsconfig.json automation/deploy-bin.ts", "pretest": "npm run build", "test": "gulp test", "test:fast": "npm run build:fast && gulp test", @@ -60,7 +60,7 @@ "author": "Juan Cruz Viotti ", "license": "Apache-2.0", "engines": { - "node": ">=6.0" + "node": ">=8.0" }, "devDependencies": { "@types/archiver": "2.1.2", @@ -76,7 +76,7 @@ "@types/mkdirp": "0.5.2", "@types/mz": "0.0.32", "@types/net-keepalive": "^0.4.0", - "@types/node": "6.14.2", + "@types/node": "10.14.5", "@types/prettyjson": "0.0.28", "@types/raven": "2.5.1", "@types/request": "2.48.1", @@ -100,8 +100,8 @@ "require-npm4-to-publish": "^1.0.0", "resin-lint": "^3.0.1", "rewire": "^3.0.2", - "ts-node": "^4.0.1", - "typescript": "2.8.1" + "ts-node": "^8.1.0", + "typescript": "3.4.3" }, "dependencies": { "@resin.io/valid-email": "^0.1.0", diff --git a/tsconfig.json b/tsconfig.json index 606bb242..d9333e29 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es6", + "target": "es2017", "outDir": "build", "strict": true, "strictPropertyInitialization": false, @@ -11,20 +11,13 @@ "removeComments": true, "sourceMap": true, "skipLibCheck": true, - "lib": [ - // es5 defaults: - "dom", - "es5", - "scripthost", - // some specific es6 bits we're sure are safe: - "es2015.collection", - "es2015.iterable", - "es2016.array.include" + "typeRoots" : [ + "./node_modules/@types", + "./node_modules/etcher-sdk/typings", + "./typings" ] }, "include": [ - "./typings/*.d.ts", - "./node_modules/etcher-sdk/typings/**/*.d.ts", "./lib/**/*.ts" ] } diff --git a/typings/@resin-valid-email.d.ts b/typings/@resin-valid-email.d.ts deleted file mode 100644 index 7d9183ee..00000000 --- a/typings/@resin-valid-email.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module '@resin.io/valid-email'; diff --git a/typings/JSONStream.d.ts b/typings/JSONStream/index.d.ts similarity index 100% rename from typings/JSONStream.d.ts rename to typings/JSONStream/index.d.ts diff --git a/typings/balena-device-init.d.ts b/typings/balena-device-init/index.d.ts similarity index 99% rename from typings/balena-device-init.d.ts rename to typings/balena-device-init/index.d.ts index 7af56477..f3b27401 100644 --- a/typings/balena-device-init.d.ts +++ b/typings/balena-device-init/index.d.ts @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare module 'balena-device-init' { import { DeviceType } from 'balena-sdk'; import * as Promise from 'bluebird'; diff --git a/typings/balena-sync.d.ts b/typings/balena-sync.d.ts deleted file mode 100644 index 91bea19c..00000000 --- a/typings/balena-sync.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare module 'balena-sync' { - import { CommandDefinition } from 'capitano'; - - export function capitano(tool: 'balena-cli'): CommandDefinition; -} diff --git a/typings/balena-sync/index.d.ts b/typings/balena-sync/index.d.ts new file mode 100644 index 00000000..6d4c9d3e --- /dev/null +++ b/typings/balena-sync/index.d.ts @@ -0,0 +1,22 @@ +/** + * @license + * Copyright 2019 Balena Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare module 'balena-sync' { + import { CommandDefinition } from 'capitano'; + + export function capitano(tool: 'balena-cli'): CommandDefinition; +} diff --git a/typings/capitano.d.ts b/typings/capitano/index.d.ts similarity index 65% rename from typings/capitano.d.ts rename to typings/capitano/index.d.ts index acefe3ae..a2d65b44 100644 --- a/typings/capitano.d.ts +++ b/typings/capitano/index.d.ts @@ -1,3 +1,20 @@ +/** + * @license + * Copyright 2019 Balena Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + declare module 'capitano' { export function parse(argv: string[]): Cli; diff --git a/typings/color-hash.d.ts b/typings/color-hash/index.d.ts similarity index 99% rename from typings/color-hash.d.ts rename to typings/color-hash/index.d.ts index 1eb731e8..f9232309 100644 --- a/typings/color-hash.d.ts +++ b/typings/color-hash/index.d.ts @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare module 'color-hash' { interface Hasher { hex(text: string): string; diff --git a/typings/dockerfile-template.d.ts b/typings/dockerfile-template.d.ts deleted file mode 100644 index 15cc7623..00000000 --- a/typings/dockerfile-template.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -declare module 'dockerfile-template' { - /** - * Variables which define what will be replaced, and what they will be replaced with. - */ - export interface TemplateVariables { - [key: string]: string; - } - - export function process( - content: string, - variables: TemplateVariables, - ): string; -} diff --git a/typings/dockerfile-template/index.d.ts b/typings/dockerfile-template/index.d.ts new file mode 100644 index 00000000..4dcbbdfb --- /dev/null +++ b/typings/dockerfile-template/index.d.ts @@ -0,0 +1,30 @@ +/** + * @license + * Copyright 2019 Balena Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare module 'dockerfile-template' { + /** + * Variables which define what will be replaced, and what they will be replaced with. + */ + export interface TemplateVariables { + [key: string]: string; + } + + export function process( + content: string, + variables: TemplateVariables, + ): string; +} diff --git a/typings/ent.d.ts b/typings/ent.d.ts deleted file mode 100644 index 04e49ca3..00000000 --- a/typings/ent.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module 'ent'; diff --git a/typings/ent/index.d.ts b/typings/ent/index.d.ts new file mode 100644 index 00000000..582fb754 --- /dev/null +++ b/typings/ent/index.d.ts @@ -0,0 +1,18 @@ +/** + * @license + * Copyright 2019 Balena Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare module 'ent'; diff --git a/typings/filehound/index.d.ts b/typings/filehound/index.d.ts new file mode 100644 index 00000000..9c0bdbce --- /dev/null +++ b/typings/filehound/index.d.ts @@ -0,0 +1,28 @@ +/** + * @license + * Copyright 2019 Balena Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare module 'filehound' { + export function create(): FileHound; + + export interface FileHound { + paths(paths: string[]): FileHound; + paths(...paths: string[]): FileHound; + ext(extensions: string[]): FileHound; + ext(...extensions: string[]): FileHound; + find(): Promise; + } +} diff --git a/typings/global.d.ts b/typings/global.d.ts deleted file mode 100644 index 64dbc25f..00000000 --- a/typings/global.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -interface Dictionary { - [key: string]: T; -} diff --git a/typings/inquire-dynamic-list.d.ts b/typings/inquirer-dynamic-list/index.d.ts similarity index 99% rename from typings/inquire-dynamic-list.d.ts rename to typings/inquirer-dynamic-list/index.d.ts index eac1019c..125e406c 100644 --- a/typings/inquire-dynamic-list.d.ts +++ b/typings/inquirer-dynamic-list/index.d.ts @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare module 'inquirer-dynamic-list' { interface Choice { name: string; diff --git a/typings/nplugm.d.ts b/typings/nplugm/index.d.ts similarity index 99% rename from typings/nplugm.d.ts rename to typings/nplugm/index.d.ts index a9e983de..39f2e452 100644 --- a/typings/nplugm.d.ts +++ b/typings/nplugm/index.d.ts @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare module 'nplugm' { import Promise = require('bluebird'); export function list(regexp: RegExp): Promise; diff --git a/typings/package.json.d.ts b/typings/package.json.d.ts deleted file mode 100644 index 7f887f81..00000000 --- a/typings/package.json.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module '*/package.json' { - export const name: string; - export const version: string; -} diff --git a/typings/pkg/index.d.ts b/typings/pkg/index.d.ts new file mode 100644 index 00000000..25ff540f --- /dev/null +++ b/typings/pkg/index.d.ts @@ -0,0 +1,20 @@ +/** + * @license + * Copyright 2019 Balena Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare module 'pkg' { + export function exec(args: string[]): Promise; +} diff --git a/typings/president.d.ts b/typings/president.d.ts deleted file mode 100644 index c831ac3b..00000000 --- a/typings/president.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -declare module 'president' { - export function execute( - command: string[], - callback: (err: Error) => void, - ): void; -} diff --git a/typings/president/index.d.ts b/typings/president/index.d.ts new file mode 100644 index 00000000..0de6567f --- /dev/null +++ b/typings/president/index.d.ts @@ -0,0 +1,23 @@ +/** + * @license + * Copyright 2019 Balena Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare module 'president' { + export function execute( + command: string[], + callback: (err: Error) => void, + ): void; +} diff --git a/typings/publish-release/index.d.ts b/typings/publish-release/index.d.ts new file mode 100644 index 00000000..48dad1d2 --- /dev/null +++ b/typings/publish-release/index.d.ts @@ -0,0 +1,39 @@ +/** + * @license + * Copyright 2019 Balena Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare module 'publish-release' { + interface PublishOptions { + token: string; + owner: string; + repo: string; + tag: string; + name: string; + reuseRelease?: boolean; + assets: string[]; + } + + interface Release { + html_url: string; + } + + let publishRelease: ( + args: PublishOptions, + callback: (e: Error, release: Release) => void, + ) => void; + + export = publishRelease; +} diff --git a/typings/resin-cli-form.d.ts b/typings/resin-cli-form.d.ts deleted file mode 100644 index 073592bd..00000000 --- a/typings/resin-cli-form.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module 'resin-cli-form'; diff --git a/typings/resin-cli-form/index.d.ts b/typings/resin-cli-form/index.d.ts new file mode 100644 index 00000000..4fcdef7e --- /dev/null +++ b/typings/resin-cli-form/index.d.ts @@ -0,0 +1,18 @@ +/** + * @license + * Copyright 2019 Balena Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare module 'resin-cli-form'; diff --git a/typings/resin-cli-visuals.d.ts b/typings/resin-cli-visuals.d.ts deleted file mode 100644 index f1b2e48f..00000000 --- a/typings/resin-cli-visuals.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module 'resin-cli-visuals'; diff --git a/typings/resin-cli-visuals/index.d.ts b/typings/resin-cli-visuals/index.d.ts new file mode 100644 index 00000000..f5f51a76 --- /dev/null +++ b/typings/resin-cli-visuals/index.d.ts @@ -0,0 +1,18 @@ +/** + * @license + * Copyright 2019 Balena Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare module 'resin-cli-visuals'; diff --git a/typings/resin-image-fs.d.ts b/typings/resin-image-fs.d.ts deleted file mode 100644 index ad1c0879..00000000 --- a/typings/resin-image-fs.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare module 'resin-image-fs' { - import Promise = require('bluebird'); - - export function readFile(options: {}): Promise; -} diff --git a/typings/resin-image-fs/index.d.ts b/typings/resin-image-fs/index.d.ts new file mode 100644 index 00000000..ffebb4a3 --- /dev/null +++ b/typings/resin-image-fs/index.d.ts @@ -0,0 +1,22 @@ +/** + * @license + * Copyright 2019 Balena Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare module 'resin-image-fs' { + import Promise = require('bluebird'); + + export function readFile(options: {}): Promise; +} diff --git a/typings/resin.io/index.d.ts b/typings/resin.io/index.d.ts new file mode 100644 index 00000000..919313fd --- /dev/null +++ b/typings/resin.io/index.d.ts @@ -0,0 +1,18 @@ +/** + * @license + * Copyright 2019 Balena Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare module '@resin.io/valid-email'; diff --git a/typings/rindle.d.ts b/typings/rindle/index.d.ts similarity index 99% rename from typings/rindle.d.ts rename to typings/rindle/index.d.ts index 36e53cd7..8cd20fbc 100644 --- a/typings/rindle.d.ts +++ b/typings/rindle/index.d.ts @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare module 'rindle' { export function extract( stream: NodeJS.ReadableStream, diff --git a/typings/update-notifier.d.ts b/typings/update-notifier/index.d.ts similarity index 100% rename from typings/update-notifier.d.ts rename to typings/update-notifier/index.d.ts