Skip to content

Commit 9e8d656

Browse files
committed
manual: lib sha get timestamp and ordered by time
1 parent bf6a501 commit 9e8d656

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

ci/cloudfunctions/getVizzuList/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,22 @@ exports.getVizzuList = (req, res) => {
77
const bucket = storage.bucket(bucketName);
88
bucket.getFiles().then(files => {
99
let ans = [];
10+
files[0].sort((a, b) => {
11+
if (a.metadata.updated > b.metadata.updated) {
12+
return 1;
13+
}
14+
if (a.metadata.updated < b.metadata.updated) {
15+
return -1;
16+
}
17+
return 0;
18+
});
1019
files[0].forEach(file => {
1120
let fileEnd = '/vizzu.js'
1221
if (file.name.endsWith(fileEnd)) {
13-
ans.push(file.name.slice(0,-fileEnd.length));
22+
let tmp = {};
23+
tmp.sha = file.name.slice(0,-fileEnd.length)
24+
tmp.time = file.metadata.updated;
25+
ans.push(tmp);
1426
}
1527
});
1628
let message = req.query.message || req.body.message || JSON.stringify(ans);

ci/cloudfunctions/getVizzuList/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "getVizzuList",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"dependencies": {
55
"@google-cloud/storage": "*",
66
"@google-cloud/functions-framework": "*"

test/integration/manual/manual.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class Manual {
3838
libList['HEAD'] = 'https://' + remoteStableBucket + '/lib';
3939
let vizzuListUrl = await fetch('https://' + remoteCloudFunctions + '/getVizzuList');
4040
let vizzuList = await vizzuListUrl.json();
41-
vizzuList.forEach(vizzu => {
42-
libList[vizzu] = 'https://' + remoteLatestBucket + '/' + vizzu;
41+
vizzuList.slice().reverse().forEach(vizzu => {
42+
libList[vizzu.time.substring(0,10) + ' ' + vizzu.time.substring(11,16) + ' ' + vizzu.sha] = 'https://' + remoteLatestBucket + '/' + vizzu.sha;
4343
});
4444
libList['0.2.0'] = 'https://vizzuhq.github.io/vizzu-beta-release/0.2.0';
4545
this.#server.get('/getLibList', (req, res) => {

0 commit comments

Comments
 (0)