-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove unnecessary semicolons so the build passes. I broke it so I figured I would fix it. <3
- Loading branch information
1 parent
1191e28
commit bb09432
Showing
5 changed files
with
150 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
const Path = require('path'); | ||
const FS = require('fs-extra'); | ||
const Path = require('path') | ||
const FS = require('fs-extra') | ||
|
||
module.exports = function (options, done) { | ||
var source = Path.resolve(options.input, 'node_modules'); | ||
var source = Path.resolve(options.input, 'node_modules') | ||
var destination = Path.resolve(options.directory, | ||
'bundle/programs/server/node_modules' | ||
); | ||
) | ||
|
||
FS.readdir(source, function (err) { | ||
if (err && err.code === 'ENOENT') return done(); | ||
if (err) return done(err); | ||
if (err && err.code === 'ENOENT') return done() | ||
if (err) return done(err) | ||
|
||
FS.copy(source, destination, done); | ||
}); | ||
}; | ||
FS.copy(source, destination, done) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
const FS = require('fs'); | ||
const Path = require('path'); | ||
const Exec = require('./exec'); | ||
const FS = require('fs') | ||
const Path = require('path') | ||
const Exec = require('./exec') | ||
|
||
module.exports = function (options, done) { | ||
var pkgPath = Path.resolve(options.input, 'package.json'); | ||
var pkgPath = Path.resolve(options.input, 'package.json') | ||
|
||
FS.access(pkgPath, FS.F_OK, function (err) { | ||
var args, install; | ||
var args, install | ||
|
||
if (err) return done(); | ||
if (err) return done() | ||
|
||
args = ['install', '--production']; | ||
args = ['install', '--production'] | ||
|
||
install = Exec.spawn('npm', args, { cwd: options.input, stdio: 'inherit' }); | ||
install = Exec.spawn('npm', args, { cwd: options.input, stdio: 'inherit' }) | ||
|
||
install.on('error', function (err) { | ||
return done(err); | ||
}); | ||
return done(err) | ||
}) | ||
|
||
install.on('close', function (code) { | ||
if (code !== 0) return done(new Error('NPM install failed.')); | ||
done(); | ||
}); | ||
}); | ||
}; | ||
if (code !== 0) return done(new Error('NPM install failed.')) | ||
done() | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,91 @@ | ||
const Path = require('path'); | ||
const Code = require('code'); | ||
const Lab = require('lab'); | ||
const Proxyquire = require('proxyquire'); | ||
const Sinon = require('sinon'); | ||
const Path = require('path') | ||
const Code = require('code') | ||
const Lab = require('lab') | ||
const Proxyquire = require('proxyquire') | ||
const Sinon = require('sinon') | ||
|
||
const FsStub = { readdir: Sinon.stub(), copy: Sinon.stub() }; | ||
const FsStub = { readdir: Sinon.stub(), copy: Sinon.stub() } | ||
const CopyDependencies = Proxyquire('../lib/copy-dependencies', { | ||
'fs-extra': FsStub | ||
}); | ||
}) | ||
|
||
var lab = exports.lab = Lab.script(); | ||
var lab = exports.lab = Lab.script() | ||
|
||
var describe = lab.describe; | ||
var beforeEach = lab.beforeEach; | ||
var afterEach = lab.afterEach; | ||
var it = lab.it; | ||
var expect = Code.expect; | ||
var describe = lab.describe | ||
var beforeEach = lab.beforeEach | ||
var afterEach = lab.afterEach | ||
var it = lab.it | ||
var expect = Code.expect | ||
|
||
describe('move-dependencies', function () { | ||
var directory = Path.resolve(__dirname, '.demeteorized'); | ||
var options = { input: __dirname, directory: directory }; | ||
var directory = Path.resolve(__dirname, '.demeteorized') | ||
var options = { input: __dirname, directory: directory } | ||
|
||
beforeEach(function (done) { | ||
done(); | ||
}); | ||
done() | ||
}) | ||
|
||
afterEach(function (done) { | ||
FsStub.readdir.reset(); | ||
FsStub.copy.reset(); | ||
done(); | ||
}); | ||
FsStub.readdir.reset() | ||
FsStub.copy.reset() | ||
done() | ||
}) | ||
|
||
it('exports a function', function (done) { | ||
expect(CopyDependencies).to.be.a.function(); | ||
done(); | ||
}); | ||
expect(CopyDependencies).to.be.a.function() | ||
done() | ||
}) | ||
|
||
describe('node_modules directory', function () { | ||
describe('directory does not exist', function () { | ||
beforeEach(function (done) { | ||
FsStub.readdir.yields({ code: 'ENOENT' }); | ||
done(); | ||
}); | ||
FsStub.readdir.yields({ code: 'ENOENT' }) | ||
done() | ||
}) | ||
|
||
it('exists early when directory does not exist', function (done) { | ||
CopyDependencies(options, function (err) { | ||
expect(err).to.not.exist(); | ||
expect(FsStub.copy.called).to.be.false(); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
expect(err).to.not.exist() | ||
expect(FsStub.copy.called).to.be.false() | ||
done() | ||
}) | ||
}) | ||
}) | ||
|
||
describe('error reading directory', function () { | ||
beforeEach(function (done) { | ||
FsStub.readdir.yields(new Error('fs error')); | ||
done(); | ||
}); | ||
FsStub.readdir.yields(new Error('fs error')) | ||
done() | ||
}) | ||
|
||
it('returns error when reading node_modules directory', function (done) { | ||
CopyDependencies(options, function (err) { | ||
expect(err.message).to.equal('fs error'); | ||
expect(FsStub.copy.called).to.be.false(); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
expect(err.message).to.equal('fs error') | ||
expect(FsStub.copy.called).to.be.false() | ||
done() | ||
}) | ||
}) | ||
}) | ||
|
||
describe('copying directory', function () { | ||
beforeEach(function (done) { | ||
FsStub.readdir.yields(); | ||
FsStub.copy.yields(); | ||
done(); | ||
}); | ||
FsStub.readdir.yields() | ||
FsStub.copy.yields() | ||
done() | ||
}) | ||
|
||
it('copies node_modules into demeteorized application', function (done) { | ||
var source = Path.resolve(options.input, 'node_modules'); | ||
var source = Path.resolve(options.input, 'node_modules') | ||
var destination = Path.resolve(options.directory, | ||
'bundle/programs/server/node_modules' | ||
); | ||
) | ||
|
||
CopyDependencies(options, function (err) { | ||
expect(err).to.not.exist(); | ||
expect(FsStub.copy.calledWith(source, destination)).to.be.true(); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
expect(err).to.not.exist() | ||
expect(FsStub.copy.calledWith(source, destination)).to.be.true() | ||
done() | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.