Skip to content

feat(flutter-packages-builder): create flutter packages builder script#82

Merged
mrverdant13 merged 6 commits into
mainfrom
flutter-packages-builder/feat/flutter-packages-builder
Apr 16, 2026
Merged

feat(flutter-packages-builder): create flutter packages builder script#82
mrverdant13 merged 6 commits into
mainfrom
flutter-packages-builder/feat/flutter-packages-builder

Conversation

@mrverdant13
Copy link
Copy Markdown
Owner

Details

Create flutter packages builder script

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Node.js tool to build all opt-in Flutter packages/apps (those containing web/package.json) using the lower-bound Flutter SDK version from each package’s pubspec.yaml, then generates a merged build/web/package.json and packs the build output into a .tgz.

Changes:

  • Introduces tool/build-flutter-packages.mjs to discover eligible packages under packages/ and apps/.
  • Uses FVM-installed Flutter versions (derived from environment.flutter) to build each target (flutter build web --profile).
  • Writes build/web/package.json, runs npm pack, and renames the tarball to <name>.tgz.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tool/build-flutter-packages.mjs Outdated
Comment thread tool/build-flutter-packages.mjs Outdated
Comment thread tool/build-flutter-packages.mjs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Node-based CLI script to build Flutter web packages/apps that opt in via web/package.json, selecting the Flutter SDK version from each package’s environment.flutter constraint and producing a packed .tgz artifact.

Changes:

  • Introduces tool/build-flutter-packages.mjs to discover eligible packages and build them with an FVM-installed Flutter version.
  • Implements a lightweight pubspec.yaml parser to extract name, description, version, and environment.flutter.
  • Generates build/web/package.json (merged from web/package.json + pubspec metadata) and runs npm pack to create a tarball.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tool/build-flutter-packages.mjs
Comment thread tool/build-flutter-packages.mjs
Comment thread tool/build-flutter-packages.mjs
Comment thread tool/build-flutter-packages.mjs
Comment thread tool/build-flutter-packages.mjs Outdated
Comment thread tool/build-flutter-packages.mjs Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Node-based tooling script to build Flutter workspace packages that opt in via web/package.json, selecting a Flutter SDK version based on each package’s environment.flutter constraint and producing an npm tarball from the web build output.

Changes:

  • Introduces tool/build-flutter-packages.mjs to discover eligible packages via Melos and build them with a selected FVM-managed Flutter SDK.
  • Generates build/web/package.json by merging metadata from pubspec.yaml with web/package.json, then runs npm pack and renames the resulting tarball.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tool/build-flutter-packages.mjs
Comment on lines +153 to +179
/**
* Returns all workspace packages that have a `web/` directory, sourced from
* `melos list --dir-exists=web --json` so discovery matches the workspace globs
* in melos.yaml exactly.
*/
function discoverPackages() {
const result = spawnSync('melos', ['list', '--dir-exists=web', '--json'], { encoding: 'utf8', cwd: repoRoot });
if (result.error || result.status !== 0) {
console.error('✗ `melos list --dir-exists=web --json` failed — is Melos installed and on PATH?');
if (result.error) console.error(` ${result.error.message}`);
process.exit(result.status ?? 1);
}

let packages;
try {
packages = JSON.parse(result.stdout);
} catch {
console.error('✗ Failed to parse `melos list --dir-exists=web --json` output.');
process.exit(1);
}

return packages.map(({ location }) => ({
dir: location,
pubspecPath: join(location, 'pubspec.yaml'),
webPkgPath: join(location, 'web', 'package.json'),
}));
}
Comment thread tool/build-flutter-packages.mjs
@mrverdant13 mrverdant13 merged commit 40dab0a into main Apr 16, 2026
2 checks passed
@mrverdant13 mrverdant13 deleted the flutter-packages-builder/feat/flutter-packages-builder branch April 16, 2026 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants