taskforge-cli 0.0.1 → 0.0.2
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
|
@@ -12,7 +12,7 @@ In config file you can `defult` export an `Config` object or a `defineConfig()`
|
|
|
12
12
|
|
|
13
13
|
## How to use it
|
|
14
14
|
|
|
15
|
-
```
|
|
15
|
+
```
|
|
16
16
|
// package.json
|
|
17
17
|
|
|
18
18
|
...
|
|
@@ -44,7 +44,7 @@ export default defineConfig({
|
|
|
44
44
|
|
|
45
45
|
## Options:
|
|
46
46
|
|
|
47
|
-
### Config:
|
|
47
|
+
### Config file location:
|
|
48
48
|
|
|
49
49
|
**cli option**: `--config`
|
|
50
50
|
|
|
@@ -52,9 +52,9 @@ export default defineConfig({
|
|
|
52
52
|
|
|
53
53
|
**type**: `string`
|
|
54
54
|
|
|
55
|
-
**defult**:
|
|
55
|
+
**defult**: `./tf.config.js|cjs|mjs|ts`
|
|
56
56
|
|
|
57
|
-
If your config file is not at the root of your project, provide a relative path to the config file.
|
|
57
|
+
If your config file is not at the root of your project, provide a relative path to the config file. i.e: `../config/tf.config.ts`
|
|
58
58
|
|
|
59
59
|
### Env file:
|
|
60
60
|
|
package/dist/bin/index.js
CHANGED
|
@@ -48,7 +48,7 @@ function identifyScript() {
|
|
|
48
48
|
return passedArguments[passedArguments.findIndex((value) => value === "custom") + 1];
|
|
49
49
|
} else
|
|
50
50
|
throw new Error(
|
|
51
|
-
'No script is passed.\nIf you have a custom scripts other than predefined scripts use "tf custom <script-name>".\nRemember the script name must be next to the custom keyword'
|
|
51
|
+
'No script is passed.\nIf you have a custom scripts other than predefined scripts use "tf custom <script-name>".\nRemember the script name must be next to the `custom` keyword'
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
const scriptName = identifyScript();
|
|
@@ -184,15 +184,9 @@ if (finalConfig?.scripts?.[scriptName]?.execute) {
|
|
|
184
184
|
const executable = executableCommand[0];
|
|
185
185
|
const command = executableCommand.slice(1).concat(arbitaryArgumets);
|
|
186
186
|
const process = node_child_process.spawn(executable, command, {
|
|
187
|
-
stdio:
|
|
187
|
+
stdio: "inherit",
|
|
188
188
|
shell: true
|
|
189
189
|
});
|
|
190
|
-
process.stdout.on("data", (chunk) => {
|
|
191
|
-
console.log(chunk.toString());
|
|
192
|
-
});
|
|
193
|
-
process.stderr.on("data", (chunk) => {
|
|
194
|
-
console.error(chunk.toString());
|
|
195
|
-
});
|
|
196
190
|
process.on("exit", (code, signal) => {
|
|
197
191
|
console.log(`Process exited with code ${code}, signal ${signal}`);
|
|
198
192
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taskforge-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "A cli tool to leverage env related headache",
|
|
5
5
|
"lint-staged": {
|
|
6
6
|
"src/**/*.ts": "pnpm format"
|
|
@@ -15,14 +15,16 @@
|
|
|
15
15
|
"bin": {
|
|
16
16
|
"tf": "dist/bin/index.js"
|
|
17
17
|
},
|
|
18
|
+
"types": ".dist/**/*.d.ts",
|
|
18
19
|
"exports": {
|
|
19
20
|
"./config": {
|
|
21
|
+
"types": {
|
|
22
|
+
"default": "./dist/exports/config.d.ts"
|
|
23
|
+
},
|
|
20
24
|
"require": {
|
|
21
|
-
"types": "./dist/exports/config.d.cts",
|
|
22
25
|
"default": "./dist/exports/config.cjs"
|
|
23
26
|
},
|
|
24
27
|
"import": {
|
|
25
|
-
"types": "./dist/exports/config.d.mts",
|
|
26
28
|
"default": "./dist/exports/config.mjs"
|
|
27
29
|
}
|
|
28
30
|
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
type ScriptDetails = {
|
|
4
|
-
envFile?: string;
|
|
5
|
-
execute: string;
|
|
6
|
-
envDir?: string;
|
|
7
|
-
};
|
|
8
|
-
type Scripts = {
|
|
9
|
-
dev?: ScriptDetails;
|
|
10
|
-
build?: ScriptDetails;
|
|
11
|
-
test?: ScriptDetails;
|
|
12
|
-
} & Record<string, ScriptDetails>;
|
|
13
|
-
declare const configSchema: z.ZodOptional<z.ZodObject<{
|
|
14
|
-
envDir: z.ZodOptional<z.ZodString>;
|
|
15
|
-
scripts: z.ZodOptional<z.ZodCustom<Scripts, Scripts>>;
|
|
16
|
-
}, z.core.$strip>>;
|
|
17
|
-
type Config = z.infer<typeof configSchema>;
|
|
18
|
-
/**
|
|
19
|
-
* Defines and validates the CLI configuration.
|
|
20
|
-
*
|
|
21
|
-
* This helper enables strong typing and IDE autocomplete when
|
|
22
|
-
* authoring configuration files. It accepts either a plain
|
|
23
|
-
* configuration object or a factory function that returns one.
|
|
24
|
-
*
|
|
25
|
-
* When a function is provided, it is executed immediately and
|
|
26
|
-
* its return value is used as the final configuration.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```ts
|
|
30
|
-
* import { defineConfig } from "taskforge/config";
|
|
31
|
-
*
|
|
32
|
-
* export default defineConfig({
|
|
33
|
-
* envDir: ".",
|
|
34
|
-
* scripts: {
|
|
35
|
-
* build: {
|
|
36
|
-
* execute: "tsc"
|
|
37
|
-
* }
|
|
38
|
-
* }
|
|
39
|
-
* });
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```ts
|
|
44
|
-
* export default defineConfig(() => ({
|
|
45
|
-
* scripts: {
|
|
46
|
-
* dev: "pnpm dev"
|
|
47
|
-
* }
|
|
48
|
-
* }));
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* @param config - Configuration object or a function returning it
|
|
52
|
-
* @returns The resolved configuration object
|
|
53
|
-
*/
|
|
54
|
-
declare function defineConfig(config: Config | (() => Config)): {
|
|
55
|
-
envDir?: string | undefined;
|
|
56
|
-
scripts?: Scripts | undefined;
|
|
57
|
-
} | undefined;
|
|
58
|
-
|
|
59
|
-
export { defineConfig };
|
|
60
|
-
export type { Config };
|
|
File without changes
|