@ceylar/ada 0.0.10 → 0.0.11

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/src/index.ts CHANGED
@@ -1,52 +1,53 @@
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 process from 'node:process'
3
+
4
+ import { program } from 'commander'
5
+ import * as commands from '@/cli/commands'
6
+ import { parseCliError } from '@/cli/util'
7
+ import { logger } from '@/util'
8
+ import packageJSON from '../package.json'
9
+
10
+ program.name('ada')
11
+ program.version(packageJSON.version)
12
+
13
+ Object.values(commands).forEach((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
+ }
30
+ else {
31
+ logger.error(`${parseCliError(error, process.argv, command.options || [])}`)
32
+ }
33
+ })
34
+ })
35
+
36
+ // program
37
+ // .command('init', { isDefault: true })
38
+ // .description('initialize configs')
39
+ // .option('-p, --prettier', 'setup prettier')
40
+ // .option('-e, --eslint', 'setup eslint')
41
+ // .action((options) => {
42
+ // console.log('init', options);
43
+ // });
44
+
45
+ // program
46
+ // .command('set')
47
+ // .description('sets variable to config')
48
+ // .option('-m, --manager <npm | yarn | pnpm>', 'package manager that will be used to install dependencies')
49
+ // .action((options) => {
50
+ // console.log('set', options);
51
+ // });
52
+
53
+ 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
+ function 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 'node:path'
2
+
3
+ function resolveCurrentDir(...paths: string[]) {
4
+ return resolve(import.meta.dirname, ...paths)
5
+ }
6
+
7
+ export { resolveCurrentDir }
package/tsconfig.json CHANGED
@@ -1,32 +1,34 @@
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
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": [
5
+ "ES2023"
6
+ ],
7
+ "moduleDetection": "force",
8
+ "baseUrl": ".",
9
+ "module": "ESNext",
10
+ /* Bundler mode */
11
+ "moduleResolution": "bundler",
12
+ "paths": {
13
+ "@/*": [
14
+ "./src/*"
15
+ ]
16
+ },
17
+ "types": [
18
+ "node"
19
+ ],
20
+ "allowImportingTsExtensions": true,
21
+ /* Linting */
22
+ "strict": true,
23
+ "noFallthroughCasesInSwitch": true,
24
+ "noUnusedLocals": true,
25
+ "noUnusedParameters": true,
26
+ "noEmit": true,
27
+ "isolatedModules": true,
28
+ "skipLibCheck": true,
29
+ "noUncheckedSideEffectImports": true
30
+ },
31
+ "include": [
32
+ "src/**/*.ts"
33
+ ]
34
+ }
package/eslint.config.mjs DELETED
@@ -1,63 +0,0 @@
1
- import js from '@eslint/js';
2
-
3
- import react from 'eslint-plugin-react';
4
- import reactHooks from 'eslint-plugin-react-hooks';
5
- import simpleImportSort from 'eslint-plugin-simple-import-sort';
6
- import globals from 'globals';
7
- import ts from 'typescript-eslint';
8
-
9
- /** @type {import('eslint').Linter.Config<Linter.RulesRecord>[]} */
10
- export default ts.config(
11
- js.configs.recommended,
12
- ...ts.configs.recommended,
13
- {
14
- plugins: {
15
- react: react,
16
- 'react-hooks': reactHooks,
17
- 'simple-import-sort': simpleImportSort,
18
- ts: ts.plugin
19
- },
20
- rules: {
21
- 'prefer-const': 'error',
22
- 'no-else-return': 'error',
23
-
24
- 'simple-import-sort/exports': 'error',
25
- 'simple-import-sort/imports': [
26
- 'error',
27
- {
28
- groups: [
29
- ['^@(([\\/.]?\\w)|assets|test-utils)'],
30
- ['^\\u0000'],
31
- ['^\\.\\.(?!/?$)', '^\\.\\./?$'],
32
- ['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
33
- ['^.+\\.s?css$']
34
- ]
35
- }
36
- ]
37
- },
38
- languageOptions: {
39
- globals: {
40
- ...globals.node,
41
- ...globals.browser,
42
- ...globals.es2022
43
- }
44
- }
45
- },
46
- {
47
- languageOptions: {
48
- parserOptions: {
49
- project: ['tsconfig.json']
50
- }
51
- },
52
- files: ['/src/**/*.ts', '/src/**/*.tsx']
53
- },
54
- {
55
- languageOptions: {
56
- parserOptions: react.configs.recommended.parserOptions
57
- },
58
- files: ['/src/**/*.js', '/src/**/*.jsx']
59
- },
60
- {
61
- ignores: ['node_modules', 'bin']
62
- }
63
- );
@@ -1,12 +0,0 @@
1
- /** @type {import('prettier').Config} */
2
- export default {
3
- printWidth: 120,
4
- singleQuote: true,
5
- jsxSingleQuote: true,
6
- trailingComma: 'none',
7
- semi: true,
8
- tabWidth: 2,
9
- useTabs: false,
10
- endOfLine: 'crlf',
11
- arrowParens: 'always'
12
- };