Skip to content

Commit

Permalink
fix: rename stuff again
Browse files Browse the repository at this point in the history
  • Loading branch information
jrolfs committed Aug 6, 2019
1 parent f956e14 commit 875e614
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@hover/hvr-scripts",
"name": "@hover/javascript",
"version": "0.0.0-semantically-released",
"description": "CLI toolbox for common scripts for JavaScript + TypeScript projects",
"engines": {
"node": ">= 8",
"npm": ">= 5"
},
"bin": {
"hvr-scripts": "dist/index.js"
"hover-scripts": "dist/index.js"
},
"scripts": {
"test": "node src test",
Expand Down Expand Up @@ -108,12 +108,12 @@
],
"repository": {
"type": "git",
"url": "https://github.com/hoverinc/hvr-scripts.git"
"url": "https://github.com/hoverinc/hover-javascript.git"
},
"bugs": {
"url": "https://github.com/hoverinc/hvr-scripts/issues"
"url": "https://github.com/hoverinc/hover-javascript/issues"
},
"homepage": "https://github.com/hoverinc/hvr-scripts#readme",
"homepage": "https://github.com/hoverinc/hover-javascript#readme",
"devDependencies": {
"jest-in-case": "^1.0.2",
"slash": "^3.0.0"
Expand Down
12 changes: 6 additions & 6 deletions src/__tests__/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ test('appDirectory is the dirname to the package.json', () => {
expect(require('../utils').appDirectory).toBe(pkgPath)
})

test('resolveHvrScripts resolves to src/index.js when in the hvr-scripts package', () => {
mockPkg({package: {name: '@hover/hvr-scripts'}})
expect(require('../utils').resolveHvrScripts()).toBe(
test('resolveHoverScripts resolves to src/index.js when in the @hover/javascript package', () => {
mockPkg({package: {name: '@hover/javascript'}})
expect(require('../utils').resolveHoverScripts()).toBe(
require.resolve('../').replace(process.cwd(), '.'),
)
})

test('resolveHvrScripts resolves to hvr-scripts if not in the kcd-scripts package', () => {
mockPkg({package: {name: 'not-hvr-scripts'}})
test('resolveHoverScripts resolves to "hover-scripts" if not in the @hover/javascript package', () => {
mockPkg({package: {name: 'not-@nover/javascript'}})
whichSyncMock.mockImplementationOnce(() => require.resolve('../'))
expect(require('../utils').resolveHvrScripts()).toBe('hvr-scripts')
expect(require('../utils').resolveHoverScripts()).toBe('hover-scripts')
})

test(`resolveBin resolves to the full path when it's not in $PATH`, () => {
Expand Down
4 changes: 2 additions & 2 deletions src/config/lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const {resolveHvrScripts, resolveBin, isOptedOut} = require('../utils')
const {resolveHoverScripts, resolveBin, isOptedOut} = require('../utils')

const kcdScripts = resolveHvrScripts()
const kcdScripts = resolveHoverScripts()
const doctoc = resolveBin('doctoc')

module.exports = {
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
let shouldThrow
try {
shouldThrow =
require(`${process.cwd()}/package.json`).name === '@hover/hvr-scripts' &&
require(`${process.cwd()}/package.json`).name === '@hover/javascript' &&
Number(process.version.slice(1).split('.')[0]) < 8
} catch (error) {
// ignore
}

if (shouldThrow) {
throw new Error(
'You must use Node version 8 or greater to run the scripts within hvr-scripts ' +
'You must use Node version 8 or greater to run the scripts within @hover/javascript ' +
'because we dogfood the untranspiled version of the scripts.',
)
}
Expand Down
8 changes: 4 additions & 4 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ const {package: pkg, path: pkgPath} = readPkgUp.sync({
})
const appDirectory = path.dirname(pkgPath)

function resolveHvrScripts() {
if (pkg.name === '@hover/hvr-scripts') {
function resolveHoverScripts() {
if (pkg.name === '@hover/javascript') {
return require.resolve('./').replace(process.cwd(), '.')
}
return resolveBin('hvr-scripts')
return resolveBin('hover-scripts')
}

// eslint-disable-next-line complexity
Expand Down Expand Up @@ -187,7 +187,7 @@ module.exports = {
parseEnv,
pkg,
resolveBin,
resolveHvrScripts,
resolveHoverScripts,
uniq,
writeExtraEntry,
}

0 comments on commit 875e614

Please sign in to comment.