|
1 |
| -const spawn = require("../spawn"); |
2 |
| -const path = require("path"); |
3 |
| -const { prompt } = require("enquirer"); |
4 |
| -const { NPX, CREATE_REACT_APP } = require("../constants.js"); |
| 1 | +const spawn = require('../spawn'); |
| 2 | +const path = require('path'); |
| 3 | +const { prompt } = require('enquirer'); |
| 4 | +const { NPX, CREATE_REACT_APP } = require('../constants.js'); |
5 | 5 |
|
6 | 6 | module.exports = app => {
|
7 |
| - app.task("create-react-app", async () => { |
| 7 | + app.task('create-react-app', async () => { |
8 | 8 | let dest = app.options.name;
|
9 | 9 | if (!dest) {
|
10 | 10 | const answers = await prompt({
|
11 |
| - type: "text", |
12 |
| - name: "appName", |
13 |
| - message: "What would you like the app name to be?" |
| 11 | + type: 'text', |
| 12 | + name: 'appName', |
| 13 | + message: 'What would you like the app name to be?' |
14 | 14 | });
|
15 | 15 | dest = answers.appName;
|
16 | 16 | }
|
17 | 17 | await spawn(NPX, [CREATE_REACT_APP, dest]);
|
18 | 18 | });
|
19 | 19 |
|
20 |
| - app.task("create-react-app-templates", async () => { |
| 20 | + app.task('create-react-app-templates', async () => { |
21 | 21 | const dest = path.join(app.cwd, app.options.name);
|
22 | 22 | const answers = await prompt([
|
23 | 23 | {
|
24 |
| - type: "text", |
25 |
| - name: "description", |
26 |
| - message: "What description would you like to use for your website?" |
| 24 | + type: 'text', |
| 25 | + name: 'description', |
| 26 | + message: 'What description would you like to use for your website?' |
27 | 27 | },
|
28 | 28 | {
|
29 |
| - type: "text", |
30 |
| - name: "title", |
31 |
| - message: "What title would you like to use for your website?" |
| 29 | + type: 'text', |
| 30 | + name: 'title', |
| 31 | + message: 'What title would you like to use for your website?' |
32 | 32 | }
|
33 | 33 | ]);
|
34 | 34 |
|
35 | 35 | return app
|
36 |
| - .src("create-react-app/public/*.*", { |
37 |
| - cwd: path.join(__dirname, "../../templates") |
| 36 | + .src('create-react-app/public/*.*', { |
| 37 | + cwd: path.join(__dirname, '../../templates') |
38 | 38 | })
|
39 |
| - .pipe(app.renderFile("*", answers).on("error", console.error)) |
| 39 | + .pipe(app.renderFile('*', answers).on('error', console.error)) |
40 | 40 | .pipe(app.conflicts(dest))
|
41 | 41 | .pipe(app.dest(dest));
|
42 | 42 | });
|
43 | 43 |
|
44 |
| - app.task("default", ["create-react-app", "create-react-app-templates"]); |
| 44 | + app.task('default', ['create-react-app', 'create-react-app-templates']); |
45 | 45 | };
|
0 commit comments