Skip to content

Commit

Permalink
feat: support override scripts config (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 authored Mar 25, 2022
1 parent 0f335a1 commit caa0706
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 26 deletions.
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,13 @@
"5.3.4": {
"version": "5.3.3",
"reason": "https://github.com/styled-components/styled-components/issues/3706"
},
"5.3.5": {
"version": "5.3.5",
"scripts": {
"postinstall": ""
},
"reason": "https://github.com/styled-components/styled-components/commit/ba9d732ca7da53f2a095e35450ecffd592c6f5ba"
}
}
}
Expand All @@ -902,6 +909,7 @@
"find-duplicated-property-keys": "^1.2.7",
"git-contributor": "^1.0.10",
"husky": "^4.2.5",
"node-core-test": "^1.1.0",
"semantic-release": "^17.3.9"
},
"ci": {
Expand Down
59 changes: 33 additions & 26 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
'use strict';

const assert = require('assert');
const test = require('node-core-test')
const bugVersions = require('.');

let pkgCount = 0;
let versionCount = 0;
for (const name in bugVersions) {
pkgCount++;
const versions = bugVersions[name];
assert(versions);
for (const version in versions) {
versionCount++;
const item = versions[version];
assert(item);
assert(item.version || item.dependencies);
if (item.version) {
assert(typeof item.version === 'string');
} else if (item.dependencies) {
assert(typeof item.dependencies === 'object');
assert(Object.keys(item.dependencies).length > 0);
}
test('should get bug-versions', () => {
let pkgCount = 0;
let versionCount = 0;
for (const name in bugVersions) {
pkgCount++;
const versions = bugVersions[name];
assert(versions);
for (const version in versions) {
versionCount++;
const item = versions[version];
assert(item);
assert(item.version || item.dependencies);
if (item.version) {
assert(typeof item.version === 'string');
} else if (item.dependencies) {
assert(typeof item.dependencies === 'object');
assert(Object.keys(item.dependencies).length > 0);
}

assert(item.reason)
assert(typeof item.reason === 'string');
assert(item.reason)
assert(typeof item.reason === 'string');
}
}
}

console.log('Total: %d bug pkgs and %d bug versions', pkgCount, versionCount);
console.log('');
console.log('Total: %d bug pkgs and %d bug versions', pkgCount, versionCount);
assert(pkgCount > 0);
assert(versionCount > 0);
});

const pkg = require('./package');
console.log('unsafe-node-versions: %s', JSON.stringify(pkg.config['unsafe-node-versions'], null, 2));
console.log('');
console.log('unsafe-alinode-versions: %s', JSON.stringify(pkg.config['unsafe-alinode-versions'], null, 2));
test('should get "config" field from package.json', () => {
const pkg = require('./package');
assert(pkg.config['unsafe-node-versions']);
// console.log('unsafe-node-versions: %s', JSON.stringify(pkg.config['unsafe-node-versions'], null, 2));
assert(pkg.config['unsafe-alinode-versions']);
// console.log('unsafe-alinode-versions: %s', JSON.stringify(pkg.config['unsafe-alinode-versions'], null, 2));
});

0 comments on commit caa0706

Please sign in to comment.