@ceylar/ada 0.0.6 → 0.0.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.
@@ -1,5 +1,5 @@
1
- import { z } from 'zod';
2
-
3
- const managerSchema = z.enum(['npm', 'yarn', 'pnpm']);
4
-
5
- export { managerSchema };
1
+ import { z } from 'zod';
2
+
3
+ const managerSchema = z.enum(['npm', 'yarn', 'pnpm']);
4
+
5
+ export { managerSchema };
@@ -1,7 +1,7 @@
1
- import { managerSchema } from './schema';
2
-
3
- import { z } from 'zod';
4
-
5
- type Manager = z.infer<typeof managerSchema>;
6
-
7
- export type { Manager };
1
+ import { managerSchema } from './schema';
2
+
3
+ import { z } from 'zod';
4
+
5
+ type Manager = z.infer<typeof managerSchema>;
6
+
7
+ export type { Manager };
package/src/index.ts CHANGED
@@ -1,52 +1,52 @@
1
- #!/usr/bin/env node
2
- import * as commands from '@/cli/commands';
3
- import { parseCliError } from '@/cli/util';
4
- import { logger } from '@/util';
5
-
6
- import packageJSON from '../package.json';
7
-
8
- import { program } from 'commander';
9
-
10
- program.name('ada');
11
- program.version(packageJSON.version);
12
-
13
- Object.values(commands).map((command) => {
14
- const currentCommand = program.command(command.name, {
15
- isDefault: command.isDefault
16
- });
17
-
18
- currentCommand.description(command.description);
19
-
20
- command.options?.forEach((option) => {
21
- currentCommand.option(option[0], option[1]);
22
- });
23
-
24
- currentCommand.action((options) => {
25
- const { success, data, error } = command.schema.safeParse(options);
26
- if (success) {
27
- // @ts-expect-error: type inference
28
- command.action(data);
29
- } else {
30
- logger.error(`${parseCliError(error, process.argv, command.options || [])}`);
31
- }
32
- });
33
- });
34
-
35
- // program
36
- // .command('init', { isDefault: true })
37
- // .description('initialize configs')
38
- // .option('-p, --prettier', 'setup prettier')
39
- // .option('-e, --eslint', 'setup eslint')
40
- // .action((options) => {
41
- // console.log('init', options);
42
- // });
43
-
44
- // program
45
- // .command('set')
46
- // .description('sets variable to config')
47
- // .option('-m, --manager <npm | yarn | pnpm>', 'package manager that will be used to install dependencies')
48
- // .action((options) => {
49
- // console.log('set', options);
50
- // });
51
-
52
- program.parse(process.argv);
1
+ #!/usr/bin/env node
2
+ import * as commands from '@/cli/commands';
3
+ import { parseCliError } from '@/cli/util';
4
+ import { logger } from '@/util';
5
+
6
+ import packageJSON from '../package.json';
7
+
8
+ import { program } from 'commander';
9
+
10
+ program.name('ada');
11
+ program.version(packageJSON.version);
12
+
13
+ Object.values(commands).map((command) => {
14
+ const currentCommand = program.command(command.name, {
15
+ isDefault: command.isDefault
16
+ });
17
+
18
+ currentCommand.description(command.description);
19
+
20
+ command.options?.forEach((option) => {
21
+ currentCommand.option(option[0], option[1]);
22
+ });
23
+
24
+ currentCommand.action((options) => {
25
+ const { success, data, error } = command.schema.safeParse(options);
26
+ if (success) {
27
+ // @ts-expect-error: type inference
28
+ command.action(data);
29
+ } else {
30
+ logger.error(`${parseCliError(error, process.argv, command.options || [])}`);
31
+ }
32
+ });
33
+ });
34
+
35
+ // program
36
+ // .command('init', { isDefault: true })
37
+ // .description('initialize configs')
38
+ // .option('-p, --prettier', 'setup prettier')
39
+ // .option('-e, --eslint', 'setup eslint')
40
+ // .action((options) => {
41
+ // console.log('init', options);
42
+ // });
43
+
44
+ // program
45
+ // .command('set')
46
+ // .description('sets variable to config')
47
+ // .option('-m, --manager <npm | yarn | pnpm>', 'package manager that will be used to install dependencies')
48
+ // .action((options) => {
49
+ // console.log('set', options);
50
+ // });
51
+
52
+ program.parse(process.argv);
package/src/util/index.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { isEmpty } from './isEmpty';
2
- export { logger } from './logger';
3
- export { resolveCurrentDir } from './resolveCurrentDir';
1
+ export { isEmpty } from './isEmpty';
2
+ export { logger } from './logger';
3
+ export { resolveCurrentDir } from './resolveCurrentDir';
@@ -1,11 +1,11 @@
1
- const isEmpty = (obj: object) => {
2
- for (const prop in obj) {
3
- if (Object.hasOwn(obj, prop)) {
4
- return false;
5
- }
6
- }
7
-
8
- return true;
9
- };
10
-
11
- export { isEmpty };
1
+ const isEmpty = (obj: object) => {
2
+ for (const prop in obj) {
3
+ if (Object.hasOwn(obj, prop)) {
4
+ return false;
5
+ }
6
+ }
7
+
8
+ return true;
9
+ };
10
+
11
+ export { isEmpty };
@@ -1,15 +1,15 @@
1
- const logger = {
2
- info(message: string) {
3
- console.log(`\x1b[32m${message}\x1b[0m`);
4
- },
5
-
6
- warn(message: string) {
7
- console.log(`\x1b[33m${message}\x1b[0m`);
8
- },
9
-
10
- error(message: string) {
11
- console.log(`\x1b[31m${message}\x1b[0m`);
12
- }
13
- };
14
-
15
- export { logger };
1
+ const logger = {
2
+ info(message: string) {
3
+ console.log(`\x1b[32m${message}\x1b[0m`);
4
+ },
5
+
6
+ warn(message: string) {
7
+ console.log(`\x1b[33m${message}\x1b[0m`);
8
+ },
9
+
10
+ error(message: string) {
11
+ console.log(`\x1b[31m${message}\x1b[0m`);
12
+ }
13
+ };
14
+
15
+ export { logger };
@@ -1,7 +1,7 @@
1
- import { resolve } from 'path';
2
-
3
- const resolveCurrentDir = (...paths: string[]) => {
4
- return resolve(import.meta.dirname, ...paths);
5
- };
6
-
7
- export { resolveCurrentDir };
1
+ import { resolve } from 'path';
2
+
3
+ const resolveCurrentDir = (...paths: string[]) => {
4
+ return resolve(import.meta.dirname, ...paths);
5
+ };
6
+
7
+ export { resolveCurrentDir };
package/tsconfig.json CHANGED
@@ -1,32 +1,32 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "lib": [
5
- "ES2023",
6
- "dom"
7
- ],
8
- "module": "ESNext",
9
- "skipLibCheck": true,
10
- /* Bundler mode */
11
- "moduleResolution": "bundler",
12
- "allowImportingTsExtensions": true,
13
- "isolatedModules": true,
14
- "moduleDetection": "force",
15
- "noEmit": true,
16
- /* Linting */
17
- "strict": true,
18
- "noUnusedLocals": true,
19
- "noUnusedParameters": true,
20
- "noFallthroughCasesInSwitch": true,
21
- "noUncheckedSideEffectImports": true,
22
- "baseUrl": ".",
23
- "paths": {
24
- "@/*": [
25
- "./src/*"
26
- ]
27
- }
28
- },
29
- "include": [
30
- "src/**/*.ts"
31
- ]
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": [
5
+ "ES2023",
6
+ "dom"
7
+ ],
8
+ "module": "ESNext",
9
+ "skipLibCheck": true,
10
+ /* Bundler mode */
11
+ "moduleResolution": "bundler",
12
+ "allowImportingTsExtensions": true,
13
+ "isolatedModules": true,
14
+ "moduleDetection": "force",
15
+ "noEmit": true,
16
+ /* Linting */
17
+ "strict": true,
18
+ "noUnusedLocals": true,
19
+ "noUnusedParameters": true,
20
+ "noFallthroughCasesInSwitch": true,
21
+ "noUncheckedSideEffectImports": true,
22
+ "baseUrl": ".",
23
+ "paths": {
24
+ "@/*": [
25
+ "./src/*"
26
+ ]
27
+ }
28
+ },
29
+ "include": [
30
+ "src/**/*.ts"
31
+ ]
32
32
  }