My bower package sass-smacss:
https://github.com/leongaban/sass-smacss
And my bower.json file:
{
"name": "sass-smacss",
"version": "1.0.0",
"description": "SMACSS based SASS modules for organized style writing",
"homepage": "https://github.com/leongaban/sass-smacss",
"main": "sass/main_web.scss",
"authors": [
{
"name": "Leon Gaban",
"email": "leongaban#gmail.com",
"homepage": "http://leongaban.com",
"twitter": "#leongaban"
}
],
"repository": {
"type": "git",
"url": "https://github.com/leongaban/sass-smacss.git"
},
"keywords": [
"sass",
"css",
"smacss",
"stylesheets"
],
"license": "MIT",
"ignore": [
"**/.*",
"bower.json",
"bower_components"
]
}
Looks like I was able to bower register it, however when I run bower info sass-smacss I get No versions available, and it's not found on Bower's packages search.
Followed instructions from:
http://bower.io/docs/creating-packages/
http://bob.yexley.net/creating-and-maintaining-your-own-bower-package/
UPDATE
Thanks #drorb I added a git tag. However after registering it again, still getting the No versions available message :(
I did git tag -a v1.0.0 -m 'First version'
Bower package versions are based on Git tags. In your case the sass-smacss Git repository does not contain any tag (only a master branch).
Also notice that tag names (effectively version names) must follow semver semantics.
Related
I am trying to import components in a shared package in a monorepo, but am unable to do so.
I have the following package.json files under the root of a repo that I want to run as a monorepo. /apps/billing is a create-react-app. /apps/shared is going to contain components for billing and other apps.
/package.json
{
"name": "root",
"version": "1.0.0",
"private": true,
"description": "",
"main": "index.js",
"workspaces": [
"apps/*"
],
"scripts": {
"billing": "cd apps/billing; yarn start"
},
"author": "",
"license": "ISC",
"dependencies": {}
}
/apps/billing/package.json
{
"name": "#root/billing",
"version": "0.1.0",
"private": true,
"dependencies": {
<snip>
},
}
/apps/billing/shared.json
{
"name": "#root/shared",
"version": "1.0.0",
"main": "index.js",
"license": "MIT"
}
In the /apps/billing directory I tried to run yarn add #root/shared and get the following output:
error An unexpected error occurred: "https://registry.yarnpkg.com/#root%2fshared: Not found".
In billing, when I try to import a component from shared
import Button from '#root/shared/components/Button';
I get
Module not found: Can't resolve '#root/shared/components/Button'
Are there additional steps to setup a yarn monorepo?
It's wrong structure for monorepo.
Also you've wrongly named /apps/billing/shared.json it should be package.json instead of shared.json
At first your package.json in the root folder should be named eg. #name-of-your-app/monorepo
then packages under your root.
fe. in apps/billing
{
"name": "#name-of-your-app/billing-app",
"version": "0.1.0",
"private": true,
"dependencies": {
// any dependencies
},
then your shared components:
each should be in its own directory
each should have its own package.json
Let's say that you have shared/Button
then Button should be in its own directory and contain package.json
eg. of shared/Button/package.json/
{
"name": "#name-of-your-app/button",
"version": "0.1.0",
"private": true,
"dependencies": {
// any dependencies
},
and if you want to use this button in your billing-app
then you should at first add this as dependency IMPORTANT watchout for version of your button in package.json, the same should be installed as dependency in your app, otherwise it will finish up with bunch of errors.
-Then when you want to import this button in any component under your billing-app then import should look like this:
import Button from '#name-of-your-app/button'
You can read more about workspaces here:
yarn workspaces
Also I recommend to read more about monorepo structure fe. here
I'd like to fetch the composer.lock (& .json) from a project, and run some test to see if there is outdated packages in it.
the composer outdated seems to require me to install all packages first,
but that seams a bit overkill, as all needed information should be in the composer.lock-file.
Is there information avaible after an install, thats not avaible from the lock-file?
Is it posible to find outdated packages without running the composer install?
Update 1
I take "foolz/sphinxql-query-builder" as an exemple from one project.
In composer.json there is a
require['foolz/sphinxql-query-builder'] = '^1.0'.
In composer.lock there is a
packages[] = {name: foolz/sphinxql-query-builder, version: '1.0.2', ...}
In ~/.cache/composer/repo/https---packagist.org/p-provider-2018-04.json there is a providers['foolz/sphinxql-query-builder']->sha256
In ~/.cache/composer/repo/https---packagist.org/provider-foolz\$sphinxql-query-builder.json there is a
packages['foolz/sphinxql-query-builder']->$version
From that file i can run
array_keys((array) $json->packages->{'foolz/sphinxql-query-builder'})
to get a list of availible versions.
So how do i fetch the latest 'provider-foolz\$sphinxql-query-builder.json' file?
Composer.lock defines the exact versions of your packages, so only with this file you are not able to define if it is possible to upgrade the package to a new tag version
For example,
In composer.json you have this version of package
"laravelium/sitemap": "^3.0",
In composer lock there exists this information
{
"name": "laravelium/sitemap",
"version": "v3.0.1",
"source": {
"type": "git",
"url": "https://gitlab.com/Laravelium/Sitemap.git",
"reference": "b287ec4a6b47dcd63fd121199c05e059c479bc6f"
},
"dist": {
"type": "zip",
"url": "https://gitlab.com/api/v4/projects/Laravelium%2FSitemap/repository/archive.zip?sha=b287ec4a6b47dcd63fd121199c05e059c479bc6f",
"reference": "b287ec4a6b47dcd63fd121199c05e059c479bc6f",
"shasum": ""
},
"require": {
"illuminate/support": "5.7.*",
"php": ">=7.1.3"
},
"require-dev": {
"orchestra/testbench": "3.7.*",
"phpunit/phpunit": "~7.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Laravelium\\Sitemap\\SitemapServiceProvider"
]
}
},
"autoload": {
"psr-0": {
"Laravelium\\Sitemap": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roumen Damianoff",
"email": "roumen#damianoff.com",
"homepage": "https://damianoff.com",
"role": "Developer"
}
],
"description": "Laravelium Sitemap package for Laravel.",
"homepage": "https://laravelium.com",
"keywords": [
"Sitemap",
"generator",
"google-news",
"html",
"laravel",
"laravelium",
"php",
"xml"
],
"time": "2018-09-04T19:08:44+00:00"
},
Note, that you will install version v3.{\d+} (>=3 && <4) if it exists, and new tag version may have incompatible change
composer show -l returns the list of packages. Coloured red packages can be updated, and colored green are on the latest version.
Nevertheless, you steel need to proceed with composer install, because only this way you can understand the exact versions of installed packages
I am trying to build a PHP framework for the company I work in, and the most crazy thing is ever happing!
I have one package that depends on other both in development yet.
Just to get started (they are in different folders, of course!):
I ran composer init to create a package xxxxxx/core-min, and the result was:
{
"name": "xxxxxx/core-min",
"description": "Dummy Minimal Core",
"type": "library",
"license": "New BSD License",
"authors": [
{
"name": "My Name",
"email": "me#xxxxxx.com"
}
],
"minimum-stability": "dev",
"require": {}
}
Created the Packagist Service on Github, Submitted, and everything is okay so far.
I ran composer require xxxxxx/core-min and got it perfectly installed.
Then, I ran composer init to create a package xxxxxx/core, and the result was:
{
"name": "xxxxxx/core",
"description": "Dummy Full Core",
"type": "library",
"require": {
"xxxxxx/core-min": "dev-master"
},
"license": "New BSD License",
"authors": [
{
"name": "My Name",
"email": "me#xxxxxx.com"
}
],
"minimum-stability": "dev"
}
I ran composer require xxxxxx/core-min and got this message:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for zyneframework/core dev-master -> satisfiable by zyneframework/core[dev-master].
- zyneframework/core dev-master requires zyneframework/core-min dev-master -> satisfiable by zyneframework/core-min[dev-master] but these conflict with your requirements or minimum-stability.
This is tricking me out and I can't find any real solution!
Tried several GitHub issues and nothing!
I have created package using Laravel.
The composer.json file for my package will look like this
{
"name": "lakshmajim/testview",
"description": "hi",
"keywords": [
"package"
],
"homepage": "https://github.com/lakshmajim/testview",
"license": "MIT",
"authors": [
{
"name": "lakshmajim",
"email": "lakshmaji9#gmail.com"
}
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-4": {
"lakshmajim\\testview\\": "src/"
}
},
"minimum-stability": "dev"
}
then I have pulled to github
then I have linked it to Packagist
when I am running this composer require lakshmajim/testview
it is showing following error message
[InvalidArgumentException]
Could not find package lakshmajim/testview at any version for your minimum-stability (stable). Check the package spelling or your minimum-s
tability
QUESTION:
Why I am getting that error message ,when I'm trying to install using composer?
How can I successfully run composer require lakshmajim/testview
it's a release issue
you must run
composer require lakshmajim/testview dev-master
you don't have a release yet.
I just put up a package on packagist and I tried to run a composer update and am getting the error:
Unknown downloader type: h. Available types: git, svn, hg, perforce, zip, rar, tar, gzip, phar, file.
In the main project file I have this:
"require": {
//.......
"cyphix333/sbb-code-parser": "dev-master"
},
The composer.json file for cyphix333/sbb-code-parser is:
{
"name": "cyphix333/sbb-code-parser",
"description": "SBBCodeParser is a simple BBCode parser",
"keywords": [
"SBBCodeParser"
],
"homepage": "https://github.com/samclarke/SBBCodeParser",
"canonical": "https://github.com/cyphix333/SBBCodeParser",
"source": "https://github.com/cyphix333/SBBCodeParser/tree/master",
"autoload": {
"classmap": ["SBBCodeParser.php","classes/"]
},
"authors": [
{
"name": "Sam Clarke"
}
],
"require": {
"php": ">=5.3"
}
}
I am not sure what I am doing wrong here?
If you just started getting this error, try composer clear-cache and/or delete ~/.composer and vendor.
The specific error I was getting was:
[InvalidArgumentException]
Unknown downloader type: . Available types: git, svn, fossil, hg, perforce, zip, rar, tar, gzip, xz, phar,
file, path.
I just deleted everything and then tried again; works now.
I'm using
Composer version 1.2.0 2016-07-19 01:28:52
I've solved this issue deleting the vendor directory.
rm -Rf vendor
And then running:
composer update
Changes to your composer.json: dropped canonical and source; added type library.
Give this one a try:
{
"name": "cyphix333/sbb-code-parser",
"description": "SBBCodeParser is a simple BBCode parser",
"homepage": "https://github.com/samclarke/SBBCodeParser",
"keywords": ["SBBCodeParser"],
"type": "library",
"authors": [
{
"name": "Sam Clarke"
}
],
"require": {
"php": ">=5.3"
},
"autoload": {
"classmap": ["SBBCodeParser.php", "classes/"]
}
}
I did resolve this error after updating the composer version.
The installation did not work with composer v2.
Passing to the v1 version works.
composer self-update --1
I encountered this issue too, we had a human error in our composer.json. The dist part of one of our custom repositories was entered with a faulty downloader type (as stated in the error message).
{
"type": "package",
"package": {
"name": "campaignmonitor/createsend-php",
"type": "drupal-library",
"version": "dev-master",
"dist": {
"url": "https://github.com/campaignmonitor/createsend-php.git",
"type": "drupal-library"
},
"source": {
"url": "https://github.com/campaignmonitor/createsend-php.git",
"type": "git",
"reference": "master"
}
}
}
Note that the dist's type is entered as drupal-library, that is the package type, not the downloader type. We corrected this by using the following for dist:
"dist": {
"url": "https://github.com/campaignmonitor/createsend-php/archive/master.zip",
"type": "zip"
},
As we developed this project we had no problems when running composer install locally. We encountered this error when making the project production ready, using --prefer-dist. Obviously, it will only then use dist over source and then encounter this error.
Disclaimer: This case is somewhat different then the original question, though it's highly relatable and this question came up on top when trying to search for the answer. I hope this is okay.