mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 21:57:51 +00:00
Automation: enforce noImplicitAny for the type-checked javascript
Change-type: patch
This commit is contained in:
parent
7ca4d2d720
commit
c4e317a290
@ -6,6 +6,8 @@
|
|||||||
*
|
*
|
||||||
* We don't `require('semver')` to allow this script to be run as a npm
|
* We don't `require('semver')` to allow this script to be run as a npm
|
||||||
* 'preinstall' hook, at which point no dependencies have been installed.
|
* 'preinstall' hook, at which point no dependencies have been installed.
|
||||||
|
*
|
||||||
|
* @param {string} version
|
||||||
*/
|
*/
|
||||||
function parseSemver(version) {
|
function parseSemver(version) {
|
||||||
const match = /v?(\d+)\.(\d+).(\d+)/.exec(version);
|
const match = /v?(\d+)\.(\d+).(\d+)/.exec(version);
|
||||||
@ -16,6 +18,10 @@ function parseSemver(version) {
|
|||||||
return [parseInt(major, 10), parseInt(minor, 10), parseInt(patch, 10)];
|
return [parseInt(major, 10), parseInt(minor, 10), parseInt(patch, 10)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} v1
|
||||||
|
* @param {string} v2
|
||||||
|
*/
|
||||||
function semverGte(v1, v2) {
|
function semverGte(v1, v2) {
|
||||||
let v1Array = parseSemver(v1);
|
let v1Array = parseSemver(v1);
|
||||||
let v2Array = parseSemver(v2);
|
let v2Array = parseSemver(v2);
|
||||||
|
@ -21,7 +21,6 @@ import type { Chalk } from 'chalk';
|
|||||||
import type * as visuals from 'resin-cli-visuals';
|
import type * as visuals from 'resin-cli-visuals';
|
||||||
import type * as CliForm from 'resin-cli-form';
|
import type * as CliForm from 'resin-cli-form';
|
||||||
import type { ux } from 'cli-ux';
|
import type { ux } from 'cli-ux';
|
||||||
import type { stripIndent as StripIndent } from 'common-tags';
|
|
||||||
|
|
||||||
// Equivalent of _.once but avoiding the need to import lodash for lazy deps
|
// Equivalent of _.once but avoiding the need to import lodash for lazy deps
|
||||||
const once = <T>(fn: () => T) => {
|
const once = <T>(fn: () => T) => {
|
||||||
@ -63,4 +62,4 @@ export const getCliUx = once(() => require('cli-ux').ux as typeof ux);
|
|||||||
// Directly export stripIndent as we always use it immediately, but importing just `stripIndent` reduces startup time
|
// Directly export stripIndent as we always use it immediately, but importing just `stripIndent` reduces startup time
|
||||||
export const stripIndent =
|
export const stripIndent =
|
||||||
// tslint:disable-next-line:no-var-requires
|
// tslint:disable-next-line:no-var-requires
|
||||||
require('common-tags/lib/stripIndent') as typeof StripIndent;
|
require('common-tags/lib/stripIndent') as typeof import('common-tags/lib/stripIndent');
|
||||||
|
@ -24,7 +24,10 @@ const { promisify } = require('util');
|
|||||||
const execFileAsync = promisify(execFile);
|
const execFileAsync = promisify(execFile);
|
||||||
const patchesDir = 'patches';
|
const patchesDir = 'patches';
|
||||||
|
|
||||||
/** Run the patch-package tool in a child process and wait for it to finish */
|
/**
|
||||||
|
* Run the patch-package tool in a child process and wait for it to finish
|
||||||
|
* @param {string} patchDir
|
||||||
|
*/
|
||||||
async function patchPackage(patchDir) {
|
async function patchPackage(patchDir) {
|
||||||
// Equivalent to: `npx patch-package --patch-dir $patchDir`
|
// Equivalent to: `npx patch-package --patch-dir $patchDir`
|
||||||
const result = await execFileAsync('node', [
|
const result = await execFileAsync('node', [
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
"extends": "./tsconfig.json",
|
"extends": "./tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"noImplicitAny": false,
|
|
||||||
"checkJs": true
|
"checkJs": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
|
22
typings/common-tags/index.d.ts
vendored
Normal file
22
typings/common-tags/index.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2022 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 'common-tags/lib/stripIndent' {
|
||||||
|
import { stripIndent } from 'common-tags';
|
||||||
|
|
||||||
|
export = stripIndent;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user