Update tsconfig.json files with resolveJsonModule option

This commit is contained in:
Simon Larsen 2024-04-08 14:03:07 +01:00
parent 11fd2d3c65
commit 1401daab06
No known key found for this signature in database
GPG key ID: AB45983AA9C81CDE
21 changed files with 162 additions and 77 deletions

View file

@ -3,7 +3,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -105,6 +106,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}

View file

@ -3,7 +3,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -105,6 +106,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}

View file

@ -3,7 +3,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -105,6 +106,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}

View file

@ -3,7 +3,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -108,6 +109,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}

View file

@ -3,7 +3,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -108,6 +109,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}

View file

@ -3,7 +3,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -109,6 +110,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}

View file

@ -3,7 +3,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -105,6 +106,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}

View file

@ -3,7 +3,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -105,6 +106,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}

View file

@ -1,50 +1,83 @@
#!/usr/bin/env tsx
import yargs from 'yargs';
import MonitorInfrastructure from './Jobs/MonitorInfrastructure';
import { ChildProcess, spawn } from 'node:child_process';
import Logger from './Utils/Logger';
import PackageJson from './package.json';
export interface ArgumentType {
[x: string]: unknown;
k: string;
u: string | undefined;
_: (string | number)[];
$0: string;
}
let daemon: ChildProcess | null = null;
const usage: string =
'\nUsage: oneuptime-infrastructure-agent --secret-key <secret-key>';
'\nUsage: oneuptime-infrastructure-agent start --secret-key <secret-key>.';
const argv:
| {
[x: string]: unknown;
k: string;
u: string | undefined;
_: (string | number)[];
$0: string;
}
| Promise<{
[x: string]: unknown;
k: string;
u: string | undefined;
_: (string | number)[];
$0: string;
}> = yargs
yargs
.scriptName('oneuptime-infrastructure-agent')
.usage(usage)
.option('k', {
alias: 'secret-key',
describe:
'Secret Key for this agent. You will find this on OneUptime Dashboard',
type: 'string',
demandOption: true,
.version(PackageJson.version)
.command('start', 'Start the app as a daemon', (y: any) => {
return y.option('k', {
alias: 'secret-key',
describe:
'Secret Key for this agent. You will find this on OneUptime Dashboard',
type: 'string',
demandOption: true,
})
.option('u', {
alias: 'oneuptime-url',
describe: 'OneUptime Host. By default this is https://oneuptime.com',
type: 'string',
demandOption: false,
});
}, (y: any) => {
const argv = y.argv as ArgumentType;
// add secrt key and oneuptime url
const startArguments: Array<string> = ['Start.ts'];
if (argv['secret-key']) {
startArguments.push('--secret-key=' + argv['secret-key'].toString());
} else {
Logger.info('No --secret-key argument found. You can find secret key for this monitor on OneUptime Dashboard');
process.exit(1);
}
if (argv['oneuptime-url']) {
startArguments.push('--oneuptime-url=' + argv['oneuptime-url'].toString());
} else {
startArguments.push('--oneuptime-url=https://oneuptime.com');
}
daemon = spawn('tsx', startArguments, {
detached: true,
stdio: 'ignore'
});
daemon.unref();
Logger.info('OneUptime Infrastructure Agent started as daemon');
})
.option('u', {
alias: 'oneuptime-url',
describe: 'OneUptime Host. By default this is https://oneuptime.com',
type: 'string',
demandOption: false,
.command('stop', 'Stop the daemon', () => {
if (daemon && daemon.pid) {
process.kill(daemon.pid);
Logger.info('OneUptime Infrastructure Agent stopped');
} else {
Logger.info('OneUptime Infrastructure Agent not running');
}
})
.command('$0', 'the default command', () => { }, (_) => {
yargs.showHelp();
})
.help(true).argv;
const secretKey: string | undefined = (argv as any)['secret-key'];
const oneuptimeHost: string =
(argv as any)['oneuptime-url'] || 'https://oneuptime.com';
if (!secretKey) {
throw new Error(
'No secret-key argument found. You can find secret key for this monitor on OneUptime Dashboard'
);
}
MonitorInfrastructure.initJob(secretKey, oneuptimeHost);

View file

@ -0,0 +1,14 @@
import MonitorInfrastructure from "./Jobs/MonitorInfrastructure";
import { argv } from 'yargs';
const secretKey: string | undefined = (argv as any)['secret-key'];
const oneuptimeHost: string =
(argv as any)['oneuptime-url'] || 'https://oneuptime.com';
if (!secretKey) {
throw new Error(
'No secret-key argument found. You can find secret key for this monitor on OneUptime Dashboard'
);
}
MonitorInfrastructure.initJob(secretKey, oneuptimeHost);

View file

@ -3,12 +3,13 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
/* Projects */
// "incremental": true, /* Enable incremental compilation */
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
@ -105,6 +106,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}

View file

@ -3,7 +3,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -108,6 +109,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}

View file

@ -3,7 +3,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -108,6 +109,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}

View file

@ -3,7 +3,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "CommonJS"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -105,6 +106,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}

View file

@ -3,7 +3,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -108,6 +109,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}

View file

@ -3,7 +3,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -105,6 +106,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}

View file

@ -3,7 +3,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -105,7 +106,8 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
},
"include": ["/**/*.ts"],
"exclude": ["node_modules"]

View file

@ -4,7 +4,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -109,6 +110,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}

View file

@ -3,7 +3,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -105,6 +106,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}

View file

@ -3,7 +3,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -108,6 +109,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}

View file

@ -3,7 +3,8 @@
// these options are overrides used only by ts-node
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true,
}
},
"compilerOptions": {
@ -105,6 +106,7 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"resolveJsonModule": true
}
}