diff --git a/ts2panda/src/cmdOptions.ts b/ts2panda/src/cmdOptions.ts index 0c7169dd9b839c5cc8726f6e41f490eb474f1e72..ff02ad83b28dcce341b9126eb024f3734da9b7d7 100644 --- a/ts2panda/src/cmdOptions.ts +++ b/ts2panda/src/cmdOptions.ts @@ -56,6 +56,7 @@ export const ts2pandaOptions = [ { name: 'output-proto', type: Boolean, defaultValue: false, description: "Output protoBin file. Default: false" }, { name: 'merge-abc', type: Boolean, defaultValue: false, description: "Compile as merge abc" }, { name: 'input-file', type: String, defaultValue: "", description: "A file containing a list of source files to be compiled. Each line of this file should be constructed in such format: fileName;recordName;moduleType;sourceFile;packageName" }, + { name: 'oh-modules', type: Boolean, defaultValue: false, description: "Set oh-modules as typescript compiler's package manager type. Default: false" } ] @@ -368,6 +369,13 @@ export class CmdOptions { return this.options["merge-abc"] } + static isOhModules(): boolean { + if (!this.options) { + return false; + } + return this.options["oh-modules"] + } + // @ts-ignore static parseUserCmd(args: string[]): ts.ParsedCommandLine | undefined { this.options = commandLineArgs(ts2pandaOptions, { partial: true }); diff --git a/ts2panda/src/index.ts b/ts2panda/src/index.ts index 23f5a202a98fb09e27d5c7c28cd22651d84ca313..65d1334a5575de1b0bec5216bfc668b709fc7c3e 100644 --- a/ts2panda/src/index.ts +++ b/ts2panda/src/index.ts @@ -532,6 +532,9 @@ function run(args: string[], options?: ts.CompilerOptions): void { parsed.options = options; } } + if (CmdOptions.isOhModules()) { + parsed.options["packageManagerType"] = "ohpm"; + } try { if (CmdOptions.isWatchEvaluateDeamonMode()) { launchWatchEvaluateDeamon(parsed);