Multiple Pubspec.yaml

206 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Rat Jo

ungelesen,
13.09.2014, 20:42:0113.09.14
an mi...@dartlang.org
Hi,

Is it possible to have multiple pubspec in the same project?

I'm trying to have this structure:

pubspec.yaml (server)
main.dart (server)
 -> public
 ---> index.html
 ---> index.dart
 ---> pubspec.yaml (client)

The editor doesn't seem to like. I'm trying to have different library for my server code and my client.

Jo

Günter Zöchbauer

ungelesen,
14.09.2014, 03:15:4514.09.14
an mi...@dartlang.org
Just make different packages.
A pubspec.yaml is not for libraries it is for packages.
A package can have many libraries.
You can import packages which are not published to pub.dartlang.org with a path dependency.

pubspec.yaml in client and server

dependencies:
  my_shared_package:
    path: ../my_shared_package

Rat Jo

ungelesen,
17.09.2014, 17:58:5817.09.14
an mi...@dartlang.org
Sorry, I was talking about package..

I want to have mysql package only for the server code and all other package (bootstrap, dquery, google_maps, intl, mime, rikolu, ...)

Günter Zöchbauer

ungelesen,
18.09.2014, 03:00:1418.09.14
an mi...@dartlang.org
There were bugs related to this code layout but I thought they are all fixed.
What looks weird is your public directory.
You have index.html, index.dart and pubspec.yaml in the same directory.
index.html and index.dart need to be in the web subdirectory of your package.

-> public
---> pubspec.yaml
---> web
-----> index.html
-----> index.dart


I would discourage using such a layout anyway.
Make all packages related to one application on the same directory level

myapp
--> client
----> pubspec.yaml
----> web
------> index.html
------> index.dart
----> lib
------> other files

--> server
----> pubspec.yaml
----> bin
------> main.dart
----> lib
------> other files

--> shared
----> pubspec.yaml
----> lib
------> other files

The only disadvantage you have from this layout is that DartEditor doesn't show the entire code in one folder.
If this is what bothers you you can use workspaces in DartEditor.
To use workspaces you need to add a command line argument

DartEditor -data myworkspaces/my_cool_app

If you have other reasons please share so we can discuss how to avoid them.
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten