-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpackage.js
More file actions
72 lines (62 loc) · 1.95 KB
/
package.js
File metadata and controls
72 lines (62 loc) · 1.95 KB
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
68
69
70
71
72
Package.describe({
name: 'ostrio:cron-jobs',
version: '6.2.0',
summary: 'Tasks/CRON scheduler and manager for horizontally scaled multi-server apps',
git: 'https://github.com/veliovgroup/josk',
documentation: 'README.md'
});
/**
* Meteor test-packages runs package.js under each release's bundled Node.
* @returns {{ npm: Record<string, string>, mocha: string }}
*/
const meteorTestProfile = () => {
const nodeMajor = parseInt(String(process.versions.node).split('.')[0], 10);
if (nodeMajor >= 18) {
return {
npm: {
'cron-parser': '5.5.0',
chai: '5.3.3',
redis: '4.7.1',
pg: '8.16.3',
},
mocha: 'meteortesting:mocha@3.3.0',
};
}
if (nodeMajor >= 14) {
return {
npm: {
'cron-parser': '4.9.0',
chai: '4.4.1',
redis: '4.7.1',
pg: '8.11.3',
},
mocha: 'meteortesting:mocha@2.1.0',
};
}
throw new Error(`ostrio:cron-jobs requires Node >= 14 (got ${process.version})`);
};
Package.onUse((api) => {
// CI: 2.14–2.16, 3.2 / 3.3.1 / 3.4 (skip 3.3.0)
api.versionsFrom(['2.14', '3.2']);
api.use('ecmascript', 'server');
// TypeScript setup
api.use(['zodern:types@1.0.13', 'typescript'], ['client', 'server'], { weak: true });
// For zodern:types to pick up our published types.
api.addAssets('index.d.ts', ['client', 'server']);
api.mainModule('index.js', 'server');
});
Package.onTest((api) => {
const profile = meteorTestProfile();
Npm.depends(profile.npm);
api.use(['ecmascript', 'mongo', profile.mocha, 'zodern:types', 'typescript'], 'server');
const suite = process.env.METEOR_TEST_SUITE;
const defaultTests = ['test/meteor.js', 'test/meteor-types.ts'];
const testFiles = suite === 'mongo'
? ['test/meteor-ci-mongo.js']
: suite === 'redis'
? ['test/meteor-ci-redis.js']
: suite === 'postgres'
? ['test/meteor-ci-postgres.js']
: defaultTests;
api.addFiles(testFiles, 'server');
});