adapt-cli 2.1.13 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.bowerrc +2 -2
- package/.eslintignore +1 -0
- package/.eslintrc.json +14 -0
- package/.github/CONTRIBUTING.md +8 -0
- package/.github/ISSUE_TEMPLATE.md +17 -0
- package/.github/pull_request_template.md +25 -0
- package/.github/workflows/addtomainproject.yml +19 -0
- package/.github/workflows/releases.yml +25 -0
- package/.travis.yml +46 -46
- package/README.md +266 -266
- package/bin/adapt.js +3 -0
- package/json/help-create/component.json +9 -9
- package/json/help-create/course.json +9 -9
- package/json/help-create/question.json +9 -0
- package/json/help-create.json +12 -11
- package/json/help-devinstall.json +9 -9
- package/json/help-install.json +10 -10
- package/json/help-ls.json +7 -7
- package/json/help-register.json +7 -7
- package/json/help-rename.json +7 -7
- package/json/help-search.json +8 -8
- package/json/help-uninstall.json +7 -7
- package/json/help-unregister.json +8 -8
- package/json/help-update.json +12 -12
- package/json/help-version.json +7 -7
- package/json/help.json +19 -19
- package/lib/api.js +260 -0
- package/lib/cli.js +69 -52
- package/lib/commands/authenticate.js +18 -0
- package/lib/commands/create/component.js +64 -81
- package/lib/commands/create/course.js +26 -81
- package/lib/commands/create/question.js +18 -0
- package/lib/commands/create.js +94 -90
- package/lib/commands/devinstall.js +35 -97
- package/lib/commands/help.js +31 -52
- package/lib/commands/install.js +16 -907
- package/lib/commands/ls.js +9 -24
- package/lib/commands/register.js +11 -196
- package/lib/commands/rename.js +14 -129
- package/lib/commands/search.js +11 -29
- package/lib/commands/uninstall.js +9 -136
- package/lib/commands/unregister.js +12 -96
- package/lib/commands/update.js +12 -867
- package/lib/commands/version.js +13 -15
- package/lib/integration/AdaptFramework/build.js +42 -0
- package/lib/integration/AdaptFramework/clone.js +27 -0
- package/lib/integration/AdaptFramework/deleteSrcCore.js +9 -0
- package/lib/integration/AdaptFramework/deleteSrcCourse.js +9 -0
- package/lib/integration/AdaptFramework/download.js +21 -0
- package/lib/integration/AdaptFramework/erase.js +34 -0
- package/lib/integration/AdaptFramework/getLatestVersion.js +79 -0
- package/lib/integration/AdaptFramework/npmInstall.js +21 -0
- package/lib/integration/AdaptFramework.js +19 -0
- package/lib/integration/Plugin.js +404 -0
- package/lib/integration/PluginManagement/autenticate.js +56 -0
- package/lib/integration/PluginManagement/install.js +224 -0
- package/lib/integration/PluginManagement/print.js +52 -0
- package/lib/integration/PluginManagement/register.js +130 -0
- package/lib/integration/PluginManagement/rename.js +101 -0
- package/lib/integration/PluginManagement/schemas.js +8 -0
- package/lib/integration/PluginManagement/search.js +46 -0
- package/lib/integration/PluginManagement/uninstall.js +141 -0
- package/lib/integration/PluginManagement/unregister.js +101 -0
- package/lib/integration/PluginManagement/update.js +224 -0
- package/lib/integration/PluginManagement.js +21 -0
- package/lib/integration/Project.js +146 -0
- package/lib/integration/Target.js +299 -0
- package/lib/integration/getBowerRegistryConfig.js +34 -0
- package/lib/logger.js +28 -0
- package/lib/util/JSONReadValidate.js +34 -0
- package/lib/util/constants.js +38 -0
- package/lib/util/createPromptTask.js +7 -0
- package/lib/util/download.js +45 -0
- package/lib/util/errors.js +58 -0
- package/lib/util/extract.js +24 -0
- package/lib/util/getDirNameFromImportMeta.js +6 -0
- package/lib/util/promises.js +36 -0
- package/package.json +74 -49
- package/TESTING.md +0 -25
- package/bin/adapt +0 -3
- package/gruntfile.js +0 -18
- package/lib/AdaptConsoleApplication.js +0 -19
- package/lib/CommandParser.js +0 -19
- package/lib/CommandTranslator.js +0 -16
- package/lib/ConsoleRenderer.js +0 -10
- package/lib/Constants.js +0 -68
- package/lib/JsonLoader.js +0 -40
- package/lib/JsonWriter.js +0 -21
- package/lib/PackageMeta.js +0 -41
- package/lib/Plugin.js +0 -53
- package/lib/PluginTypeResolver.js +0 -47
- package/lib/Project.js +0 -89
- package/lib/RendererHelpers.js +0 -41
- package/lib/RepositoryDownloader.js +0 -64
- package/lib/Slug.js +0 -5
- package/lib/VersionChecker.js +0 -7
- package/lib/commands/create/index.js +0 -6
- package/lib/commands/index.js +0 -16
- package/lib/commands/install/InstallLog.js +0 -32
- package/lib/commands/install/InstallTarget.js +0 -259
- package/lib/commands/install/extend.js +0 -31
- package/lib/download.js +0 -101
- package/lib/errors.js +0 -58
- package/lib/promise/authenticate.js +0 -58
- package/lib/promise/build.js +0 -20
- package/lib/promise/cloneInstall.js +0 -35
- package/lib/promise/confirmBuild.js +0 -6
- package/lib/promise/exec.js +0 -39
- package/lib/promise/getRepository.js +0 -26
- package/lib/promise/highest.js +0 -109
- package/lib/promise/install.js +0 -31
- package/lib/promise/installAdaptDependencies.js +0 -30
- package/lib/promise/installNodeDependencies.js +0 -28
- package/lib/promise/removeTemporaryDownload.js +0 -8
- package/lib/promise/replaceTextContent.js +0 -10
- package/lib/promise/uninstallPackage.js +0 -15
- package/lib/promise/update.js +0 -33
- package/lib/promise/util.js +0 -16
- package/test/fixtures/adapt-with-plugins.json +0 -6
- package/test/specs/command_translation_concerns.js +0 -13
- package/test/specs/create_command_concerns.js +0 -22
- package/test/specs/create_concerns.js +0 -30
- package/test/specs/install_concerns.js +0 -31
- package/test/specs/installing_compatible_plugins_concerns.js +0 -126
- package/test/specs/installing_incompatible_plugins_concerns.js +0 -103
- package/test/specs/ls_concerns.js +0 -28
- package/test/specs/plugin_name_concerns.js +0 -82
- package/test/specs/project_concerns.js +0 -128
- package/test/specs/registration_concerns.js +0 -31
- package/test/specs/repository_downloader_concerns.js +0 -55
- package/test/specs/search_concerns.js +0 -30
- package/test/specs/type_resolution_concerns.js +0 -71
- package/test/specs/uninstall_command_concerns.js +0 -64
- package/test/specs/uninstall_concerns.js +0 -31
package/lib/JsonLoader.js
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
var fs = require('fs'),
|
2
|
-
JSONLint = require('json-lint');
|
3
|
-
|
4
|
-
module.exports = {
|
5
|
-
existsSync: fs.existsSync,
|
6
|
-
|
7
|
-
exists: fs.exists,
|
8
|
-
|
9
|
-
readJSON: function (filepath, done) {
|
10
|
-
done = done || function () {};
|
11
|
-
|
12
|
-
fs.readFile(filepath, 'utf8', function (err, data) {
|
13
|
-
if(err) return done(err);
|
14
|
-
|
15
|
-
try {
|
16
|
-
validateJSON(data, filepath);
|
17
|
-
done(null, JSON.parse(data));
|
18
|
-
} catch (ex) {
|
19
|
-
done(ex.message);
|
20
|
-
}
|
21
|
-
});
|
22
|
-
},
|
23
|
-
|
24
|
-
readJSONSync: function (filepath) {
|
25
|
-
var data = fs.readFileSync(filepath, 'utf-8');
|
26
|
-
validateJSON(data, filepath);
|
27
|
-
return JSON.parse(data);
|
28
|
-
}
|
29
|
-
};
|
30
|
-
|
31
|
-
function validateJSON(jsonData, filepath) {
|
32
|
-
var lint = JSONLint(jsonData);
|
33
|
-
if (lint.error) {
|
34
|
-
var errorMessage = 'JSON parsing error: ' + lint.error + ', line: ' + lint.line + ', character: ' + lint.character;
|
35
|
-
if(filepath) {
|
36
|
-
errorMessage += ', file: \'' + filepath + '\'';
|
37
|
-
}
|
38
|
-
throw new Error(errorMessage);
|
39
|
-
}
|
40
|
-
}
|
package/lib/JsonWriter.js
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
var fs = require('fs');
|
2
|
-
|
3
|
-
module.exports = {
|
4
|
-
existsSync: fs.existsSync,
|
5
|
-
|
6
|
-
exists: fs.exists,
|
7
|
-
|
8
|
-
writeJSON: function (filepath, values, done) {
|
9
|
-
done = done || function () {};
|
10
|
-
|
11
|
-
fs.writeFile(filepath, JSON.stringify(values, null, 4), { encoding: 'utf8' }, function (err) {
|
12
|
-
if(err) return done(err);
|
13
|
-
|
14
|
-
done();
|
15
|
-
});
|
16
|
-
},
|
17
|
-
|
18
|
-
writeJSONSync: function (filepath, values) {
|
19
|
-
return fs.writeFileSync(filepath, JSON.stringify(values, null, 4), { encoding: 'utf8' });
|
20
|
-
}
|
21
|
-
}
|
package/lib/PackageMeta.js
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
var bower = require('bower'),
|
2
|
-
Q = require('q');
|
3
|
-
|
4
|
-
module.exports = {
|
5
|
-
getKeywords: function (plugin, config) {
|
6
|
-
var deferred = Q.defer();
|
7
|
-
|
8
|
-
bower.commands.info(plugin.toString(), 'keywords', config || {})
|
9
|
-
.on('end', function(results) {
|
10
|
-
deferred.resolve(results);
|
11
|
-
})
|
12
|
-
.on('error', function(err) {
|
13
|
-
deferred.reject(err);
|
14
|
-
});
|
15
|
-
return deferred.promise;
|
16
|
-
},
|
17
|
-
getFrameworkCompatibility: function (plugin, config) {
|
18
|
-
var deferred = Q.defer();
|
19
|
-
var allVersions = '*';
|
20
|
-
|
21
|
-
bower.commands.info(plugin.toString(), 'framework', config || {})
|
22
|
-
.on('end', function(results) {
|
23
|
-
deferred.resolve(results || allVersions);
|
24
|
-
})
|
25
|
-
.on('error', function() {
|
26
|
-
deferred.resolve(allVersions);
|
27
|
-
});
|
28
|
-
return deferred.promise;
|
29
|
-
},
|
30
|
-
getRepositoryUrl: function (plugin, config) {
|
31
|
-
var deferred = Q.defer();
|
32
|
-
bower.commands.lookup(plugin.name, config || {})
|
33
|
-
.on('end', function(results) {
|
34
|
-
deferred.resolve(results);
|
35
|
-
})
|
36
|
-
.on('error', function(err) {
|
37
|
-
deferred.reject(err);
|
38
|
-
});
|
39
|
-
return deferred.promise;
|
40
|
-
}
|
41
|
-
};
|
package/lib/Plugin.js
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
var slug = require('./Slug'),
|
2
|
-
endpointParser = require('bower-endpoint-parser'),
|
3
|
-
zero = '0.0.0',
|
4
|
-
any = '*';
|
5
|
-
|
6
|
-
|
7
|
-
var Plugin = function(name, versionOrIsContrib, isContrib) {
|
8
|
-
this.name = name;
|
9
|
-
|
10
|
-
if(typeof isContrib === 'undefined') {
|
11
|
-
isContrib = false;
|
12
|
-
}
|
13
|
-
if(typeof versionOrIsContrib === 'undefined') {
|
14
|
-
isContrib = false;
|
15
|
-
this.version = any;
|
16
|
-
} else if(typeof versionOrIsContrib === 'boolean'){
|
17
|
-
isContrib = versionOrIsContrib;
|
18
|
-
this.version = any;
|
19
|
-
} else {
|
20
|
-
this.version = versionOrIsContrib === zero ? any : versionOrIsContrib;
|
21
|
-
}
|
22
|
-
this.packageName = makePackageName(name, isContrib);
|
23
|
-
|
24
|
-
Object.defineProperty(this, 'isContrib', {
|
25
|
-
get: function () {
|
26
|
-
return /^adapt-contrib/.test(this.packageName);
|
27
|
-
}
|
28
|
-
});
|
29
|
-
};
|
30
|
-
|
31
|
-
Plugin.prototype.toString = function() {
|
32
|
-
var version = '';
|
33
|
-
if(this.version !== any) {
|
34
|
-
version = '#'+ this.version;
|
35
|
-
}
|
36
|
-
return ''+this.packageName + version;
|
37
|
-
};
|
38
|
-
|
39
|
-
function makePackageName(name, isContrib) {
|
40
|
-
return (/^adapt-/i.test(name) ? '' : 'adapt-') + (!isContrib ? '' : 'contrib-') + slug(name);
|
41
|
-
}
|
42
|
-
|
43
|
-
Plugin.parse = function (endpoint) {
|
44
|
-
var ep = endpointParser.decompose(endpoint),
|
45
|
-
version = /^\*$/.test(ep.target) ? any : ep.target;
|
46
|
-
return new Plugin(ep.name || ep.source, version);
|
47
|
-
};
|
48
|
-
|
49
|
-
Plugin.compose = function (endpoint) {
|
50
|
-
return Plugin.parse(endpointParser.compose(endpoint));
|
51
|
-
};
|
52
|
-
|
53
|
-
module.exports = Plugin;
|
@@ -1,47 +0,0 @@
|
|
1
|
-
var PluginTypeResolver = function(types) {
|
2
|
-
this.types = types || [
|
3
|
-
{
|
4
|
-
pattern: /^adapt-component$/,
|
5
|
-
typename: 'component',
|
6
|
-
belongsTo: 'components'
|
7
|
-
},
|
8
|
-
{
|
9
|
-
pattern: /^adapt-extension$/,
|
10
|
-
typename: 'extension',
|
11
|
-
belongsTo: 'extensions'
|
12
|
-
},
|
13
|
-
{
|
14
|
-
pattern: /^adapt-menu$/,
|
15
|
-
typename: 'menu',
|
16
|
-
belongsTo: 'menu'
|
17
|
-
},
|
18
|
-
{
|
19
|
-
pattern: /^adapt-theme$/,
|
20
|
-
typename: 'theme',
|
21
|
-
belongsTo: 'theme'
|
22
|
-
}
|
23
|
-
];
|
24
|
-
this.defaultType = this.types[0];
|
25
|
-
};
|
26
|
-
PluginTypeResolver.prototype.resolve = function (keywords) {
|
27
|
-
keywords = Array.isArray(keywords) ? keywords : [keywords];
|
28
|
-
|
29
|
-
var types = keywords.map(toType(this.types))
|
30
|
-
.filter(NonMatchingKeywords);
|
31
|
-
|
32
|
-
return (types.length ? types[0] : this.defaultType);
|
33
|
-
};
|
34
|
-
module.exports = PluginTypeResolver;
|
35
|
-
|
36
|
-
function toType(types) {
|
37
|
-
return function (keyword) {
|
38
|
-
var typematches = types.filter(function (type) {
|
39
|
-
return type.pattern.test(keyword);
|
40
|
-
});
|
41
|
-
if(typematches.length) return typematches[0];
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
function NonMatchingKeywords(item) {
|
46
|
-
return item !== undefined
|
47
|
-
}
|
package/lib/Project.js
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
var Plugin = require('./Plugin'),
|
2
|
-
fs = require('fs'),
|
3
|
-
_ = require('lodash'),
|
4
|
-
JsonLoader = require('./JsonLoader'),
|
5
|
-
JsonWriter = require('./JsonWriter'),
|
6
|
-
chalk = require('chalk'),
|
7
|
-
renderer = require('./ConsoleRenderer'),
|
8
|
-
EmptyProject = function (){
|
9
|
-
return {
|
10
|
-
dependencies: {}
|
11
|
-
};
|
12
|
-
};
|
13
|
-
EmptyPackage = function () {
|
14
|
-
return { "version": "0.0.0" };
|
15
|
-
};
|
16
|
-
|
17
|
-
var Project = function (manifestFilePath, frameworkPackagePath) {
|
18
|
-
this.manifestFilePath = manifestFilePath;
|
19
|
-
this.frameworkPackagePath = frameworkPackagePath;
|
20
|
-
Object.defineProperty(this, 'plugins', {
|
21
|
-
get: function () {
|
22
|
-
var manifest = parse(this.manifestFilePath);
|
23
|
-
return _.toPairs(manifest.dependencies)
|
24
|
-
.map(function (pair) {
|
25
|
-
return new Plugin(pair[0], pair[1]);
|
26
|
-
});
|
27
|
-
}.bind(this)
|
28
|
-
});
|
29
|
-
};
|
30
|
-
|
31
|
-
Project.prototype.add = function (plugin) {
|
32
|
-
if(typeof Plugin !== 'object' && plugin.constructor !== Plugin) {
|
33
|
-
plugin = new Plugin(plugin);
|
34
|
-
}
|
35
|
-
var manifest;
|
36
|
-
if(this.isProjectContainsManifestFile()) {
|
37
|
-
manifest = parse(this.manifestFilePath);
|
38
|
-
} else {
|
39
|
-
manifest = EmptyProject();
|
40
|
-
}
|
41
|
-
manifest.dependencies[plugin.packageName] = plugin.version;
|
42
|
-
save(this.manifestFilePath, manifest);
|
43
|
-
};
|
44
|
-
|
45
|
-
Project.prototype.remove = function (plugin) {
|
46
|
-
if(typeof Plugin !== 'object' && plugin.constructor !== Plugin) {
|
47
|
-
plugin = new Plugin(plugin);
|
48
|
-
}
|
49
|
-
var manifest = parse(this.manifestFilePath);
|
50
|
-
delete manifest.dependencies[plugin.packageName];
|
51
|
-
save(this.manifestFilePath, manifest);
|
52
|
-
};
|
53
|
-
|
54
|
-
Project.prototype.getFrameworkVersion = function () {
|
55
|
-
return parsePackage(this.frameworkPackagePath).version;
|
56
|
-
};
|
57
|
-
|
58
|
-
Project.prototype.isProjectContainsManifestFile = function() {
|
59
|
-
return fs.existsSync(this.manifestFilePath);
|
60
|
-
};
|
61
|
-
|
62
|
-
function parse(manifestFilePath) {
|
63
|
-
if(!manifestFilePath) return EmptyProject();
|
64
|
-
|
65
|
-
return JsonLoader.readJSONSync(manifestFilePath);
|
66
|
-
}
|
67
|
-
|
68
|
-
function parsePackage(frameworkPackagePath) {
|
69
|
-
var EmptyPackage = function () {
|
70
|
-
return { "version": "0.0.0" }
|
71
|
-
};
|
72
|
-
|
73
|
-
if(!frameworkPackagePath) return EmptyPackage();
|
74
|
-
|
75
|
-
try {
|
76
|
-
return JsonLoader.readJSONSync(frameworkPackagePath);
|
77
|
-
}
|
78
|
-
catch (ex) {
|
79
|
-
return EmptyPackage();
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
function save(manifestFilePath, manifest) {
|
84
|
-
if(manifestFilePath) {
|
85
|
-
JsonWriter.writeJSONSync(manifestFilePath, manifest);
|
86
|
-
}
|
87
|
-
}
|
88
|
-
|
89
|
-
module.exports = Project;
|
package/lib/RendererHelpers.js
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
var chalk = require('chalk'),
|
2
|
-
inquirer = require('inquirer'),
|
3
|
-
Q = require('q');
|
4
|
-
|
5
|
-
module.exports = {
|
6
|
-
reportCompatibilityWarning : function (renderer, plugin) {
|
7
|
-
renderer.log(chalk.yellow('The plugin'), chalk.white(plugin), chalk.yellow('is not compatible with this version of Adapt.', 'Installing it may cause unexpected behaviour.'));
|
8
|
-
return confirm(plugin);
|
9
|
-
},
|
10
|
-
reportFailure : function (renderer, done) {
|
11
|
-
return function (err) {
|
12
|
-
renderer.log(chalk.red('Oh dear, something went wrong.'), err.message);
|
13
|
-
done(err);
|
14
|
-
};
|
15
|
-
},
|
16
|
-
reportInvalidFrameworkDirectory : function (renderer, done) {
|
17
|
-
return function (err) {
|
18
|
-
renderer.log(chalk.red('Fatal error: please run above commands in adapt course directory.'));
|
19
|
-
done(err);
|
20
|
-
};
|
21
|
-
},
|
22
|
-
};
|
23
|
-
|
24
|
-
function confirm(plugin) {
|
25
|
-
var deferred = Q.defer();
|
26
|
-
var schema = [
|
27
|
-
{
|
28
|
-
name: 'continueWithInstall',
|
29
|
-
message: 'Install this plugin anyway?',
|
30
|
-
type: 'confirm',
|
31
|
-
default: false
|
32
|
-
}
|
33
|
-
];
|
34
|
-
inquirer.prompt(schema).then(properties => {
|
35
|
-
deferred.resolve({
|
36
|
-
plugin: plugin,
|
37
|
-
continueWithInstall: properties.continueWithInstall
|
38
|
-
});
|
39
|
-
}).catch(err => deferred.reject(err));
|
40
|
-
return deferred.promise;
|
41
|
-
}
|
@@ -1,64 +0,0 @@
|
|
1
|
-
var Constants = require('./Constants'),
|
2
|
-
urljoin = require('url-join'),
|
3
|
-
path = require('path'),
|
4
|
-
Q = require('q');
|
5
|
-
|
6
|
-
var RepositoryDownloader = function(options) {
|
7
|
-
if (!options.branch && !options.repository)
|
8
|
-
throw new Error('Repository details are required.');
|
9
|
-
this.options = options;
|
10
|
-
|
11
|
-
Object.defineProperty(this, 'url', {
|
12
|
-
get: function() {
|
13
|
-
return urljoin(this.options.repository, 'archive', this.options.branch + '.zip');
|
14
|
-
}
|
15
|
-
});
|
16
|
-
};
|
17
|
-
|
18
|
-
RepositoryDownloader.prototype.fetch = function(destination) {
|
19
|
-
var deferred = Q.defer(),
|
20
|
-
download = require('download'),
|
21
|
-
previousPercent = 0,
|
22
|
-
fileName = '';
|
23
|
-
|
24
|
-
download(this.url, destination, {
|
25
|
-
extract: true
|
26
|
-
})
|
27
|
-
.on('response', function (response) {
|
28
|
-
fileName = getFileName(response.headers['content-disposition']);
|
29
|
-
})
|
30
|
-
.on('downloadProgress', function(progress) {
|
31
|
-
var state = {
|
32
|
-
receivedSize: progress.transferred,
|
33
|
-
percent: Math.round(progress.transferred / progress.total * 100)
|
34
|
-
};
|
35
|
-
|
36
|
-
if(state.percent > previousPercent) {
|
37
|
-
previousPercent = state.percent;
|
38
|
-
deferred.notify(state, progress);
|
39
|
-
}
|
40
|
-
})
|
41
|
-
.on('error', function(err) {
|
42
|
-
deferred.reject(err);
|
43
|
-
})
|
44
|
-
.then(function() {
|
45
|
-
deferred.resolve(fileName);
|
46
|
-
});
|
47
|
-
|
48
|
-
return deferred.promise;
|
49
|
-
};
|
50
|
-
|
51
|
-
function getFileName(disposition) {
|
52
|
-
var fileName = "";
|
53
|
-
if (disposition && disposition.indexOf('attachment') !== -1) {
|
54
|
-
var regex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
|
55
|
-
var matches = regex.exec(disposition);
|
56
|
-
if (matches != null && matches[1]) {
|
57
|
-
fileName = matches[1].replace(/['"]/g, '');
|
58
|
-
}
|
59
|
-
}
|
60
|
-
return fileName;
|
61
|
-
}
|
62
|
-
|
63
|
-
module.exports = RepositoryDownloader;
|
64
|
-
|
package/lib/Slug.js
DELETED
package/lib/VersionChecker.js
DELETED
package/lib/commands/index.js
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
var _ = require('lodash'),
|
2
|
-
fs = require('fs'),
|
3
|
-
commands = {},
|
4
|
-
files = fs.readdirSync(__dirname);
|
5
|
-
|
6
|
-
module.exports = files.filter(excludeIndex).reduce(function (commands, filename) {
|
7
|
-
var useDefaultDependencies = {},
|
8
|
-
command = require('./' + filename);
|
9
|
-
|
10
|
-
if(typeof command === 'function') command = command(useDefaultDependencies);
|
11
|
-
return _.extend(commands, command);
|
12
|
-
}, {});
|
13
|
-
|
14
|
-
function excludeIndex (filename) {
|
15
|
-
return !/^index.js$/.test(filename);
|
16
|
-
}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
var readline = require('readline');
|
2
|
-
|
3
|
-
var isLoggingProgress = false;
|
4
|
-
var lastProgressStr = '';
|
5
|
-
|
6
|
-
module.exports = {
|
7
|
-
logProgress:function(str) {
|
8
|
-
lastProgressStr = str;
|
9
|
-
isLoggingProgress = true;
|
10
|
-
readline.cursorTo(process.stdout, 0);
|
11
|
-
process.stdout.write(str);
|
12
|
-
},
|
13
|
-
|
14
|
-
logProgressConclusion(str) {
|
15
|
-
lastProgressStr = str;
|
16
|
-
isLoggingProgress = false;
|
17
|
-
readline.cursorTo(process.stdout, 0);
|
18
|
-
process.stdout.write(str);
|
19
|
-
process.stdout.write('\n');
|
20
|
-
},
|
21
|
-
|
22
|
-
log:function() {
|
23
|
-
if (isLoggingProgress) {
|
24
|
-
readline.clearLine(process.stdout, 0);
|
25
|
-
readline.cursorTo(process.stdout, 0);
|
26
|
-
console.log.apply(console, arguments);
|
27
|
-
this.logProgress(lastProgressStr);
|
28
|
-
} else {
|
29
|
-
console.log.apply(console, arguments);
|
30
|
-
}
|
31
|
-
}
|
32
|
-
}
|