bod 5.21.7 → 5.21.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -69,5 +69,5 @@ Options:
69
69
  ## Contact
70
70
 
71
71
  [![Email](https://img.shields.io/badge/-Gmail-ea4335?style=for-the-badge&logo=gmail&logoColor=white)](mailto:sabertazimi@gmail.com)
72
- [![Twitter](https://img.shields.io/badge/-Twitter-1da1f2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/sabertazimi)
72
+ [![X](https://img.shields.io/badge/-X.com-000000?style=for-the-badge&logo=x&logoColor=white)](https://x.com/sabertazimi)
73
73
  [![GitHub](https://img.shields.io/badge/-GitHub-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/sabertazimi)
package/dist/bod.js CHANGED
@@ -1,34 +1,34 @@
1
- "use strict";
2
1
  var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const tslib_1 = require("tslib");
5
- const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
6
- const node_path_1 = tslib_1.__importDefault(require("node:path"));
7
- const node_process_1 = tslib_1.__importDefault(require("node:process"));
8
- const index_1 = require("./index");
9
- const utils_1 = require("./utils");
10
- const packageJsonPath = node_path_1.default.join(__dirname, '../package.json');
11
- const packageJson = JSON.parse(node_fs_1.default.readFileSync(packageJsonPath, { encoding: 'utf-8' }));
12
- utils_1.program.version((_a = packageJson.version) !== null && _a !== void 0 ? _a : '0.0.1', '-v, --version');
13
- for (const command of index_1.CommandFactory.values()) {
14
- utils_1.program
2
+ import { __awaiter } from "tslib";
3
+ import fs from 'node:fs';
4
+ import path from 'node:path';
5
+ import process from 'node:process';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { CommandFactory } from './index.js';
8
+ import { color, printer, program } from './utils/index.js';
9
+ const dirname = path.dirname(fileURLToPath(import.meta.url));
10
+ const packageJsonPath = path.join(dirname, '../package.json');
11
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf-8' }));
12
+ program.version((_a = packageJson.version) !== null && _a !== void 0 ? _a : '0.0.1', '-v, --version');
13
+ for (const command of CommandFactory.values()) {
14
+ program
15
15
  .command(command.getUsage())
16
16
  .alias(command.getAlias())
17
17
  .description(command.getDescription())
18
- .action((appName) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
18
+ .action((appName) => __awaiter(void 0, void 0, void 0, function* () {
19
19
  try {
20
20
  yield command.run(appName);
21
21
  }
22
22
  catch (error) {
23
- utils_1.printer.error(error);
24
- utils_1.program.outputHelp();
23
+ printer.error(error);
24
+ program.outputHelp();
25
25
  }
26
26
  }));
27
27
  }
28
- utils_1.program.on('--help', () => {
29
- utils_1.printer.log('');
30
- utils_1.printer.info(` Run ${utils_1.color.cyan(`bod <command> --help`)} for detailed usage of given command.`);
31
- utils_1.printer.log('');
28
+ program.on('--help', () => {
29
+ printer.log('');
30
+ printer.info(` Run ${color.cyan(`bod <command> --help`)} for detailed usage of given command.`);
31
+ printer.log('');
32
32
  });
33
- utils_1.program.showHelpAfterError();
34
- utils_1.program.parse(node_process_1.default.argv);
33
+ program.showHelpAfterError();
34
+ program.parse(process.argv);
@@ -1,6 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
1
+ import { __awaiter } from "tslib";
4
2
  class BaseCommand {
5
3
  constructor(options) {
6
4
  const { name, description, usage, alias } = options;
@@ -10,7 +8,7 @@ class BaseCommand {
10
8
  this.alias = alias !== null && alias !== void 0 ? alias : this.name[0];
11
9
  }
12
10
  run(_appName) {
13
- return tslib_1.__awaiter(this, void 0, void 0, function* () { });
11
+ return __awaiter(this, void 0, void 0, function* () { });
14
12
  }
15
13
  getName() {
16
14
  return this.name;
@@ -25,4 +23,4 @@ class BaseCommand {
25
23
  return this.alias;
26
24
  }
27
25
  }
28
- exports.default = BaseCommand;
26
+ export default BaseCommand;
@@ -1,4 +1,4 @@
1
- import BaseCommand from './BaseCommand';
1
+ import BaseCommand from './BaseCommand.js';
2
2
  interface Action {
3
3
  name: string;
4
4
  value: string;
@@ -1,9 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const utils_1 = require("../utils");
5
- const BaseCommand_1 = tslib_1.__importDefault(require("./BaseCommand"));
6
- class CreateCommand extends BaseCommand_1.default {
1
+ import { __awaiter } from "tslib";
2
+ import { findPackageManager, select, spawn } from '../utils/index.js';
3
+ import BaseCommand from './BaseCommand.js';
4
+ class CreateCommand extends BaseCommand {
7
5
  constructor() {
8
6
  super({
9
7
  name: 'create',
@@ -16,7 +14,7 @@ class CreateCommand extends BaseCommand_1.default {
16
14
  this.resolvePackageManager();
17
15
  }
18
16
  run(appName_1) {
19
- return tslib_1.__awaiter(this, arguments, void 0, function* (appName, additionalOptions = []) {
17
+ return __awaiter(this, arguments, void 0, function* (appName, additionalOptions = []) {
20
18
  yield this.processTemplateAction();
21
19
  this.resolveAppPath(appName);
22
20
  this.execute(additionalOptions);
@@ -29,15 +27,14 @@ class CreateCommand extends BaseCommand_1.default {
29
27
  return this.commandArgs;
30
28
  }
31
29
  processTemplateAction() {
32
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
- const { templateName } = yield utils_1.inquirer.prompt([
34
- {
35
- name: 'templateName',
36
- type: 'list',
37
- message: 'Select template:',
38
- choices: [...CreateCommand.TemplateActions],
39
- },
40
- ]);
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ const templateName = yield select({
32
+ message: 'Select template:',
33
+ choices: CreateCommand.TemplateActions.map(action => ({
34
+ name: action.name,
35
+ value: action.value,
36
+ })),
37
+ });
41
38
  const { command, args, postCommands } = CreateCommand.TemplateActions.find(({ value }) => value === templateName);
42
39
  this.command = command;
43
40
  this.commandArgs = [...args];
@@ -45,7 +42,7 @@ class CreateCommand extends BaseCommand_1.default {
45
42
  });
46
43
  }
47
44
  resolvePackageManager() {
48
- const packageManager = (0, utils_1.findPackageManager)();
45
+ const packageManager = findPackageManager();
49
46
  CreateCommand.TemplateActions.forEach((action) => {
50
47
  if (action.command === 'npm')
51
48
  action.command = packageManager;
@@ -62,14 +59,14 @@ class CreateCommand extends BaseCommand_1.default {
62
59
  });
63
60
  }
64
61
  execute(additionalOptions) {
65
- const proc = utils_1.spawn.sync(this.command, [...this.commandArgs, ...additionalOptions], {
62
+ const proc = spawn.sync(this.command, [...this.commandArgs, ...additionalOptions], {
66
63
  stdio: 'inherit',
67
64
  });
68
65
  if (proc.status !== 0) {
69
66
  throw new Error(`\n\`${this.command} ${this.commandArgs.join(' ')}\` exited.`);
70
67
  }
71
68
  this.postCommands.forEach((postCommand) => {
72
- const proc = utils_1.spawn.sync(postCommand.command, postCommand.args, {
69
+ const proc = spawn.sync(postCommand.command, postCommand.args, {
73
70
  stdio: 'inherit',
74
71
  });
75
72
  if (proc.status !== 0) {
@@ -134,4 +131,4 @@ CreateCommand.TemplateActions = [
134
131
  postCommands: [],
135
132
  },
136
133
  ];
137
- exports.default = CreateCommand;
134
+ export default CreateCommand;
@@ -1,4 +1,4 @@
1
- import BaseCommand from './BaseCommand';
1
+ import BaseCommand from './BaseCommand.js';
2
2
  declare class InfoCommand extends BaseCommand {
3
3
  constructor();
4
4
  run(_appName?: string): Promise<void>;
@@ -1,9 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const utils_1 = require("../utils");
5
- const BaseCommand_1 = tslib_1.__importDefault(require("./BaseCommand"));
6
- class InfoCommand extends BaseCommand_1.default {
1
+ import { __awaiter } from "tslib";
2
+ import { envinfo, printer } from '../utils/index.js';
3
+ import BaseCommand from './BaseCommand.js';
4
+ class InfoCommand extends BaseCommand {
7
5
  constructor() {
8
6
  super({
9
7
  name: 'info',
@@ -12,9 +10,9 @@ class InfoCommand extends BaseCommand_1.default {
12
10
  });
13
11
  }
14
12
  run(_appName) {
15
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
16
- utils_1.printer.info(`Environment information:`);
17
- const envInfo = yield utils_1.envinfo.run({
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ printer.info(`Environment information:`);
15
+ const envInfo = yield envinfo.run({
18
16
  System: ['OS', 'CPU'],
19
17
  Binaries: ['Node', 'Yarn', 'npm'],
20
18
  Browsers: ['Chrome', 'Edge', 'Firefox', 'Safari'],
@@ -25,8 +23,8 @@ class InfoCommand extends BaseCommand_1.default {
25
23
  duplicates: true,
26
24
  fullTree: true,
27
25
  });
28
- utils_1.printer.info(envInfo);
26
+ printer.info(envInfo);
29
27
  });
30
28
  }
31
29
  }
32
- exports.default = InfoCommand;
30
+ export default InfoCommand;
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const BaseCommand_1 = tslib_1.__importDefault(require("../BaseCommand"));
1
+ import { __awaiter } from "tslib";
2
+ import BaseCommand from '../BaseCommand.js';
5
3
  const options = {
6
4
  name: 'base',
7
5
  description: 'Base command description',
@@ -10,27 +8,27 @@ const options = {
10
8
  };
11
9
  describe('baseCommand', () => {
12
10
  it('should have [name] field', () => {
13
- const baseCommand = new BaseCommand_1.default(options);
11
+ const baseCommand = new BaseCommand(options);
14
12
  expect(baseCommand.getName()).toBe(options.name);
15
13
  });
16
14
  it('should have [description] field', () => {
17
- const baseCommand = new BaseCommand_1.default(options);
15
+ const baseCommand = new BaseCommand(options);
18
16
  expect(baseCommand.getDescription()).toBe(options.description);
19
17
  });
20
18
  it('should have [usage] field', () => {
21
- const baseCommand = new BaseCommand_1.default(options);
19
+ const baseCommand = new BaseCommand(options);
22
20
  expect(baseCommand.getUsage()).toBe(options.usage);
23
21
  });
24
22
  it('should have [alias] field', () => {
25
- const baseCommand = new BaseCommand_1.default(options);
23
+ const baseCommand = new BaseCommand(options);
26
24
  expect(baseCommand.getAlias()).toBe(options.alias);
27
25
  });
28
26
  it('should set [alias] field to first character of [name] field by default', () => {
29
- const baseCommand = new BaseCommand_1.default(Object.assign(Object.assign({}, options), { alias: undefined }));
27
+ const baseCommand = new BaseCommand(Object.assign(Object.assign({}, options), { alias: undefined }));
30
28
  expect(baseCommand.getAlias()).toBe(options.name[0]);
31
29
  });
32
- it('should have [run] method', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
33
- const baseCommand = new BaseCommand_1.default(options);
30
+ it('should have [run] method', () => __awaiter(void 0, void 0, void 0, function* () {
31
+ const baseCommand = new BaseCommand(options);
34
32
  yield expect(baseCommand.run()).resolves.toBeUndefined();
35
33
  }));
36
34
  });
@@ -1,31 +1,25 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const ci_info_1 = require("ci-info");
5
- const rimraf_1 = require("rimraf");
6
- const utils_1 = require("../../utils");
7
- const CreateCommand_1 = tslib_1.__importDefault(require("../CreateCommand"));
1
+ import { __awaiter } from "tslib";
2
+ import { isCI } from 'ci-info';
3
+ import { sync } from 'rimraf';
4
+ import * as utils from '../../utils/index.js';
5
+ import CreateCommand from '../CreateCommand.js';
6
+ const { spawn } = utils;
8
7
  const appPath = 'bod-unit-tests';
9
8
  describe('createCommand', () => {
10
- beforeEach(() => (0, rimraf_1.sync)(appPath));
11
- afterEach(() => (0, rimraf_1.sync)(appPath));
9
+ beforeEach(() => sync(appPath));
10
+ afterEach(() => sync(appPath));
12
11
  it('should extends [BaseCommand] fields', () => {
13
- const createCommand = new CreateCommand_1.default();
12
+ const createCommand = new CreateCommand();
14
13
  expect(createCommand.getName()).toBe('create');
15
14
  expect(createCommand.getDescription()).toBe('Create a new project powered by @sabertazimi/react-scripts');
16
15
  expect(createCommand.getUsage()).toBe('create <appName>');
17
16
  expect(createCommand.getAlias()).toBe('c');
18
17
  });
19
- it.each(CreateCommand_1.default.TemplateActions)('should get correct command/args and invoke [inquirer] via template choice [$name]', (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ value }) {
20
- const mockPrompt = jest
21
- .spyOn(utils_1.inquirer, 'prompt')
22
- .mockImplementation(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
23
- const promise = new Promise((resolve) => {
24
- resolve({ templateName: value });
25
- });
26
- return promise;
27
- }));
28
- const mockSpawn = jest.spyOn(utils_1.spawn, 'sync').mockImplementation(() => {
18
+ it.each(CreateCommand.TemplateActions)('should get correct command/args and invoke [select] via template choice [$name]', (_a) => __awaiter(void 0, [_a], void 0, function* ({ value }) {
19
+ const mockSelect = jest
20
+ .spyOn(utils, 'select')
21
+ .mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () { return value; }));
22
+ const mockSpawn = jest.spyOn(spawn, 'sync').mockImplementation(() => {
29
23
  return {
30
24
  status: 0,
31
25
  };
@@ -35,27 +29,22 @@ describe('createCommand', () => {
35
29
  : value === 'vite'
36
30
  ? ['--template', 'vue']
37
31
  : [];
38
- const createCommand = new CreateCommand_1.default();
32
+ const createCommand = new CreateCommand();
39
33
  yield expect(createCommand.run(appPath, additionalOptions)).resolves.toBeUndefined();
40
- const { command, args, postCommands } = CreateCommand_1.default.TemplateActions.find(action => action.value === value);
34
+ const { command, args, postCommands } = CreateCommand.TemplateActions.find(action => action.value === value);
41
35
  expect(createCommand.getCommand()).toBe(command);
42
36
  expect(createCommand.getCommandArgs()).toHaveLength(args.length + 1);
43
37
  expect(createCommand.getCommandArgs()).toStrictEqual(args.concat(appPath));
44
- expect(mockPrompt).toHaveBeenCalledTimes(1);
38
+ expect(mockSelect).toHaveBeenCalledTimes(1);
45
39
  expect(mockSpawn).toHaveBeenCalledTimes(postCommands.length + 1);
46
- mockPrompt.mockRestore();
40
+ mockSelect.mockRestore();
47
41
  mockSpawn.mockRestore();
48
42
  }));
49
- it.each(CreateCommand_1.default.TemplateActions)('should throw error when exited with non zero via template choice [$name]', (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ value }) {
50
- const mockPrompt = jest
51
- .spyOn(utils_1.inquirer, 'prompt')
52
- .mockImplementation(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
53
- const promise = new Promise((resolve) => {
54
- resolve({ templateName: value });
55
- });
56
- return promise;
57
- }));
58
- const mockSpawn = jest.spyOn(utils_1.spawn, 'sync').mockImplementation(() => {
43
+ it.each(CreateCommand.TemplateActions)('should throw error when exited with non zero via template choice [$name]', (_a) => __awaiter(void 0, [_a], void 0, function* ({ value }) {
44
+ const mockSelect = jest
45
+ .spyOn(utils, 'select')
46
+ .mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () { return value; }));
47
+ const mockSpawn = jest.spyOn(spawn, 'sync').mockImplementation(() => {
59
48
  return {
60
49
  status: 1,
61
50
  };
@@ -65,32 +54,27 @@ describe('createCommand', () => {
65
54
  : value === 'vite'
66
55
  ? ['--template', 'vue']
67
56
  : [];
68
- const createCommand = new CreateCommand_1.default();
57
+ const createCommand = new CreateCommand();
69
58
  yield expect(createCommand.run(appPath, additionalOptions)).rejects.toThrow();
70
- expect(mockPrompt).toHaveBeenCalledTimes(1);
59
+ expect(mockSelect).toHaveBeenCalledTimes(1);
71
60
  expect(mockSpawn).toHaveBeenCalledTimes(1);
72
- mockPrompt.mockRestore();
61
+ mockSelect.mockRestore();
73
62
  mockSpawn.mockRestore();
74
63
  }));
75
- it.each(CreateCommand_1.default.TemplateActions)('should initialize app directory via template choice [$name]', (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ value }) {
76
- const mockPrompt = jest
77
- .spyOn(utils_1.inquirer, 'prompt')
78
- .mockImplementation(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
79
- const promise = new Promise((resolve) => {
80
- resolve({ templateName: value });
81
- });
82
- return promise;
83
- }));
64
+ it.each(CreateCommand.TemplateActions)('should initialize app directory via template choice [$name]', (_a) => __awaiter(void 0, [_a], void 0, function* ({ value }) {
65
+ const mockSelect = jest
66
+ .spyOn(utils, 'select')
67
+ .mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () { return value; }));
84
68
  const additionalOptions = value === 'vue'
85
69
  ? ['--default']
86
70
  : value === 'vite'
87
71
  ? ['--template', 'vue']
88
72
  : [];
89
- const createCommand = new CreateCommand_1.default();
90
- if (ci_info_1.isCI) {
73
+ const createCommand = new CreateCommand();
74
+ if (isCI) {
91
75
  yield expect(createCommand.run(appPath, additionalOptions)).resolves.toBeUndefined();
92
- expect(mockPrompt).toHaveBeenCalledTimes(1);
76
+ expect(mockSelect).toHaveBeenCalledTimes(1);
93
77
  }
94
- mockPrompt.mockRestore();
78
+ mockSelect.mockRestore();
95
79
  }));
96
80
  });
@@ -1,22 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const utils_1 = require("../../utils");
5
- const InfoCommand_1 = tslib_1.__importDefault(require("../InfoCommand"));
1
+ import { __awaiter } from "tslib";
2
+ import { printer } from '../../utils/index.js';
3
+ import InfoCommand from '../InfoCommand.js';
6
4
  describe('infoCommand', () => {
7
5
  jest.setTimeout(20000);
8
6
  it('should extends [BaseCommand] fields', () => {
9
- const infoCommand = new InfoCommand_1.default();
7
+ const infoCommand = new InfoCommand();
10
8
  expect(infoCommand.getName()).toBe('info');
11
9
  expect(infoCommand.getDescription()).toBe('Print debugging information about your environment');
12
10
  expect(infoCommand.getUsage()).toBe('info');
13
11
  expect(infoCommand.getAlias()).toBe('i');
14
12
  });
15
- it('should print environment variables', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
13
+ it('should print environment variables', () => __awaiter(void 0, void 0, void 0, function* () {
16
14
  const mockConsoleInfo = jest
17
- .spyOn(utils_1.printer, 'info')
15
+ .spyOn(printer, 'info')
18
16
  .mockImplementation(jest.fn());
19
- const infoCommand = new InfoCommand_1.default();
17
+ const infoCommand = new InfoCommand();
20
18
  yield expect(infoCommand.run()).resolves.toBeUndefined();
21
19
  expect(mockConsoleInfo).toHaveBeenCalledTimes(2);
22
20
  mockConsoleInfo.mockRestore();
@@ -1,18 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const index_1 = require("../index");
1
+ import { BaseCommand, CreateCommand, InfoCommand } from '../index.js';
4
2
  describe('commands', () => {
5
3
  let commands;
6
4
  let counts;
7
5
  beforeEach(() => {
8
6
  commands = new Set([
9
- new index_1.BaseCommand({
7
+ new BaseCommand({
10
8
  name: 'base',
11
9
  description: 'Base command description',
12
10
  usage: 'base',
13
11
  }),
14
- new index_1.CreateCommand(),
15
- new index_1.InfoCommand(),
12
+ new CreateCommand(),
13
+ new InfoCommand(),
16
14
  ]);
17
15
  counts = new Map();
18
16
  });
@@ -1,3 +1,3 @@
1
- export { default as BaseCommand } from './BaseCommand';
2
- export { default as CreateCommand } from './CreateCommand';
3
- export { default as InfoCommand } from './InfoCommand';
1
+ export { default as BaseCommand } from './BaseCommand.js';
2
+ export { default as CreateCommand } from './CreateCommand.js';
3
+ export { default as InfoCommand } from './InfoCommand.js';
@@ -1,10 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InfoCommand = exports.CreateCommand = exports.BaseCommand = void 0;
4
- const tslib_1 = require("tslib");
5
- var BaseCommand_1 = require("./BaseCommand");
6
- Object.defineProperty(exports, "BaseCommand", { enumerable: true, get: function () { return tslib_1.__importDefault(BaseCommand_1).default; } });
7
- var CreateCommand_1 = require("./CreateCommand");
8
- Object.defineProperty(exports, "CreateCommand", { enumerable: true, get: function () { return tslib_1.__importDefault(CreateCommand_1).default; } });
9
- var InfoCommand_1 = require("./InfoCommand");
10
- Object.defineProperty(exports, "InfoCommand", { enumerable: true, get: function () { return tslib_1.__importDefault(InfoCommand_1).default; } });
1
+ export { default as BaseCommand } from './BaseCommand.js';
2
+ export { default as CreateCommand } from './CreateCommand.js';
3
+ export { default as InfoCommand } from './InfoCommand.js';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import type { BaseCommand } from './commands';
1
+ import type { BaseCommand } from './commands/index.js';
2
2
  declare const CommandFactory: Map<string, BaseCommand>;
3
3
  export { CommandFactory };
package/dist/index.js CHANGED
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommandFactory = void 0;
4
- const commands_1 = require("./commands");
1
+ import { CreateCommand, InfoCommand } from './commands/index.js';
5
2
  const CommandFactory = new Map();
6
- exports.CommandFactory = CommandFactory;
7
- const createCommand = new commands_1.CreateCommand();
8
- const infoCommand = new commands_1.InfoCommand();
3
+ const createCommand = new CreateCommand();
4
+ const infoCommand = new InfoCommand();
9
5
  CommandFactory.set(createCommand.getName(), createCommand);
10
6
  CommandFactory.set(infoCommand.getName(), infoCommand);
7
+ export { CommandFactory };
@@ -1,27 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const node_process_1 = tslib_1.__importDefault(require("node:process"));
5
- const index_1 = require("../index");
1
+ import process from 'node:process';
2
+ import { color, findPackageManager, program } from '../index.js';
6
3
  describe('utils', () => {
7
4
  it('should execute chalk correctly', () => {
8
- expect((0, index_1.color)('raw text')).toStrictEqual('raw text');
5
+ expect(color('raw text')).toStrictEqual('raw text');
9
6
  });
10
7
  it('should execute program correctly', () => {
11
- const mockParse = jest.spyOn(index_1.program, 'parse').mockImplementation(jest.fn());
12
- expect(node_process_1.default.env.__BOD__).toStrictEqual('__BOD__');
8
+ const mockParse = jest.spyOn(program, 'parse').mockImplementation(jest.fn());
9
+ expect(process.env.__BOD__).toStrictEqual('__BOD__');
13
10
  mockParse.mockRestore();
14
11
  });
15
12
  it('should return correct package manager', () => {
16
- node_process_1.default.env.npm_config_user_agent = 'pnpm/8.15.0';
17
- expect((0, index_1.findPackageManager)()).toStrictEqual('pnpm');
18
- node_process_1.default.env.npm_config_user_agent = 'yarn/1.22.22';
19
- expect((0, index_1.findPackageManager)()).toStrictEqual('yarn');
20
- node_process_1.default.env.npm_config_user_agent = 'yarn/4.2.0';
21
- expect((0, index_1.findPackageManager)()).toStrictEqual('yarn');
22
- node_process_1.default.env.npm_config_user_agent = 'bun/0.1.0';
23
- expect((0, index_1.findPackageManager)()).toStrictEqual('bun');
24
- node_process_1.default.env.npm_config_user_agent = 'npm/10.0.0';
25
- expect((0, index_1.findPackageManager)()).toStrictEqual('npm');
13
+ process.env.npm_config_user_agent = 'pnpm/8.15.0';
14
+ expect(findPackageManager()).toStrictEqual('pnpm');
15
+ process.env.npm_config_user_agent = 'yarn/1.22.22';
16
+ expect(findPackageManager()).toStrictEqual('yarn');
17
+ process.env.npm_config_user_agent = 'yarn/4.2.0';
18
+ expect(findPackageManager()).toStrictEqual('yarn');
19
+ process.env.npm_config_user_agent = 'bun/0.1.0';
20
+ expect(findPackageManager()).toStrictEqual('bun');
21
+ process.env.npm_config_user_agent = 'npm/10.0.0';
22
+ expect(findPackageManager()).toStrictEqual('npm');
26
23
  });
27
24
  });
@@ -1,8 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.printer = exports.color = void 0;
4
- const tslib_1 = require("tslib");
5
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
- exports.color = chalk_1.default;
7
- const consola_1 = tslib_1.__importDefault(require("consola"));
8
- exports.printer = consola_1.default;
1
+ import color from 'chalk';
2
+ import printer from 'consola';
3
+ export { color, printer };
@@ -1,6 +1,4 @@
1
- import type { Answers } from 'inquirer';
1
+ import { select } from '@inquirer/prompts';
2
2
  import { Command } from 'commander';
3
- import inquirer from 'inquirer';
4
3
  declare const program: Command;
5
- export { inquirer, program };
6
- export type { Answers };
4
+ export { program, select };
@@ -1,11 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.program = exports.inquirer = void 0;
4
- const tslib_1 = require("tslib");
5
- const node_process_1 = tslib_1.__importDefault(require("node:process"));
6
- const commander_1 = require("commander");
7
- const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
8
- exports.inquirer = inquirer_1.default;
9
- const program = new commander_1.Command();
10
- exports.program = program;
11
- node_process_1.default.env.__BOD__ = '__BOD__';
1
+ import process from 'node:process';
2
+ import { select } from '@inquirer/prompts';
3
+ import { Command } from 'commander';
4
+ const program = new Command();
5
+ process.env.__BOD__ = '__BOD__';
6
+ export { program, select };
@@ -1,7 +1,5 @@
1
- import type { Answers } from './core';
2
- import { color, printer } from './console';
3
- import { inquirer, program } from './core';
4
- import { envinfo, spawn } from './os';
1
+ import { color, printer } from './console.js';
2
+ import { program, select } from './core.js';
3
+ import { envinfo, spawn } from './os.js';
5
4
  declare function findPackageManager(): string;
6
- export { color, envinfo, findPackageManager, inquirer, printer, program, spawn };
7
- export type { Answers };
5
+ export { color, envinfo, findPackageManager, printer, program, select, spawn };
@@ -1,21 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.spawn = exports.program = exports.printer = exports.inquirer = exports.envinfo = exports.color = void 0;
4
- exports.findPackageManager = findPackageManager;
5
- const tslib_1 = require("tslib");
6
- const node_process_1 = tslib_1.__importDefault(require("node:process"));
7
- const console_1 = require("./console");
8
- Object.defineProperty(exports, "color", { enumerable: true, get: function () { return console_1.color; } });
9
- Object.defineProperty(exports, "printer", { enumerable: true, get: function () { return console_1.printer; } });
10
- const core_1 = require("./core");
11
- Object.defineProperty(exports, "inquirer", { enumerable: true, get: function () { return core_1.inquirer; } });
12
- Object.defineProperty(exports, "program", { enumerable: true, get: function () { return core_1.program; } });
13
- const os_1 = require("./os");
14
- Object.defineProperty(exports, "envinfo", { enumerable: true, get: function () { return os_1.envinfo; } });
15
- Object.defineProperty(exports, "spawn", { enumerable: true, get: function () { return os_1.spawn; } });
1
+ import process from 'node:process';
2
+ import { color, printer } from './console.js';
3
+ import { program, select } from './core.js';
4
+ import { envinfo, spawn } from './os.js';
16
5
  function findPackageManager() {
17
6
  var _a;
18
- const userAgent = (_a = node_process_1.default.env.npm_config_user_agent) !== null && _a !== void 0 ? _a : '';
7
+ const userAgent = (_a = process.env.npm_config_user_agent) !== null && _a !== void 0 ? _a : '';
19
8
  const packageManager = /pnpm/.test(userAgent)
20
9
  ? 'pnpm'
21
10
  : /yarn/.test(userAgent)
@@ -25,3 +14,4 @@ function findPackageManager() {
25
14
  : 'npm';
26
15
  return packageManager;
27
16
  }
17
+ export { color, envinfo, findPackageManager, printer, program, select, spawn };
package/dist/utils/os.js CHANGED
@@ -1,8 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.spawn = exports.envinfo = void 0;
4
- const tslib_1 = require("tslib");
5
- const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
6
- exports.spawn = cross_spawn_1.default;
7
- const envinfo_1 = tslib_1.__importDefault(require("envinfo"));
8
- exports.envinfo = envinfo_1.default;
1
+ import spawn from 'cross-spawn';
2
+ import envinfo from 'envinfo';
3
+ export { envinfo, spawn };
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "bod",
3
- "version": "5.21.7",
3
+ "type": "module",
4
+ "version": "5.21.8",
4
5
  "description": "Boilerplate CLI App",
5
6
  "author": "sabertazimi <sabertazimi@gmail.com>",
6
7
  "license": "MIT",
@@ -43,7 +44,7 @@
43
44
  "build": "pnpm clean && pnpm compile",
44
45
  "clean": "rimraf ./dist/",
45
46
  "compile": "tsc",
46
- "dev": "ts-node ./src/bod.ts",
47
+ "dev": "tsx ./src/bod.ts",
47
48
  "format": "prettier --write src/**/*.ts",
48
49
  "lint": "pnpm lint:style && pnpm lint:type-check",
49
50
  "lint:style": "eslint ./src",
@@ -52,21 +53,21 @@
52
53
  "start": "pnpm dev"
53
54
  },
54
55
  "dependencies": {
56
+ "@inquirer/prompts": "^8.0.1",
55
57
  "chalk": "^4.1.2",
56
58
  "commander": "^14.0.2",
57
59
  "consola": "^3.4.2",
58
60
  "cross-spawn": "^7.0.6",
59
- "envinfo": "^7.20.0",
60
- "inquirer": "^8.2.7",
61
+ "envinfo": "^7.21.0",
61
62
  "tslib": "^2.8.1"
62
63
  },
63
64
  "devDependencies": {
64
65
  "@types/cross-spawn": "^6.0.6",
65
66
  "@types/envinfo": "^7.8.4",
66
- "@types/inquirer": "^8.2.12",
67
67
  "ci-info": "^4.3.1",
68
- "rimraf": "^6.1.0",
68
+ "rimraf": "^6.1.2",
69
+ "tsx": "^4.20.6",
69
70
  "type-fest": "^5.2.0"
70
71
  },
71
- "gitHead": "10fa1fff5fd812bcbd27cb1ee393a158a3aab69e"
72
+ "gitHead": "74eab627b3c0388b1f96c802df1674b37d42838f"
72
73
  }