Skip to content
Permalink
Browse files

fix(node 8): remove dependency asyncawait, it was causing installatio…

…n issues in windows
  • Loading branch information
jyounce committed Nov 1, 2017
1 parent 31a0874 commit f40c686f9266b8719ebe0de97f1b08b635f1395c
Showing with 141 additions and 110 deletions.
  1. +0 −15 package-lock.json
  2. +0 −2 package.json
  3. +22 −16 scripts/bump/bump.coffee
  4. +18 −14 scripts/lib/create-lib.coffee
  5. +11 −7 scripts/lib/unpack-lib-server.coffee
  6. +12 −12 scripts/utils/env.coffee
  7. +78 −44 scripts/utils/lib.coffee

Some generated files are not rendered by default. Learn more.

@@ -47,14 +47,12 @@
"npm-uninstall-server": "cd src/src/server/ && npm uninstall `ls -1 node_modules | tr '/\n' ' '` --no-save && rm -rf node_modules && cd ../../../"
},
"devDependencies": {
"bluebird": "3.5.1",
"conventional-changelog": "1.1.6",
"prepend-file": "1.3.1",
"ps-node": "0.1.6",
"request": "2.83.0"
},
"dependencies": {
"asyncawait": "1.0.6",
"babel-core": "6.26.0",
"babel-preset-es2015": "6.24.1",
"bower": "1.8.2",
@@ -1,11 +1,9 @@
# BUMP VERSIONS THEN RUN CHANGELOG
# ================================
module.exports = (rbRoot, version) ->
async = require 'asyncawait/async'
await = require 'asyncawait/await'
Promise = require 'bluebird'
fse = Promise.promisifyAll require 'fs-extra'
exec = Promise.promisify require('child_process').exec
q = require 'q'
fse = require 'fs-extra'
execSync = require('child_process').execSync
jsonFormat = spaces: '\t'

paths =
@@ -26,28 +24,36 @@ module.exports = (rbRoot, version) ->

# tasks
# =====
tasks =
api =
bumpPkg: (pkgName, file) ->
pkg = pkgs[pkgName]
pkgPath = paths.pkgs[pkgName]
pkg.version = version
fse.writeJsonAsync(pkgPath, pkg, jsonFormat).then ->
fse.writeJson(pkgPath, pkg, jsonFormat).then ->
console.log "bumped #{file}".info

changelog: ->
cmd = "coffee #{paths.changelog}"
exec(cmd).then (result) ->
console.log result.info
try stdout = execSync cmd
catch e then throw e
msg = stdout.toString()
console.log msg.info
q msg

# run tasks (in order)
# ====================
runTasks = async ->
await tasks.bumpPkg 'rb', 'package.json'
await tasks.bumpPkg 'rbLock', 'package-lock.json'
await tasks.bumpPkg 'src', 'src server package.json'
await tasks.bumpPkg 'srcLock', 'src server package-lock.json'
await tasks.bumpPkg 'test', 'test package.json'
await tasks.changelog()
runTasks = -> # sync
defer = q.defer()
tasks = [
-> api.bumpPkg 'rb', 'package.json'
-> api.bumpPkg 'rbLock', 'package-lock.json'
-> api.bumpPkg 'src', 'src server package.json'
-> api.bumpPkg 'srcLock', 'src server package-lock.json'
-> api.bumpPkg 'test', 'test package.json'
-> api.changelog()
]
tasks.reduce(q.when, q()).done -> defer.resolve()
defer.promise

# run it!
# =======
@@ -1,24 +1,28 @@
# CREATE LIB
# ==========
module.exports = ->
async = require 'asyncawait/async'
await = require 'asyncawait/await'
lib = require '../utils/lib'
src = require '../utils/src'
q = require 'q'
lib = require '../utils/lib'
src = require '../utils/src'

# run tasks (in order, synchronously)
# ===================================
runTasks = async ->
runTasks = ->
# for local installs, MUST run before publishing!
await src.installServer()
await lib.clean()
await lib.copySrc()
await lib.compileCoffee()
await lib.cleanCoffee()
await lib.cleanupServer()
await lib.minifyJs()
await lib.packServer()
msg: 'lib created (success!)'
defer = q.defer()
tasks = [
-> src.installServer()
-> lib.clean()
-> lib.copySrc()
-> lib.compileCoffee()
-> lib.cleanCoffee()
-> lib.cleanupServer()
-> lib.minifyJs()
-> lib.packServer()
-> msg: 'lib created (success!)'
]
tasks.reduce(q.when, q()).done (msg) -> defer.resolve msg
defer.promise

# run it!
# =======
@@ -1,17 +1,21 @@
# UNPACK LIB SERVER
# =================
module.exports = ->
async = require 'asyncawait/async'
await = require 'asyncawait/await'
lib = require '../utils/lib'
q = require 'q'
lib = require '../utils/lib'

# run tasks (in order, synchronously)
# ===================================
runTasks = async ->
runTasks = ->
# for consumer installs
await lib.cleanServer()
await lib.unpackServer()
msg: 'server unpacked (success!)'
defer = q.defer()
tasks = [
-> lib.cleanServer()
-> lib.unpackServer()
-> msg: 'server unpacked (success!)'
]
tasks.reduce(q.when, q()).done (msg) -> defer.resolve msg
defer.promise

# run it!
# =======
@@ -1,9 +1,8 @@
# ENVIRONMENT HELPER
# ==================
q = require 'q'
exec = require('child_process').exec
fse = require 'fs-extra'
async = require 'asyncawait/async'
await = require 'asyncawait/await'
semver = require 'semver'
consts = require '../consts/consts'
log = require './log'
@@ -19,17 +18,18 @@ module.exports =
log.msg "running npm: v#{version}"
resolve version

isConsumer: async (silent=false) -> # :promise<boolean>
exists = await fse.pathExists consts.RB_SRC # published package doesn't have root/src/
exists = !exists
log.msg "is consumer install: #{exists}" unless silent
exists
isConsumer: (silent=false) -> # :promise<boolean>
# published package doesn't have root/src/
fse.pathExists(consts.RB_SRC).then (exists) ->
exists = !exists
log.msg "is consumer install: #{exists}" unless silent
exists

isNpmVersion: async (versionRange) -> # :promise<boolean>
version = await @getNpmVersion()
inRange = semver.satisfies version, versionRange
log.msg "is npm v#{version} in range #{versionRange}: #{inRange}"
inRange
isNpmVersion: (versionRange) -> # :promise<boolean>
@getNpmVersion().then (version) ->
inRange = semver.satisfies version, versionRange
log.msg "is npm v#{version} in range #{versionRange}: #{inRange}"
inRange



@@ -1,36 +1,49 @@
# LIB HELPER
# ==========
q = require 'q'
fse = require 'fs-extra'
del = require 'del'
gulp = require 'gulp'
coffee = require 'gulp-coffee'
minifyJs = require 'gulp-uglify'
tar = require 'tar'
fstream = require 'fstream' # used in github tar examples
async = require 'asyncawait/async'
await = require 'asyncawait/await'
consts = require '../consts/consts'
log = require './log'

# module
# ======
module.exports =
clean: async (verbose=false) -> # :promise<boolean>
opts = force: true
_paths = await del consts.RB_LIB, opts
log.msg _path, 'minor' for _path in _paths if verbose
exists = await fse.pathExists consts.RB_LIB
log.msg "cleaned lib: #{!exists}"
exists

copySrc: async -> # :promise<boolean>
opts =
errorOnExist: true
filter: (src) -> not /\.DS_Store$/ig.test src
copied = await fse.copy consts.RB_SRC, consts.RB_LIB, opts
exists = await fse.pathExists consts.RB_LIB
log.msg "copied src to lib: #{exists}"
exists
clean: (verbose=false) -> # :promise<boolean>
defer = q.defer()
tasks = [
->
del(consts.RB_LIB, force: true).then (_paths) ->
log.msg _path, 'minor' for _path in _paths if verbose
->
fse.pathExists(consts.RB_LIB).then (exists) ->
exists = !exists
log.msg "cleaned lib: #{exists}"
exists
]
tasks.reduce(q.when, q()).done (val) -> defer.resolve val
defer.promise

copySrc: -> # :promise<boolean>
defer = q.defer()
tasks = [
->
opts =
errorOnExist: true
filter: (src) -> not /\.DS_Store$/ig.test src
fse.copy consts.RB_SRC, consts.RB_LIB, opts
->
fse.pathExists(consts.RB_LIB).then (exists) ->
log.msg "copied src to lib: #{exists}"
exists
]
tasks.reduce(q.when, q()).done (val) -> defer.resolve val
defer.promise

compileCoffee: -> # :promise<boolean>
new Promise (resolve, reject) ->
@@ -46,32 +59,53 @@ module.exports =
log.msg "compiled coffee lib files: true"
resolve true

cleanCoffee: async (verbose=false) -> # :promise<boolean>
opts = force: true
glob = ["#{consts.RB_LIB}/**/*.coffee", "!**/node_modules/**"]
_paths = await del glob, opts
log.msg _path, 'minor' for _path in _paths if verbose
exists = await fse.pathExists _paths[0]
log.msg "cleaned coffee lib files: #{!exists and !!_paths.length}"
exists

cleanServer: async (verbose=false) -> # :promise<boolean> (for consumer installs)
opts = force: true
glob = ["#{consts.RB_LIB_SERVER}/*", "!#{consts.RB_LIB_SERVER_PKG}"]
_paths = await del glob, opts
log.msg _path, 'minor' for _path in _paths if verbose
exists = await fse.pathExists consts.RB_LIB_SERVER_PKG
log.msg "cleaned server lib: #{exists}"
exists

cleanupServer: async (verbose=false) -> # :promise<boolean> (for local installs)
opts = force: true
glob = ["#{consts.RB_LIB_SERVER}/package-lock.json"]
_paths = await del glob, opts
log.msg _path, 'minor' for _path in _paths if verbose
exists = await fse.pathExists "#{consts.RB_LIB_SERVER}/package-lock.json"
log.msg "cleaned up lib server: #{!exists}"
exists
cleanCoffee: (verbose=false) -> # :promise<boolean>
defer = q.defer()
tasks = [
->
glob = ["#{consts.RB_LIB}/**/*.coffee", "!**/node_modules/**"]
del(glob, force: true).then (_paths) ->
log.msg _path, 'minor' for _path in _paths if verbose
_paths
(_paths) -> # coffee file paths
fse.pathExists(_paths[0]).then (exists) ->
exists = !exists and !!_paths.length
log.msg "cleaned coffee lib files: #{exists}"
exists
]
tasks.reduce(q.when, q()).done (val) -> defer.resolve val
defer.promise

cleanServer: (verbose=false) -> # :promise<boolean> (for consumer installs)
defer = q.defer()
tasks = [
->
glob = ["#{consts.RB_LIB_SERVER}/*", "!#{consts.RB_LIB_SERVER_PKG}"]
del(glob, force: true).then (_paths) ->
log.msg _path, 'minor' for _path in _paths if verbose
->
fse.pathExists(consts.RB_LIB_SERVER_PKG).then (exists) ->
log.msg "cleaned server lib: #{exists}"
exists
]
tasks.reduce(q.when, q()).done (val) -> defer.resolve val
defer.promise

cleanupServer: (verbose=false) -> # :promise<boolean> (for local installs)
defer = q.defer()
tasks = [
->
glob = ["#{consts.RB_LIB_SERVER}/package-lock.json"]
del(glob, force: true).then (_paths) ->
log.msg _path, 'minor' for _path in _paths if verbose
->
fse.pathExists("#{consts.RB_LIB_SERVER}/package-lock.json").then (exists) ->
exists = !exists
log.msg "cleaned up lib server: #{exists}"
exists
]
tasks.reduce(q.when, q()).done (val) -> defer.resolve val
defer.promise

minifyJs: -> # :promise<boolean>
new Promise (resolve, reject) ->

0 comments on commit f40c686

Please sign in to comment.
You can’t perform that action at this time.