-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
chore(version): orm-5.0.1 & orm_flutter-0.1.1
- Loading branch information
Showing
18 changed files
with
215 additions
and
64 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
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:yaml/yaml.dart'; | ||
import 'package:orm/generator_helper.dart'; | ||
import 'package:orm/src/_internal/project_directory.dart'; | ||
import 'package:path/path.dart' as path; | ||
|
||
import 'utils/is_flutter_engine_type.dart'; | ||
|
||
Future<void> downloadEngine(GeneratorOptions options) async { | ||
if (isFlutterEngineType(options.generator.config)) { | ||
return downloadFlutterQueryEngine(options); | ||
} | ||
|
||
final sourcePath = options.binaryPaths.queryEngine?.values.firstOrNull; | ||
if (sourcePath == null) { | ||
print("⚠️[orm] Binary engine not found."); | ||
return; | ||
} | ||
|
||
final source = File(sourcePath); | ||
if (!await source.exists()) { | ||
print( | ||
'⚠️[orm] Prisma provided the engine path, but the file does not exist'); | ||
return; | ||
} | ||
|
||
final target = | ||
File(path.join(options.generator.output!.value, 'prisma-query-engine')); | ||
if (await target.exists()) { | ||
await target.delete(recursive: true); | ||
} | ||
|
||
if (!await target.parent.exists()) { | ||
await target.parent.create(recursive: true); | ||
} | ||
|
||
await source.copy(target.path); | ||
} | ||
|
||
Future<void> downloadFlutterQueryEngine(GeneratorOptions options) async { | ||
final projectDir = findProjectDirectory(path.dirname(options.schemaPath)); | ||
if (projectDir == null) { | ||
throw "⚠️[orm] Please generate a client in your project directory"; | ||
} | ||
|
||
final pubspec = loadYaml( | ||
await File(path.join(projectDir.path, 'pubspec.yaml')).readAsString()); | ||
if (pubspec case {"dependencies": {"orm_flutter": _}}) { | ||
final process = await Process.run( | ||
'dart', | ||
['run', 'orm_flutter:dl_engine'], | ||
workingDirectory: projectDir.path, | ||
includeParentEnvironment: true, | ||
); | ||
if (process.exitCode == 0) { | ||
return; | ||
} | ||
|
||
print(process.stdout); | ||
print(process.stderr); | ||
return; | ||
} | ||
|
||
throw ''' | ||
You are generating a Prisma client for Flutter | ||
It is detected that you do not have the `orm_flutter` integration package installed. | ||
**Please use the following command to install:** | ||
flutter pub add orm_flutter | ||
After the installation is complete, please regenerate the client. | ||
'''; | ||
} |
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
13 changes: 4 additions & 9 deletions
13
packages/orm/lib/src/datasources/_validate_datasource_url.dart
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.