@apia/cli 4.0.15 → 4.0.16

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.
@@ -1,19 +1,19 @@
1
- const readline = require('readline');
2
-
3
- function askQuestion(question, defaultAnswer, defaultValue, useDefaults) {
4
- if (useDefaults) return defaultValue;
5
-
6
- const rl = readline.createInterface({
7
- input: process.stdin,
8
- output: process.stdout,
9
- });
10
-
11
- return new Promise((resolve) => {
12
- rl.question(`${question} [default: ${defaultAnswer}]: `, (answer) => {
13
- rl.close();
14
- resolve(answer || defaultValue); // Use default if no answer
15
- });
16
- });
17
- }
18
-
1
+ const readline = require('readline');
2
+
3
+ function askQuestion(question, defaultAnswer, defaultValue, useDefaults) {
4
+ if (useDefaults) return defaultValue;
5
+
6
+ const rl = readline.createInterface({
7
+ input: process.stdin,
8
+ output: process.stdout,
9
+ });
10
+
11
+ return new Promise((resolve) => {
12
+ rl.question(`${question} [default: ${defaultAnswer}]: `, (answer) => {
13
+ rl.close();
14
+ resolve(answer || defaultValue); // Use default if no answer
15
+ });
16
+ });
17
+ }
18
+
19
19
  module.exports = askQuestion;
@@ -1,33 +1,33 @@
1
- const path = require('path');
2
- const fs = require('fs');
3
-
4
- /**
5
- * Searches for the file with <fileName> in the current working directory (process.cwd()) and all its ancestors.
6
- *
7
- * @returns - An object { fileName: string; content: string } if found, or undefined else.
8
- */
9
- function findFileInAncestors(fileName) {
10
- let currentDir = path.resolve(process.cwd())
11
- let searchAgain = true;
12
-
13
- do {
14
- /**
15
- * Searches for the .env file in the current folder and its ancestors.
16
- */
17
- const currentEnv = path.resolve(currentDir, fileName)
18
-
19
- searchAgain = !fs.existsSync(currentEnv);
20
- if (!searchAgain) {
21
- return { fileName: currentEnv, content: fs.readFileSync(currentEnv, { encoding: 'utf8' }) };
22
- }
23
-
24
- const aux = currentDir;
25
- currentDir = path.resolve(currentDir, '..');
26
-
27
- searchAgain = aux !== currentDir;
28
- } while (searchAgain);
29
-
30
- return undefined;
31
- }
32
-
1
+ const path = require('path');
2
+ const fs = require('fs');
3
+
4
+ /**
5
+ * Searches for the file with <fileName> in the current working directory (process.cwd()) and all its ancestors.
6
+ *
7
+ * @returns - An object { fileName: string; content: string } if found, or undefined else.
8
+ */
9
+ function findFileInAncestors(fileName) {
10
+ let currentDir = path.resolve(process.cwd())
11
+ let searchAgain = true;
12
+
13
+ do {
14
+ /**
15
+ * Searches for the .env file in the current folder and its ancestors.
16
+ */
17
+ const currentEnv = path.resolve(currentDir, fileName)
18
+
19
+ searchAgain = !fs.existsSync(currentEnv);
20
+ if (!searchAgain) {
21
+ return { fileName: currentEnv, content: fs.readFileSync(currentEnv, { encoding: 'utf8' }) };
22
+ }
23
+
24
+ const aux = currentDir;
25
+ currentDir = path.resolve(currentDir, '..');
26
+
27
+ searchAgain = aux !== currentDir;
28
+ } while (searchAgain);
29
+
30
+ return undefined;
31
+ }
32
+
33
33
  module.exports = findFileInAncestors;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  class Plugin {
2
2
  constructor(name, fc) {
3
- window.dispatchComponent.once("ready", () => {
3
+ window.dispatchComponent.on("ready", () => {
4
4
  window.dispatchComponent.emit("dispatch", { name, fc });
5
5
  });
6
6
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/Plugin.ts"],"sourcesContent":["import { EventEmitter } from '@apia/util';\r\n\r\ndeclare global {\r\n interface Window {\r\n dispatchComponent: EventEmitter<{\r\n dispatch: any;\r\n ready: null;\r\n }>;\r\n }\r\n}\r\n\r\nexport class Plugin {\r\n constructor(name: string, fc: any) {\r\n window.dispatchComponent.once('ready', () => {\r\n window.dispatchComponent.emit('dispatch', { name, fc });\r\n });\r\n }\r\n}\r\n"],"names":[],"mappings":"AAWO,MAAM,MAAO,CAAA;AAAA,EAClB,WAAA,CAAY,MAAc,EAAS,EAAA;AACjC,IAAO,MAAA,CAAA,iBAAA,CAAkB,IAAK,CAAA,OAAA,EAAS,MAAM;AAC3C,MAAA,MAAA,CAAO,kBAAkB,IAAK,CAAA,UAAA,EAAY,EAAE,IAAA,EAAM,IAAI,CAAA;AAAA,KACvD,CAAA;AAAA;AAEL;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/Plugin.ts"],"sourcesContent":["import { EventEmitter } from '@apia/util';\r\n\r\ndeclare global {\r\n interface Window {\r\n dispatchComponent: EventEmitter<{\r\n dispatch: any;\r\n ready: null;\r\n }>;\r\n }\r\n}\r\n\r\nexport class Plugin {\r\n constructor(name: string, fc: any) {\r\n window.dispatchComponent.on('ready', () => {\r\n window.dispatchComponent.emit('dispatch', { name, fc });\r\n });\r\n }\r\n}\r\n"],"names":[],"mappings":"AAWO,MAAM,MAAO,CAAA;AAAA,EAClB,WAAA,CAAY,MAAc,EAAS,EAAA;AACjC,IAAO,MAAA,CAAA,iBAAA,CAAkB,EAAG,CAAA,OAAA,EAAS,MAAM;AACzC,MAAA,MAAA,CAAO,kBAAkB,IAAK,CAAA,UAAA,EAAY,EAAE,IAAA,EAAM,IAAI,CAAA,CAAA;AAAA,KACvD,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apia/cli",
3
- "version": "4.0.15",
3
+ "version": "4.0.16",
4
4
  "sideEffects": true,
5
5
  "author": "Alexis Leite <alexisleite@live.com>",
6
6
  "bin": {
@@ -14,7 +14,7 @@
14
14
  "access": "public",
15
15
  "registry": "https://registry.npmjs.org/"
16
16
  },
17
- "gitHead": "893eb39744c85737b54df181b2919a51963fcc81",
17
+ "gitHead": "7c6a8c2281bfd78469eece56b7efaca115734db4",
18
18
  "devDependencies": {
19
19
  "ts-loader": "^9.5.2"
20
20
  }