def ensure_babelify(ctx): if 'babelify' not in runners.run("npm ls --depth=0 babelify --no-color"): print "didn't find babelify, installing it.." with cd(ctx.pkg.root): ctx.run("npm install --save-dev babelify --no-color", echo=False, encoding='utf-8') else: return True
def ensure_es2015(ctx): if 'babel-preset-es2015' not in runners.run("npm ls --depth=0 babel-preset-es2015 --no-color"): print "didn't find babel-preset-es2015, installing it.." with cd(ctx.pkg.root): ctx.run("npm install babel-preset-es2015 --save-dev") else: return True
def ensure_node_modules(ctx): """Has node init been called? (if not call it). """ node_modules = os.path.join(ctx.pkg.root, 'node_modules') if not os.path.exists(node_modules): with cd(ctx.pkg.root): ctx.run("npm install --no-color") else: return True
def ensure_package_json(ctx): """Is this a node package? """ package_json = os.path.join(ctx.pkg.root, 'package.json') if not os.path.exists(package_json): print "Missing package.json file, creating default version.." with cd(ctx.pkg.root): ctx.run("npm init -f") else: return True