UNPKG

1.04 kBJavaScriptView Raw
1"use strict";
2/*
3 Copyright 2018 Google LLC
4
5 Use of this source code is governed by an MIT-style
6 license that can be found in the LICENSE file or at
7 https://opensource.org/licenses/MIT.
8*/
9Object.defineProperty(exports, "__esModule", { value: true });
10exports.askSWSrc = void 0;
11const inquirer_1 = require("inquirer");
12const common_tags_1 = require("common-tags");
13// The key used for the question/answer.
14const name = 'swSrc';
15/**
16 * @return {Promise<Answers>} The answers from inquirer.
17 */
18function askQuestion() {
19 return (0, inquirer_1.prompt)([
20 {
21 name,
22 message: (0, common_tags_1.oneLine) `Where's your existing service worker file? To be used with
23 injectManifest, it should include a call to
24 'self.__WB_MANIFEST'`,
25 type: 'input',
26 },
27 ]);
28}
29async function askSWSrc() {
30 const answers = await askQuestion();
31 // When prompt type is input the return is string or null
32 return answers[name] ? answers[name].trim() : null;
33}
34exports.askSWSrc = askSWSrc;