Skip to content

Commit d1a00d1

Browse files
author
Oskar Karlsson
committed
refactor(util): Moved util.js in to the src folder
We want to precompile all js files with babel and for simplicity we should keep all source files in the same folder. The test are using `util` but I can't see any real problems with having the tests importing a file inside the src folder
1 parent 9c561ac commit d1a00d1

File tree

11 files changed

+13
-14
lines changed

11 files changed

+13
-14
lines changed

src/cli/parsers/commitizen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import minimist from 'minimist';
22

3-
import { isString, isArray } from '../../../common/util';
3+
import { isString, isArray } from '../../common/util';
44

55
export {
66
parse

src/cli/parsers/git-cz.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import minimist from 'minimist';
22

3-
import { isString, isArray } from '../../../common/util';
3+
import { isString, isArray } from '../../common/util';
44

55
export {
66
parse

src/cli/strategies/git-cz.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import fs from 'fs';
22
import path from 'path';
33
import sh from 'shelljs';
44
import inquirer from 'inquirer';
5-
import {getParsedPackageJsonFromPath} from '../../../common/util';
5+
import {getParsedPackageJsonFromPath} from '../../common/util';
66
import {gitCz as gitCzParser, commitizen as commitizenParser} from '../parsers';
77
import {commit, staging, adapter} from '../../commitizen';
88
import {addPath} from '../../git';

src/commitizen/adapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from 'path';
22
import fs from 'fs';
33
import findNodeModules from 'find-node-modules';
44

5-
import {isFunction} from '../../common/util';
5+
import {isFunction} from '../common/util';
66

77
export {
88
addPathToAdapterConfig,

src/commitizen/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from 'path';
22
import * as configLoader from './configLoader';
3-
import {executeShellCommand} from '../../common/util';
3+
import {executeShellCommand} from '../common/util';
44
import * as adapter from './adapter';
55

66
let {

src/commitizen/staging.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import git from 'gulp-git';
2-
import {isString} from '../../common/util';
2+
import {isString} from '../common/util';
33

44
export {isClean};
55

common/util.js renamed to src/common/util.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export {
1616
*/
1717
function executeShellCommand(sh, path, installCommand) {
1818
sh.cd(path);
19-
sh.exec(installCommand);
19+
sh.exec(installCommand);
2020
}
2121

2222
/**
@@ -53,7 +53,7 @@ function isArray(arr) {
5353
}
5454

5555
/**
56-
* Test if the passed argument is a function
56+
* Test if the passed argument is a function
5757
*/
5858
function isFunction(functionToCheck) {
5959
if(typeof functionToCheck === "undefined")
@@ -63,7 +63,7 @@ function isFunction(functionToCheck) {
6363
return false;
6464
} else {
6565
var getType = {};
66-
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
66+
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
6767
}
6868
}
6969

@@ -80,4 +80,3 @@ function isString(str) {
8080
return Object.prototype.toString.call(str) == '[object String]';
8181
}
8282
}
83-

src/git/commit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import git from 'gulp-git';
22
import gulp from 'gulp';
33
import dedent from 'dedent';
4-
import {isString} from '../../common/util';
4+
import {isString} from '../common/util';
55

66
export { commit };
77

test/tester.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as repo from './tools/repo';
22
import * as clean from './tools/clean';
33
import * as files from './tools/files';
4-
import * as util from '../common/util';
4+
import * as util from '../src/common/util';
55
import {config as userConfig} from './config';
66
import * as sh from 'shelljs'; // local instance
77
import _ from 'lodash';

test/tests/adapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import fs from 'fs';
77
// in the short term
88
import {adapter, init as commitizenInit} from '../../src/commitizen';
99

10-
import {isFunction} from '../../common/util';
10+
import {isFunction} from '../../src/common/util';
1111

1212
// Bootstrap our tester
1313
import {bootstrap} from '../tester';

0 commit comments

Comments
 (0)