(answers, done, generateApis)
| 8 | var authServices = ['facebook', 'github', 'google']; |
| 9 | |
| 10 | function install(answers, done, generateApis) { |
| 11 | return helpers.run(path.join(__dirname, '../generators/app')) |
| 12 | .withPrompts(answers) |
| 13 | .toPromise() |
| 14 | .then(function (dir) { |
| 15 | var promise = Promise.resolve(dir); |
| 16 | |
| 17 | if (generateApis) { |
| 18 | console.log('Generating APIs...'); |
| 19 | promise = defaultApi(dir).then(function (dir) { |
| 20 | return apiWithDifferentEndpointName(dir); |
| 21 | }).then(function (dir) { |
| 22 | return apiWithNoMethods(dir); |
| 23 | }).then(function (dir) { |
| 24 | return apiWithReservedWord(dir); |
| 25 | }).then(function (dir) { |
| 26 | return apiWithAllMasterMethods(dir); |
| 27 | }).then(function (dir) { |
| 28 | return apiWithAllAdminMethods(dir); |
| 29 | }).then(function (dir) { |
| 30 | return apiWithAllUserMethods(dir); |
| 31 | }).then(function (dir) { |
| 32 | return apiWithDifferentUserField(dir); |
| 33 | }).then(function (dir) { |
| 34 | return apiWithOnlyPostUserMethod(dir); |
| 35 | }).then(function (dir) { |
| 36 | return apiWithoutModel(dir); |
| 37 | }).then(function (dir) { |
| 38 | return apiWithModelFields(dir); |
| 39 | }).then(function (dir) { |
| 40 | return apiWithUserModelField(dir); |
| 41 | }).then(function (dir) { |
| 42 | return apiWithCountAndRowsGetList(dir); |
| 43 | }); |
| 44 | } |
| 45 | |
| 46 | promise.then(function (dir) { |
| 47 | console.log('Copying node_modules folder...'); |
| 48 | fs.ensureSymlinkSync(path.join(__dirname, '../node_modules'), path.join(dir, 'node_modules')); |
| 49 | spawnCommand('npm', ['run', 'lint']).on('exit', function (err) { |
| 50 | if (err) { |
| 51 | return done(err); |
| 52 | } |
| 53 | if (process.env.CI) { |
| 54 | spawnCommand('npm', ['test', '--', '-i', '--coverage']).on('exit', done); |
| 55 | } else { |
| 56 | spawnCommand('npm', ['test']).on('exit', done); |
| 57 | } |
| 58 | }); |
| 59 | }).catch(function (err) { |
| 60 | console.log(err); |
| 61 | console.log(err.stack); |
| 62 | done(err); |
| 63 | }); |
| 64 | }); |
| 65 | } |
| 66 | |
| 67 | function defaultApi(dir) { |
no test coverage detected