How I can register subdirectory of my vcs root as a bower module? - bower

I have this project structure:
- .git
- test
--- unit
--- e2e
- sources
--- lib
--- js
I have this project structure. This is some library, that I want to share with other peoples. I want to register my code as bower module, so people can easy use my library.
Actually, bower module is only /sources/* contents. I don't want test directory to be published in bower module contents. I want only /sources/* contents to be published.
Note, I know that I can ignore some directories like test/ directory. After this when I do bower install moduleName I will got this structure:
- sources
--- lib
--- js
This is not what I want. I want to get sources contents.
Also, I tried to put bower.json into sources directory. After that:
I have problems with bower version <ver> (no tags are created)
I resolve full project structure, but only only contents of the dir with bower.json file
How to register bower module, so only contents of some subdirectory will be published?

Related

How to specify `node_modules` from parent folder in `serverless.yml`?

In serverless.yml file, how can I include the modules from parent folder?
package:
include:
- ../node_modules/**
but the packaged zip file doesn't include the dependencies from parent node_modules folder. I have tried the plugin: https://www.npmjs.com/package/serverless-plugin-include-dependencies but it still doesn't work. None of dependencies from parent folder is packaged.
How can I change the dependencies folder directory when packaging my application? I also want to apply excluding devDependencies logic for the parent folder.
I'd suggest to package your functions individually in some side script & then run the serverless deploy.
Then you can easily fine-tune your packaging process and include the node_modules from your parent, excluding the dev dependencies.
package:
individually: true
functions:
sample:
package:
artifact: ../functions/sample/deploy/sample.zip
Another small benefit on this is, if you only want to update some function you can explicitly just repackage that one and run the serverless deploy much faster.

Bower + Rails and files in public folder

I read a lot of articles how to integrate Rails and Bower. But what I need now basically, is little bit more complicated scenario. I have bower component with the following directory structure:
xx.js
xx.css
vendor
|- dir1
|---vendor-file-1.js
|---vendor-file-2.js
|- dir2
|- vendor-file.js
|- vendor-file.cab
|- vendor-file.jar
Basically, xx.js and xx.css is the component itself. But this component is usable only when vendor files are attached to the page with script tags. These vendor javascript files are using cab and jar files. I don't want to modify vendor files, and the path to cab and jar files is hardcoded in vendor-file.js (loaded from the same directory).
So I plan to use my component the standard bower-rails way. And I plan to attach vendor files to the page (when it's required) with script tags.
So, for this reason I need to put all of the vendor files into ./public folder.
I can try to configure it with .bowerrc and directory parameter. But in this case I don't know what to do with other components. Is there any way to configure bower to have "directory" parameter for each bower component and not for all of them?
Or any other ideas how to deal with cab and jar file if something is loading them from the same directory?

bin subdirectories have no generated packages directories

I am using Dart 1.3.6 SDK and generated a typical command line application with a bin directory. The bin directory automatically gets its packages directory. However, none of the subdirectories of the bin directory gets any packages directory. As such I cannot import packages such as http that I am trying to use.
According to Dart's literature I think bin, test, web and example directories should all generate packages in there sub-directories. Yes?
I got the info that pub get should create these directories. I just created the symlinks manually when they were missing.
https://code.google.com/p/dart/issues/detail?id=16947
So far "entry points" in sub directories are not supported:
See also:
https://code.google.com/p/dart/issues/detail?id=18589
https://code.google.com/p/dart/issues/detail?id=17596

Is there a way to disable all those symlinks to the packages directory?

I am using the Dart Eclipse plugin following this guide:
http://blog.dartwatch.com/2013/01/integrating-dart-into-eclipse-and-your.html
( without the Maven integration )
If I use the pubspec.yaml file, my project gets spammed with these packages symlinks.
( I am using the "Package Explorer" view from Eclipse )
I would like some control over where these files get created.
I would argue the web root directory and maybe a scripts directory should be enough.
Currently, no, there is no way to control which directories get "packages" directories and which don't. Pub will place "packages" directories in "bin", "example", "test", "tool", and "web", and any subdirectory of those.
Those are all of the directories where a package may be expected to have a Dart entrypoint. Since an entrypoint needs a "packages" directory next to it to be able to use "package:" imports, pub will place one there.
It won't place "packages" directories anywhere else.
I would argue the web root directory and maybe a scripts directory should be enough.
"tool" is pub's convention for a "scripts" directory.
I found the code that generates these directories in dart-sdk\util\pub\entrypoint.dart.
There is a method called: _linkSecondaryPackageDir.
If I add: if (path.basename(dir) != 'web') return;
The packages folder only gets created in the root folder and the web folder, just like I want.
I will test if this breaks anything and report back.

What relevance do folders have in a dart project?

When I create a sub folder in a Dart Project in Dart Editor, immediately a package subfolder is created inside this sub folder. I have not read anywhere that sub folders have a special meaning for the project structure, but it appears they do. Anybody knows more?
The package subfolder holds symlinks to your Pub packages. You can read more about Pub and Pub packages at http://pub.dartlang.org/doc/.
When you start a non-web project, the editor will automatically create package directories in your bin/ and test/ directories (but not in your lib/ directory). If you create a web project, a package directory is also created in the web/ folder.
If you add a Pub dependency in the pubspec.yaml file and run pub install, your will see that the package folders will contain symlinks to the Pub package you just installed. If you are using Dart Editor, pub install will automatically run once you modify your pubspec,yaml file.
If you create a subfolder inside any directory that contains one of these auto-generated package folders, the subfolder will get its own package directory. This way, you will have access to your Pub packages no matter how deeply you nest your code in a directory.
Shailen's answer is correct. I wanted to add a bit more, as the title of this question is "What relevance to folders have in a Dart project?"
Dart is designed to be very web friendly. Because there is no load path or classpath on the web, Dart apps must run without requiring an installation or pre-configuration of a local environment.
The only way you can link one file to another in Dart is via a URI. These URIs can be file URIs, and they can be relative. That means file A.dart can point to file B.dart via an absolute or relative path.
So, to answer you question, there is nothing special about a folder layout for Dart applications. The app will run as long as your Dart file can reference its dependencies via the same kind of linking rules that exist on the web (think <a href="" or <link src="").
However, pub (the Dart dependency manager) does make a few assumptions about package and application layout. If certain conventions are followed, pub can manage symlinks for you so that it's easier to reference 3rd party dependencies. Do you need to use pub? Nope, you can manually copy files around or manually manage symlinks. But pub certainly does make it easier to use packages, given the constraints of Dart's design (no load path, no classpath).

Resources