forked from Meteor-Community-Packages/meteor-link-accounts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage.js
67 lines (59 loc) · 1.88 KB
/
package.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
56
57
58
59
60
61
62
63
64
65
66
67
var fs = Npm.require('fs');
var path = Npm.require('path');
Package.describe({
"summary": "Meteor external service link system",
"version": "1.1.14",
"git": "https://github.com/yubozhao/meteor-link-accounts",
"name": "bozhao:link-accounts",
"description": "Link social accounts for Meteor"
});
Package.on_use(function (api) {
api.versionsFrom('[email protected]');
api.imply('accounts-base', ['client', 'server']);
api.use(['underscore', 'check']);
api.use(['accounts-oauth', 'oauth'], ['client', 'server']);
api.add_files('link_accounts_client.js', 'client');
api.add_files('link_accounts_server.js', 'server');
api.add_files([
'core-services/meteor_developer.js',
'core-services/facebook.js',
'core-services/github.js',
'core-services/google.js',
'core-services/meetup.js',
'core-services/twitter.js',
'core-services/weibo.js',
'community-services/instagram.js',
'community-services/ok.js',
'community-services/vk.js',
'community-services/mailru.js',
'community-services/linkedin.js',
'community-services/twitch.js',
'community-services/soundcloud.js',
'community-services/slack.js',
'community-services/angellist.js',
'community-services/spotify.js'
], 'client');
});
function isPackageAvailable (packageName) {
function isAppDir (dir) {
try {
return fs.statSync(path.join(filepath, '.meteor', 'packages')).isFile();
} catch (e) {
return false;
}
};
var currentDir = process.cwd();
while (currentDir) {
var newDir = path.dirname(currentDir);
if (isAppDir(currentDir)) {
break;
} else if (newDir === currentDir) {
currentDir = '';
} else {
currentDir = newDir;
}
};
var meteorPackages = fs.readFileSync(path.join(currentDir, '.meteor', 'packages'), 'utf8');
var packageName = new RegExp(packageName);
return !!meteorPackages.match(packageName);
};