1
0
mirror of https://github.com/SomboChea/ui synced 2026-01-12 14:15:47 +07:00

Compare commits

...

16 Commits

Author SHA1 Message Date
Juan Picado @jotadeveloper
5e43ac0d49 chore(release): 0.1.4 2019-05-04 15:42:15 +02:00
Juan Picado @jotadeveloper
4e899a8574 chore: update snapshot 2019-05-04 15:41:57 +02:00
Juan Picado @jotadeveloper
01daf73bbf chore(release): 0.1.3 2019-05-04 15:39:29 +02:00
Juan Picado @jotadeveloper
a89f363115 feat: browser history is aware of basename (#45)
* feat: browser history is aware of basename

* test: fix ui options global object

* chore: fix comment
2019-05-04 12:13:29 +02:00
Daniel Ruf
c3eac3d27b test: fix formatDateDistance test (#43)
Test formatDateDistance with a date which is about 2 months in the past and another which is exactly 2 months in the past.
2019-05-02 20:57:42 +02:00
Juan Picado @jotadeveloper
9d7be476ad chore: relocate unit test (#39)
add new json snapshot serializer
2019-05-01 21:02:46 +02:00
Ayush Sharma
1070e5c3aa chore: adds actions (#40)
* chore: adds actions

* chore: updates workflow

* chore: leave node 12 placeholder

* chore: leave node 12 placeholder
2019-04-29 09:06:00 +02:00
Juan Picado @jotadeveloper
11f50919ef chore(release): 0.1.2 2019-04-28 14:33:39 +02:00
Juan Picado @jotadeveloper
ea1ebde2f1 chore: reverts commit fc11429 2019-04-28 14:32:40 +02:00
Juan Picado @jotadeveloper
c4cb559137 chore(release): 0.1.1 2019-04-28 14:02:17 +02:00
Ayush Sharma
e8fd59696e fix: version rendering issue. (#38)
* fix: object passing for react rendering

* fix: const for 'not available'

* fix: const for 'not available'
2019-04-28 13:15:45 +02:00
Ayush Sharma
fc114298ad chore: adds pull request action (#37)
* chore: improvements in actions

* chore: improvements in actions

* chore: improvements in actions

* chore: aggregates action in a script

* chore: minor fix

* chore: adds node 12 in action

* chore: keep node 12 after 8 10 11

* chore: keep node 12 after 8 10 11

* chore: name fixes
2019-04-27 22:22:52 +02:00
Juan Picado @jotadeveloper
86bda48b79 chore(release): 0.1.0 2019-04-26 06:52:55 +02:00
Jamie Kyle
d6a8f5519f feat: accept primary color to be configured (#36) 2019-04-25 21:42:48 +02:00
Juan Picado @jotadeveloper
eda98b817e chore: update readme 2019-04-25 19:53:01 +02:00
Juan Picado @jotadeveloper
12da966254 chore: update readme 2019-04-25 19:49:19 +02:00
47 changed files with 299 additions and 89 deletions

192
.github/main.workflow vendored
View File

@@ -1,79 +1,215 @@
workflow "build and test" {
################################################
# Workflow for a branch push
################################################
workflow "build and test on branch" {
resolves = [
"lint",
"test",
"branch-filter",
"branch.lint.node.10",
"branch.test.node.10",
"branch.test.node.8",
# "branch.test.node.12"
]
on = "push"
}
action "branch-filter" {
# node 10
action "branch.filter" {
uses = "actions/bin/filter@master"
args = "branch"
}
action "install" {
action "branch.install.node.10" {
needs = ["branch.filter"]
uses = "docker://node:10"
args = "yarn install"
}
action "build" {
action "branch.build.node.10" {
uses = "docker://node:10"
needs = ["install"]
needs = ["branch.install.node.10"]
args = "yarn run build"
}
action "lint" {
action "branch.lint.node.10" {
uses = "docker://node:10"
needs = ["install"]
needs = ["branch.install.node.10"]
args = "yarn run lint"
}
action "test" {
action "branch.test.node.10" {
uses = "docker://node:10"
needs = ["build"]
needs = ["branch.build.node.10"]
args = "yarn run test"
}
workflow "release" {
# node 8
action "branch.install.node.8" {
needs = ["branch.filter"]
uses = "docker://node:8"
args = "yarn install"
}
action "branch.build.node.8" {
uses = "docker://node:8"
needs = ["branch.install.node.8"]
args = "yarn run build"
}
action "branch.test.node.8" {
uses = "docker://node:8"
needs = ["branch.build.node.8"]
args = "yarn run test"
}
# @todo node 12
# action "branch.install.node.12" {
# needs = ["branch.filter"]
# uses = "docker://node:12"
# args = "yarn install"
# }
# action "branch.build.node.12" {
# uses = "docker://node:12"
# needs = ["branch.install.node.12"]
# args = "yarn run build"
# }
# action "branch.test.node.12" {
# uses = "docker://node:12"
# needs = ["branch.build.node.12"]
# args = "yarn run test"
# }
################################################
# Workflow for a Pull request
################################################
workflow "build and test on PR" {
resolves = [
"github-release",
"release:lint",
"pr.lint.node.10",
"pr.test.node.10",
"pr.test.node.8",
# "pr.test.node.12"
]
on = "pull_request"
}
# node 10
action "pr.filter" {
uses = "actions/bin/filter@master"
args = "action 'opened|synchronize|reopened'"
}
action "pr.install.node.10" {
needs = ["pr.filter"]
uses = "docker://node:10"
args = "yarn install"
}
action "pr.build.node.10" {
uses = "docker://node:10"
needs = ["pr.install.node.10"]
args = "yarn run build"
}
action "pr.lint.node.10" {
uses = "docker://node:10"
needs = ["pr.install.node.10"]
args = "yarn run lint"
}
action "pr.test.node.10" {
uses = "docker://node:10"
needs = ["pr.build.node.10"]
args = "yarn run test"
}
# node 8
action "pr.install.node.8" {
needs = ["pr.filter"]
uses = "docker://node:8"
args = "yarn install"
}
action "pr.build.node.8" {
uses = "docker://node:8"
needs = ["pr.install.node.8"]
args = "yarn run build"
}
action "pr.test.node.8" {
uses = "docker://node:8"
needs = ["pr.build.node.8"]
args = "yarn run test"
}
# @todo node 12
# action "pr.install.node.12" {
# needs = ["pr.filter"]
# uses = "docker://node:12"
# args = "yarn install"
# }
# action "pr.build.node.12" {
# uses = "docker://node:12"
# needs = ["pr.install.node.12"]
# args = "yarn run build"
# }
# action "pr.test.node.12" {
# uses = "docker://node:12"
# needs = ["pr.build.node.12"]
# args = "yarn run test"
# }
################################################
# Workflow for a github release when a tag is
# pushed
################################################
workflow "github release" {
resolves = [
"release.github",
"release.lint",
]
on = "push"
}
action "release:tag-filter" {
action "release.filter" {
uses = "actions/bin/filter@master"
args = "tag v*"
}
action "release:install" {
action "release.install" {
uses = "docker://node:10"
needs = ["release:tag-filter"]
needs = ["release.filter"]
args = "yarn install"
}
action "release:build" {
action "release.build" {
uses = "docker://node:10"
needs = ["release:install"]
needs = ["release.install"]
args = "yarn run build"
}
action "release:lint" {
action "release.lint" {
uses = "docker://node:10"
needs = ["release:install"]
needs = ["release.install"]
args = "yarn run lint"
}
action "release:test" {
action "release.test" {
uses = "docker://node:10"
needs = ["release:build"]
needs = ["release.build"]
args = "yarn run test"
}
action "release:publish" {
needs = ["release:test"]
action "release.auth" {
needs = ["release.test"]
uses = "actions/bin/filter@master"
args = ["actor", "octocat", "torvalds"]
}
action "release.npm.publish" {
needs = ["release.auth"]
uses = "docker://node:10"
args = "sh scripts/publish.sh"
secrets = [
@@ -84,8 +220,8 @@ action "release:publish" {
}
}
action "github-release" {
needs = ["release:publish"]
action "release.github" {
needs = ["release.npm.publish"]
uses = "docker://node:10"
args = "sh scripts/github-release.sh"
secrets = [

View File

@@ -2,6 +2,41 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="0.1.4"></a>
## [0.1.4](https://github.com/verdaccio/ui/compare/v0.1.3...v0.1.4) (2019-05-04)
<a name="0.1.3"></a>
## [0.1.3](https://github.com/verdaccio/ui/compare/v0.1.2...v0.1.3) (2019-05-04)
<a name="0.1.2"></a>
## [0.1.2](https://github.com/verdaccio/ui/compare/v0.1.1...v0.1.2) (2019-04-28)
<a name="0.1.1"></a>
## [0.1.1](https://github.com/verdaccio/ui/compare/v0.1.0...v0.1.1) (2019-04-28)
### Bug Fixes
* version rendering issue. ([#38](https://github.com/verdaccio/ui/issues/38)) ([e8fd596](https://github.com/verdaccio/ui/commit/e8fd596))
<a name="0.1.0"></a>
# [0.1.0](https://github.com/verdaccio/ui/compare/v0.0.13...v0.1.0) (2019-04-26)
### Features
* accept primary color to be configured ([#36](https://github.com/verdaccio/ui/issues/36)) ([d6a8f55](https://github.com/verdaccio/ui/commit/d6a8f55))
<a name="0.0.13"></a>
## [0.0.13](https://github.com/verdaccio/ui/compare/v0.0.4...v0.0.13) (2019-04-13)

View File

@@ -3,26 +3,15 @@
# Version 4 UI Theme
[Verdaccio](https://verdaccio.org/) is a simple, **zero-config-required local private npm registry**.
No need for an entire database just to get started! Verdaccio comes out of the box with
**its own tiny database**, and the ability to proxy other registries (eg. npmjs.org),
caching the downloaded modules along the way.
For those looking to extend their storage capabilities, Verdaccio
**supports various community-made plugins to hook into services such as Amazon's s3,
Google Cloud Storage** or create your own plugin.
[Verdaccio](https://verdaccio.org/) UI is a [theme plugin](https://verdaccio.org/docs/en/dev-plugins#theme-plugin) build in React, Flow and Emotion. It uses Jest and Enzyme for Unit testing.
[![verdaccio (latest)](https://img.shields.io/npm/v/verdaccio/latest.svg)](https://www.npmjs.com/package/verdaccio)
[![verdaccio (next)](https://img.shields.io/npm/v/verdaccio/next.svg)](https://www.npmjs.com/package/verdaccio)
[![verdaccio (next)](http://img.shields.io/npm/dy/verdaccio.svg)](https://www.npmjs.com/package/verdaccio)
[![verdaccio (latest)](https://img.shields.io/npm/v/@verdaccio/ui-theme/latest.svg)](https://www.npmjs.com/package/verdaccio)
[![docker pulls](https://img.shields.io/docker/pulls/verdaccio/verdaccio.svg?maxAge=43200)](https://verdaccio.org/docs/en/docker.html)
[![backers](https://opencollective.com/verdaccio/tiers/backer/badge.svg?label=Backer&color=brightgreen)](https://opencollective.com/verdaccio)
[![stackshare](https://img.shields.io/badge/Follow%20on-StackShare-blue.svg?logo=stackshare&style=flat)](https://stackshare.io/verdaccio)
![circle ci status](https://circleci.com/gh/verdaccio/verdaccio.svg?style=shield&circle-token=:circle-token)
[![codecov](https://img.shields.io/codecov/c/github/verdaccio/verdaccio/master.svg)](https://codecov.io/gh/verdaccio/verdaccio)
[![discord](https://img.shields.io/discord/388674437219745793.svg)](http://chat.verdaccio.org/)
[![node](https://img.shields.io/node/v/verdaccio/latest.svg)](https://www.npmjs.com/package/verdaccio)
[![node](https://img.shields.io/node/v/@verdaccio/ui-theme/latest.svg)](https://www.npmjs.com/package/verdaccio)
![MIT](https://img.shields.io/github/license/mashape/apistatus.svg)
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/verdaccio/localized.svg)](https://crowdin.com/project/verdaccio)
@@ -30,11 +19,27 @@ Google Cloud Storage** or create your own plugin.
[![Twitter followers](https://img.shields.io/twitter/follow/verdaccio_npm.svg?style=social&label=Follow)](https://twitter.com/verdaccio_npm)
[![Github](https://img.shields.io/github/stars/verdaccio/verdaccio.svg?style=social&label=Stars)](https://github.com/verdaccio/verdaccio/stargazers)
đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§
## Contributing
**This is a maintenance branch, only bug fixing, minor changes or security updates**
We use `>=yarn@1.13.0`, keep on mind we use lock file.
For development run the following command, it will execute `webpack` and `verdaccio` to
```
yarn dev
```
The configuration file is located on `tools/_config.yaml`.
Run linting tooling and test to check your code is clean before commit.
```
yarn lint && yarn test
```
Remember we follow the [the Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0-beta.4/).
🤓 Feel free to participate in code reviews, let us know if you want to participate in this plugin.
đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§đźš§
## Open Collective Sponsors
@@ -63,7 +68,7 @@ This project exists thanks to all the people who contribute. [[Contribute](CONTR
[![contrubitors](https://opencollective.com/verdaccio/contributors.svg?width=890&button=true)](../../graphs/contributors)
### FAQ / Contact / Troubleshoot
### FAQ / Contact / Troubleshoot
If you have any issue you can try the following options, do no desist to ask or check our issues database, perhaps someone has asked already what you are looking for.

View File

@@ -6,7 +6,7 @@ module.exports = {
collectCoverage: true,
testEnvironment: 'jest-environment-jsdom-global',
testURL: 'http://localhost',
testRegex: '(test/unit/webui/.*\\.spec)\\.js',
testRegex: '(test/unit/.*\\.spec)\\.js',
setupFiles: [
'./test/unit/setup.js'
],
@@ -35,6 +35,7 @@ module.exports = {
'<rootDir>/build',
],
snapshotSerializers: [
'enzyme-to-json/serializer',
"jest-emotion"
],
coveragePathIgnorePatterns: [

View File

@@ -1,6 +1,6 @@
{
"name": "@verdaccio/ui-theme",
"version": "0.0.13",
"version": "0.1.4",
"description": "Verdaccio User Interface",
"author": {
"name": "Verdaccio Core Team"
@@ -28,6 +28,7 @@
"emotion": "9.2.12",
"enzyme": "3.9.0",
"enzyme-adapter-react-16": "1.10.0",
"enzyme-to-json": "3.3.5",
"eslint": "5.14.1",
"eslint-config-google": "0.12.0",
"eslint-config-prettier": "4.1.0",

View File

@@ -11,6 +11,8 @@ import ListItem from '@material-ui/core/ListItem/index';
import React from 'react';
import { DIST_TAGS } from '../../../lib/constants';
const NOT_AVAILABLE = 'Not available';
class Versions extends React.PureComponent<any> {
render() {
return (
@@ -32,7 +34,8 @@ class Versions extends React.PureComponent<any> {
<ListItem className={'version-item'} key={version}>
<ListItemText>{version}</ListItemText>
<Spacer />
<ListItemText>{isVersion && timeMap[version] ? `${formatDateDistance(timeMap[version])} ago` : packages[version]}</ListItemText>
{isVersion && <ListItemText>{timeMap[version] ? `${formatDateDistance(timeMap[version])} ago` : NOT_AVAILABLE}</ListItemText>}
{isVersion === false && <ListItemText>{packages[version]}</ListItemText>}
</ListItem>
))}
</List>

View File

@@ -3,7 +3,10 @@
*/
import { createBrowserHistory } from 'history';
import { getBaseNamePath } from './utils/url';
const history = createBrowserHistory();
const history = createBrowserHistory({
basename: getBaseNamePath(),
});
export default history;

View File

@@ -9,9 +9,12 @@
<link rel="icon" type="image/png" href="<%= htmlWebpackPlugin.options.verdaccioURL %>/-/static/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script>
window.__VERDACCIO_BASENAME_UI_OPTIONS = JSON.parse('<%= htmlWebpackPlugin.options.__UI_OPTIONS %>');
window.VERDACCIO_BASENAME = '<%= htmlWebpackPlugin.options.basename %>';
window.VERDACCIO_API_URL = '<%= htmlWebpackPlugin.options.verdaccioURL %>/-/verdaccio/';
window.VERDACCIO_SCOPE = '<%= htmlWebpackPlugin.options.scope %>';
window.VERDACCIO_LOGO = '<%= htmlWebpackPlugin.options.logo %>';
window.VERDACCIO_PRIMARY_COLOR = '<%= htmlWebpackPlugin.options.primary_color %>';
window.VERDACCIO_VERSION = '<%= htmlWebpackPlugin.options.version_app %>';
</script>
</head>

View File

@@ -30,7 +30,7 @@ const colors = {
// Main colors
// -------------------------
primary: '#4b5e40',
primary: window.VERDACCIO_PRIMARY_COLOR || '#4b5e40',
secondary: '#20232a',
};

View File

@@ -2,3 +2,11 @@ export function getRegistryURL() {
// Don't add slash if it's not a sub directory
return `${location.origin}${location.pathname === '/' ? '' : location.pathname}`;
}
export function getBaseNamePath() {
return window.__VERDACCIO_BASENAME_UI_OPTIONS.url_prefix;
}
export function getRootPath() {
return window.__VERDACCIO_BASENAME_UI_OPTIONS.base;
}

View File

@@ -1,5 +0,0 @@
import path from 'path';
export const parseConfigurationFile = (name) => {
return path.join(__dirname, `./partials/config/yaml/${name}.yaml`);
};

View File

@@ -1,11 +1,11 @@
import React from 'react';
import { mount } from 'enzyme';
import storage from '../../../src/webui/utils/storage';
import App from '../../../src/webui/app';
import storage from '../../src/webui/utils/storage';
import App from '../../src/webui/app';
import { generateTokenWithTimeRange } from './components/__mocks__/token';
jest.mock('../../../src/webui/utils/storage', () => {
jest.mock('../../src/webui/utils/storage', () => {
class LocalStorageMock {
constructor() {
this.store = {};
@@ -26,7 +26,7 @@ jest.mock('../../../src/webui/utils/storage', () => {
return new LocalStorageMock();
});
jest.mock('../../../src/webui/utils/api', () => ({
jest.mock('../../src/webui/utils/api', () => ({
request: require('./components/__mocks__/api').default.request
}));
@@ -36,7 +36,7 @@ describe('App', () => {
beforeEach(() => {
wrapper = mount(<App />);
});
test('toggleLoginModal: should toggle the value in state', () => {
const { handleToggleLoginModal } = wrapper.instance();
expect(wrapper.state().showLoginModal).toBeFalsy();

View File

@@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<NotFound /> component should load the component in default state 1`] = `ShallowWrapper {}`;
exports[`<NotFound /> component should load the component in default state 1`] = `<withRouter(WithTheme(WithWidth(NotFound))) />`;

File diff suppressed because one or more lines are too long

View File

@@ -6,8 +6,8 @@
import React from 'react';
import { shallow } from 'enzyme';
import CopyToClipBoard from '../../../../src/webui/components/CopyToClipBoard';
import { CopyIcon } from '../../../../src/webui/components/CopyToClipBoard/styles';
import CopyToClipBoard from '../../../src/webui/components/CopyToClipBoard/index';
import { CopyIcon } from '../../../src/webui/components/CopyToClipBoard/styles';
describe('<CopyToClipBoard /> component', () => {
let wrapper;

View File

@@ -2,9 +2,9 @@
import React from 'react';
import { mount } from 'enzyme';
import Footer from '../../../../src/webui/components/Footer/index';
import Footer from '../../../src/webui/components/Footer/index';
jest.mock('../../../../package.json', () => ({
jest.mock('../../../package.json', () => ({
version: '4.0.0-alpha.3'
}));

View File

@@ -6,7 +6,7 @@
import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import { shallow } from 'enzyme';
import Header from '../../../../src/webui/components/Header';
import Header from '../../../src/webui/components/Header/index';
describe('<Header /> component with logged in state', () => {
let wrapper;

View File

@@ -3,7 +3,7 @@
*/
import React from 'react';
import { shallow } from 'enzyme';
import Help from '../../../../src/webui/components/Help/index';
import Help from '../../../src/webui/components/Help/index';
describe('<Help /> component', () => {

View File

@@ -6,7 +6,7 @@
import React from 'react';
import { mount } from 'enzyme';
import LoginModal from '../../../../src/webui/components/Login';
import LoginModal from '../../../src/webui/components/Login/index';
const eventUsername = {
target: {

View File

@@ -4,7 +4,7 @@
import React from 'react';
import { shallow, mount } from 'enzyme';
import NoItems from '../../../../src/webui/components/NoItems/index';
import NoItems from '../../../src/webui/components/NoItems/index';
console.error = jest.fn();

View File

@@ -5,7 +5,7 @@
import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import { shallow } from 'enzyme';
import NotFound from '../../../../src/webui/components/NotFound/index';
import NotFound from '../../../src/webui/components/NotFound/index';
console.error = jest.fn();

View File

@@ -4,9 +4,9 @@
import React from 'react';
import { shallow } from 'enzyme';
import Package from '../../../../src/webui/components/Package/index';
import Tag from '../../../../src/webui/components/Tag/index';
import { Version, WrapperLink, Field, OverviewItem } from '../../../../src/webui/components/Package/styles';
import Package from '../../../src/webui/components/Package/index';
import Tag from '../../../src/webui/components/Tag/index';
import { Version, WrapperLink, Field, OverviewItem } from '../../../src/webui/components/Package/styles';
/**

View File

@@ -4,8 +4,8 @@
import React from 'react';
import { mount } from 'enzyme';
import PackageList from '../../../../src/webui/components/PackageList/index';
import Help from '../../../../src/webui/components/Help/index';
import PackageList from '../../../src/webui/components/PackageList/index';
import Help from '../../../src/webui/components/Help/index';
import { BrowserRouter } from 'react-router-dom';
describe('<PackageList /> component', () => {

View File

@@ -4,7 +4,7 @@
import React from 'react';
import { shallow, mount } from 'enzyme';
import Readme from '../../../../src/webui/components/Readme/index';
import Readme from '../../../src/webui/components/Readme/index';
describe('<Readme /> component', () => {
test('should load the component in default state', () => {

View File

@@ -6,11 +6,11 @@
import React from 'react';
import { mount } from 'enzyme';
import { Search } from '../../../../src/webui/components/Search/index';
import { Search } from '../../../src/webui/components/Search/index';
const SEARCH_FILE_PATH = '../../../../src/webui/components/Search/index';
const API_FILE_PATH = '../../../../src/webui/utils/api';
const URL_FILE_PATH = '../../../../src/webui/utils/url';
const SEARCH_FILE_PATH = '../../../src/webui/components/Search/index';
const API_FILE_PATH = '../../../src/webui/utils/api';
const URL_FILE_PATH = '../../../src/webui/utils/url';
// Global mocks
const event = {

View File

@@ -1,4 +1,4 @@
import {API_ERROR} from '../../../../../src/lib/constants';
import {API_ERROR} from '../../../../src/lib/constants';
/**
* API mock for login endpoint
* @param {object} config configuration of api call

View File

@@ -10,6 +10,7 @@ import Adapter from 'enzyme-adapter-react-16';
configure({ adapter: new Adapter() });
global.__APP_VERSION__ = '1.0.0';
global.__VERDACCIO_BASENAME_UI_OPTIONS = {};
// mocking few DOM methods
if (global.document) {

View File

@@ -1,4 +1,4 @@
import { isTokenExpire, makeLogin } from '../../../../src/webui/utils/login';
import { isTokenExpire, makeLogin } from '../../../src/webui/utils/login';
import {
generateTokenWithTimeRange,

View File

@@ -5,7 +5,7 @@ import {
formatDateDistance,
getLastUpdatedPackageTime,
getRecentReleases
} from '../../../../src/webui/utils/package';
} from '../../../src/webui/utils/package';
import { packageMeta } from '../components/store/packageMeta';
@@ -52,13 +52,21 @@ describe('formatDate', () => {
describe('formatDateDistance', () => {
test('should calculate the distance', () => {
const dateAboutTwoMonthsAgo = () => {
const date = new Date();
date.setMonth(date.getMonth() - 1);
date.setDate(date.getDay() - 20);
return date;
};
const dateTwoMonthsAgo = () => {
const date = new Date();
date.setMonth(date.getMonth() - 2);
return date;
};
const date = dateTwoMonthsAgo();
expect(formatDateDistance(date)).toEqual('about 2 months');
const date1 = dateAboutTwoMonthsAgo();
const date2 = dateTwoMonthsAgo();
expect(formatDateDistance(date1)).toEqual('about 2 months');
expect(formatDateDistance(date2)).toEqual('2 months');
});
});

File diff suppressed because one or more lines are too long

View File

@@ -7,6 +7,7 @@ module.exports = {
output: {
path: `${env.APP_ROOT}/static/`,
filename: '[name].[hash].js',
// FIXME: do we need this?
publicPath: 'ToReplaceByVerdaccio/-/static',
},

View File

@@ -45,8 +45,11 @@ const prodConf = {
}),
new HTMLWebpackPlugin({
title: 'ToReplaceByTitle',
__UI_OPTIONS: 'ToReplaceByVerdaccioUI',
scope: 'ToReplaceByScope',
basename: 'ToReplaceByPrefix',
logo: 'ToReplaceByLogo',
primary_color: 'ToReplaceByPrimaryColor',
filename: 'index.html',
favicon: `${env.SRC_ROOT}/webui/template/favicon.ico`,
verdaccioURL: 'ToReplaceByVerdaccio',

View File

@@ -4771,6 +4771,13 @@ enzyme-adapter-utils@^1.10.0:
prop-types "^15.7.2"
semver "^5.6.0"
enzyme-to-json@3.3.5:
version "3.3.5"
resolved "https://registry.verdaccio.org/enzyme-to-json/-/enzyme-to-json-3.3.5.tgz#f8eb82bd3d5941c9d8bc6fd9140030777d17d0af"
integrity sha512-DmH1wJ68HyPqKSYXdQqB33ZotwfUhwQZW3IGXaNXgR69Iodaoj8TF/D9RjLdz4pEhGq2Tx2zwNUIjBuqoZeTgA==
dependencies:
lodash "^4.17.4"
enzyme@3.9.0:
version "3.9.0"
resolved "https://registry.npmjs.org/enzyme/-/enzyme-3.9.0.tgz#2b491f06ca966eb56b6510068c7894a7e0be3909"