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

fix: remove dependency on nps-utils #822

Merged
merged 4 commits into from Feb 1, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -46,7 +46,7 @@ jobs:
apt-get install -y p7zip-full \
osslsigncode \
nsis
- run: yarn exec nps test
- run: yarn test
- store_test_results:
path: /root/project/cli/reports
node-devcli: &node-devcli
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,13 @@

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.

### [2.4.2](https://github.com/oclif/oclif/compare/v2.4.1...v2.4.2) (2022-02-01)


### Bug Fixes

* remove IManifest ([#823](https://github.com/oclif/oclif/issues/823)) ([31f1f07](https://github.com/oclif/oclif/commit/31f1f07480d4f59db45da35ff0926bc44665cc6f))

### [2.4.1](https://github.com/oclif/oclif/compare/v2.4.0...v2.4.1) (2022-01-31)


Expand Down
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -146,7 +146,7 @@ DESCRIPTION
This will clone the template repo 'oclif/hello-world' and update package properties
```

_See code: [src/commands/generate.ts](https://github.com/oclif/oclif/blob/v2.4.0/src/commands/generate.ts)_
_See code: [src/commands/generate.ts](https://github.com/oclif/oclif/blob/v2.4.1/src/commands/generate.ts)_

## `oclif generate command NAME`

Expand Down Expand Up @@ -220,7 +220,7 @@ DESCRIPTION
generates plugin manifest json
```

_See code: [src/commands/manifest.ts](https://github.com/oclif/oclif/blob/v2.4.0/src/commands/manifest.ts)_
_See code: [src/commands/manifest.ts](https://github.com/oclif/oclif/blob/v2.4.1/src/commands/manifest.ts)_

## `oclif pack deb`

Expand Down Expand Up @@ -321,7 +321,7 @@ DESCRIPTION
promote CLI builds to a S3 release channel
```

_See code: [src/commands/promote.ts](https://github.com/oclif/oclif/blob/v2.4.0/src/commands/promote.ts)_
_See code: [src/commands/promote.ts](https://github.com/oclif/oclif/blob/v2.4.1/src/commands/promote.ts)_

## `oclif readme`

Expand Down Expand Up @@ -351,7 +351,7 @@ DESCRIPTION
Customize the code URL prefix by setting oclif.repositoryPrefix in package.json.
```

_See code: [src/commands/readme.ts](https://github.com/oclif/oclif/blob/v2.4.0/src/commands/readme.ts)_
_See code: [src/commands/readme.ts](https://github.com/oclif/oclif/blob/v2.4.1/src/commands/readme.ts)_

## `oclif upload deb`

Expand Down
51 changes: 33 additions & 18 deletions package-scripts.js
@@ -1,51 +1,66 @@
const {
concurrent,
series,
setColors,
mkdirp,
} = require('nps-utils')
const script = (script, description) => description ? {script, description} : {script}
const _ = require('lodash')
const sh = require('shelljs')
const path = require('path')
const {execSync} = require('child_process')

let hasYarn = false
try {
execSync('yarn -v', {stdio: 'ignore'})
hasYarn = true
} catch {}

const pkgManager = hasYarn ? 'yarn' : 'npm run'

sh.set('-e')

setColors(['dim'])
const objectValuesToString = o => {
if (_.isString(o)) {
return o
}

const m = Object.entries(o).map(([, v]) => v)
return m.join(' && ')
}

process.env.TEST_SERIES = '1'
const testTypes = ['', 'integration']
const tests = testTypes.map(cmd => {
const testTypes = ['commands']
const tests = testTypes.map(type => {
const {silent} = sh.config
sh.config.silent = true
const mocha = 'mocha --forbid-only'
const base = cmd === 'integration' ? path.join('test', cmd) : path.join('test/commands', cmd)
const base = path.join('test', 'commands')
sh.pushd(base)
let tests = _(sh.ls())
.map(t => [t.split('.')[0], path.join(base, t)])
.map(([t, s]) => [t, process.env.CIRCLECI ? `MOCHA_FILE=reports/mocha-${t}.xml ${mocha} --reporter mocha-junit-reporter ${s}` : `${mocha} ${s}`])
.map(([t, s]) => {
const mochaString = process.env.CIRCLECI ? `MOCHA_FILE=reports/mocha-${t}.xml ${mocha} --reporter mocha-junit-reporter ${s}` : `${mocha} ${s}`
const concurrentlyString = `node node_modules/concurrently/dist/bin/concurrently.js --kill-others-on-fail --prefix-colors "dim" --prefix "[{name}]" --names "${type}"`
return [t, `${concurrentlyString} "${mochaString}"`]
})

sh.popd()
tests = process.env.TEST_SERIES === '1' ?
series(...tests.map(t => t[1]).value()) :
concurrent(tests.fromPairs().value())
tests.map(t => t[1]).join(' && ') :
tests.fromPairs().value()
if (process.env.CIRCLECI) {
tests = series(mkdirp('reports'), tests)
tests = `${pkgManager} mkdirp reports && ${objectValuesToString(tests)}`
}

sh.config.silent = silent
return [cmd, series('nps build', tests)]
return [type, `${pkgManager} build && ${objectValuesToString(tests)}`]
})

module.exports = {
scripts: {
build: 'shx rm -rf lib && tsc',
lint: {
// default: concurrent.nps('lint.eslint', 'lint.tsc'),
default: concurrent.nps('lint.tsc'),
default: 'node node_modules/concurrently/dist/bin/concurrently.js --kill-others-on-fail --prefix-colors "dim" --prefix "[{name}]" --names "lint.tsc" \'nps lint.tsc\'',
// eslint: script('eslint . --ext .ts --config .eslintrc', 'lint js & ts files'),
tsc: script('tsc --noEmit', 'syntax check with tsc'),
},
test: Object.assign({
default: series.nps(...testTypes.map(t => `test.${t}`)),
default: testTypes.map(t => `nps test.${t}`).join(' && '),
}, Object.fromEntries(tests)),
},
}
12 changes: 7 additions & 5 deletions package.json
@@ -1,25 +1,25 @@
{
"name": "oclif",
"description": "oclif: create your own CLI",
"version": "2.4.1",
"version": "2.4.2",
"author": "Salesforce",
"bin": {
"oclif": "bin/run"
},
"bugs": "https://github.com/oclif/oclif/issues",
"dependencies": {
"@oclif/core": "^1.2.0",
"@oclif/core": "^1.3.0",
"@oclif/plugin-help": "^5.1.10",
"@oclif/plugin-not-found": "^2.2.4",
"@oclif/plugin-warn-if-update-available": "^2.0.4",
"aws-sdk": "^2.1064.0",
"concurrently": "^7.0.0",
"debug": "^4.3.3",
"find-yarn-workspace-root": "^2.0.0",
"fs-extra": "^8.1",
"github-slugger": "^1.2.1",
"lodash": "^4.17.11",
"normalize-package-data": "^3.0.3",
"nps-utils": "^1.7.0",
"qqjs": "^0.3.10",
"semver": "^7.3.5",
"tslib": "^2.3.1",
Expand Down Expand Up @@ -125,13 +125,15 @@
"scripts": {
"build": "shx rm -rf lib && tsc",
"devcli:lint": "eslint . --ext .ts --config .eslintrc",
"devcli:test": "mocha --forbid-only \"test/*.test.ts\"",
"devcli:test": "mocha --forbid-only \"test/unit/*.test.ts\"",
"devcli": "yarn build --noEmit && yarn run devcli:test && yarn run devcli:lint",
"lint": "nps lint",
"postpack": "shx rm .oclif.manifest.json",
"posttest": "yarn run lint",
"prepack": "shx rm -rf lib && tsc && bin/dev manifest .",
"test": "nps test",
"test": "nps test && yarn test:unit && yarn test:integration",
"test:integration": "mocha --forbid-only \"test/integration/*.test.ts\"",
"test:unit": "mocha --forbid-only \"test/unit/*.test.ts\"",
"version": "bin/dev readme && git add README.md"
},
"publishConfig": {
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
@@ -1,2 +1 @@
export {run} from '@oclif/core'
export {IManifest} from './tarballs'
4 changes: 2 additions & 2 deletions src/tarballs/build.ts
Expand Up @@ -6,7 +6,7 @@ import * as qq from 'qqjs'
import {log} from '../log'

import {writeBinScripts} from './bin'
import {BuildConfig, IManifest} from './config'
import {BuildConfig} from './config'
import {fetchNodeBinary} from './node'
import {commitAWSDir, templateShortKey} from '../upload-util'

Expand Down Expand Up @@ -123,7 +123,7 @@ export async function build(c: BuildConfig, options: {
const gzCloudKey = `${commitAWSDir(config.version, c.gitSha, c.updateConfig.s3)}/${gzLocalKey}`
const xzCloudKey = `${commitAWSDir(config.version, c.gitSha, c.updateConfig.s3)}/${xzLocalKey}`

const manifest: IManifest = {
const manifest: Interfaces.S3Manifest = {
rollout: rollout === false ? undefined : rollout,
version: config.version,
sha: c.gitSha,
Expand Down
15 changes: 0 additions & 15 deletions src/tarballs/config.ts
Expand Up @@ -30,21 +30,6 @@ export interface BuildConfig {
dist(input: string): string;
}

export interface IManifest {
version: string;
sha: string;
gz: string;
xz?: string;
sha256gz: string;
sha256xz?: string;
baseDir: string;
rollout?: number;
node: {
compatible: string;
recommended: string;
};
}

export async function gitSha(cwd: string, options: {short?: boolean} = {}): Promise<string> {
const args = options.short ? ['rev-parse', '--short', 'HEAD'] : ['rev-parse', 'HEAD']
return qq.x.stdout('git', args, {cwd})
Expand Down
File renamed without changes.
File renamed without changes.