Skip to content

Commit

Permalink
chore: update pinned-deps script
Browse files Browse the repository at this point in the history
  • Loading branch information
jrandolf committed Sep 29, 2022
1 parent ba86cbc commit 4e4f36a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion scripts/ensure-pinned-deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,28 @@
* limitations under the License.
*/

import {readdirSync, readFileSync} from 'fs';
import {join} from 'path';
import packageJson from '../package.json';

const LOCAL_PACKAGE_NAMES = [];
const packagesDir = join(__dirname, '..', 'packages');
for (const package of readdirSync(packagesDir)) {
const {name} = JSON.parse(
readFileSync(join(packagesDir, package, 'package.json'), 'utf8')
);
LOCAL_PACKAGE_NAMES.push(name);
}

const allDeps = {...packageJson.dependencies, ...packageJson.devDependencies};

const invalidDeps = new Map<string, string>();

for (const [depKey, depValue] of Object.entries(allDeps)) {
if (/[0-9\*]/.test(depValue[0]!)) {
if (LOCAL_PACKAGE_NAMES.includes(depKey)) {
continue;
}
if (/[0-9]/.test(depValue[0]!)) {
continue;
}

Expand Down

0 comments on commit 4e4f36a

Please sign in to comment.