Skip to content

Commit 7e57879

Browse files
committed
revert tab completion to cjs
1 parent cd115a4 commit 7e57879

File tree

7 files changed

+64
-769
lines changed

7 files changed

+64
-769
lines changed

lib/cli.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import stringLength from 'string-length';
99
import rootCheck from 'root-check';
1010
import meow from 'meow';
1111
import list from 'cli-list';
12-
import Tabtab from 'tabtab';
12+
import tabtab from './completion/tabtab.cjs';
1313
import pkg from './utils/project-package.js';
1414
import Router from './router.js';
1515
import {bootstrap} from 'global-agent';
@@ -21,12 +21,6 @@ const gens = list(process.argv.slice(2));
2121

2222
bootstrap();
2323

24-
/* eslint new-cap: 0, no-extra-parens: 0 */
25-
const tabtab = new Tabtab.Commands.default({
26-
name: 'yo',
27-
completer: 'yo-complete'
28-
});
29-
3024
const cli = gens.map(gen => {
3125
const minicli = meow({autoHelp: false, autoVersion: true, pkg, argv: gen, importMeta: import.meta});
3226
const options = minicli.flags;
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
'use strict';
2-
import path from 'path';
3-
import {execFile} from 'node:child_process';
4-
import parseHelp from 'parse-help';
5-
import {getDirname} from '../utils/node-shims.js';
6-
7-
const __dirname = getDirname(import.meta.url);
2+
const path = require('path');
3+
const {execFile} = require('child_process');
4+
const parseHelp = require('parse-help');
85

96
/**
107
* The Completer is in charge of handling `yo-complete` behavior.
118
* @constructor
129
* @param {Environment} env A yeoman environment instance
1310
*/
14-
export default class Completer {
11+
class Completer {
1512
constructor(env) {
1613
this.env = env;
1714
}
@@ -105,3 +102,5 @@ export default class Completer {
105102
return results;
106103
}
107104
}
105+
106+
module.exports = Completer;
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
#! /usr/bin/env node
22
'use strict';
3-
import tabtabFactory from 'tabtab';
4-
import Completer from './completer.js';
5-
6-
const tabtab = tabtabFactory({
3+
const tabtab = require('tabtab')({
74
name: 'yo',
85
cache: !process.env.YO_TEST
96
});
7+
const Completer = require('./completer.cjs');
108

119
(async () => {
1210
// eslint-disable-next-line node/no-unsupported-features/es-syntax
@@ -23,4 +21,4 @@ const tabtab = tabtabFactory({
2321
tabtab.start();
2422
})();
2523

26-
export default tabtab;
24+
module.exports = tabtab;

lib/completion/tabtab.cjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const Tabtab = require('tabtab');
2+
3+
// eslint-disable-next-line new-cap
4+
const tabtab = new Tabtab.Commands.default({
5+
name: 'yo',
6+
completer: 'yo-complete',
7+
cache: false
8+
});
9+
10+
module.exports = tabtab;

0 commit comments

Comments
 (0)