public override void Run() { this.Init(); PluginLinker.CopyNativeProjects(this.SourcePath, new[] { "c3p", "reactnative" }, this.TargetOutputPath); string scriptOutputPath = Path.Combine(this.TargetOutputPath, "js"); this.CopyLibTypeScript(scriptOutputPath); string modulesOutputPath = Path.Combine(scriptOutputPath, "node_modules"); Directory.CreateDirectory(modulesOutputPath); File.Copy( Path.Combine(this.SourcePath, "ts", "node_modules", "react-native.d.ts"), Path.Combine(modulesOutputPath, "react-native.d.ts")); // React Native supports (most) ES6 language features, particularly Promises. string tsconfigFilePath = Path.Combine(scriptOutputPath, "tsconfig.json"); File.WriteAllText(tsconfigFilePath, File.ReadAllText(tsconfigFilePath).Replace("\"es5\"", "\"es6\"")); this.FixTSModuleReferences(scriptOutputPath, true); Utils.CompileTypeScript(scriptOutputPath); this.CopyPackageJson(); Utils.PackNpmPackage(this.TargetOutputPath); }
public override void Run() { this.Init(); ClrApi pluginApi = this.MergeApis(this.LoadApis()); PluginLinker.CopyNativeProjects(this.SourcePath, null, this.TargetOutputPath); string scriptOutputPath = Path.Combine(this.TargetOutputPath, "js"); if (!Directory.Exists(scriptOutputPath)) { Directory.CreateDirectory(scriptOutputPath); } this.CreateTypeScriptBindings( pluginApi, true, true, c3pReactNativePackageName, scriptOutputPath); string modulesDirectoryPath = Path.Combine(scriptOutputPath, "node_modules"); Directory.CreateDirectory(modulesDirectoryPath); this.CreateBridgeModuleTypeScriptDefinition(modulesDirectoryPath); Utils.ExtractResource("NativeObject.ts", modulesDirectoryPath); Utils.ExtractResource("NativeBridge.ts", modulesDirectoryPath); Utils.ExtractResource("react-native.d.ts", modulesDirectoryPath); Utils.ExtractResource("tsconfig.json", scriptOutputPath); this.GeneratePluginModule(pluginApi, scriptOutputPath); this.RemoveES6PromiseImports(scriptOutputPath); Utils.CompileTypeScript(scriptOutputPath); Log.Message(Utils.EnsureTrailingSlash(Path.GetFullPath(this.TargetOutputPath))); this.GeneratePackageJson(c3pReactNativePackageName, new[] { " \"main\": \"js/plugin.js\"" }); Utils.PackNpmPackage(this.TargetOutputPath); }