cnpm / cnpmjs.org

Compare 14a6f62 ... +0 ... a1e8a82

Coverage Reach
controllers/sync_module_worker.js controllers/registry/package/list.js controllers/registry/package/save.js controllers/registry/package/update.js controllers/registry/package/download.js controllers/registry/package/dist_tag.js controllers/registry/package/remove_version.js controllers/registry/package/remove.js controllers/registry/package/download_total.js controllers/registry/package/tag.js controllers/registry/package/list_since.js controllers/registry/package/show.js controllers/registry/package/deprecate.js controllers/registry/package/list_shorts.js controllers/registry/package/list_versions.js controllers/registry/package/list_all.js controllers/registry/package/list_dependents.js controllers/registry/package/list_by_user.js controllers/registry/user/add.js controllers/registry/user/update.js controllers/registry/user/show.js controllers/registry/user/common.js controllers/registry/user/ping.js controllers/registry/user/whoami.js controllers/registry/token/create.js controllers/registry/token/list.js controllers/registry/token/del.js controllers/registry/user_package.js controllers/web/package/show.js controllers/web/package/search.js controllers/web/package/search_range.js controllers/web/package/list_privates.js controllers/web/badge.js controllers/web/user/show.js controllers/web/show_sync.js controllers/utils.js controllers/sync.js controllers/total.js services/package.js services/npm.js services/download_total.js services/total.js services/default_user_service.js services/user.js services/token.js services/module_log.js services/hook.js services/common.js middleware/auth.js middleware/publishable.js middleware/proxy_to_npm.js middleware/web_not_found.js middleware/login.js middleware/sync_by_install.js middleware/editable.js middleware/exists_package.js middleware/registry_not_found.js middleware/opensearch.js middleware/unpublishable.js middleware/limit.js middleware/static.js middleware/block.js models/user.js models/_module_maintainer_class_methods.js models/index.js models/token.js models/module_unpublished.js models/total.js models/utils.js models/tag.js models/module_abbreviated.js models/module_keyword.js models/package_readme.js models/module.js models/npm_module_maintainer.js models/download_total.js models/module_deps.js models/module_star.js models/module_log.js models/module_maintainer.js sync/sync_exist.js sync/status.js sync/sync_all.js sync/sync_popular.js common/urllib.js common/logger.js common/mail.js common/sequelize.js common/markdown.js common/cache.js common/nfs.js servers/web.js servers/registry.js routes/registry.js routes/web.js lib/common.js config/index.js

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -39,11 +39,11 @@
Loading
39 39
};
40 40
41 41
exports.getSyncTagDir = function (name) {
42 -
  return `${name}/sync/tags`;
42 +
  return `${name}/sync/tags/`;
43 43
};
44 44
45 45
exports.getSyncPackageDir = function (name) {
46 -
  return `${name}/sync/packages`;
46 +
  return `${name}/sync/packages/`;
47 47
};
48 48
49 49
const TAG_NAME_REG = /^tag-(.+)\.json$/;

@@ -4,6 +4,7 @@
Loading
4 4
var packageService = require('../../../services/package');
5 5
var userService = require('../../../services/user');
6 6
var config = require('../../../config');
7 +
var hook = require('../../../services/hook');
7 8
8 9
// PUT /:name/-rev/:rev
9 10
//
@@ -158,6 +159,31 @@
Loading
158 159
159 160
  var r = yield packageService.updatePrivateModuleMaintainers(name, usernames);
160 161
  debug('result: %j', r);
162 +
  if (r.add && r.add.length) {
163 +
    const envelope = {
164 +
      event: 'package:owner',
165 +
      name: name,
166 +
      type: 'package',
167 +
      version: null,
168 +
      hookOwner: null,
169 +
      payload: null,
170 +
      change: null,
171 +
    };
172 +
    hook.trigger(envelope);
173 +
  }
174 +
  if (r.remove && r.remove.length) {
175 +
    const envelope = {
176 +
      event: 'package:owner-rm',
177 +
      name: name,
178 +
      type: 'package',
179 +
      version: null,
180 +
      hookOwner: null,
181 +
      payload: null,
182 +
      change: null,
183 +
    };
184 +
    hook.trigger(envelope);
185 +
  }
186 +
161 187
162 188
  this.status = 201;
163 189
  this.body = {

@@ -360,22 +360,36 @@
Loading
360 360
    const distTagDirFiles = yield nfs.list(distTagDir);
361 361
    const distTagFileNames = distTagDirFiles.filter(fileName => common.isBackupTagFile(fileName));
362 362
363 -
    packageJsons = yield packageJsonFileNames.map(function* (packageJsonFileName) {
363 +
    const packageJsonRes = yield gather(packageJsonFileNames.map(function* (packageJsonFileName) {
364 364
      const version = common.getVersionFromFileName(packageJsonFileName);
365 365
      return yield readPackage(name, version);
366 +
    }), 5);
367 +
    packageJsons = packageJsonRes.map(({ isError, error, value}) => {
368 +
      if (isError) {
369 +
        error.message = '[sync] read package.json failed: ' + error.message;
370 +
        throw error;
371 +
      }
372 +
      return value;
366 373
    });
367 374
368 375
    packageJsons = packageJsons.sort((a, b) => {
369 376
      return a.publish_time - b.publish_time;
370 377
    });
371 378
372 -
    tags = yield distTagFileNames.map(function* (tagFileName) {
379 +
    const tagRes = yield gather(distTagFileNames.map(function* (tagFileName) {
373 380
      const tag = common.getTagNameFromFileName(tagFileName);
374 381
      const version = yield readDistTag(name, tag);
375 382
      return {
376 383
        tag,
377 384
        version,
378 385
      };
386 +
    }));
387 +
    tags = tagRes.map(({ isError, error, value}) => {
388 +
      if (isError) {
389 +
        error.message = '[sync] read dist-tag failed: ' + error.message;
390 +
        throw error;
391 +
      }
392 +
      return value;
379 393
    });
380 394
  } catch (err) {
381 395
    if (retryCount < 3) {
@@ -471,6 +485,7 @@
Loading
471 485
    try {
472 486
      yield nfs.download(packageJsonKey, filePath);
473 487
      const packageJSONFile = yield mzFs.readFile(filePath, 'utf8');
488 +
      console.log('file: ', filePath, packageJSONFile);
474 489
      const packageJSON = JSON.parse(packageJSONFile);
475 490
      return packageJSON;
476 491
    } finally {

Learn more Showing 3 files with coverage changes found.

Changes in services/package.js
-1
+1
Loading file...
Changes in services/download_total.js
-2
+2
Loading file...
Changes in services/hook.js
-1
+1
Loading file...
Files Coverage
common 66.67%
controllers -0.06% 85.39%
middleware 94.34%
models 90.42%
routes 100.00%
servers 90.91%
services 0.48% 92.13%
sync 89.61%
config/index.js 75.51%
lib/common.js 89.19%
Project Totals (97 files) 87.54%
Loading