Skip to content

Commit c0d4e60

Browse files
committed
1.x
1 parent 891ada0 commit c0d4e60

4 files changed

Lines changed: 37 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [1.2.0] - 2026-02-06
2+
3+
### Added
4+
- Test file import rewriting in NewCommand: updates `import '/` to `import 'package:<project_name>/` when scaffolding new Nylo projects
5+
16
## [1.1.0] - 2026-02-01
27

38
### Added

lib/src/commands/new_command.dart

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ class NewCommand {
147147

148148
// Update app title
149149
await _updateAppTitle(projectPath, projectName);
150+
151+
// Update test file imports
152+
await _updateTestImports(projectPath, projectName);
150153
}
151154

152155
/// Updates Android-specific configuration
@@ -207,6 +210,24 @@ class NewCommand {
207210
}
208211
}
209212

213+
/// Updates test file imports from `import '/` to `import 'package:<name>/`
214+
Future<void> _updateTestImports(
215+
String projectPath, String projectName) async {
216+
final testDir = Directory(path.join(projectPath, 'test'));
217+
if (!await testDir.exists()) return;
218+
219+
await for (final entity in testDir.list(recursive: true)) {
220+
if (entity is File && entity.path.endsWith('.dart')) {
221+
String content = await entity.readAsString();
222+
if (content.contains("import '/")) {
223+
content =
224+
content.replaceAll("import '/", "import 'package:$projectName/");
225+
await entity.writeAsString(content);
226+
}
227+
}
228+
}
229+
}
230+
210231
/// Runs flutter pub get in the project directory
211232
Future<void> _runPubGet(String projectPath) async {
212233
final result = await ProcessRunner.run(
@@ -237,10 +258,18 @@ class NewCommand {
237258
['run', 'nylo_framework:main', 'make:key'],
238259
workingDirectory: projectPath,
239260
);
240-
241261
if (result.exitCode != 0 && result.stderr.trim().isNotEmpty) {
242262
NyloConsole.writeWarning('App key generation completed with warnings');
243263
}
264+
265+
final resultMakeEnv = await ProcessRunner.run(
266+
'dart',
267+
['run', 'nylo_framework:main', 'make:env'],
268+
workingDirectory: projectPath,
269+
);
270+
if (resultMakeEnv.exitCode != 0) {
271+
NyloConsole.writeWarning('App key generation completed with warnings');
272+
}
244273
}
245274

246275
/// Prints the success message with next steps

lib/src/constants.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Constants {
66
static const String templateRepoUrl = 'https://github.com/nylo-core/nylo';
77

88
/// Installer version
9-
static const String version = '1.1.0';
9+
static const String version = '1.2.0';
1010

1111
/// Documentation URL
1212
static const String docsUrl = 'https://nylo.dev/docs';

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: nylo_installer
22
description: CLI tool to create new Nylo Flutter projects. Quickly scaffold production-ready Flutter applications.
3-
version: 1.1.0
3+
version: 1.2.0
44
homepage: https://nylo.dev
55
repository: https://github.com/nylo-core/nylo-installer
66
issue_tracker: https://github.com/nylo-core/nylo-installer/issues

0 commit comments

Comments
 (0)