@@ -7,21 +7,25 @@ const libs = path.join(root, "lib");
7
7
const clients = path . join ( root , "clients" ) ;
8
8
9
9
/**
10
- * Throw and Error if any deprecated package is not marked private.
10
+ * Throw and Error if any reserved package is not marked private.
11
11
*/
12
12
{
13
13
const excluded = [ ] ;
14
14
15
- const deprecatedPackages = path . join ( root , "deprecated" , "packages" ) ;
16
- for ( const folder of fs . readdirSync ( deprecatedPackages ) ) {
17
- const pkgJson = require ( path . join ( deprecatedPackages , folder , "package.json" ) ) ;
15
+ const reservedPackages = path . join ( root , "reserved" , "packages" ) ;
16
+ for ( const folder of fs . readdirSync ( reservedPackages ) ) {
17
+ const pkgJsonPath = path . join ( reservedPackages , folder , "package.json" ) ;
18
+ if ( ! fs . existsSync ( pkgJsonPath ) ) {
19
+ continue ;
20
+ }
21
+ const pkgJson = require ( path . join ( reservedPackages , folder , "package.json" ) ) ;
18
22
19
23
if ( excluded . includes ( pkgJson . name ) ) {
20
24
continue ;
21
25
}
22
26
23
27
if ( pkgJson . private !== true ) {
24
- throw new Error ( "package in deprecated folder is not marked private:" , folder ) ;
28
+ throw new Error ( "package in reserved folder is not marked private:" , folder ) ;
25
29
} else {
26
30
}
27
31
}
@@ -31,9 +35,19 @@ const clients = path.join(root, "clients");
31
35
* Analyze package dependency graph.
32
36
*/
33
37
{
34
- const packagesData = fs . readdirSync ( packages ) . map ( ( pkg ) => require ( path . join ( packages , pkg , "package.json" ) ) ) ;
35
- const libsData = fs . readdirSync ( libs ) . map ( ( pkg ) => require ( path . join ( libs , pkg , "package.json" ) ) ) ;
36
- const clientsData = fs . readdirSync ( clients ) . map ( ( pkg ) => require ( path . join ( clients , pkg , "package.json" ) ) ) ;
38
+ const hasPkgJson = ( subfolder , pkg ) => fs . existsSync ( path . join ( subfolder , pkg , "package.json" ) ) ;
39
+ const packagesData = fs
40
+ . readdirSync ( packages )
41
+ . filter ( hasPkgJson . bind ( null , "packages" ) )
42
+ . map ( ( pkg ) => require ( path . join ( packages , pkg , "package.json" ) ) ) ;
43
+ const libsData = fs
44
+ . readdirSync ( libs )
45
+ . filter ( hasPkgJson . bind ( null , "libs" ) )
46
+ . map ( ( pkg ) => require ( path . join ( libs , pkg , "package.json" ) ) ) ;
47
+ const clientsData = fs
48
+ . readdirSync ( clients )
49
+ . filter ( hasPkgJson . bind ( null , "clients" ) )
50
+ . map ( ( pkg ) => require ( path . join ( clients , pkg , "package.json" ) ) ) ;
37
51
38
52
const allPackages = [ ...packagesData , ...libsData , ...clientsData ] ;
39
53
0 commit comments