-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaplus-npm.js
55 lines (49 loc) · 1.61 KB
/
aplus-npm.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"use strict";
/***
* __ _ __ __
* ____ ___ ____ / /_ (_)/ /___ / /_ ___ _____ ____
* / __ `__ \ / __ \ / __ \ / // // _ \ / __ \ / _ \ / ___// __ \
* / / / / / // /_/ // /_/ // // // __// / / // __// / / /_/ /
* /_/ /_/ /_/ \____//_.___//_//_/ \___//_/ /_/ \___//_/ \____/
*
* mobile solutions for everyday heroes
*
* @file
* Alloy+ plugin for executing npm during build process
*
* @module
* @aplus/npm
*
* @author
* Brenton House <[email protected]>
*
* @copyright
* Copyright (c) 2016 by Superhero Studios Incorporated. All Rights Reserved.
*
* @license
* Licensed under the terms of the MIT License (MIT)
* Please see the LICENSE.md included with this distribution for details.
*
*/
var _ = require('lodash');
function plugin(params) {
params.dirname = params.dirname ? _.template(params.dirname)(params) : params.event.dir.lib;
params.args = params.args ? _.map(params.args, function(arg) {
return _.template(arg)(params);
}) : ["install"];
params.logger.trace("running npm in directory: " + params.dirname);
params.logger.trace("npm " + params.args.join(" "));
var spawn = require("./spawn");
return spawn.sync("npm", params.args, {
cwd: params.dirname
});
}
module.exports.execute = plugin;
module.exports.tasks = [
{
"module": module.id,
"dirname": "${event.dir.lib}",
"args": ["install"],
"events": "preload"
}
]