mirror of
https://github.com/scratchfoundation/scratch-analysis.git
synced 2024-11-28 02:25:45 -05:00
Keep the origin from the project meta tag around. For sb2s, make it always empty.
This commit is contained in:
parent
adb9c56f53
commit
26ff6d7265
5 changed files with 21 additions and 2 deletions
|
@ -238,6 +238,9 @@ module.exports = function (project, callback) {
|
|||
// Extensions
|
||||
meta.extensions = extensions(project);
|
||||
|
||||
// Metadata is only in sb3s so just fill in an empty object.
|
||||
meta.meta = {};
|
||||
|
||||
// Return all metadata
|
||||
return callback(null, meta);
|
||||
};
|
||||
|
|
|
@ -125,6 +125,12 @@ const extensions = function (list) {
|
|||
};
|
||||
};
|
||||
|
||||
const metadata = function (meta) {
|
||||
return {
|
||||
origin: meta.origin ? meta.origin : ''
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = function (project, callback) {
|
||||
const meta = {
|
||||
scripts: scripts(project.targets),
|
||||
|
@ -136,7 +142,8 @@ module.exports = function (project, callback) {
|
|||
costumes: extract(project.targets, 'costumes', 'name', 'md5ext'),
|
||||
sprites: sprites(project.targets),
|
||||
blocks: blocks(project.targets),
|
||||
extensions: extensions(project.extensions)
|
||||
extensions: extensions(project.extensions),
|
||||
meta: metadata(project.meta)
|
||||
};
|
||||
|
||||
callback(null, meta);
|
||||
|
|
3
test/fixtures/sb3/default.json
vendored
3
test/fixtures/sb3/default.json
vendored
|
@ -98,6 +98,7 @@
|
|||
"meta": {
|
||||
"semver": "3.0.0",
|
||||
"vm": "0.2.0-prerelease.20181217191056",
|
||||
"agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"
|
||||
"agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
|
||||
"origin": "test.scratch.mit.edu"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,6 +69,9 @@ test('defalt (object)', t => {
|
|||
t.equal(result.extensions.count, 0);
|
||||
t.deepEqual(result.extensions.id, []);
|
||||
|
||||
t.type(result.meta, 'object');
|
||||
t.deepEqual(result.meta, {});
|
||||
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -75,6 +75,8 @@ test('defalt (object)', t => {
|
|||
t.equal(result.extensions.count, 0);
|
||||
t.deepEqual(result.extensions.id, []);
|
||||
|
||||
t.type(result.meta, 'object');
|
||||
t.equal(result.meta.origin, 'test.scratch.mit.edu');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
@ -137,6 +139,9 @@ test('defalt (binary)', t => {
|
|||
t.equal(result.extensions.count, 0);
|
||||
t.deepEqual(result.extensions.id, []);
|
||||
|
||||
t.type(result.meta, 'object');
|
||||
t.equal(result.meta.origin, '');
|
||||
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue