Skip to content

Commit

Permalink
feat: add canvas mirror config (cnpm#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
killagu authored Mar 2, 2021
1 parent 060c6ca commit bd03075
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ node_modules

dump.rdb
.DS_Store
.idea

.dist
.tmp
Expand Down
14 changes: 14 additions & 0 deletions config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,20 @@ var config = {
alwayNewDirIndex: 0,
},

'canvas': {
name: 'canvas',
category: 'node-canvas-prebuilt',
enable: true,
disturl: 'https://github.com/Automattic/node-canvas/releases',
repo: 'Automattic/node-canvas',
url: 'https://github.com/Automattic/node-canvas',
description: 'Repo used to build binaries for node-canvas on CI',
syncerClass: 'GithubWithVersion',
needFormatTagName: false,
// for mirrors
alwayNewDirIndex: 0,
},

'node-swc': {
name: 'node-swc',
category: 'node-swc',
Expand Down
28 changes: 28 additions & 0 deletions test/sync/canvas.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'use strict';

var assert = require('assert');
var config = require('../../config');
var mm = require('mm');
var GithubWithVersion = require('../../sync/GithubWithVersion');

describe('test/sync/canvas-prebuilt-v2.test.js', function () {
var syncer = new GithubWithVersion(config.categories['canvas']);

describe('listdiff()', function () {
it('should list exists between original sources', function *() {
mm(syncer, 'listExists', function *() {
return [];
});
var items = yield syncer.listdiff('/v2.7.0/', 0);
const diff = items.find(item => item.name === 'canvas-v2.7.0-node-v57-darwin-unknown-x64.tar.gz');
assert.deepStrictEqual(diff, {
name: 'canvas-v2.7.0-node-v57-darwin-unknown-x64.tar.gz',
date: '2020-08-01T21:25:27Z',
size: 10009583,
type: 'file',
downloadURL: 'https://github.com/Automattic/node-canvas/releases/download/v2.7.0/canvas-v2.7.0-node-v57-darwin-unknown-x64.tar.gz',
parent: '/v2.7.0/'
});
});
});
});

0 comments on commit bd03075

Please sign in to comment.