diff --git a/.lycheeignore b/.lycheeignore index deaae03e..0027b2f4 100644 --- a/.lycheeignore +++ b/.lycheeignore @@ -84,6 +84,8 @@ https://securetoken.google.com/ file:///home/runner/work/solidui/solidui/lib/src/utils/scheme https://pods.example.au/john-doe/profile/card#me https://github.com/gjwgit/myapp/blob/main/README.md +https://github.com/anusii/solidpod/blob/main/solidpodeg/README.md +https://server/POD_NAME/APP_NAME/data/FILE_PATH # 20260605 gjw Failing solid servers diff --git a/.pubignore b/.pubignore index a7371d3c..9bf863b4 100644 --- a/.pubignore +++ b/.pubignore @@ -15,6 +15,8 @@ ARCHIVE ignore pubspec.yaml.* +!templates/solidpod/pubspec.yaml.tmpl + .flutter-plugins* qtest_*.txt diff --git a/README.md b/README.md index 5adc5037..5bbc2fe7 100644 --- a/README.md +++ b/README.md @@ -101,19 +101,71 @@ of a `flutter create --template=solidpod`, which stock Flutter cannot offer because the `--template` flag only accepts a fixed set of built-in types. We provide a small generator instead. -From any checkout that depends on `solidpod`: +The recommended way is to activate the generator once and then run it from any +directory: ```bash -dart run solidpod:create my_pod_app +flutter pub global activate solidpod +solidpod create my_pod_app ``` -Or activate it once and use it anywhere: +Alternatively, `dart run solidpod:create` works **only from within a package +that already depends on `solidpod`** (for example a clone of the `solidpod` +repository), because `dart run` must resolve the `solidpod:create` executable +through that project's `pubspec.yaml`: ```bash -flutter pub global activate solidpod -solidpod create my_pod_app +dart run solidpod:create my_pod_app ``` +Running `dart run solidpod:create` from an unrelated directory fails with +`Found no pubspec.yaml file in or parent directories` — use the global +activation above instead. + +### Running from a local checkout (before publishing) + +If you are working on a branch of `solidpod` that is not yet published to +pub.dev, you can still generate an app from any directory without publishing. +Replace `/path/to/solidpod` below with the path to your local checkout. + +- Run the generator script directly. This always uses your current working tree + — both `bin/create.dart` and the template files — so it picks up your edits + on every run: + + ```bash + dart run /path/to/solidpod/bin/create.dart my_pod_app + ``` + +- Or activate the local checkout and use the short `solidpod create` command + anywhere: + + ```bash + flutter pub global activate --source path /path/to/solidpod + solidpod create my_pod_app + ``` + + Note that this takes a snapshot of `bin/create.dart`, so re-run the + `activate` command after editing the generator itself; edits to the template + files are picked up without re-activating. + +For Windows users, command `solidpod` can be added to the system by the +following steps: + +- Run **PowerShell** +- Run the following commands: + + ```shell + $pubCacheBin = "$env:LOCALAPPDATA\Pub\Cache\bin" + $userPath = [Environment]::GetEnvironmentVariable("Path", "User") + + if ($userPath -notlike "*$pubCacheBin*") { + [Environment]::SetEnvironmentVariable("Path", "$userPath;$pubCacheBin", "User") + } + ``` + +- Close **Powershell** +- Open **Command Prompter** or **PowerShell** and use `solidpod` command. + The generator runs `flutter create` to lay down the platform folders, overlays the template (substituting your app name), and runs `flutter pub get`. Useful options: diff --git a/bin/create.dart b/bin/create.dart index 7e5e9278..6261fbc3 100644 --- a/bin/create.dart +++ b/bin/create.dart @@ -170,7 +170,11 @@ Future main(List arguments) async { await _runProcess('flutter', ['pub', 'get'], outputDir.path); } - _printNextSteps(stdout, outputDir.path, runFlutterCreate: args.runFlutterCreate); + _printNextSteps( + stdout, + outputDir.path, + runFlutterCreate: args.runFlutterCreate, + ); } // ── Template rendering ───────────────────────────────────────────────────── @@ -284,7 +288,8 @@ void _patchAndroidRedirectScheme(Directory output, String scheme) { if (content.contains(placeholder)) return; final patched = content.replaceFirstMapped( RegExp(r'versionName flutterVersionName\n'), - (m) => '${m[0]} manifestPlaceholders = [$placeholder: "$scheme"]\n', + (m) => + '${m[0]} manifestPlaceholders = [$placeholder: "$scheme"]\n', ); if (patched != content) { groovy.writeAsStringSync(patched); @@ -403,7 +408,8 @@ Future _runProcess( ); final code = await process.exitCode; if (code != 0) { - stderr.writeln('Error: `$executable ${args.join(' ')}` exited with $code.'); + stderr + .writeln('Error: `$executable ${args.join(' ')}` exited with $code.'); return false; } return true; @@ -563,7 +569,11 @@ Example: '''); } -void _printNextSteps(IOSink out, String path, {required bool runFlutterCreate}) { +void _printNextSteps( + IOSink out, + String path, { + required bool runFlutterCreate, +}) { out.writeln(''' Done! Your Solid Pod app is ready in $path/