mirror of
				https://github.com/Instadapp/trustwallet-assets.git
				synced 2024-07-29 22:37:31 +00:00 
			
		
		
		
	 ec1fe7f6ee
			
		
	
	
		ec1fe7f6ee
		
			
		
	
	
	
	
		
			
			* Make non-mandatory action interface elements optional. * Remove one unused import * Scripts main renamed to entrypoint. * Script common rename to generic * Move generic scripts from action to generic. * Move chain-specific scripts to blockchain. Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
		
			
				
	
	
		
			31 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { chainsPath } from "../generic/repo-structure";
 | |
| import { findFiles } from "../generic/filesystem";
 | |
| import { ActionInterface, CheckStepInterface } from "../generic/interface";
 | |
| import { isValidJSON } from "../generic/json";
 | |
| import * as bluebird from "bluebird";
 | |
| 
 | |
| export class JsonAction implements ActionInterface {
 | |
|     getName(): string { return "Json files"; }
 | |
| 
 | |
|     getSanityChecks(): CheckStepInterface[] {
 | |
|         return [
 | |
|             {
 | |
|                 getName: () => { return "Check all JSON files to have valid content"},
 | |
|                 check: async () => {
 | |
|                     const errors: string[] = [];
 | |
|                     const files = [
 | |
|                         ...findFiles(chainsPath, 'json'),
 | |
|                     ];
 | |
| 
 | |
|                     await bluebird.each(files, async file => { 
 | |
|                         if (!isValidJSON(file)) {
 | |
|                             errors.push(`${file} path contains invalid JSON`);
 | |
|                         }
 | |
|                     });
 | |
|                     return [errors, []];
 | |
|                 }
 | |
|             },
 | |
|         ];
 | |
|     }
 | |
| }
 |