Skip to content

Commit

Permalink
chore: Move lib/ to src/
Browse files Browse the repository at this point in the history
  • Loading branch information
q2s2t committed Nov 2, 2018
1 parent 908b4f7 commit d4dc90d
Show file tree
Hide file tree
Showing 21 changed files with 36 additions and 37 deletions.
5 changes: 3 additions & 2 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Code quality:
Implement `standard`
Code coverage 100 %
Implement `standard` @done(18-11-02 15:53)
Code coverage 100 % @done(18-11-02 15:52)
✔ Tests file naming and test naming conventions @done(18-09-29 09:28)
☐ Windows testing on AppVeyor
☐ https://conventionalcommits.org
Expand Down Expand Up @@ -56,3 +56,4 @@ Documentation:
☐ Hack to use delete() command (delete is a JS reserved word)
☐ use `cherryPick` as argument name for clarity
☐ list and rename doesn't output progress percentage (upstream behaviour)
☐ Only support recent versions of 7z
20 changes: 10 additions & 10 deletions index/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// @TODO is default as required?
export { default as add } from '../lib/add'
export { default as benchmark } from '../lib/benchmark'
export { default as delete } from '../lib/delete'
export { default as extract } from '../lib/extract'
export { default as extractFull } from '../lib/extractFull'
export { default as hash } from '../lib/hash'
export { default as list } from '../lib/list'
export { default as rename } from '../lib/rename'
export { default as test } from '../lib/test'
export { default as update } from '../lib/update'
export { default as add } from '../src/add'
export { default as benchmark } from '../src/benchmark'
export { default as delete } from '../src/delete'
export { default as extract } from '../src/extract'
export { default as extractFull } from '../src/extractFull'
export { default as hash } from '../src/hash'
export { default as list } from '../src/list'
export { default as rename } from '../src/rename'
export { default as test } from '../src/test'
export { default as update } from '../src/update'
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion lib/regexp.js → src/regexp.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export const BODY_PROGRESS = /^ *(?<percent>\d+)% ?(?<fileCount>\d+)? ?(?<file>.
export const BODY_SYMBOL_FILE = /^(?<symbol>[=TU+R.-]) (?<file>.+)$/
export const BODY_HASH = /^(?<hash>\S+)? +(?<size>\d*) +(?<file>.+)$/
export const END_OF_STAGE_HYPHEN = /^(-+ +)+-+$/
// @TODO put all regexp in here
export const INFOS = /^(?<property>.+?)(?<separator>( = )|(: +))(?<value>.+)$/
export const INFOS_SPLIT = /, +# /
export const ERR_ONE_LINE = /ERROR: (?<message>.*)\n/
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/func/add.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global describe, it */
import { expect } from 'chai'
import { copyFileSync, existsSync, statSync } from 'fs'
import { add } from '../../lib/commands.js'
import { add } from '../../src/commands.js'

const mockDir = './test/_mock'
const tmpDir = './test/_tmp'
Expand Down
2 changes: 1 addition & 1 deletion test/func/extract.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global describe, it */
import { expect } from 'chai'
import { copyFileSync, readdirSync } from 'fs'
import { extract } from '../../lib/commands.js'
import { extract } from '../../src/commands.js'

const mockDir = './test/_mock'
const tmpDir = './test/_tmp'
Expand Down
2 changes: 1 addition & 1 deletion test/func/extractFull.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global describe, it */
import { expect } from 'chai'
import { copyFileSync } from 'fs'
import { extractFull } from '../../lib/commands.js'
import { extractFull } from '../../src/commands.js'
import readdirRecursiveSync from 'fs-readdir-recursive'

const mockDir = './test/_mock'
Expand Down
20 changes: 9 additions & 11 deletions test/func/hash.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global describe, it */
import { expect } from 'chai'
import { hash } from '../../lib/commands.js'
import { hash } from '../../src/commands.js'

const mockDir = './test/_mock'

Expand Down Expand Up @@ -54,14 +54,13 @@ describe('Functional: hash()', function () {

it('should hash the right values', function (done) {
const seven = hash([`${mockDir}/DirExt/sub1/`], { r: true })
const hashesKnown = [ { hash: undefined, size: NaN, file: 'sub1' },
{ hash: 'FEDC304F', size: 9, file: 'sub1/sub1.txt' },
{ hash: 'FEDC304F', size: 9, file: 'sub1/sub1.not' },
{ hash: 'FEDC304F', size: 9, file: 'sub1/sub1.md' } ]
let hashes = []
seven.on('data', (d) => hashes.push(d))
seven.on('end', function () {
expect(hashes).to.deep.equal(hashesKnown)
expect(hashes).to.deep.include({ hash: undefined, size: NaN, file: 'sub1' })
expect(hashes).to.deep.include({ hash: 'FEDC304F', size: 9, file: 'sub1/sub1.txt' })
expect(hashes).to.deep.include({ hash: 'FEDC304F', size: 9, file: 'sub1/sub1.not' })
expect(hashes).to.deep.include({ hash: 'FEDC304F', size: 9, file: 'sub1/sub1.md' })
expect(seven.info.get('CRC32 for data and names')).to.equal('2363C80A')
done()
})
Expand Down Expand Up @@ -99,14 +98,13 @@ describe('Functional: hash()', function () {
r: true,
$path: `${mockDir}/Seven Zip`
})
const hashesKnown = [ { hash: undefined, size: NaN, file: 'sub1' },
{ hash: 'FEDC304F', size: 9, file: 'sub1/sub1.txt' },
{ hash: 'FEDC304F', size: 9, file: 'sub1/sub1.not' },
{ hash: 'FEDC304F', size: 9, file: 'sub1/sub1.md' } ]
let hashes = []
seven.on('data', (d) => hashes.push(d))
seven.on('end', function () {
expect(hashes).to.deep.equal(hashesKnown)
expect(hashes).to.deep.include({ hash: undefined, size: NaN, file: 'sub1' })
expect(hashes).to.deep.include({ hash: 'FEDC304F', size: 9, file: 'sub1/sub1.txt' })
expect(hashes).to.deep.include({ hash: 'FEDC304F', size: 9, file: 'sub1/sub1.not' })
expect(hashes).to.deep.include({ hash: 'FEDC304F', size: 9, file: 'sub1/sub1.md' })
expect(seven.info.get('CRC32 for data and names')).to.equal('2363C80A')
done()
})
Expand Down
2 changes: 1 addition & 1 deletion test/func/list.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global describe, it */
import { expect } from 'chai'
import { copyFileSync } from 'fs'
import { list } from '../../lib/commands.js'
import { list } from '../../src/commands.js'

const mockDir = './test/_mock'
const tmpDir = './test/_tmp'
Expand Down
2 changes: 1 addition & 1 deletion test/func/remove.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global describe, it */
import { expect } from 'chai'
import { copyFileSync, statSync } from 'fs'
import { remove as del } from '../../lib/commands.js'
import { remove as del } from '../../src/commands.js'

const mockDir = './test/_mock'
const tmpDir = './test/_tmp'
Expand Down
2 changes: 1 addition & 1 deletion test/func/rename.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global describe, it */
import { expect } from 'chai'
import { rename } from '../../lib/commands.js'
import { rename } from '../../src/commands.js'
import { copyFileSync } from 'fs'

const mockDir = './test/_mock'
Expand Down
2 changes: 1 addition & 1 deletion test/func/test.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global describe, it */
import { expect } from 'chai'
import { copyFileSync } from 'fs'
import { test } from '../../lib/commands.js'
import { test } from '../../src/commands.js'

const mockDir = './test/_mock'
const tmpDir = './test/_tmp'
Expand Down
2 changes: 1 addition & 1 deletion test/func/update.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global describe, it */
import { expect } from 'chai'
import { copyFileSync } from 'fs'
import { update } from '../../lib/commands.js'
import { update } from '../../src/commands.js'

const mockDir = './test/_mock'
const tmpDir = './test/_tmp'
Expand Down
7 changes: 4 additions & 3 deletions test/unit/parser.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* global describe, it */
import { expect } from 'chai'
import { matchBodyProgress, matchBodySymbol, matchBodyHash, matchEndOfHeadersHyphen, matchInfos, matchEndOfHeadersSymbol, matchEndOfBodySymbol, matchEndOfBodyHyphen, matchBodyList } from '../../lib/parser.js'
import { STAGE_HEADERS } from '../../lib/references.js'
import { SevenZipStream } from '../../lib/stream.js'
import { matchBodyProgress, matchBodySymbol, matchBodyHash, matchEndOfHeadersHyphen, matchInfos, matchEndOfHeadersSymbol, matchEndOfBodySymbol, matchEndOfBodyHyphen, matchBodyList } from '../../src/parser.js'
import { STAGE_HEADERS } from '../../src/references.js'
import { SevenZipStream } from '../../src/stream.js'

describe('Unit: parser.js', function () {
describe('matchInfos()', function () {
Expand Down Expand Up @@ -289,6 +289,7 @@ describe('Unit: parser.js', function () {
const r = matchBodyHash({}, ' DirExt/sub1/sub1.txt')
expect(r).to.be.an('object')
expect(r['hash']).to.equal(undefined)
/* eslint-disable-next-line */
expect(r['size']).to.be.NaN
expect(r['file']).to.equal('DirExt/sub1/sub1.txt')
})
Expand Down
2 changes: 1 addition & 1 deletion test/unit/special.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global describe, it */
import { expect } from 'chai'
import { transformBinToString, transformSpecialArrayToArgs } from '../../lib/special.js'
import { transformBinToString, transformSpecialArrayToArgs } from '../../src/special.js'

describe('Unit: special.js', function () {
it('should works with the `$raw` special switch', function () {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/switches.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global describe, it */
import { expect } from 'chai'
import { transformSwitchesToArgs } from '../../lib/switches.js'
import { transformSwitchesToArgs } from '../../src/switches.js'

describe('Unit: switches.js', function () {
it('Should return deflaut flags with no args', function () {
Expand Down

0 comments on commit d4dc90d

Please sign in to comment.