task-script-support-cli 0.2.6 → 0.2.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.
Files changed (39) hide show
  1. package/dist/package.json +1 -1
  2. package/dist/src/commands/configure.d.ts +2 -1
  3. package/dist/src/commands/configure.d.ts.map +1 -1
  4. package/dist/src/commands/configure.js +2 -1
  5. package/dist/src/commands/configure.js.map +1 -1
  6. package/dist/src/commands/gen.d.ts +2 -1
  7. package/dist/src/commands/gen.d.ts.map +1 -1
  8. package/dist/src/commands/gen.js +2 -0
  9. package/dist/src/commands/gen.js.map +1 -1
  10. package/dist/src/services/templater-service.d.ts +24 -0
  11. package/dist/src/services/templater-service.d.ts.map +1 -0
  12. package/dist/src/services/templater-service.js +134 -0
  13. package/dist/src/services/templater-service.js.map +1 -0
  14. package/dist/src/tasks/check-env.d.ts +0 -17
  15. package/dist/src/tasks/check-env.d.ts.map +1 -1
  16. package/dist/src/tasks/check-env.js +0 -53
  17. package/dist/src/tasks/check-env.js.map +1 -1
  18. package/dist/src/tasks/create-new-project.d.ts +12 -3
  19. package/dist/src/tasks/create-new-project.d.ts.map +1 -1
  20. package/dist/src/tasks/create-new-project.js +25 -15
  21. package/dist/src/tasks/create-new-project.js.map +1 -1
  22. package/dist/src/tasks/generate/project-context-guard.d.ts +42 -0
  23. package/dist/src/tasks/generate/project-context-guard.d.ts.map +1 -0
  24. package/dist/src/tasks/generate/project-context-guard.js +119 -0
  25. package/dist/src/tasks/generate/project-context-guard.js.map +1 -0
  26. package/dist/src/tasks/stdout/print-generated-results.d.ts +3 -1
  27. package/dist/src/tasks/stdout/print-generated-results.d.ts.map +1 -1
  28. package/dist/src/tasks/stdout/print-generated-results.js +14 -5
  29. package/dist/src/tasks/stdout/print-generated-results.js.map +1 -1
  30. package/package.json +1 -1
  31. package/src/commands/configure.ts +2 -1
  32. package/src/commands/gen.ts +2 -0
  33. package/src/services/templater-service.ts +136 -0
  34. package/src/tasks/check-env.ts +0 -55
  35. package/src/tasks/create-new-project.ts +28 -16
  36. package/src/tasks/generate/project-context-guard.ts +116 -0
  37. package/src/tasks/stdout/print-generated-results.ts +21 -4
  38. package/assets/yargs-template/task-runner/templater.sh +0 -69
  39. package/dist/assets/yargs-template/task-runner/templater.sh +0 -69
@@ -2,7 +2,12 @@ import chalk from "chalk";
2
2
  import { AppTask } from "../../wrappers/app-task";
3
3
  import { autoInjectable } from "tsyringe";
4
4
  import { UtilService } from "../../services/util-service";
5
- import { ProjectService } from "../../services/project-service";
5
+ import { FileService } from "../../services/file-service";
6
+
7
+ const newProjectMessage = (dest: string) => `
8
+ Try:
9
+ cd ${dest} && npm i && npm start -- help
10
+ `;
6
11
 
7
12
  /**
8
13
  * Prints the generated output results
@@ -11,7 +16,10 @@ import { ProjectService } from "../../services/project-service";
11
16
  export default class PrintGeneratedResults extends AppTask {
12
17
  loggerName = "Print Results";
13
18
 
14
- constructor(private utilService: UtilService) {
19
+ constructor(
20
+ private utilService: UtilService,
21
+ private fileService: FileService,
22
+ ) {
15
23
  super();
16
24
  }
17
25
 
@@ -28,10 +36,19 @@ export default class PrintGeneratedResults extends AppTask {
28
36
 
29
37
  console.log(`
30
38
 
31
- Generated new ${this.state.data.outputDestination?.includes(ProjectService.defaults.extention) ? "file" : "project"}:
39
+ Generated new ${genType !== "Project" ? "file" : "project"}:
32
40
 
33
41
  ${this.state.data.outputDestination || "<None>"}
34
-
42
+ ${
43
+ genType === "Project"
44
+ ? `\n${newProjectMessage(
45
+ this.fileService.toRelativePath(
46
+ this.fileService.getRunnerDir(),
47
+ this.state.data.outputDestination!,
48
+ ),
49
+ )}\n`
50
+ : ""
51
+ }
35
52
  `);
36
53
  }
37
54
  }
@@ -1,69 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
-
4
- if [[ -z "$1" ]]; then
5
- echo "Missing required parameter. Usage: ./templater.sh <output-name>"
6
- exit 1;
7
- fi
8
-
9
- DIR_LIST_TO_COPY=('.vscode' 'src' 'tests')
10
- FILE_LIST_TO_COPY=('.prettierignore' '.prettierrc' 'task-runner' 'install-link.sh' 'eslint.config.ts' 'vitest.config.ts' 'package-lock.json' 'package.json' 'tsconfig.json')
11
- NAME_REF_LIST=('package.json' 'package-lock.json' 'install-link.sh')
12
- CWD=$(pwd)
13
- SCRIPT_DIR=$(dirname "$0")
14
- DESTINATION="$CWD/$1"
15
-
16
- # ensure dest exists
17
- if [ -f "$DESTINATION" ]; then
18
- echo "Using destination: $DESTINATION"
19
- else
20
- echo "Creating destination directory: $DESTINATION"
21
- mkdir -p "$DESTINATION"
22
- fi
23
-
24
- # copy directories
25
- for folder in "${DIR_LIST_TO_COPY[@]}"; do
26
- echo "Running Copy/: cp -R $SCRIPT_DIR/$folder $DESTINATION/$folder"
27
- cp -R "$SCRIPT_DIR/$folder" "$DESTINATION/$folder"
28
- done
29
-
30
- # copy files
31
- for filename in "${FILE_LIST_TO_COPY[@]}"; do
32
- echo "Running Copy: cp $SCRIPT_DIR/$filename $DESTINATION/$filename"
33
- cp "$SCRIPT_DIR/$filename" "$DESTINATION/$filename"
34
- done
35
-
36
- # fix naming
37
- for fileToEdit in "${NAME_REF_LIST[@]}"; do
38
- dest="$DESTINATION/$fileToEdit"
39
- replace_pattern="s/task-runner/$1/g"
40
- echo "Running Patch: cat \"$dest\" | sed -i \"$replace_pattern\" "
41
- output=$(cat "$dest" | sed "$replace_pattern")
42
- echo "$output" > "$dest"
43
-
44
- # echo "Running patch: sed -i \"s/task-runner/$1/g\" \"$DESTINATION/$fileToEdit\""
45
- # sed -i "s/task-runner/$1/g" "$DESTINATION/$fileToEdit"
46
- done
47
-
48
- # do the .gitignore file manually since npm won't let us publish that in the template
49
- # see: https://github.com/npm/npm/issues/3763
50
- echo 'node_modules
51
- dist
52
- .env' > "$DESTINATION/.gitignore";
53
-
54
- # remove double nested tests directory : need to look into why this is happening
55
- if [ -d "$DESTINATION/tests/tests" ]; then
56
- rm -rf "$DESTINATION/tests/tests";
57
- fi
58
-
59
- mv "$DESTINATION/task-runner" "$DESTINATION/$1"
60
-
61
-
62
- # cd into destination and run git init
63
- echo "initializing with git"
64
- INITIALIZED=$(cd "$DESTINATION" && git init -b main)
65
-
66
- echo;
67
- echo " Try:"
68
- echo " cd $DESTINATION && npm i && npm run dev"
69
- echo;
@@ -1,69 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
-
4
- if [[ -z "$1" ]]; then
5
- echo "Missing required parameter. Usage: ./templater.sh <output-name>"
6
- exit 1;
7
- fi
8
-
9
- DIR_LIST_TO_COPY=('.vscode' 'src' 'tests')
10
- FILE_LIST_TO_COPY=('.prettierignore' '.prettierrc' 'task-runner' 'install-link.sh' 'eslint.config.ts' 'vitest.config.ts' 'package-lock.json' 'package.json' 'tsconfig.json')
11
- NAME_REF_LIST=('package.json' 'package-lock.json' 'install-link.sh')
12
- CWD=$(pwd)
13
- SCRIPT_DIR=$(dirname "$0")
14
- DESTINATION="$CWD/$1"
15
-
16
- # ensure dest exists
17
- if [ -f "$DESTINATION" ]; then
18
- echo "Using destination: $DESTINATION"
19
- else
20
- echo "Creating destination directory: $DESTINATION"
21
- mkdir -p "$DESTINATION"
22
- fi
23
-
24
- # copy directories
25
- for folder in "${DIR_LIST_TO_COPY[@]}"; do
26
- echo "Running Copy/: cp -R $SCRIPT_DIR/$folder $DESTINATION/$folder"
27
- cp -R "$SCRIPT_DIR/$folder" "$DESTINATION/$folder"
28
- done
29
-
30
- # copy files
31
- for filename in "${FILE_LIST_TO_COPY[@]}"; do
32
- echo "Running Copy: cp $SCRIPT_DIR/$filename $DESTINATION/$filename"
33
- cp "$SCRIPT_DIR/$filename" "$DESTINATION/$filename"
34
- done
35
-
36
- # fix naming
37
- for fileToEdit in "${NAME_REF_LIST[@]}"; do
38
- dest="$DESTINATION/$fileToEdit"
39
- replace_pattern="s/task-runner/$1/g"
40
- echo "Running Patch: cat \"$dest\" | sed -i \"$replace_pattern\" "
41
- output=$(cat "$dest" | sed "$replace_pattern")
42
- echo "$output" > "$dest"
43
-
44
- # echo "Running patch: sed -i \"s/task-runner/$1/g\" \"$DESTINATION/$fileToEdit\""
45
- # sed -i "s/task-runner/$1/g" "$DESTINATION/$fileToEdit"
46
- done
47
-
48
- # do the .gitignore file manually since npm won't let us publish that in the template
49
- # see: https://github.com/npm/npm/issues/3763
50
- echo 'node_modules
51
- dist
52
- .env' > "$DESTINATION/.gitignore";
53
-
54
- # remove double nested tests directory : need to look into why this is happening
55
- if [ -d "$DESTINATION/tests/tests" ]; then
56
- rm -rf "$DESTINATION/tests/tests";
57
- fi
58
-
59
- mv "$DESTINATION/task-runner" "$DESTINATION/$1"
60
-
61
-
62
- # cd into destination and run git init
63
- echo "initializing with git"
64
- INITIALIZED=$(cd "$DESTINATION" && git init -b main)
65
-
66
- echo;
67
- echo " Try:"
68
- echo " cd $DESTINATION && npm i && npm run dev"
69
- echo;