Skip to content

Commit 43bd5e7

Browse files
authored
Ensure all dependencies of published packages are public (#2499)
1 parent 4b5f4a9 commit 43bd5e7

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

packages/@internationalized/date/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"version": "3.0.0-alpha.1",
44
"description": "Internationalized calendar and date manipulation utilities",
55
"license": "Apache-2.0",
6-
"private": true,
76
"main": "dist/main.js",
87
"module": "dist/module.js",
98
"types": "dist/types.d.ts",

scripts/checkPublishedDependencies.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
const exec = require('child_process').execSync;
4+
5+
let output = exec('yarn workspaces info --json').toString().replace(/^(.|\n)*?\{/, '{').replace(/\}\nDone in .*\n?$/, '}');
6+
let workspacePackages = JSON.parse(output);
7+
8+
let excludedPackages = new Set([
9+
'@adobe/spectrum-css-temp',
10+
'@react-spectrum/test-utils',
11+
'@spectrum-icons/build-tools',
12+
'@react-spectrum/docs'
13+
]);
14+
15+
let missing = new Set();
16+
for (let pkg in workspacePackages) {
17+
let json = JSON.parse(fs.readFileSync(path.join(__dirname, '..', workspacePackages[pkg].location, 'package.json'), 'utf8'));
18+
if (json.private) {
19+
continue;
20+
}
21+
22+
for (let dep of workspacePackages[pkg].workspaceDependencies) {
23+
let json = JSON.parse(fs.readFileSync(path.join(__dirname, '..', workspacePackages[dep].location, 'package.json'), 'utf8'));
24+
if (json.private && !excludedPackages.has(json.name)) {
25+
missing.add(dep);
26+
}
27+
}
28+
}
29+
30+
if (missing.size) {
31+
console.error('The following packages are marked private but are dependencies of published packages:');
32+
console.error(missing);
33+
process.exit(1);
34+
}

scripts/lint-packages.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,5 @@ for (let pkg of packages) {
136136
if (errors) {
137137
return process.exit(1);
138138
}
139+
140+
require('./checkPublishedDependencies');

0 commit comments

Comments
 (0)