1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | exports.autoDetectEntries = void 0;
|
7 | const globby_1 = __importDefault(require("globby"));
|
8 | const path_1 = require("path");
|
9 | async function autoDetectEntries(options) {
|
10 | const attempts = {
|
11 | bundle: await globby_1.default(path_1.resolve(options.srcFolder, 'bundle.(js|ts)')),
|
12 | application: await globby_1.default(path_1.resolve(options.srcFolder, 'js/(application|app).(js|ts|jsx|tsx)'))
|
13 | };
|
14 | const entries = {};
|
15 | if (attempts.bundle.length) {
|
16 | entries.bundle = attempts.bundle[0];
|
17 | }
|
18 | else if (attempts.application.length) {
|
19 | entries['js/app'] = attempts.application[0];
|
20 | }
|
21 | else {
|
22 | throw new Error('Unable to autodetect the main entry file. Please specify entries manually.');
|
23 | }
|
24 | return entries;
|
25 | }
|
26 | exports.autoDetectEntries = autoDetectEntries;
|