Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist
node_modules
types
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
},
"scripts": {
"compile": "tsc",
"postinstall": "patch-package",
"lint": "eslint '*/**/*.{js,ts}'",
"prepare": "tsc",
"test": "tsc && jest"
Expand All @@ -26,7 +25,6 @@
"@types/debug": "^4.1.5",
"@types/ejs": "^3.0.5",
"@types/jest": "^26.0.15",
"@types/js-yaml": "^3.12.5",
"@types/node": "^14.14.9",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
Expand All @@ -36,7 +34,6 @@
"eslint-plugin-prettier": "^3.1.4",
"jest": "^26.6.3",
"jest-plugin-fs": "^2.9.0",
"patch-package": "^6.2.2",
"prettier": "^2.2.0",
"release-it": "^14.2.1",
"release-it-lerna-changelog": "^3.1.0",
Expand Down
13 changes: 0 additions & 13 deletions patches/@types+js-yaml+3.12.5.patch

This file was deleted.

2 changes: 1 addition & 1 deletion src/utils/parse-travis-ci-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function (): ConfigurationInterface | null {

const config = yaml.safeLoad(configString, {
onWarning: console.log,
});
}) as { [key: string]: any } | string | undefined;

if (typeof config !== 'object') {
console.error(config);
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
"esModuleInterop": true,
"module": "commonjs",
"outDir": "./dist",
"preserveConstEnums": true
"preserveConstEnums": true,
"typeRoots": [ "./types", "./node_modules/@types"]
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
"exclude": ["node_modules", "tests", "types"]
}
172 changes: 172 additions & 0 deletions types/js-yaml/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
/*
* Copied from @types/js-yaml:
* https://github.com/DefinitelyTyped/DefinitelyTyped/blob/d235bae47b2a2abc6f44a0dc1854e763dad4d7f8/types/js-yaml/index.d.ts
*
* Applied this small patch:
* ```diff
* diff --git a/node_modules/@types/js-yaml/index.d.ts b/node_modules/@types/js-yaml/index.d.ts
* index 8dfd30d..654e1f3 100644
* --- a/node_modules/@types/js-yaml/index.d.ts
* +++ b/node_modules/@types/js-yaml/index.d.ts
* @@ -8,7 +8,7 @@
*
* export as namespace jsyaml;
*
* -export function safeLoad(str: string, opts?: LoadOptions): string | object | undefined;
* +export function safeLoad(str: string, opts?: LoadOptions): string | { [key: string]: any } | undefined;
* export function load(str: string, opts?: LoadOptions): any;
*
* export class Type {
*/
declare module 'js-yaml' {
export function safeLoad(
str: string,
opts?: LoadOptions
): string | { [key: string]: any } | undefined;
export function load(str: string, opts?: LoadOptions): any;

export class Type {
constructor(tag: string, opts?: TypeConstructorOptions);
kind: 'sequence' | 'scalar' | 'mapping' | null;
resolve(data: any): boolean;
construct(data: any): any;
instanceOf: object | null;
predicate: ((data: object) => boolean) | null;
represent:
| ((data: object) => any)
| { [x: string]: (data: object) => any }
| null;
defaultStyle: string | null;
styleAliases: { [x: string]: any };
}

/* tslint:disable-next-line:no-unnecessary-class */
export class Schema implements SchemaDefinition {
constructor(definition: SchemaDefinition);
static create(types: Type[] | Type): Schema;
static create(schemas: Schema[] | Schema, types: Type[] | Type): Schema;
}

export function safeLoadAll(
str: string,
iterator?: null,
opts?: LoadOptions
): any[];
export function safeLoadAll(
str: string,
iterator: (doc: any) => void,
opts?: LoadOptions
): void;

export function loadAll(
str: string,
iterator?: null,
opts?: LoadOptions
): any[];
export function loadAll(
str: string,
iterator: (doc: any) => void,
opts?: LoadOptions
): void;

export function safeDump(obj: any, opts?: DumpOptions): string;
export function dump(obj: any, opts?: DumpOptions): string;

export interface LoadOptions {
/** string to be used as a file path in error/warning messages. */
filename?: string;
/** function to call on warning messages. */
onWarning?(this: null, e: YAMLException): void;
/** specifies a schema to use. */
schema?: SchemaDefinition;
/** compatibility with JSON.parse behaviour. */
json?: boolean;
/** listener for parse events */
listener?(this: State, eventType: EventType, state: State): void;
}

export type EventType = 'open' | 'close';

export interface State {
input: string;
filename: string | null;
schema: SchemaDefinition;
onWarning: (this: null, e: YAMLException) => void;
json: boolean;
length: number;
position: number;
line: number;
lineStart: number;
lineIndent: number;
version: null | number;
checkLineBreaks: boolean;
kind: string;
result: any;
implicitTypes: Type[];
}

export interface DumpOptions {
/** indentation width to use (in spaces). */
indent?: number;
/** when true, will not add an indentation level to array elements */
noArrayIndent?: boolean;
/** do not throw on invalid types (like function in the safe schema) and skip pairs and single values with such types. */
skipInvalid?: boolean;
/** specifies level of nesting, when to switch from block to flow style for collections. -1 means block style everwhere */
flowLevel?: number;
/** Each tag may have own set of styles. - "tag" => "style" map. */
styles?: { [x: string]: any };
/** specifies a schema to use. */
schema?: SchemaDefinition;
/** if true, sort keys when dumping YAML. If a function, use the function to sort the keys. (default: false) */
sortKeys?: boolean | ((a: any, b: any) => number);
/** set max line width. (default: 80) */
lineWidth?: number;
/** if true, don't convert duplicate objects into references (default: false) */
noRefs?: boolean;
/** if true don't try to be compatible with older yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1 (default: false) */
noCompatMode?: boolean;
/**
* if true flow sequences will be condensed, omitting the space between `key: value` or `a, b`. Eg. `'[a,b]'` or `{a:{b:c}}`.
* Can be useful when using yaml for pretty URL query params as spaces are %-encoded. (default: false).
*/
condenseFlow?: boolean;
}

export interface TypeConstructorOptions {
kind?: 'sequence' | 'scalar' | 'mapping';
resolve?: (data: any) => boolean;
construct?: (data: any) => any;
instanceOf?: object;
predicate?: (data: object) => boolean;
represent?:
| ((data: object) => any)
| { [x: string]: (data: object) => any };
defaultStyle?: string;
styleAliases?: { [x: string]: any };
}

export interface SchemaDefinition {
implicit?: any[];
explicit?: Type[];
include?: Schema[];
}

/** only strings, arrays and plain objects: http://www.yaml.org/spec/1.2/spec.html#id2802346 */
export let FAILSAFE_SCHEMA: Schema;
/** only strings, arrays and plain objects: http://www.yaml.org/spec/1.2/spec.html#id2802346 */
export let JSON_SCHEMA: Schema;
/** same as JSON_SCHEMA: http://www.yaml.org/spec/1.2/spec.html#id2804923 */
export let CORE_SCHEMA: Schema;
/** all supported YAML types, without unsafe ones (!!js/undefined, !!js/regexp and !!js/function): http://yaml.org/type/ */
export let DEFAULT_SAFE_SCHEMA: Schema;
/** all supported YAML types. */
export let DEFAULT_FULL_SCHEMA: Schema;
export let MINIMAL_SCHEMA: Schema;
export let SAFE_SCHEMA: Schema;

export class YAMLException extends Error {
constructor(reason?: any, mark?: any);
toString(compact?: boolean): string;
}
}
Loading