@@ -82,31 +82,34 @@ jobs:
8282 - name : Login to NPM
8383 run : npm config set "//registry.npmjs.org/:_authToken=${NPM_ACCESS_TOKEN}"
8484
85- - name : Verify NPM publish access
85+ - name : Verify NPM token
8686 run : |
87+ npm ping
8788 npm whoami
88- npm access list packages @deck.gl-community --json > /tmp/npm-access.json
8989 node - <<'NODE'
9090 const fs = require('fs');
91- const packages = JSON.parse(fs.readFileSync('/tmp/npm-access.json', 'utf8'));
92- const requiredPackages = [
93- '@deck.gl-community/basemap-layers',
94- '@deck.gl-community/bing-maps',
95- '@deck.gl-community/editable-layers',
96- '@deck.gl-community/experimental',
97- '@deck.gl-community/geo-layers',
98- '@deck.gl-community/graph-layers',
99- '@deck.gl-community/infovis-layers',
100- '@deck.gl-community/layers',
101- '@deck.gl-community/leaflet',
102- '@deck.gl-community/react',
103- '@deck.gl-community/three',
104- '@deck.gl-community/timeline-layers',
105- '@deck.gl-community/widgets'
106- ];
107- const missing = requiredPackages.filter((name) => !Object.hasOwn(packages, name));
108- if (missing.length) {
109- throw new Error(`NPM token cannot see required @deck.gl-community packages: ${missing.join(', ')}`);
91+ const path = require('path');
92+
93+ const packageDirs = ['modules', 'dev'].flatMap((root) =>
94+ fs.existsSync(root)
95+ ? fs
96+ .readdirSync(root, {withFileTypes: true})
97+ .filter((entry) => entry.isDirectory())
98+ .map((entry) => path.join(root, entry.name))
99+ : []
100+ );
101+
102+ const packages = packageDirs
103+ .map((directory) => path.join(directory, 'package.json'))
104+ .filter((filename) => fs.existsSync(filename))
105+ .map((filename) => JSON.parse(fs.readFileSync(filename, 'utf8')))
106+ .filter((pkg) => pkg.name?.startsWith('@deck.gl-community/') && !pkg.private)
107+ .map((pkg) => pkg.name)
108+ .sort();
109+
110+ console.log(`NPM token is valid. Publishing ${packages.length} public packages:`);
111+ for (const name of packages) {
112+ console.log(`- ${name}`);
110113 }
111114 NODE
112115
0 commit comments