2021-10-28 06:27:35 -04:00
|
|
|
/*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
* or more contributor license agreements. See the NOTICE file
|
|
|
|
* distributed with this work for additional information
|
|
|
|
* regarding copyright ownership. The ASF licenses this file
|
|
|
|
* to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
|
|
|
|
2019-01-30 16:55:25 -05:00
|
|
|
/* eslint-disable sort-keys */
|
|
|
|
|
2018-11-07 19:03:20 -05:00
|
|
|
const Generator = require('yeoman-generator');
|
2019-01-30 16:55:25 -05:00
|
|
|
const chalk = require('chalk');
|
|
|
|
const yosay = require('yosay');
|
2018-11-07 19:03:20 -05:00
|
|
|
|
|
|
|
module.exports = class extends Generator {
|
2019-01-30 16:55:25 -05:00
|
|
|
async prompting() {
|
|
|
|
// Have Yeoman greet the user.
|
2021-11-09 07:42:28 -05:00
|
|
|
this.log(
|
|
|
|
yosay(`Welcome to the rad ${chalk.red('generator-superset')} generator!`),
|
|
|
|
);
|
2019-01-30 16:55:25 -05:00
|
|
|
|
|
|
|
this.option('skipInstall');
|
|
|
|
|
|
|
|
this.answers = await this.prompt([
|
|
|
|
{
|
|
|
|
type: 'list',
|
|
|
|
name: 'subgenerator',
|
|
|
|
message: 'What do you want to do?',
|
|
|
|
choices: [
|
|
|
|
{
|
2020-05-13 16:51:43 -04:00
|
|
|
name: 'Create superset-ui core package',
|
2019-01-30 16:55:25 -05:00
|
|
|
value: 'package',
|
|
|
|
},
|
|
|
|
{
|
2020-05-13 16:51:43 -04:00
|
|
|
name: 'Create superset-ui chart plugin package',
|
|
|
|
value: 'plugin-chart',
|
|
|
|
},
|
2019-01-30 16:55:25 -05:00
|
|
|
],
|
|
|
|
},
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
configuring() {
|
2018-11-07 19:03:20 -05:00
|
|
|
// Redirect the default 'app' generator
|
|
|
|
// to 'package' subgenerator
|
|
|
|
// until there are multiple subgenerators
|
|
|
|
// then this can be changed into a menu to select
|
|
|
|
// subgenerator.
|
2019-01-30 16:55:25 -05:00
|
|
|
this.composeWith(require.resolve(`../${this.answers.subgenerator}`));
|
2018-11-07 19:03:20 -05:00
|
|
|
}
|
|
|
|
};
|