Skip to content

Commit

Permalink
feat: transfer repo from x-orpheus (#41)
Browse files Browse the repository at this point in the history
* feat: transfer repo from x-orpheus

* refactor: rename svrx-util to @svrx/util

* refactor: rename svrx-cli to @svrx/cli

* refactor: rename svrx to @svrx/svrx

* fix(local): fix version sort

* build(ci): limit deploy branch

* chore(release): publish v1.0.0
  • Loading branch information
xuchaoying authored Sep 23, 2019
1 parent 09d3af0 commit 4c033c2
Show file tree
Hide file tree
Showing 14 changed files with 885 additions and 879 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ deploy:
on:
node: "10"
tags: true
all_branches: true
condition: ${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH} =~ ^release\/.*$
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 x-orpheus
Copyright (c) 2019 svrxjs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# svrx-cli
# @svrx/cli

CLI tool for svrx.

## Install

```shell
npm install -g svrx-cli
npm install -g @svrx/cli
```

## Documentation

You can read documentation [here](https://svrx.gitbook.io/docs/).
You can read documentation [here](https://docs.svrx.io/).
4 changes: 2 additions & 2 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"npmClient": "npm",
"changelog": {
"repo": "x-orpheus/svrx-cli",
"repo": "svrxjs/svrx-cli",
"labels": {
"PR: new feature": ":rocket: New Feature",
"PR: breaking change": ":boom: Breaking Change",
Expand All @@ -28,5 +28,5 @@
]
}
},
"version": "0.0.8"
"version": "1.0.0"
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@
"dependencies": {},
"repository": {
"type": "git",
"url": "git+https://github.com/x-orpheus/svrx-cli.git"
"url": "git+https://github.com/svrxjs/svrx-cli.git"
},
"keywords": [
"svrx",
"cli",
"mock",
"dev-server"
],
"author": "x-orpheus",
"author": "svrxjs",
"license": "MIT",
"bugs": {
"url": "https://github.com/x-orpheus/svrx-cli/issues"
"url": "https://github.com/svrxjs/svrx-cli/issues"
},
"homepage": "https://svrx.gitbook.io/docs/"
"homepage": "https://svrx.io/"
}
6 changes: 3 additions & 3 deletions packages/svrx-cli/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# svrx-cli
# @svrx/cli

CLI tool for svrx.

## Install

```shell
npm install -g svrx-cli
npm install -g svrx/cli
```

## Documentation

You can read documentation [here](https://svrx.gitbook.io/docs/).
You can read documentation [here](https://docs.svrx.io/).
4 changes: 2 additions & 2 deletions packages/svrx-cli/bin/svrx.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/* eslint-disable no-console */
const parse = require('yargs-parser');
const { logger } = require('svrx-util');
const { logger } = require('@svrx/util');
const updateNotifier = require('update-notifier');
const pkg = require('../package.json');
const Manager = require('../lib');
Expand Down Expand Up @@ -122,7 +122,7 @@ const help = async (cmd) => {
console.log(
''.padEnd(PAD_START),
'-v, --version'.padEnd(PAD_END),
'Version info of svrx-cli and currently used svrx',
'Version info of cli and currently used svrx',
);
console.log(
''.padEnd(PAD_START),
Expand Down
2 changes: 1 addition & 1 deletion packages/svrx-cli/lib/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const userHome = require('user-home');
const path = require('path');
const mkdirp = require('mkdirp');
const { rcFileRead } = require('svrx-util');
const { rcFileRead } = require('@svrx/util');

class Config {
constructor() {
Expand Down
2 changes: 1 addition & 1 deletion packages/svrx-cli/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// const path = require('path');
const { logger } = require('svrx-util');
const { logger } = require('@svrx/util');
const config = require('./config');
const local = require('./local');
const registry = require('./registry');
Expand Down
3 changes: 2 additions & 1 deletion packages/svrx-cli/lib/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const getVersions = (versionsRoot) => {
module.exports = {
getLatestVersion: (versionsRoot) => {
const versions = getVersions(versionsRoot);
versions.sort((v1, v2) => semver.lt(v1, v2));
versions.sort((v1, v2) => (semver.lt(v1, v2) ? 1 : -1));

const noBetaVersions = versions.filter((v) => v.indexOf('-') === -1);
if (noBetaVersions.length > 0) return noBetaVersions[0];
return versions.length > 0 ? versions[0] : null;
Expand Down
10 changes: 5 additions & 5 deletions packages/svrx-cli/lib/registry.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('path');
const { npm, logger } = require('svrx-util');
const { npm, logger } = require('@svrx/util');
const _ = require('lodash');
const tmp = require('tmp');
const fs = require('fs-extra');
Expand All @@ -10,7 +10,7 @@ const local = require('./local');
const getVersions = async () => {
const spinner = logger.progress('Searching versions...');
try {
const result = await npm.view(['svrx', 'versions']);
const result = await npm.view(['@svrx/svrx', 'versions']);
if (spinner) spinner();
return _.chain(result)
.values()
Expand All @@ -26,7 +26,7 @@ const getVersions = async () => {
const getTags = async () => {
const spinner = logger.progress('Searching tags...');
try {
const result = await npm.view(['svrx', 'dist-tags']);
const result = await npm.view(['@svrx/svrx', 'dist-tags']);
if (spinner) spinner();
return _.chain(result)
.values()
Expand Down Expand Up @@ -78,7 +78,7 @@ const getInstallTask = async ({ version, versionsRoot }) => {
const tmpObj = tmp.dirSync();
const tmpPath = tmpObj.name;
const options = {
name: 'svrx',
name: '@svrx/svrx',
version: installVersion,
path: tmpPath,
npmLoad: {
Expand All @@ -88,7 +88,7 @@ const getInstallTask = async ({ version, versionsRoot }) => {
};

const result = await npm.install(options);
const svrxRoot = path.resolve(tmpPath, 'node_modules/svrx');
const svrxRoot = path.resolve(tmpPath, 'node_modules/@svrx/svrx');
const destFolder = path.resolve(versionsRoot, result.version);
const destFolderDependency = path.resolve(versionsRoot, result.version, 'node_modules');

Expand Down
Loading

0 comments on commit 4c033c2

Please sign in to comment.