@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/.github/workflows/publish.yml +32 -29
- package/.github/workflows/test-version-on-pr.yml +38 -38
- package/babel.config.json +9 -9
- package/bin/index.js +5052 -5055
- package/bin/resources/eslint.config.mjs +8 -67
- package/bin/resources/prettier.config.mjs +12 -12
- package/bin/resources/stylelint.config.mjs +7 -7
- package/bin/resources/tsconfig.json +37 -37
- package/eslint.config.ts +14 -0
- package/package.json +45 -51
- package/readme.md +3 -3
- package/resources/eslint.config.mjs +8 -67
- package/resources/prettier.config.mjs +12 -12
- package/resources/stylelint.config.mjs +7 -7
- package/resources/tsconfig.json +37 -37
- package/rollup.config.ts +56 -55
- package/src/cli/commands/get.ts +21 -21
- package/src/cli/commands/index.ts +3 -3
- package/src/cli/commands/init.ts +107 -108
- package/src/cli/commands/set.ts +13 -13
- package/src/cli/type.ts +12 -12
- package/src/cli/util.ts +23 -23
- package/src/config/get.ts +38 -38
- package/src/config/index.ts +4 -4
- package/src/config/schema.ts +19 -19
- package/src/config/set.ts +14 -14
- package/src/config/type.ts +8 -8
- package/src/entities/manager/index.ts +2 -2
- package/src/entities/manager/schema.ts +5 -5
- package/src/entities/manager/type.ts +7 -7
- package/src/index.ts +53 -52
- package/src/util/index.ts +3 -3
- package/src/util/isEmpty.ts +11 -11
- package/src/util/logger.ts +15 -15
- package/src/util/resolveCurrentDir.ts +7 -7
- package/tsconfig.json +34 -32
- package/eslint.config.mjs +0 -63
- package/prettier.config.mjs +0 -12
package/src/index.ts
CHANGED
|
@@ -1,52 +1,53 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
program.name('ada')
|
|
11
|
-
program.version(packageJSON.version)
|
|
12
|
-
|
|
13
|
-
Object.values(commands).
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
// .
|
|
38
|
-
// .
|
|
39
|
-
// .option('-
|
|
40
|
-
// .
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
//
|
|
46
|
-
// .
|
|
47
|
-
// .
|
|
48
|
-
// .
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
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'
|
package/src/util/isEmpty.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
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 }
|
package/src/util/logger.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const logger = {
|
|
2
|
-
info(message: string) {
|
|
3
|
-
console.log(`\
|
|
4
|
-
},
|
|
5
|
-
|
|
6
|
-
warn(message: string) {
|
|
7
|
-
console.log(`\
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
error(message: string) {
|
|
11
|
-
console.log(`\
|
|
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
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
/* Bundler mode */
|
|
11
|
-
"moduleResolution": "bundler",
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
);
|
package/prettier.config.mjs
DELETED