Skip to content

Commit

Permalink
fix: oclif rename
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 13, 2018
1 parent 4c10f9e commit e26b62e
Show file tree
Hide file tree
Showing 15 changed files with 148 additions and 168 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
- image: node:latest
working_directory: ~/cli
environment:
NYC: "yarn exec nyc -- --nycrc-path node_modules/@anycli/nyc-config/.nycrc"
NYC: "yarn exec nyc -- --nycrc-path node_modules/@oclif/nyc-config/.nycrc"
MOCHA_FILE: "reports/mocha.xml"
steps:
- checkout
Expand All @@ -15,7 +15,7 @@ jobs:
- v1-yarn-{{checksum ".circleci/config.yml"}}-{{ checksum "yarn.lock"}}
- v1-yarn-{{checksum ".circleci/config.yml"}}
- run: .circleci/greenkeeper
- run: yarn add -D nyc@11 @anycli/nyc-config@0 mocha-junit-reporter@1 @commitlint/cli@6 @commitlint/config-conventional@6
- run: yarn add -D nyc@11 @oclif/nyc-config@0 mocha-junit-reporter@1 @commitlint/cli@6 @commitlint/config-conventional@6
# - run: ./bin/run --help
- run: |
mkdir -p reports
Expand All @@ -35,11 +35,11 @@ jobs:
- add_ssh_keys
- checkout
- restore_cache: *restore_cache
- run: yarn global add @anycli/semantic-release@1 semantic-release@12
- run: yarn global add @oclif/semantic-release@1 semantic-release@12
- run: yarn --frozen-lockfile
- run: |
export PATH=/usr/local/share/.config/yarn/global/node_modules/.bin:$PATH
semantic-release -e @anycli/semantic-release
semantic-release -e @oclif/semantic-release
- save_cache:
key: v1-yarn-{{checksum ".circleci/config.yml"}}-{{checksum "yarn.lock"}}
paths:
Expand All @@ -49,7 +49,7 @@ jobs:

workflows:
version: 2
"@anycli/plugin-plugins":
"@oclif/plugin-plugins":
jobs:
- node-latest
- node-8
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "anycli"
"extends": "oclif"
}
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
@anycli/plugin-plugins
@oclif/plugin-plugins
======================

plugins plugin for anycli
plugins plugin for oclif

[![Version](https://img.shields.io/npm/v/@anycli/plugin-plugins.svg)](https://npmjs.org/package/@anycli/plugin-plugins)
[![CircleCI](https://circleci.com/gh/anycli/plugin-plugins/tree/master.svg?style=svg)](https://circleci.com/gh/anycli/plugin-plugins/tree/master)
[![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/anycli/plugin-plugins?branch=master&svg=true)](https://ci.appveyor.com/project/heroku/plugin-plugins/branch/master)
[![Codecov](https://codecov.io/gh/anycli/plugin-plugins/branch/master/graph/badge.svg)](https://codecov.io/gh/anycli/plugin-plugins)
[![Greenkeeper](https://badges.greenkeeper.io/anycli/plugin-plugins.svg)](https://greenkeeper.io/)
[![Known Vulnerabilities](https://snyk.io/test/npm/@anycli/plugin-plugins/badge.svg)](https://snyk.io/test/npm/@anycli/plugin-plugins)
[![Downloads/week](https://img.shields.io/npm/dw/@anycli/plugin-plugins.svg)](https://npmjs.org/package/@anycli/plugin-plugins)
[![License](https://img.shields.io/npm/l/@anycli/plugin-plugins.svg)](https://github.com/anycli/plugin-plugins/blob/master/package.json)
[![Version](https://img.shields.io/npm/v/@oclif/plugin-plugins.svg)](https://npmjs.org/package/@oclif/plugin-plugins)
[![CircleCI](https://circleci.com/gh/oclif/plugin-plugins/tree/master.svg?style=svg)](https://circleci.com/gh/oclif/plugin-plugins/tree/master)
[![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/oclif/plugin-plugins?branch=master&svg=true)](https://ci.appveyor.com/project/heroku/plugin-plugins/branch/master)
[![Codecov](https://codecov.io/gh/oclif/plugin-plugins/branch/master/graph/badge.svg)](https://codecov.io/gh/oclif/plugin-plugins)
[![Greenkeeper](https://badges.greenkeeper.io/oclif/plugin-plugins.svg)](https://greenkeeper.io/)
[![Known Vulnerabilities](https://snyk.io/test/npm/@oclif/plugin-plugins/badge.svg)](https://snyk.io/test/npm/@oclif/plugin-plugins)
[![Downloads/week](https://img.shields.io/npm/dw/@oclif/plugin-plugins.svg)](https://npmjs.org/package/@oclif/plugin-plugins)
[![License](https://img.shields.io/npm/l/@oclif/plugin-plugins.svg)](https://github.com/oclif/plugin-plugins/blob/master/package.json)
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ cache:

install:
- ps: Install-Product node $env:nodejs_version x64
- yarn add -D nyc@11 @anycli/nyc-config@0
- yarn add -D nyc@11 @oclif/nyc-config@0
test_script:
- .\bin\run --help
- .\node_modules\.bin\nyc --nycrc-path node_modules/@anycli/nyc-config/.nycrc yarn test
- .\node_modules\.bin\nyc --nycrc-path node_modules/@oclif/nyc-config/.nycrc yarn test
after_test:
- .\node_modules\.bin\nyc --nycrc-path node_modules/@anycli/nyc-config/.nycrc report --reporter text-lcov > coverage.lcov
- .\node_modules\.bin\nyc --nycrc-path node_modules/@oclif/nyc-config/.nycrc report --reporter text-lcov > coverage.lcov
- ps: |
$env:PATH = 'C:\msys64\usr\bin;' + $env:PATH
Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh
Expand Down
4 changes: 2 additions & 2 deletions bin/run
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node

require('@anycli/command').run()
.catch(require('@anycli/errors/handle'))
require('@oclif/command').run()
.catch(require('@oclif/errors/handle'))
42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"name": "@anycli/plugin-plugins",
"description": "plugins plugin for anycli",
"name": "@oclif/plugin-plugins",
"description": "plugins plugin for oclif",
"version": "0.2.16",
"author": "Jeff Dickey @jdxcode",
"anycli": {
"oclif": {
"commands": "./lib/commands",
"scope": "heroku-cli",
"devPlugins": [
"@anycli/plugin-help"
"@oclif/plugin-help"
]
},
"bugs": "https://github.com/anycli/plugin-plugins/issues",
"bugs": "https://github.com/oclif/plugin-plugins/issues",
"dependencies": {
"@anycli/command": "^1.2.18",
"@oclif/command": "^1.2.19",
"@heroku-cli/color": "^1.1.3",
"chalk": "^2.3.0",
"cli-ux": "^3.3.18",
"chalk": "^2.3.1",
"cli-ux": "^3.3.19",
"debug": "^3.1.0",
"fs-extra": "^5.0.0",
"http-call": "^5.0.2",
Expand All @@ -26,17 +26,17 @@
"yarn": "^1.3.2"
},
"devDependencies": {
"@anycli/config": "^1.3.41",
"@anycli/dev-cli": "^0.3.8",
"@anycli/errors": "^0.2.1",
"@anycli/plugin-help": "^0.7.1",
"@anycli/test": "^0.10.15",
"@anycli/tslint": "^0.2.7",
"@oclif/config": "^1.3.45",
"@oclif/dev-cli": "^0.3.10",
"@oclif/errors": "^0.2.2",
"@oclif/plugin-help": "^0.7.2",
"@oclif/test": "^0.10.15",
"@oclif/tslint": "^0.2.7",
"@types/chai": "^4.1.2",
"@types/fs-extra": "^5.0.0",
"@types/load-json-file": "^2.0.7",
"@types/mocha": "^2.2.48",
"@types/node": "^9.4.1",
"@types/node": "^9.4.5",
"@types/semver": "^5.5.0",
"@types/supports-color": "^3.1.0",
"chai": "^4.1.2",
Expand All @@ -51,22 +51,22 @@
"node": ">=8.0.0"
},
"files": [
".anycli.manifest.json",
".oclif.manifest.json",
"/lib"
],
"homepage": "https://github.com/anycli/plugin-plugins",
"homepage": "https://github.com/oclif/plugin-plugins",
"keywords": [
"anycli-plugin"
"oclif-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"repository": "anycli/plugin-plugins",
"repository": "oclif/plugin-plugins",
"scripts": {
"build": "rm -rf lib && tsc",
"lint": "concurrently -p command \"tsc -p test --noEmit\" \"tslint -p test\"",
"postpublish": "rm .anycli.manifest.json",
"postpublish": "rm .oclif.manifest.json",
"posttest": "yarn run lint",
"prepublishOnly": "yarn run build && anycli-dev manifest",
"prepublishOnly": "yarn run build && oclif-dev manifest",
"test": "mocha --forbid-only \"test/**/*.test.ts\""
},
"types": "lib/index.d.ts"
Expand Down
2 changes: 1 addition & 1 deletion src/commands/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Command, flags} from '@anycli/command'
import {Command, flags} from '@oclif/command'
import color from '@heroku-cli/color'

import Plugins from '../../plugins'
Expand Down
10 changes: 5 additions & 5 deletions src/commands/plugins/install.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Command} from '@anycli/command'
import {Command} from '@oclif/command'
import chalk from 'chalk'
import cli from 'cli-ux'

Expand All @@ -7,10 +7,10 @@ import Plugins from '../../plugins'
// let examplePlugin = 'heroku-production-status'
// let bin = 'heroku'
// const g = global as any
// if (g.anycli && g.anycli.config) {
// const config = g.anycli.config
// if (g.oclif && g.oclif.config) {
// const config = g.oclif.config
// bin = config.bin
// let pjson = config.pjson.anycli || config.pjson['cli-engine']
// let pjson = config.pjson.oclif || config.pjson['cli-engine']
// if (pjson.help && pjson.help.plugins) {
// examplePlugin = Object.keys(pjson.help.plugins)[0]
// }
Expand All @@ -19,7 +19,7 @@ import Plugins from '../../plugins'
export default class PluginsInstall extends Command {
static description = 'installs a plugin into the CLI'
static usage = 'plugins:install PLUGIN...'
static examples = ['$ <%= config.bin %> plugins:install <%- config.pjson.anycli.examplePlugin || "heroku-production-status" %> ']
static examples = ['$ <%= config.bin %> plugins:install <%- config.pjson.oclif.examplePlugin || "heroku-production-status" %> ']
static strict = false
static args = [{name: 'plugin', description: 'plugin to install', required: true}]

Expand Down
8 changes: 4 additions & 4 deletions src/commands/plugins/uninstall.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {Command} from '@anycli/command'
import {Command} from '@oclif/command'
import cli from 'cli-ux'

import Plugins from '../../plugins'

let examplePlugin = 'heroku-production-status'
let bin = 'heroku'
const g = global as any
if (g.anycli && g.anycli.config) {
const config = g.anycli.config
if (g.oclif && g.oclif.config) {
const config = g.oclif.config
bin = config.bin
let pjson = config.pjson.anycli || config.pjson['cli-engine']
let pjson = config.pjson.oclif || config.pjson['cli-engine']
if (pjson.help && pjson.help.plugins) {
examplePlugin = Object.keys(pjson.help.plugins)[0]
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/plugins/update.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Command} from '@anycli/command'
import {Command} from '@oclif/command'

import Plugins from '../../plugins'

Expand Down
26 changes: 13 additions & 13 deletions src/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Config from '@anycli/config'
import * as Config from '@oclif/config'
import cli from 'cli-ux'
import * as fs from 'fs'
import * as fse from 'fs-extra'
Expand All @@ -10,25 +10,25 @@ import * as semver from 'semver'
import {uniq, uniqWith} from './util'
import Yarn from './yarn'

const initPJSON: Config.PJSON.User = {private: true, anycli: {schema: 1, plugins: []}, dependencies: {}}
const initPJSON: Config.PJSON.User = {private: true, oclif: {schema: 1, plugins: []}, dependencies: {}}

export default class Plugins {
readonly yarn: Yarn
private readonly debug: any

constructor(public config: Config.IConfig) {
this.yarn = new Yarn({config, cwd: this.config.dataDir})
this.debug = require('debug')('@anycli/plugins')
this.debug = require('debug')('@oclif/plugins')
}

async pjson(): Promise<Config.PJSON.User> {
try {
const pjson: Config.PJSON = await loadJSON(this.pjsonPath)
return {
...initPJSON,
anycli: {
...initPJSON.anycli,
...pjson.anycli,
oclif: {
...initPJSON.oclif,
...pjson.oclif,
},
dependencies: {},
...pjson,
Expand All @@ -42,7 +42,7 @@ export default class Plugins {

async list() {
const pjson = await this.pjson()
return this.normalizePlugins(pjson.anycli.plugins)
return this.normalizePlugins(pjson.oclif.plugins)
}

async install(name: string, tag = 'latest') {
Expand All @@ -67,14 +67,14 @@ export default class Plugins {

async add(plugin: Config.PJSON.PluginTypes) {
const pjson = await this.pjson()
pjson.anycli.plugins = uniq([...pjson.anycli.plugins || [], plugin]) as any
pjson.oclif.plugins = uniq([...pjson.oclif.plugins || [], plugin]) as any
await this.savePJSON(pjson)
}

async remove(name: string) {
const pjson = await this.pjson()
if (pjson.dependencies) delete pjson.dependencies[name]
pjson.anycli.plugins = this.normalizePlugins(pjson.anycli.plugins)
pjson.oclif.plugins = this.normalizePlugins(pjson.oclif.plugins)
.filter(p => p.name !== name)
await this.savePJSON(pjson)
}
Expand Down Expand Up @@ -114,13 +114,13 @@ export default class Plugins {

unfriendlyName(name: string): string | undefined {
if (name.includes('@')) return
const scope = this.config.pjson.anycli.scope
const scope = this.config.pjson.oclif.scope
if (!scope) return
return `@${scope}/plugin-${name}`
}

friendlyName(name: string): string {
const scope = this.config.pjson.anycli.scope
const scope = this.config.pjson.oclif.scope
if (!scope) return name
const match = name.match(`@${scope}/plugin-(.+)`)
if (!match) return name
Expand Down Expand Up @@ -154,12 +154,12 @@ export default class Plugins {
}

private async savePJSON(pjson: Config.PJSON.User) {
pjson.anycli.plugins = this.normalizePlugins(pjson.anycli.plugins)
pjson.oclif.plugins = this.normalizePlugins(pjson.oclif.plugins)
const fs: typeof fse = require('fs-extra')
await fs.outputJSON(this.pjsonPath, pjson, {spaces: 2})
}

private normalizePlugins(input: Config.PJSON.User['anycli']['plugins']) {
private normalizePlugins(input: Config.PJSON.User['oclif']['plugins']) {
let plugins = (input || []).map(p => {
if (typeof p === 'string') {
return {name: p, type: 'user', tag: 'latest'} as Config.PJSON.PluginTypes.User
Expand Down
2 changes: 1 addition & 1 deletion src/yarn.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {IConfig} from '@anycli/config'
import {IConfig} from '@oclif/config'
import * as path from 'path'

const debug = require('debug')('cli:yarn')
Expand Down
4 changes: 2 additions & 2 deletions test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Config from '@anycli/config'
import * as Fancy from '@anycli/test'
import * as Config from '@oclif/config'
import * as Fancy from '@oclif/test'
import * as fs from 'fs-extra'

export const test = Fancy.test
Expand Down
2 changes: 1 addition & 1 deletion tslint.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "@anycli/tslint"
"extends": "@oclif/tslint"
}
Loading

0 comments on commit e26b62e

Please sign in to comment.