diff --git a/lib/generators/ant-design-pro/index.js b/lib/generators/ant-design-pro/index.js index 4f2d4ce..4ff25be 100644 --- a/lib/generators/ant-design-pro/index.js +++ b/lib/generators/ant-design-pro/index.js @@ -40,30 +40,12 @@ class AntDesignProGenerator extends BasicGenerator { }; } else { const prompts = [ - { - name: 'nextPro', - type: 'list', - choices: ['Pro V5', 'Pro V4'], - message: '🧙 Be the first to experience the new umi@3 ?', - default: 'Pro V4', - when: () => { - // 为了测试,没有任何用处 - process.send && process.send({ type: 'prompt' }); - process.emit('message', { type: 'prompt' }); - return true; - }, - }, { name: 'language', type: 'list', message: '🤓 Which language do you want to use?', choices: ['TypeScript', 'JavaScript'], default: 'TypeScript', - when: ({ nextPro }) => { - process.send && process.send({ type: 'prompt' }); - process.emit('message', { type: 'prompt' }); - return nextPro === 'Pro V4'; - }, }, { name: 'allBlocks', @@ -71,23 +53,6 @@ class AntDesignProGenerator extends BasicGenerator { message: '🚀 Do you need all the blocks or a simple scaffold?', choices: ['simple', 'complete'], default: 'simple', - when: ({ nextPro }) => { - process.send && process.send({ type: 'prompt' }); - process.emit('message', { type: 'prompt' }); - return nextPro === 'Pro V4'; - }, - }, - { - name: 'nextAntd', - type: 'list', - choices: ['antd@4', 'antd@3'], - when: ({ allBlocks, nextPro }) => { - process.send && process.send({ type: 'prompt' }); - process.emit('message', { type: 'prompt' }); - return allBlocks === 'simple' && nextPro === 'Pro V4'; - }, - message: '🦄 Time to use better, faster and latest antd@4!', - default: 'antd@4', }, ]; return this.prompt(prompts).then(props => { @@ -97,7 +62,7 @@ class AntDesignProGenerator extends BasicGenerator { } async writing() { - const { language = 'TypeScript', allBlocks, nextPro, nextAntd } = this.prompts; + const { language = 'TypeScript', allBlocks, } = this.prompts; const isTypeScript = language === 'TypeScript'; const projectName = this.opts.name || this.opts.env.cwd; @@ -110,26 +75,12 @@ class AntDesignProGenerator extends BasicGenerator { const githubUrl = await getGithubUrl(); const gitArgs = [`clone`, githubUrl, `--depth=1`]; - // 如果想要使用旧的 antd,使用 antd@3 分支 - if (nextAntd === 'antd@3' && allBlocks === 'simple') { - gitArgs.push('--branch', 'antd@3'); - } - - if (nextPro === 'Pro V5') { - gitArgs.push('--branch', 'v5'); - } - // all-blocks 分支上包含了所有的区块 if (allBlocks === 'complete') { log(`🙈 complete mode can only use the version of antd@4`); gitArgs.push('--branch', 'all-blocks'); } - // Set branch if provided - if (this.opts.args.branch && !nextPro) { - gitArgs.push('--branch', this.opts.args.branch); - } - gitArgs.push(projectName); // // 没有提供关闭的配置 diff --git a/test/index.test.js b/test/index.test.js index 1f06f6d..4ad3cd9 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -136,8 +136,6 @@ describe('typescript', () => { .beforeScript(path.join(fixtures, 'mock_github.js')) .waitForPrompt() .writeKey('ENTER') - .writeKey('ENTER') - .writeKey('ENTER') // js .writeKey('DOWN', 'ENTER') // all blocks