Skip to content

Commit

Permalink
fix: example and vulnerabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
mattc41190 committed Jul 26, 2020
1 parent 8f32ac6 commit 072dcc7
Show file tree
Hide file tree
Showing 6 changed files with 1,949 additions and 836 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ npm install --save-dev gulp-surge
Then, require it in your Gulpfile and add it as a task:

```js
var surge = require('gulp-surge')
const surge = require('gulp-surge')

gulp.task('deploy', [], function () {
const deploy = () => {
return surge({
project: './build', // Path to your static build directory
domain: 'example.surge.sh' // Your domain or Surge subdomain
})
})
}
```

## License
Expand Down
36 changes: 19 additions & 17 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
var gulp = require('gulp')
var surge = require('./')
var mocha = require('gulp-mocha')
var standard = require('gulp-standard')
const {src, parallel} = require('gulp')
const surge = require('./')
const mocha = require('gulp-mocha')
const standard = require('gulp-standard')

gulp.task('default', ['test', 'deploy', 'lint'])
const lint = () => {
return src(['./index.js', './test/**/*.js'])
.pipe(standard())
.pipe(standard.reporter('default', {
breakOnError: false
}))
}

gulp.task('test', function () {
return gulp.src('./test/**/*.js', { read: false })
const test = () => {
return src('./test/**/*.js', { read: false })
.pipe(mocha({ timeout: 1000 }))
})
}

gulp.task('deploy', [], function () {
const deploy = () => {
return surge({
project: './test/fixtures/gulp-test-1.surge.sh',
domain: 'gulp-test-1.surge.sh'
})
})
}

gulp.task('lint', [], function () {
return gulp.src(['./index.js', './test/**/*.js'])
.pipe(standard())
.pipe(standard.reporter('default', {
breakOnError: false
}))
})
tasks = [lint, test, deploy]

exports.default = parallel(...tasks)
16 changes: 9 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
'use strict'

// var gutil = require('gulp-util')
var spawn = require('child_process').spawn
var path = require('path')
// var surge = require('surge')
var surge = path.resolve(path.dirname(require.resolve('surge')), '../../.bin/surge' + (process.platform === 'win32' ? '.cmd' : ''))
const spawn = require('child_process').spawn
const path = require('path')

module.exports = function (options) {
return spawn(surge, [options.project, options.domain], { stdio: 'inherit' })
const surge = path.resolve(
path.dirname(require.resolve('surge')),
'../../.bin/surge' + (process.platform === 'win32' ? '.cmd' : '')
)

module.exports = (options) => {
spawn(surge, [options.project, options.domain], { stdio: 'inherit' })
}
Loading

0 comments on commit 072dcc7

Please sign in to comment.