flowershow 0.1.10 → 0.2.1

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 (81) hide show
  1. package/README.md +246 -10
  2. package/dist/cli.d.ts +3 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +70 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/lib/api-client.d.ts +68 -0
  7. package/dist/lib/api-client.d.ts.map +1 -0
  8. package/dist/lib/api-client.js +104 -0
  9. package/dist/lib/api-client.js.map +1 -0
  10. package/dist/lib/auth.d.ts +21 -0
  11. package/dist/lib/auth.d.ts.map +1 -0
  12. package/dist/lib/auth.js +133 -0
  13. package/dist/lib/auth.js.map +1 -0
  14. package/dist/lib/commands/auth-login.d.ts +2 -0
  15. package/dist/lib/commands/auth-login.d.ts.map +1 -0
  16. package/dist/lib/commands/auth-login.js +55 -0
  17. package/dist/lib/commands/auth-login.js.map +1 -0
  18. package/dist/lib/commands/auth-logout.d.ts +2 -0
  19. package/dist/lib/commands/auth-logout.d.ts.map +1 -0
  20. package/dist/lib/commands/auth-logout.js +26 -0
  21. package/dist/lib/commands/auth-logout.js.map +1 -0
  22. package/dist/lib/commands/auth-status.d.ts +2 -0
  23. package/dist/lib/commands/auth-status.d.ts.map +1 -0
  24. package/dist/lib/commands/auth-status.js +36 -0
  25. package/dist/lib/commands/auth-status.js.map +1 -0
  26. package/dist/lib/commands/delete.d.ts +2 -0
  27. package/dist/lib/commands/delete.d.ts.map +1 -0
  28. package/dist/lib/commands/delete.js +80 -0
  29. package/dist/lib/commands/delete.js.map +1 -0
  30. package/dist/lib/commands/list.d.ts +2 -0
  31. package/dist/lib/commands/list.d.ts.map +1 -0
  32. package/dist/lib/commands/list.js +42 -0
  33. package/dist/lib/commands/list.js.map +1 -0
  34. package/dist/lib/commands/publish.d.ts +2 -0
  35. package/dist/lib/commands/publish.d.ts.map +1 -0
  36. package/dist/lib/commands/publish.js +166 -0
  37. package/dist/lib/commands/publish.js.map +1 -0
  38. package/dist/lib/const.d.ts +4 -0
  39. package/dist/lib/const.d.ts.map +1 -0
  40. package/dist/lib/const.js +4 -1
  41. package/dist/lib/const.js.map +1 -0
  42. package/dist/lib/files.d.ts +13 -0
  43. package/dist/lib/files.d.ts.map +1 -0
  44. package/dist/lib/files.js +156 -0
  45. package/dist/lib/files.js.map +1 -0
  46. package/dist/lib/utils.d.ts +22 -0
  47. package/dist/lib/utils.d.ts.map +1 -0
  48. package/dist/lib/utils.js +90 -0
  49. package/dist/lib/utils.js.map +1 -0
  50. package/package.json +36 -37
  51. package/dist/bin/cli.js +0 -97
  52. package/dist/index.js +0 -1
  53. package/dist/lib/Installer.js +0 -185
  54. package/dist/lib/build.js +0 -18
  55. package/dist/lib/buildExport.js +0 -11
  56. package/dist/lib/install.js +0 -28
  57. package/dist/lib/preview.js +0 -18
  58. package/dist/lib/publish.js +0 -8
  59. package/dist/lib/upgrade.js +0 -8
  60. package/dist/lib/utils/exit.js +0 -3
  61. package/dist/lib/utils/index.js +0 -5
  62. package/dist/lib/utils/isSubdir.js +0 -6
  63. package/dist/lib/utils/logger.js +0 -19
  64. package/dist/lib/utils/sendEvent.js +0 -5
  65. package/dist/lib/utils/spinner.js +0 -49
  66. package/dist/src/bin/cli.js +0 -97
  67. package/dist/src/index.js +0 -1
  68. package/dist/src/lib/Installer.js +0 -185
  69. package/dist/src/lib/build.js +0 -18
  70. package/dist/src/lib/buildExport.js +0 -11
  71. package/dist/src/lib/const.js +0 -1
  72. package/dist/src/lib/install.js +0 -28
  73. package/dist/src/lib/preview.js +0 -18
  74. package/dist/src/lib/publish.js +0 -8
  75. package/dist/src/lib/upgrade.js +0 -8
  76. package/dist/src/lib/utils/exit.js +0 -3
  77. package/dist/src/lib/utils/index.js +0 -5
  78. package/dist/src/lib/utils/isSubdir.js +0 -6
  79. package/dist/src/lib/utils/logger.js +0 -19
  80. package/dist/src/lib/utils/sendEvent.js +0 -5
  81. package/dist/src/lib/utils/spinner.js +0 -49
@@ -1,18 +0,0 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import { execa } from "execa";
4
- import { exit, error } from "./utils/index.js";
5
- import { FLOWERSHOW_FOLDER_NAME } from "./const.js";
6
- export default async function build(dir) {
7
- const flowershowDir = path.resolve(dir, FLOWERSHOW_FOLDER_NAME);
8
- // check if flowershow is installed
9
- if (!fs.existsSync(flowershowDir)) {
10
- error(`Directory ${flowershowDir} does not exist.`);
11
- exit(1);
12
- }
13
- const subprocess = execa("npm", ["run", "build"], { cwd: flowershowDir });
14
- subprocess.stdout.pipe(process.stdout);
15
- process.on("SIGINT", () => {
16
- subprocess.kill("SIGINT");
17
- });
18
- }
@@ -1,11 +0,0 @@
1
- import path from "path";
2
- import { execa } from "execa";
3
- import { FLOWERSHOW_FOLDER_NAME } from "./const.js";
4
- export default async function buildExport(dir) {
5
- const flowershowDir = path.resolve(dir, FLOWERSHOW_FOLDER_NAME);
6
- const subprocess = execa("npm", ["run", "export"], { cwd: flowershowDir });
7
- subprocess.stdout.pipe(process.stdout);
8
- process.on("SIGINT", () => {
9
- subprocess.kill("SIGINT");
10
- });
11
- }
@@ -1 +0,0 @@
1
- export const FLOWERSHOW_FOLDER_NAME = ".flowershow";
@@ -1,28 +0,0 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import inquirer from "inquirer";
4
- import Installer from "./Installer.js";
5
- import { error, exit } from "./utils/index.js";
6
- export default async function install(dir) {
7
- const currentDir = process.cwd();
8
- const inCurrentDir = dir === ".";
9
- if (inCurrentDir) {
10
- const { ok } = await inquirer.prompt([
11
- {
12
- name: "ok",
13
- type: "confirm",
14
- message: "Create Flowershow project in current directory?",
15
- },
16
- ]);
17
- if (!ok) {
18
- return;
19
- }
20
- }
21
- const targetDir = path.resolve(dir);
22
- if (!fs.existsSync(targetDir)) {
23
- error(`Directory ${targetDir} does not exist.`);
24
- exit(1);
25
- }
26
- const installer = new Installer(currentDir, targetDir);
27
- await installer.install();
28
- }
@@ -1,18 +0,0 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import { execa } from "execa";
4
- import { exit, error } from "./utils/index.js";
5
- import { FLOWERSHOW_FOLDER_NAME } from "./const.js";
6
- export default async function preview(dir) {
7
- const flowershowDir = path.resolve(dir, FLOWERSHOW_FOLDER_NAME);
8
- // check if flowershow is installed
9
- if (!fs.existsSync(flowershowDir)) {
10
- error(`Directory ${flowershowDir} does not exist.`);
11
- exit(1);
12
- }
13
- const subprocess = execa("npm", ["run", "dev"], { cwd: flowershowDir });
14
- subprocess.stdout.pipe(process.stdout);
15
- process.on("SIGINT", () => {
16
- subprocess.kill("SIGINT");
17
- });
18
- }
@@ -1,8 +0,0 @@
1
- import chalk from "chalk";
2
- const log = console.log;
3
- export default function publish() {
4
- log(chalk.redBright.bold("Command under construction...\n"));
5
- log(chalk.blue("Check " +
6
- chalk.green.underline("https://flowershow.app") +
7
- " to learn more about Flowershow development stage and subscribe to get notified when it's ready!"));
8
- }
@@ -1,8 +0,0 @@
1
- import chalk from "chalk";
2
- const log = console.log;
3
- export default function upgrade() {
4
- log(chalk.redBright.bold("Command under construction...\n"));
5
- log(chalk.blue("Check " +
6
- chalk.green.underline("https://flowershow.app") +
7
- " to learn more about Flowershow development stage and subscribe to get notified when it's ready!"));
8
- }
@@ -1,3 +0,0 @@
1
- export const exit = (code) => {
2
- process.exit(code);
3
- };
@@ -1,5 +0,0 @@
1
- export { error, info, log, success, warn } from "./logger.js";
2
- export { exit } from "./exit.js";
3
- export { isSubdir } from "./isSubdir.js";
4
- export { sendEvent } from "./sendEvent.js";
5
- export { logWithSpinner, stopSpinner, pauseSpinner, resumeSpinner, } from "./spinner.js";
@@ -1,6 +0,0 @@
1
- import path from "path";
2
- // test if dir is a subdirectory of or same as ofDir
3
- export function isSubdir(dir, ofDir) {
4
- const relative = path.relative(ofDir, dir);
5
- return relative && !relative.startsWith("..") && !path.isAbsolute(relative);
6
- }
@@ -1,19 +0,0 @@
1
- import chalk from "chalk";
2
- export const log = (msg = "") => {
3
- console.log(msg);
4
- };
5
- export const info = (msg) => {
6
- console.log(`${chalk.bgBlueBright.black(" INFO ")} ${msg}`);
7
- };
8
- export const error = (msg) => {
9
- console.error(`\n${chalk.bgRed(" ERROR ")} ${chalk.red(msg)}`);
10
- if (msg instanceof Error) {
11
- console.error(msg.stack);
12
- }
13
- };
14
- export const success = (msg) => {
15
- console.log(`${chalk.blue("🎊")} ${msg}`);
16
- };
17
- export const warn = (msg) => {
18
- console.log(`${chalk.red("⚠")} ${msg}`);
19
- };
@@ -1,5 +0,0 @@
1
- import ua from "universal-analytics";
2
- const visitor = ua("UA-235099461-1");
3
- export function sendEvent({ event, action, meta, }) {
4
- visitor.event(event, action, JSON.stringify(meta)).send();
5
- }
@@ -1,49 +0,0 @@
1
- import ora from "ora";
2
- import chalk from "chalk";
3
- const spinner = ora({ color: "magenta" });
4
- let lastMsg = null;
5
- let isPaused = false;
6
- export const logWithSpinner = ({ msg, symbol }) => {
7
- if (!symbol) {
8
- symbol = chalk.green("✔");
9
- }
10
- if (lastMsg) {
11
- spinner.stopAndPersist({
12
- symbol: lastMsg.symbol,
13
- text: lastMsg.text,
14
- });
15
- }
16
- spinner.text = " " + msg;
17
- lastMsg = {
18
- symbol: symbol + " ",
19
- text: msg,
20
- };
21
- spinner.start();
22
- };
23
- export const stopSpinner = () => {
24
- if (!spinner.isSpinning) {
25
- return;
26
- }
27
- if (lastMsg) {
28
- spinner.stopAndPersist({
29
- symbol: lastMsg.symbol,
30
- text: lastMsg.text,
31
- });
32
- }
33
- else {
34
- spinner.stop();
35
- }
36
- lastMsg = null;
37
- };
38
- export const pauseSpinner = () => {
39
- if (spinner.isSpinning) {
40
- spinner.stop();
41
- isPaused = true;
42
- }
43
- };
44
- export const resumeSpinner = () => {
45
- if (isPaused) {
46
- spinner.start();
47
- isPaused = false;
48
- }
49
- };