@ceylar/ada 0.0.5 → 0.0.7
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 +31 -0
- package/babel.config.json +8 -8
- package/bin/index.js +8787 -0
- package/bin/resources/eslint.config.mjs +67 -0
- package/bin/resources/prettier.config.mjs +12 -0
- package/bin/resources/stylelint.config.mjs +7 -0
- package/bin/resources/tsconfig.json +37 -0
- package/eslint.config.mjs +63 -63
- package/package.json +51 -51
- package/prettier.config.mjs +12 -12
- package/readme.md +3 -3
- package/resources/eslint.config.mjs +67 -67
- package/resources/prettier.config.mjs +12 -12
- package/resources/stylelint.config.mjs +7 -7
- package/resources/tsconfig.json +36 -36
- package/rollup.config.ts +55 -55
- package/src/cli/commands/get.ts +21 -21
- package/src/cli/commands/index.ts +3 -3
- package/src/cli/commands/init.ts +108 -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 +52 -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 +31 -31
|
@@ -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';
|
package/src/util/isEmpty.ts
CHANGED
|
@@ -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 };
|
package/src/util/logger.ts
CHANGED
|
@@ -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
|
}
|