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

Added support to release date #297

Merged
merged 1 commit into from
Sep 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Converter/BowerPackageConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ protected function getMapKeys()
'description' => 'description',
'keywords' => 'keywords',
'license' => 'license',
'time' => 'time',
'bin' => 'bin',
);
}
Expand Down
1 change: 1 addition & 0 deletions Converter/NpmPackageConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ protected function getMapKeys()
'keywords' => 'keywords',
'homepage' => 'homepage',
'license' => 'license',
'time' => 'time',
'author' => array('authors', function ($value) {
return NpmPackageUtil::convertAuthor($value);
}),
Expand Down
9 changes: 9 additions & 0 deletions Repository/NpmRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Composer\Package\Loader\ArrayLoader;
use Composer\Repository\ArrayRepository;
use Fxp\Composer\AssetPlugin\Converter\NpmPackageUtil;
use Fxp\Composer\AssetPlugin\Converter\PackageUtil;
use Fxp\Composer\AssetPlugin\Exception\InvalidCreateRepositoryException;

/**
Expand Down Expand Up @@ -83,6 +84,14 @@ protected function createVcsRepositoryConfig(array $data, $registryName = null)
{
$type = isset($data['repository']['type']) ? $data['repository']['type'] : 'vcs';

// Add release date in $packageConfigs
if (isset($data['versions']) && isset($data['time'])) {
$time = $data['time'];
array_walk($data['versions'], function (&$packageConfigs, $version) use ($time) {
PackageUtil::convertStringKey($time, $version, $packageConfigs, 'time');
});
}

return array(
'type' => $this->assetType->getName().'-'.$type,
'url' => $this->getVcsRepositoryUrl($data, $registryName),
Expand Down
3 changes: 3 additions & 0 deletions Tests/Repository/NpmRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ public function testWatProvidesWithoutRepositoryUrl()
),
),
),
'time' => array(
'1.0.0' => '2016-09-20T13:48:47.730Z',
),
))));

$this->assertCount(0, $this->rm->getRepositories());
Expand Down