UNPKG

1.78 kBJavaScriptView Raw
1"use strict";
2/* -----------------------------------------------------------------------------
3| Copyright (c) Jupyter Development Team.
4| Distributed under the terms of the Modified BSD License.
5|----------------------------------------------------------------------------*/
6var __importStar = (this && this.__importStar) || function (mod) {
7 if (mod && mod.__esModule) return mod;
8 var result = {};
9 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
10 result["default"] = mod;
11 return result;
12};
13Object.defineProperty(exports, "__esModule", { value: true });
14const fs = __importStar(require("fs-extra"));
15const glob = __importStar(require("glob"));
16const path = __importStar(require("path"));
17const utils = __importStar(require("./utils"));
18utils.run('npm run clean:slate');
19utils.run('lerna run prepublishOnly');
20utils.getLernaPaths().forEach(pkgPath => {
21 const pkgData = utils.readJSONFile(path.join(pkgPath, 'package.json'));
22 const name = pkgData.name;
23 // Skip private packages.
24 if (!pkgData.public) {
25 return;
26 }
27 console.debug(`Checking ${name}...`);
28 // Make sure each glob resolves to at least one file.
29 pkgData.files.forEach((fGlob) => {
30 const result = glob.sync(fGlob);
31 if (result.length === 0) {
32 throw new Error(`${name} has missing file(s) "${fGlob}"`);
33 }
34 });
35 // Make sure there is a main and that it exists.
36 const main = pkgData.main;
37 if (!main) {
38 throw new Error(`No "main" entry for ${name}`);
39 }
40 const mainPath = path.join(pkgPath, main);
41 if (!fs.existsSync(mainPath)) {
42 throw new Error(`"main" entry "${main}" not found for ${name}`);
43 }
44});
45//# sourceMappingURL=prepublish-check.js.map
\No newline at end of file