-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated to dcli 4.x and using pubspec_manager.
- Loading branch information
Showing
15 changed files
with
95 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,9 @@ | |
* Written by Brett Sutton <[email protected]>, Jan 2022 | ||
*/ | ||
|
||
import 'dart:io'; | ||
|
||
import 'package:args/command_runner.dart'; | ||
import 'package:dcli/dcli.dart' hide PubSpec; | ||
import 'package:pubspec2/pubspec2.dart'; | ||
import 'package:dcli/dcli.dart'; | ||
import 'package:pubspec_manager/pubspec_manager.dart'; | ||
import 'package:scope/scope.dart'; | ||
import 'package:url_builder/url_builder.dart'; | ||
|
||
|
@@ -66,36 +64,34 @@ run: onepub login | |
final currentOrganisationName = settings.organisationName; | ||
final url = settings.onepubApiUrlAsString; | ||
|
||
final pubspec = await PubSpec.loadFile(project.pathToPubSpec); | ||
if (pubspec.publishTo != null) { | ||
if (pubspec.publishTo.toString() == url) { | ||
print(orange('${pubspec.name} is already a private package.')); | ||
return; | ||
} | ||
|
||
await API().checkVersion(); | ||
final organisation = await getOrganisation(obfuscatedOrganisationId); | ||
if (organisation == null) { | ||
print(orange('${pubspec.name} is already a private package ' | ||
'for another organisation')); | ||
} else { | ||
print(orange('${pubspec.name} is already a private package of ' | ||
'${organisation.name}')); | ||
} | ||
if (!confirm('Do you want to change the organisation to ' | ||
'$currentOrganisationName?')) { | ||
print(red('Action cancelled')); | ||
return; | ||
} | ||
final pubspec = PubSpec.loadFromPath(project.pathToPubSpec); | ||
if (pubspec.publishTo.toString() == url) { | ||
print(orange('${pubspec.name} is already a private package.')); | ||
return; | ||
} | ||
|
||
await API().checkVersion(); | ||
final organisation = await getOrganisation(obfuscatedOrganisationId); | ||
if (organisation == null) { | ||
print(orange('${pubspec.name} is already a private package ' | ||
'for another organisation')); | ||
} else { | ||
print(orange('${pubspec.name} is already a private package of ' | ||
'${organisation.name}')); | ||
} | ||
if (!confirm('Do you want to change the organisation to ' | ||
'$currentOrganisationName?')) { | ||
print(red('Action cancelled')); | ||
return; | ||
} | ||
|
||
final pubspecUpdated = pubspec.copy(publishTo: Uri.parse(url)); | ||
await pubspecUpdated.save(Directory(project.pathToProjectRoot)); | ||
pubspec.publishTo.set(url); | ||
pubspec.saveTo(project.pathToProjectRoot); | ||
|
||
print(''' | ||
${pubspecUpdated.name} has been marked as a private package for the organisation ${settings.organisationName}. | ||
${pubspec.name} has been marked as a private package for the organisation ${settings.organisationName}. | ||
Run 'dart/flutter pub publish' to publish ${pubspecUpdated.name} to OnePub | ||
Run 'dart/flutter pub publish' to publish ${pubspec.name} to OnePub | ||
See ${urlJoin(settings.onepubWebUrl, 'publish')} | ||
'''); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.