Most problems are my own errors: Testing Pub without reading/understanding instructions. Sometimes may also be, that Pub is out of order/anfunctional, when I do tests...
So I collect some poits, to deepen my knowledge of Pub and to solve my -dawo problems.
Check original text.. http://pub.dartlang.org/ this all is subject to changes!!
-------------------------------------------------------------------------------------------------
What do I want to ask?
1. Is Publish the only way to push new version to my local package-folders?
2. Does Pub use my local folders this way:
- Web, to start/rule package & main / entrypoint?
- Lib, to actual create packages content?
- Example, for others to use my package easily?
- Build, to show me, how my package looks out?
This, because global picture of folders, is still little unclear to me...
Question: is my package (which others use) a combination of web & lib folders??
--------------------------------------------------------------------------------------------------
http://pub.dartlang.org/doc/ Getting started: My comments on red.
reuse existing Dart code and bundle your Dart apps and libraries
Import one or more libraries from the package:
If your app wants to use pub packages, it needs to be a package too.
An application package only consumes packages but doesn’t itself get reused.
To turn your app into an application package so it can use other packages, you just need to give it a pubspec.
The simplest possible pubspec just contains the name of the package.
Most packages just define a single entrypoint whose name is the same as the name of the package. !!!!!!!!!
import '../../lib/parser.dart';
But that’s a pretty nasty relative path.
When you are ready to upgrade your dependencies to the latest versions, do: Ugrade.
YES. All seems quite clear. ===================================
http://pub.dartlang.org/doc/dependencies.html Dependencies. For library packages, you specify the range of versions of that package that you allow.
allows any version, and looks it up using the default source, which is this site itself. MEANS WHAT? Ou!! it means pub-html-page... :)
the “live” version of that package on your local file system.
Relative paths are allowed and are considered relative to the directory containing your pubspec.
you cannot upload a package to pub.dartlang.org if it has any path dependencies in its pubspec.
Git & bVersion constrains.. Clear!! Dev dependencies: Clear.
http://pub.dartlang.org/doc/pubspec.html Pubspec Format.. Quite clear.
Each time you publish your package, you will publish it at a specific version. Once that’s been done, consider it hermetically sealed: you can’t touch it anymore.
http://pub.dartlang.org/doc/package-layout.html Package layout conventions
Many packages are library packages: they define Dart libraries that other packages can import and use. These public Dart library files go inside a directory called
lib
.Most packages will define a single library that users can import. In that case, its name should usually be the same as the name of the package,
Entrypoints—Dart scripts with a
main()
function—cannot go in lib
. !!!!!!!much of a package’s code is internal implementation libraries that should only be imported and used by the package itself. Those go inside a subdirectory of
lib
called src
. you should never import from another package’s
lib/src
directory. Web files: Also, and this is important, any Dart web entrypoints (in other words, Dart scripts that are referred to in a
<script>
tag) go under web
and not lib
. Command-line apps: can be run directly from the command line. These can be shell scripts or any other scripting language, .... put it in a directory named
bin
.Example: Standalone example programs that use your package, of course!
This is an important place to consider using
package:
to import files from your own package. That ensures the example code in your package looks exactly like code outside of your package would look.Tool: Mature packages often have little helper scripts and programs that people run while developing the package itself. Think things like test runners, documentation generators, or other bits of automation.
Assets and Transformers http://pub.dartlang.org/doc/assets-and-transformers.html The
pub serve
and pub build
commands use transformers to prepare a package’s assetsto be served locally or to be deployed, respectively. Ou!! Seven screens... I leave this in side now.. hope not need this ever... BUT: I can put my empty folder structure here!Commands: Build: generates the assets for the current package and all of its dependencies, putting them into a new directory named
build
.Pub also automatically compiles your Dart application to JavaScript using dart2js.
Cache: lists information about packages currently downloaded into your system cache.
Get: Check later... must be all clear...
Publish; All files in your package will be included in the published package, with the following exceptions: If you aren’t using Git, all “hidden” files (that is, files whose names begin with
.
)
To be on the safe side, pub publish will list all files it’s going to publish for you to look over before it actually uploads your package. GREAT!! I CAN "ALMOST" PUBLISH...
Options
--dry-run
or -n
With this, pub goes through the validation process but does not actually upload the package. This is useful if you want to see if your package meets all of the publishing requirements before you’re ready to actually go public.
Upgrade: gets the latest versions of all the dependencies TL:DR lol
Serve: This command starts up a development server, or dev server, for your Dart web app.
Hope never need this...
So going now to "try" publish.. to 0.0.02.
Ei kommentteja:
Lähetä kommentti