private void OnEnable() { Selection.selectionChanged += OnSelectionChanged; NpmPublishAssetProcessor.PackageImported += PackageImported; if (!UpmClientUtils.IsListed) { UpmClientUtils.ListPackages(() => Refresh(false)); } }
private void DoPublish() { var header = $"Npm: {Registry}"; var msg = $"Are you really want to publish package {package.name}: {package.version}?"; if (!EditorUtility.DisplayDialog(header, msg, "Publish", "Cancel")) { return; } NpmPublishCommand.Execute(packageAsset, () => { // UpmClientUtils.ListPackages(() => Refresh(false)); }); }
private void DrawContentPackageJson() { GUILayout.BeginHorizontal(); GUILayout.Label(package.displayName, Styles.HeaderDisplayNameLabel); GUILayout.Label(package.version, Styles.HeaderVersionLabel); GUILayout.FlexibleSpace(); if (GUILayout.Button("Check updates")) { UpmClientUtils.ListPackages(() => Refresh(false)); } GUILayout.EndHorizontal(); GUILayout.Label(package.name, Styles.HeaderNameLabel); GUILayout.BeginHorizontal(); GUILayout.Label("Package.json", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); if (GUILayout.Button("Open", EditorStyles.miniButton)) { AssetDatabase.OpenAsset(packageAsset); } GUILayout.EndHorizontal(); GUILayout.Space(3); packageJsonScroll = GUILayout.BeginScrollView(packageJsonScroll, Styles.BigTitle); bool dependenciesBlock = false; foreach (var line in packageJsonLines) { if (line.Contains("}")) { dependenciesBlock = false; } if (dependenciesBlock && ExtractPackageInfoFromJsonLine(line, out string packageName, out string packageVersion)) { GUILayout.BeginHorizontal(); GUILayout.Label(line, Styles.RichNoPaddingLabel); GUILayout.Space(5); DrawDependencyQuickActions(packageName, packageVersion); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); }