fscr 6.2.3 → 7.3.0

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 (98) hide show
  1. package/README.md +48 -30
  2. package/dist/index.js +502 -185
  3. package/dist/lib/auth/auth-conf.js +49 -45
  4. package/dist/lib/cache/README.md +341 -0
  5. package/dist/lib/cache/cli.js +152 -0
  6. package/dist/lib/cache/file-watcher.js +193 -0
  7. package/dist/lib/cache/index.js +422 -0
  8. package/dist/lib/cache/monitor.js +224 -0
  9. package/dist/lib/commands/doctor.js +225 -0
  10. package/dist/lib/completions/completion.js +342 -0
  11. package/dist/lib/completions/generator.js +152 -0
  12. package/dist/lib/completions/scripts/bash.sh +108 -0
  13. package/dist/lib/completions/scripts/fish.sh +105 -0
  14. package/dist/lib/completions/scripts/powershell.ps1 +168 -0
  15. package/dist/lib/completions/scripts/zsh.sh +124 -0
  16. package/dist/lib/diagnostics/cache.js +121 -0
  17. package/dist/lib/diagnostics/fileSystem.js +236 -0
  18. package/dist/lib/diagnostics/gitCheck.js +41 -0
  19. package/dist/lib/diagnostics/nodeVersion.js +68 -0
  20. package/dist/lib/diagnostics/packageManager.js +64 -0
  21. package/dist/lib/diagnostics/performance.js +141 -0
  22. package/dist/lib/encryption/decryptConfig.js +3 -2
  23. package/dist/lib/encryption/encryption.js +153 -113
  24. package/dist/lib/generators/generateFScripts.js +16 -13
  25. package/dist/lib/generators/generateToc.js +23 -14
  26. package/dist/lib/generators/index.js +1 -1
  27. package/dist/lib/git/pub.js +27 -31
  28. package/dist/lib/git/taskRunner.js +79 -69
  29. package/dist/lib/git/validateNotDev.js +65 -54
  30. package/dist/lib/optionList.js +69 -57
  31. package/dist/lib/parsers/parseScriptsMd.cached.js +208 -0
  32. package/dist/lib/parsers/parseScriptsMd.js +88 -79
  33. package/dist/lib/parsers/parseScriptsPackage.js +4 -3
  34. package/dist/lib/performance/cache.js +199 -0
  35. package/dist/lib/performance/lazy-loader.js +189 -0
  36. package/dist/lib/performance/monitor.js +303 -0
  37. package/dist/lib/plugins/deployment/index.js +113 -0
  38. package/dist/lib/plugins/hooks.js +17 -0
  39. package/dist/lib/plugins/loader.js +91 -0
  40. package/dist/lib/plugins/task-notifier/index.js +72 -0
  41. package/dist/lib/release/bump.js +51 -43
  42. package/dist/lib/release/commitWithMessage.js +80 -52
  43. package/dist/lib/release/publish.js +19 -14
  44. package/dist/lib/release/pushToGit.js +40 -31
  45. package/dist/lib/release/releasenotes.js +116 -97
  46. package/dist/lib/release/seeChangedFiles.js +68 -60
  47. package/dist/lib/release/sort.js +200 -116
  48. package/dist/lib/release/tree.js +161 -147
  49. package/dist/lib/release/validateNotDev.js +52 -44
  50. package/dist/lib/running/index.js +1 -1
  51. package/dist/lib/running/runCLICommand.js +41 -31
  52. package/dist/lib/running/runParallel.js +61 -59
  53. package/dist/lib/running/runSequence.js +55 -53
  54. package/dist/lib/startScripts.js +129 -114
  55. package/dist/lib/taskList.js +99 -84
  56. package/dist/lib/test-files/.fscripts.md +113 -0
  57. package/dist/lib/test-files/.fscripts.test.md +103 -0
  58. package/dist/lib/test-files/.fscriptsb.md +107 -0
  59. package/dist/lib/test-files/.mdtest.md +40 -0
  60. package/dist/lib/test-files/consoleSample.js +17 -0
  61. package/dist/lib/test-files/inputSample.js +20 -0
  62. package/dist/lib/test-files/testConsole.js +1 -0
  63. package/dist/lib/test-files/testInput.js +2 -0
  64. package/dist/lib/upgradePackages.js +56 -46
  65. package/dist/lib/utils/clear.js +16 -13
  66. package/dist/lib/utils/console.js +27 -21
  67. package/dist/lib/utils/encryption.js +55 -13
  68. package/dist/lib/utils/hash.js +128 -0
  69. package/dist/lib/utils/helpers.js +153 -142
  70. package/dist/lib/utils/index.js +1 -1
  71. package/dist/lib/utils/prompt.js +24 -29
  72. package/package.json +20 -32
  73. package/dist/lib/codemod/arrow.js +0 -13
  74. package/dist/lib/codemod/arrow2.js +0 -67
  75. package/dist/lib/codemod/funcs.js +0 -25
  76. package/dist/lib/codemod/removeConsole.js +0 -12
  77. package/dist/lib/codemod/test.js +0 -8
  78. package/dist/lib/components/App.js +0 -64
  79. package/dist/lib/components/Selector.js +0 -133
  80. package/dist/lib/components/TabChanger.js +0 -113
  81. package/dist/lib/components/Table.js +0 -177
  82. package/dist/lib/components/Tabs.js +0 -221
  83. package/dist/lib/generateFScripts.js +0 -25
  84. package/dist/lib/generateToc.js +0 -30
  85. package/dist/lib/helpers.js +0 -191
  86. package/dist/lib/parseScriptsMd.js +0 -85
  87. package/dist/lib/parseScriptsPackage.js +0 -9
  88. package/dist/lib/release/index.js +0 -4
  89. package/dist/lib/run/lib.js +0 -454
  90. package/dist/lib/run/main-p.js +0 -59
  91. package/dist/lib/run/main-s.js +0 -56
  92. package/dist/lib/run/parse-cli-args.js +0 -222
  93. package/dist/lib/run/run-p.js +0 -30
  94. package/dist/lib/run/run-s.js +0 -57
  95. package/dist/lib/runCLICommand.js +0 -30
  96. package/dist/lib/runParallel.js +0 -20
  97. package/dist/lib/runSequence.js +0 -38
  98. package/dist/lib/taskListAutoComplete.js +0 -15
@@ -7,128 +7,143 @@ import parseScriptFile from "./parsers/parseScriptsMd.js";
7
7
  import parsePackageFile from "./parsers/parseScriptsPackage.js";
8
8
  import runCLICommand from "./running/runCLICommand.js";
9
9
  import enquirerPkg from "enquirer";
10
- const {
11
- prompt
12
- } = enquirerPkg;
10
+ const { prompt } = enquirerPkg;
13
11
  import path from "path";
14
12
  import fs from "fs";
15
- let packagePath = path.resolve(process.cwd(), "package.json");
16
- const packageJsonAfter = JSON.parse(fs.readFileSync(packagePath));
17
- const config = new Conf({
18
- projectName: packageJsonAfter.name
19
- });
20
- const taskListAutoComplete = async tasks => {
21
- try {
22
- let {
23
- answer
24
- } = await prompt({
25
- type: "autocomplete",
26
- message: `${chalk.green.bold.underline("Choose task to run")}`,
27
- choices: tasks,
28
- name: `answer`
29
- });
30
- return answer.split(separator)[0].trim();
31
- } catch (e) {
32
- return false;
33
- }
13
+
14
+ // Lazily read package.json / create the Conf store so importing this module never
15
+ // performs file IO (a dir without package.json must not crash `fsr` at startup).
16
+ let _config;
17
+ const getConfig = () => {
18
+ if (!_config) {
19
+ const packagePath = path.resolve(process.cwd(), "package.json");
20
+ const packageJson = JSON.parse(fs.readFileSync(packagePath));
21
+ _config = new Conf({ projectName: packageJson.name });
22
+ }
23
+ return _config;
24
+ };
25
+
26
+ const taskListAutoComplete = async (tasks) => {
27
+ try {
28
+ let { answer } = await prompt({
29
+ type: "autocomplete",
30
+ message: `${chalk.green.bold.underline("Choose task to run")}`,
31
+ choices: tasks,
32
+ name: `answer`
33
+ });
34
+ return answer.split(separator)[0].trim();
35
+ } catch (e) {
36
+ return false;
37
+ }
34
38
  };
39
+
35
40
  const startScripts = async (categories = true) => {
36
- const FcScripts = await parseScriptFile();
37
- if (FcScripts === false) {
38
- return false;
39
- }
40
- let recentTasks = config.get("recentTasks", {});
41
- let recentTaskArr = Object.keys(recentTasks).map(taskName => {
42
- let task = recentTasks[taskName];
43
- return {
44
- name: taskName,
45
- lastExecuted: task.lastExecuted
46
- };
47
- }).sort((a, b) => a.lastExecuted > b.lastExecuted ? 1 : b.lastExecuted > a.lastExecuted ? -1 : 0).reverse().slice(0, 3);
48
- let recentTaskOptions = recentTaskArr.map(task => {
49
- return task.name + separator + moment(task.lastExecuted).calendar();
50
- });
51
- let taskToRun;
52
- if (categories) {
53
- taskToRun = await taskList(FcScripts, recentTaskOptions);
54
- } else {
55
- let tasks = FcScripts.allTasks;
56
- taskToRun = await taskListAutoComplete(tasks.map(task => {
57
- return `${task.name}${separator}${task.description}`;
58
- }));
59
- }
60
- if (recentTasks[taskToRun] === undefined) {
61
- recentTasks[taskToRun] = {
62
- lastExecuted: Date.now()
63
- };
64
- } else {
65
- recentTasks[taskToRun].lastExecuted = Date.now();
66
- }
67
- config.set("recentTasks", recentTasks);
68
- const taskData = FcScripts.allTasks.find(t => t.name === taskToRun);
69
- if (!taskData) {
70
- console.error(`${chalk.bold.underline.red("Task not found")}`);
71
- return;
72
- }
73
- let {
74
- script,
75
- lang
76
- } = taskData;
77
- let pars = script.split(" ");
78
- let type = pars[0];
79
- let env = {};
80
- if (pars[0].includes("=")) {
81
- let envs = type.split("=");
82
- env[envs[0]] = envs[1];
83
- type = pars[1];
84
- pars.shift();
85
- pars.shift();
86
- script = pars.join(" ");
87
- } else {
88
- pars.shift();
89
- script = pars.join(" ");
90
- }
91
- await runCLICommand({
92
- task: {
93
- name: taskToRun
94
- },
95
- script: {
96
- lang: lang,
97
- type: type,
98
- env: env,
99
- full: script,
100
- rest: script.split(" ")
41
+ const FcScripts = await parseScriptFile();
42
+ if (FcScripts === false) {
43
+ return false;
44
+ }
45
+ const config = getConfig();
46
+ let recentTasks = config.get("recentTasks", {});
47
+ let recentTaskArr = Object.keys(recentTasks)
48
+ .map((taskName) => {
49
+ let task = recentTasks[taskName];
50
+ return { name: taskName, lastExecuted: task.lastExecuted };
51
+ })
52
+ .sort((a, b) =>
53
+ a.lastExecuted > b.lastExecuted ? 1 : b.lastExecuted > a.lastExecuted ? -1 : 0
54
+ )
55
+ .reverse()
56
+ .slice(0, 3);
57
+ let recentTaskOptions = recentTaskArr.map((task) => {
58
+ return task.name + separator + moment(task.lastExecuted).calendar();
59
+ });
60
+ let taskToRun;
61
+ if (categories) {
62
+ taskToRun = await taskList(FcScripts, recentTaskOptions);
63
+ } else {
64
+ let tasks = FcScripts.allTasks;
65
+
66
+ taskToRun = await taskListAutoComplete(
67
+ tasks.map((task) => {
68
+ return `${task.name}${separator}${task.description}`;
69
+ })
70
+ );
71
+ }
72
+
73
+ if (recentTasks[taskToRun] === undefined) {
74
+ recentTasks[taskToRun] = { lastExecuted: Date.now() };
75
+ } else {
76
+ recentTasks[taskToRun].lastExecuted = Date.now();
101
77
  }
102
- });
78
+ config.set("recentTasks", recentTasks);
79
+
80
+ const taskData = FcScripts.allTasks.find((t) => t.name === taskToRun);
81
+ if (!taskData) {
82
+ console.error(`${chalk.bold.underline.red("Task not found")}`);
83
+ return;
84
+ }
85
+
86
+ let { script, lang } = taskData;
87
+ let pars = script.split(" ");
88
+ let type = pars[0];
89
+ let env = {};
90
+ if (pars[0].includes("=")) {
91
+ let envs = type.split("=");
92
+ env[envs[0]] = envs[1];
93
+ type = pars[1];
94
+ pars.shift();
95
+ pars.shift();
96
+ script = pars.join(" ");
97
+ } else {
98
+ pars.shift();
99
+ script = pars.join(" ");
100
+ }
101
+ await runCLICommand({
102
+ task: { name: taskToRun },
103
+ script: {
104
+ lang: lang,
105
+ type: type,
106
+ env: env,
107
+ full: script,
108
+ rest: script.split(" ")
109
+ }
110
+ });
103
111
  };
112
+
104
113
  const startPackageScripts = async () => {
105
- const packageScripts = await parsePackageFile();
106
- let tasks = Object.keys(packageScripts).map(e => {
107
- return {
108
- name: e,
109
- script: packageScripts[e]
110
- };
111
- });
112
- let taskToRun = await taskListAutoComplete(tasks.map(task => {
113
- return `${task.name}${separator}${task.script}`;
114
- }));
115
- if (taskToRun === false) {
116
- console.log(chalk.green.bold("See you soon!"));
117
- return false;
118
- }
119
- await runCLICommand({
120
- task: {
121
- name: taskToRun
122
- },
123
- script: {
124
- lang: taskToRun.lang,
125
- type: "yarn",
126
- full: taskToRun.script,
127
- rest: taskToRun.script.split(" ").slice(1)
114
+ const packageScripts = await parsePackageFile();
115
+
116
+ let tasks = Object.keys(packageScripts).map((e) => {
117
+ return { name: e, script: packageScripts[e] };
118
+ });
119
+
120
+ let taskToRun = await taskListAutoComplete(
121
+ tasks.map((task) => {
122
+ return `${task.name}${separator}${task.script}`;
123
+ })
124
+ );
125
+
126
+ if (taskToRun === false) {
127
+ console.log(chalk.green.bold("See you soon!"));
128
+ return false;
128
129
  }
129
- });
130
+ await runCLICommand({
131
+ task: { name: taskToRun },
132
+ script: {
133
+ lang: taskToRun.lang,
134
+ type: "yarn",
135
+ full: taskToRun.script,
136
+ rest: taskToRun.script.split(" ").slice(1)
137
+ }
138
+ });
130
139
  };
140
+
131
141
  const clearRecent = async () => {
132
- config.set("recentTasks", {});
142
+ getConfig().set("recentTasks", {});
143
+ };
144
+ export {
145
+ startScripts,
146
+ taskListAutoComplete,
147
+ clearRecent,
148
+ startPackageScripts
133
149
  };
134
- export { startScripts, taskListAutoComplete, clearRecent, startPackageScripts };
@@ -2,92 +2,107 @@ import inquirer from "inquirer";
2
2
  const separator = " ~ ";
3
3
  import termSize from "term-size";
4
4
  import chalk from "chalk";
5
- const convertBold = e => {
6
- let reg = /(\*\*|^\*\*)(?=\S)([\s\S]*?\S)\*\*(?![\*\*\S])/g;
7
- let boldMatches = e.match(reg);
8
- if (boldMatches !== null) {
9
- boldMatches.forEach(m => {
10
- e = e.replace(m, chalk.bold.redBright(m.replace(/\*\*/g, ""))); //.underline.bgBlack.whiteBright
11
- });
12
- }
13
- let regunderline = /(_|^_)(?=\S)([\s\S]*?\S)_(?![_\S])/g;
14
- let underlineMatches = e.match(regunderline);
15
- if (underlineMatches !== null) {
16
- underlineMatches.forEach(m => {
17
- e = e.replace(m, chalk.underline.greenBright(m.replace(/\_\_/g, ""))); //.underline.bgBlack.whiteBright
18
- });
19
- }
20
- return e;
5
+ import { clear } from "./utils/index.js";
6
+ const convertBold = (e) => {
7
+ let reg = /(\*\*|^\*\*)(?=\S)([\s\S]*?\S)\*\*(?![\*\*\S])/g;
8
+ let boldMatches = e.match(reg);
9
+ if (boldMatches !== null) {
10
+ boldMatches.forEach((m) => {
11
+ e = e.replace(m, chalk.bold.redBright(m.replace(/\*\*/g, ""))); //.underline.bgBlack.whiteBright
12
+ });
13
+ }
14
+ let regunderline = /(_|^_)(?=\S)([\s\S]*?\S)_(?![_\S])/g;
15
+ let underlineMatches = e.match(regunderline);
16
+ if (underlineMatches !== null) {
17
+ underlineMatches.forEach((m) => {
18
+ e = e.replace(m, chalk.underline.greenBright(m.replace(/\_\_/g, ""))); //.underline.bgBlack.whiteBright
19
+ });
20
+ }
21
+ return e;
21
22
  };
22
- const convertBoldArray = arr => {
23
- return arr.map(e => {
24
- return convertBold(e);
25
- });
23
+ const convertBoldArray = (arr) => {
24
+ return arr.map((e) => {
25
+ return convertBold(e);
26
+ });
26
27
  };
27
28
  const taskList = async (FcScripts, recentTasks) => {
28
- return new Promise(resolve => {
29
- let choiceCategories = [...recentTasks.map(cat => {
30
- return {
31
- name: `${chalk.bold.underline.green(cat)}`,
32
- value: {
33
- type: "task",
34
- name: cat
35
- }
36
- };
37
- }), {
38
- name: "-------------",
39
- value: null
40
- }, ...FcScripts.categories.map(cat => {
41
- return {
42
- name: `${chalk.bold.underline.green(cat.name)} ${separator} ${convertBold(cat.description)}`,
43
- value: {
44
- type: "category",
45
- name: cat.name
46
- }
47
- };
48
- })];
49
- const {
50
- rows
51
- } = termSize();
52
- //=> {columns: 143, rows: 24}
53
- inquirer.prompt([{
54
- type: "list",
55
- name: "category",
56
- message: "What category do you want to run?",
57
- pageSize: rows - 1,
58
- choices: choiceCategories
59
- }]).then(({
60
- category
61
- }) => {
62
- let sepInd = choiceCategories.indexOf("-------------");
63
- let chosenInd = choiceCategories.indexOf(category);
64
- if (category === null) {
65
- console.log("Can't select divider");
66
- } else if (category.type === "task") {
67
- let taskToRun = category.name.split(separator)[0].trim();
68
- resolve(taskToRun);
69
- } else {
70
- let categoryName = category.name.split(separator)[0];
71
- let catObj = FcScripts.categories.findIndex(e => e.name === category.name);
72
- catObj = FcScripts.categories[catObj];
73
- let taskNames = Object.keys(catObj.tasks).map(taskName => {
74
- let task = catObj.tasks[taskName];
75
- return `${taskName} ${task.description ? separator + task.description.replace(/\n/g, " ").trim() : ""}`;
76
- });
77
- taskNames = convertBoldArray(taskNames);
78
- inquirer.prompt([{
79
- type: "list",
80
- name: "taskToRun",
81
- message: "Which task do you want to run",
82
- choices: taskNames
83
- }]).then(({
84
- taskToRun
85
- }) => {
86
- taskToRun = taskToRun.split(separator)[0].trim();
87
- resolve(taskToRun);
88
- });
89
- }
29
+ return new Promise((resolve) => {
30
+ const promptUser = () => {
31
+ let choiceCategories = [
32
+ ...recentTasks.map((cat) => {
33
+ return {
34
+ name: `${chalk.bold.underline.green(cat)}`,
35
+ value: { type: "task", name: cat }
36
+ };
37
+ }),
38
+ { name: "-------------", value: null },
39
+ ...FcScripts.categories.map((cat) => {
40
+ return {
41
+ name: `${chalk.bold.underline.green(cat.name)} ${separator} ${convertBold(
42
+ cat.description
43
+ )}`,
44
+ value: { type: "category", name: cat.name }
45
+ };
46
+ })
47
+ ];
48
+
49
+ const { rows } = termSize();
50
+ //=> {columns: 143, rows: 24}
51
+ inquirer
52
+ .prompt([
53
+ {
54
+ type: "list",
55
+ name: "category",
56
+ message: "What category do you want to run?",
57
+ pageSize: rows - 1,
58
+ choices: choiceCategories
59
+ }
60
+ ])
61
+ .then(({ category }) => {
62
+ let sepInd = choiceCategories.indexOf("-------------");
63
+ let chosenInd = choiceCategories.indexOf(category);
64
+ if (category === null) {
65
+ // Ignore divider selection and prompt again
66
+ clear();
67
+ promptUser();
68
+ } else if (category.type === "task") {
69
+ let taskToRun = category.name.split(separator)[0].trim();
70
+ resolve(taskToRun);
71
+ } else {
72
+ let categoryName = category.name.split(separator)[0];
73
+ let catObj = FcScripts.categories.findIndex(
74
+ (e) => e.name === category.name
75
+ );
76
+ catObj = FcScripts.categories[catObj];
77
+ let taskNames = Object.keys(catObj.tasks).map((taskName) => {
78
+ let task = catObj.tasks[taskName];
79
+ return `${taskName} ${
80
+ task.description
81
+ ? separator + task.description.replace(/\n/g, " ").trim()
82
+ : ""
83
+ }`;
84
+ });
85
+ taskNames = convertBoldArray(taskNames);
86
+ inquirer
87
+ .prompt([
88
+ {
89
+ type: "list",
90
+ name: "taskToRun",
91
+ message: "Which task do you want to run",
92
+ choices: taskNames
93
+ }
94
+ ])
95
+ .then(({ taskToRun }) => {
96
+ taskToRun = taskToRun.split(separator)[0].trim();
97
+ resolve(taskToRun);
98
+ });
99
+ }
100
+ });
101
+ };
102
+
103
+ // Start the prompt
104
+ promptUser();
90
105
  });
91
- });
92
106
  };
93
- export default taskList;
107
+
108
+ export default taskList;
@@ -0,0 +1,113 @@
1
+ <!-- toc -->
2
+
3
+ - [Build](#build)
4
+ * [v:publish-](#vpublish-)
5
+ * [script:js](#scriptjs)
6
+ - [Groups2](#groups2)
7
+ * [console:js](#consolejs)
8
+ * [input:js-](#inputjs-)
9
+ * [log:much:js](#logmuchjs)
10
+
11
+ <!-- tocstop -->
12
+
13
+ # Build
14
+
15
+ Build group description
16
+
17
+ ## v:publish-
18
+
19
+ Update v and push
20
+
21
+ ```bash
22
+ node src/utils/release/publish.js
23
+ ```
24
+
25
+ ## add:command
26
+
27
+ ```bash
28
+ oclif command
29
+ ```
30
+
31
+ ## script:js
32
+
33
+ ```js
34
+ const chalk = require("chalk");
35
+ console.log(`${chalk.underline.bold("RUNS JS\n\nt")}`);
36
+ ```
37
+
38
+ # Groups2
39
+
40
+ That darn second group!!!!!
41
+
42
+ ## console:js
43
+
44
+ Only one script here with bash
45
+
46
+ ```bash
47
+ node src/sampleScripts/exampleLogTimeout.js
48
+ ```
49
+
50
+ ## input:js-
51
+
52
+ Get some input from user
53
+
54
+ ```bash
55
+ node src/sampleScripts/exampleInput.js
56
+ ```
57
+
58
+ ## log:much:js
59
+
60
+ Basically logs till yo momma says stop!
61
+
62
+ ```js
63
+ const chalk = require("chalk");
64
+ const sample = arr => arr[Math.floor(Math.random() * arr.length)];
65
+ const quotes = [
66
+ "The trickster's functiowhat they reslly s function is to break taboos, create mischief, stir things up. In the end, the trickster gives people what they res function is to break taboos, create mischief, stir things up. In the end, the trickster gives people what they rewant, some sort of freedom. - Tom Robbins",
67
+ '"Disbelief in magic can really s function is to break taboos, create mischief, stir things up. In the end, the trickster gives people what they res function is to break taboos, create mischief, stir things up. In the end, the trickster gives people what they rewant, some sort of freedom. - Tom Robbins",\n' +
68
+ ' "Disbelief in magic can force a poor soul into believing in government and business. - Tom Robbins',
69
+ 'The trouble with the fasforce a poor soul into believing in government and business. - Tom Robbins",\n' +
70
+ ' "The trouble with the fasforce a poor soul into believing in government and business. - Tom Robbins",\n' +
71
+ ' "The trouble with the fast lane is that all the movement is horizontal. And I like to go vertical sometimes. - Tom Robbins',
72
+ "Our world isn't made of earth, air and water or even molecules and atoms; our world is made of language. - Tom Robbimade of earth, air and water or even molecules and atoms; our world is made of language. - Tom Robbins",
73
+ "I'm not infatuated with frivoith frivoith frivoith frivoith frivoith frivoith frivoith frivolousness. We're just good friends. - Tom Robbins",
74
+ "In fiction, when you paint yourself into a corner, you can write a pair of suction cups onto the bottoms of your shoes and walk up the wall and out the skylight and see the sun breaking through the clouds. In nonfiction, you don't have that luxury. - Tom Robbins"
75
+ ];
76
+ let sxy;
77
+ const getOption = st => {
78
+ // if (Math.random() > 0.5) {
79
+ // st = st + sample(quotes) + sample(quotes) + sample(quotes);
80
+ // }
81
+ let options = [
82
+ chalk.blue(st),
83
+ chalk.underline.green(st),
84
+ chalk.green.bgRed.bold(st),
85
+ chalk.blue(st, st, st, st),
86
+ chalk.red(st, chalk.underline.bgBlue(st) + st)
87
+ ];
88
+ return sample(options);
89
+ };
90
+ let isMil = 0;
91
+ const theRun = async () => {
92
+ return new Promise(resolve => {
93
+ sxy = setInterval(() => {
94
+ const qt = sample(quotes);
95
+ console.log(new Date() + " ------- ----- ---- \n");
96
+ console.log(getOption(qt));
97
+ console.log(new Date() + " ------- ----- ---- \n");
98
+ console.log("----- ---- \n");
99
+ console.log("----- ---- \n");
100
+ console.log("----- ---- \n");
101
+ if (isMil === 30) {
102
+ clearInterval(sxy);
103
+ console.log("DONE DONE DONE");
104
+ resolve();
105
+ } else {
106
+ isMil += 10;
107
+ }
108
+ }, 1000);
109
+ });
110
+ };
111
+
112
+ theRun();
113
+ ```
@@ -0,0 +1,103 @@
1
+ <!-- toc -->
2
+
3
+ - [Group1](#group1)
4
+ * [parcel:script](#parcelscript)
5
+ * [script:js](#scriptjs)
6
+ - [Groups2](#groups2)
7
+ * [console:js](#consolejs)
8
+ * [input:js-](#inputjs-)
9
+ * [crazy:javascript](#crazyjavascript)
10
+
11
+ <!-- tocstop -->
12
+
13
+ # Group1
14
+
15
+ Explained G 1
16
+
17
+ ## parcel:script
18
+
19
+ Described script 1
20
+
21
+ ```bash
22
+ parcel ./index.html --no-cache
23
+ ```
24
+
25
+ ## script:js
26
+
27
+ ```js
28
+ const chalk = require("chalk");
29
+ console.log(`${chalk.underline.bold("RUNS JS\n\nTEST")}`);
30
+ ```
31
+
32
+ # Groups2
33
+
34
+ ## console:js
35
+
36
+ Only one script here with bash
37
+
38
+ ```bash
39
+ node src/sampleScripts/exampleLogTimeout.js
40
+ ```
41
+
42
+ ## input:js-
43
+
44
+ Get some input from user
45
+
46
+ ```bash
47
+ node src/sampleScripts/exampleInput.js
48
+ ```
49
+
50
+ ## crazy:javascript
51
+
52
+ ```js
53
+ const chalk = require("chalk");
54
+ const sample = arr => arr[Math.floor(Math.random() * arr.length)];
55
+ const quotes = [
56
+ "The trickster's functiowhat they reslly s function is to break taboos, create mischief, stir things up. In the end, the trickster gives people what they res function is to break taboos, create mischief, stir things up. In the end, the trickster gives people what they rewant, some sort of freedom. - Tom Robbins",
57
+ '"Disbelief in magic can really s function is to break taboos, create mischief, stir things up. In the end, the trickster gives people what they res function is to break taboos, create mischief, stir things up. In the end, the trickster gives people what they rewant, some sort of freedom. - Tom Robbins",\n' +
58
+ ' "Disbelief in magic can force a poor soul into believing in government and business. - Tom Robbins',
59
+ 'The trouble with the fasforce a poor soul into believing in government and business. - Tom Robbins",\n' +
60
+ ' "The trouble with the fasforce a poor soul into believing in government and business. - Tom Robbins",\n' +
61
+ ' "The trouble with the fast lane is that all the movement is horizontal. And I like to go vertical sometimes. - Tom Robbins',
62
+ "Our world isn't made of earth, air and water or even molecules and atoms; our world is made of language. - Tom Robbimade of earth, air and water or even molecules and atoms; our world is made of language. - Tom Robbins",
63
+ "I'm not infatuated with frivoith frivoith frivoith frivoith frivoith frivoith frivoith frivolousness. We're just good friends. - Tom Robbins",
64
+ "In fiction, when you paint yourself into a corner, you can write a pair of suction cups onto the bottoms of your shoes and walk up the wall and out the skylight and see the sun breaking through the clouds. In nonfiction, you don't have that luxury. - Tom Robbins"
65
+ ];
66
+ let sxy;
67
+ const getOption = st => {
68
+ // if (Math.random() > 0.5) {
69
+ // st = st + sample(quotes) + sample(quotes) + sample(quotes);
70
+ // }
71
+ let options = [
72
+ chalk.blue(st),
73
+ chalk.underline.green(st),
74
+ chalk.green.bgRed.bold(st),
75
+ chalk.blue(st, st, st, st),
76
+ chalk.red(st, chalk.underline.bgBlue(st) + st)
77
+ ];
78
+ return sample(options);
79
+ };
80
+ let isMil = 0;
81
+ const theRun = async () => {
82
+ return new Promise(resolve => {
83
+ sxy = setInterval(() => {
84
+ const qt = sample(quotes);
85
+ console.log(new Date() + " ------- ----- ---- \n");
86
+ console.log(getOption(qt));
87
+ console.log(new Date() + " ------- ----- ---- \n");
88
+ console.log("----- ---- \n");
89
+ console.log("----- ---- \n");
90
+ console.log("----- ---- \n");
91
+ if (isMil === 30) {
92
+ clearInterval(sxy);
93
+ console.log("DONE DONE DONE");
94
+ resolve();
95
+ } else {
96
+ isMil += 10;
97
+ }
98
+ }, 1000);
99
+ });
100
+ };
101
+
102
+ theRun();
103
+ ```