Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: melos bootstrap throws an expected node content exception #693

Open
1 task done
samdeane opened this issue Apr 11, 2024 · 4 comments
Open
1 task done

fix: melos bootstrap throws an expected node content exception #693

samdeane opened this issue Apr 11, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@samdeane
Copy link

samdeane commented Apr 11, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Version

5.3.0

Description

I have a working project containing a couple of apps, and some existing internal packages.

I've now added a native flutter plugin package to it locally.

The plugin was created by: flutter create --org games.formation --template=plugin --platforms=android,ios,macos -a kotlin -i swift velocity_native and is virtually unmodified from that template.

Running melos bootstrap works fine if I don't reference the package from any other packages' pubspecs.

It also works fine if I add the package as a dependency to the pubspec of one of the applications.

However, if I add it as a dependency to the pubspec of one of my other internal packages:

name: velocity_flutter
description: Velocity engine flutter integration.
version: 1.0.0
publish_to: none

environment:
  sdk: '>=3.3.1 <4.0.0'
  flutter: '>=3.19.3 <4.0.0'

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

  velocity_native: ^1.0.0.  # <-- added this here
  velocity: ^1.0.0
  velocity_generation: ^1.0.0

# (more pubspec here, removed for brevity)

the following exception is thrown when running melos bootstrap:

> dart run melos bootstrap                                                                                                                      (issues/TEC-1540-native-velocity-plugin)
melos bootstrap
  └> /Users/sam/Developer/Projects/mono/client

Running "flutter pub get" in workspace packages...
  ✓ club
    └> club
  ✓ club_proto
    └> proto
  ✓ club_resource
    └> resource
  ✓ club_view
    └> view
  ✓ dev_server
    └> dev_server
  ✓ testbed
    └> testbed
  ✓ velocity
    └> velocity
Unhandled exception:
Error on line 17, column 3: Expected node content.
   ╷
17 │   , velocity_native: {path: ../velocity_native}}
   │   ^
   ╵
#0      Parser._parseNode (package:yaml/src/parser.dart:353:5)
#1      Parser._parseFlowMappingKey (package:yaml/src/parser.dart:630:16)
#2      Parser._stateMachine (package:yaml/src/parser.dart:116:16)
#3      Parser.parse (package:yaml/src/parser.dart:61:19)
#4      Loader._loadMapping (package:yaml/src/loader.dart:175:23)
#5      Loader._loadNode (package:yaml/src/loader.dart:92:16)
#6      Loader._loadMapping (package:yaml/src/loader.dart:169:19)
#7      Loader._loadNode (package:yaml/src/loader.dart:92:16)
#8      Loader._loadDocument (package:yaml/src/loader.dart:68:20)
#9      Loader.load (package:yaml/src/loader.dart:60:20)
#10     loadYamlDocument (package:yaml/yaml.dart:72:25)
#11     loadYamlNode (package:yaml/yaml.dart:57:5)
#12     YamlEditor._performEdit (package:yaml_edit/src/editor.dart:576:24)
#13     YamlEditor.update (package:yaml_edit/src/editor.dart:271:14)
#14     mergeMelosPubspecOverrides (package:melos/src/commands/bootstrap.dart:556:34)
#15     _BootstrapMixin._generatePubspecOverrides (package:melos/src/commands/bootstrap.dart:172:45)
<asynchronous suspension>
#16     _BootstrapMixin._linkPackagesWithPubspecOverrides.<anonymous closure> (package:melos/src/commands/bootstrap.dart:109:9)
<asynchronous suspension>
#17     StreamUtils.parallel.<anonymous closure> (package:melos/src/common/utils.dart:674:18)
<asynchronous suspension>
#18     Future.any.onValue (dart:async/future.dart:608:5)
<asynchronous suspension>

Steps to reproduce

I don't currently have a repro case which doesn't involve our code - which I can't share.

Expected behavior

melos should complete normally:

> dart run melos bootstrap                                                                                                                      (issues/TEC-1540-native-velocity-plugin)
melos bootstrap
  └> /Users/sam/Developer/Projects/mono/client

Running "flutter pub get" in workspace packages...
  ✓ club
    └> club
  ✓ club_proto
    └> proto
  ✓ club_resource
    └> resource
  ✓ club_view
    └> view
  ✓ dev_server
    └> dev_server
  ✓ testbed
    └> testbed
  ✓ velocity
    └> velocity
  ✓ velocity_flutter
    └> velocity_flutter
  ✓ velocity_generation
    └> velocity_generation
  ✓ velocity_native
    └> velocity_native
  ✓ velocity_test
    └> velocity_test
  > SUCCESS

 -> 11 packages bootstrapped

Screenshots

No response

Additional context and comments

No response

@samdeane samdeane added the bug Something isn't working label Apr 11, 2024
@samdeane samdeane changed the title fix: dart run melos bootstrap throws an expected node content exception fix: melos bootstrap throws an expected node content exception Apr 11, 2024
@samdeane
Copy link
Author

samdeane commented Apr 11, 2024

Update: manually deleting the previous pubspec_overrides.yaml file in the velocity_flutter package seems to fix this problem.

The old file was using flow-stye YAML. The new file isn't:

image

@spydon
Copy link
Collaborator

spydon commented Apr 11, 2024

It looks like your version accidentally ends in a dot? ^1.0.0., can you try removing the last dot and re-run bootstrap?

@samdeane
Copy link
Author

samdeane commented Apr 11, 2024

Ah - I think that must be an artefact of my copying & pasting into this bug report. I have linting on in vscode and I think I would have spotted the warning:
image

That said, I tried putting the extra dot back and running bootstrap, and it coped!

@spydon
Copy link
Collaborator

spydon commented Apr 11, 2024

Update: manually deleting the previous pubspec_overrides.yaml file in the velocity_flutter package seems to fix this problem.

Very odd that it was generating that before, this can be closed now then I guess?
I think running melos clean && melos bootstrap should also have solved it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants