@platformatic/rdkafka 4.1.0-alpha.1 → 4.1.0
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/ci/prepublish.js +3 -4
- package/deps/librdkafka/_mkltmpuuWEwa.c +13 -0
- package/package.json +2 -1
- package/ci/update-version.js +0 -123
package/ci/prepublish.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require(
|
|
2
|
-
require(
|
|
3
|
-
require(
|
|
4
|
-
// require('./update-version');
|
|
1
|
+
require('./checks/librdkafka-exists');
|
|
2
|
+
require('./checks/librdkafka-correct-version');
|
|
3
|
+
require('./librdkafka-defs-generator.js');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/rdkafka",
|
|
3
|
-
"version": "4.1.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Node.js bindings for librdkafka",
|
|
5
5
|
"librdkafka": "2.12.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"jshint": "^2.10.1",
|
|
34
34
|
"mocha": "^11.7.0",
|
|
35
35
|
"node-gyp": "^11.1.0",
|
|
36
|
+
"semver": "^7.8.5",
|
|
36
37
|
"taffydb": "^2.7.3",
|
|
37
38
|
"toolkit-jsdoc": "^1.0.0"
|
|
38
39
|
},
|
package/ci/update-version.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const semver = require('semver');
|
|
3
|
-
const { spawn } = require('child_process');
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
|
|
6
|
-
const root = path.resolve(__dirname, '..');
|
|
7
|
-
const pjsPath = path.resolve(root, 'package.json');
|
|
8
|
-
const pjs = require(pjsPath);
|
|
9
|
-
|
|
10
|
-
function parseVersion(tag) {
|
|
11
|
-
const { major, minor, prerelease, patch } = semver.parse(tag);
|
|
12
|
-
|
|
13
|
-
// Describe will give is commits since last tag
|
|
14
|
-
const [commitsSinceTag, hash] = prerelease[0] ? prerelease[0].split('-') : [
|
|
15
|
-
1,
|
|
16
|
-
process.env.TRAVIS_COMMIT || ''
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
major,
|
|
21
|
-
minor,
|
|
22
|
-
prerelease,
|
|
23
|
-
patch,
|
|
24
|
-
commit: commitsSinceTag - 1,
|
|
25
|
-
hash
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function getCommandOutput(command, args, cb) {
|
|
30
|
-
let output = '';
|
|
31
|
-
|
|
32
|
-
const cmd = spawn(command, args);
|
|
33
|
-
|
|
34
|
-
cmd.stdout.on('data', (data) => {
|
|
35
|
-
output += data;
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
cmd.on('close', (code) => {
|
|
39
|
-
if (code != 0) {
|
|
40
|
-
cb(new Error(`Command returned unsuccessful code: ${code}`));
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
cb(null, output.trim());
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function getVersion(cb) {
|
|
49
|
-
// https://docs.travis-ci.com/user/environment-variables/
|
|
50
|
-
if (process.env.TRAVIS_TAG) {
|
|
51
|
-
setImmediate(() => cb(null, parseVersion(process.env.TRAVIS_TAG.trim())));
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
getCommandOutput('git', ['describe', '--tags'], (err, result) => {
|
|
56
|
-
if (err) {
|
|
57
|
-
cb(err);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
cb(null, parseVersion(result.trim()));
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function getBranch(cb) {
|
|
66
|
-
if (process.env.TRAVIS_TAG) {
|
|
67
|
-
// TRAVIS_BRANCH matches TRAVIS_TAG when TRAVIS_TAG is set
|
|
68
|
-
// "git branch --contains tags/TRAVIS_TAG" doesn't work on travis so we have to assume 'master'
|
|
69
|
-
setImmediate(() => cb(null, 'master'));
|
|
70
|
-
return;
|
|
71
|
-
} else if (process.env.TRAVIS_BRANCH) {
|
|
72
|
-
setImmediate(() => cb(null, process.env.TRAVIS_BRANCH.trim()));
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
getCommandOutput('git', ['rev-parse', '--abbrev-ref', 'HEAD'], (err, result) => {
|
|
77
|
-
if (err) {
|
|
78
|
-
cb(err);
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
cb(null, result.trim());
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function getPackageVersion(tag, branch) {
|
|
87
|
-
const baseVersion = `v${tag.major}.${tag.minor}.${tag.patch}`;
|
|
88
|
-
|
|
89
|
-
console.log(`Package version is "${baseVersion}"`);
|
|
90
|
-
|
|
91
|
-
// never publish with an suffix
|
|
92
|
-
// fixes https://github.com/Blizzard/node-rdkafka/issues/981
|
|
93
|
-
// baseVersion += '-';
|
|
94
|
-
|
|
95
|
-
// if (tag.commit === 0 && branch === 'master') {
|
|
96
|
-
// return baseVersion;
|
|
97
|
-
// }
|
|
98
|
-
|
|
99
|
-
// if (branch !== 'master') {
|
|
100
|
-
// baseVersion += (tag.commit + 1 + '.' + branch);
|
|
101
|
-
// } else {
|
|
102
|
-
// baseVersion += (tag.commit + 1);
|
|
103
|
-
// }
|
|
104
|
-
|
|
105
|
-
return baseVersion;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
getVersion((err, tag) => {
|
|
109
|
-
if (err) {
|
|
110
|
-
throw err;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
getBranch((err, branch) => {
|
|
114
|
-
if (err) {
|
|
115
|
-
throw err;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
pjs.version = getPackageVersion(tag, branch);
|
|
119
|
-
|
|
120
|
-
fs.writeFileSync(pjsPath, JSON.stringify(pjs, null, 2));
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
});
|