flowershow 0.1.9 → 0.2.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.
- package/README.md +246 -10
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +70 -0
- package/dist/cli.js.map +1 -0
- package/dist/lib/api-client.d.ts +68 -0
- package/dist/lib/api-client.d.ts.map +1 -0
- package/dist/lib/api-client.js +104 -0
- package/dist/lib/api-client.js.map +1 -0
- package/dist/lib/auth.d.ts +21 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +133 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/commands/auth-login.d.ts +2 -0
- package/dist/lib/commands/auth-login.d.ts.map +1 -0
- package/dist/lib/commands/auth-login.js +55 -0
- package/dist/lib/commands/auth-login.js.map +1 -0
- package/dist/lib/commands/auth-logout.d.ts +2 -0
- package/dist/lib/commands/auth-logout.d.ts.map +1 -0
- package/dist/lib/commands/auth-logout.js +26 -0
- package/dist/lib/commands/auth-logout.js.map +1 -0
- package/dist/lib/commands/auth-status.d.ts +2 -0
- package/dist/lib/commands/auth-status.d.ts.map +1 -0
- package/dist/lib/commands/auth-status.js +36 -0
- package/dist/lib/commands/auth-status.js.map +1 -0
- package/dist/lib/commands/delete.d.ts +2 -0
- package/dist/lib/commands/delete.d.ts.map +1 -0
- package/dist/lib/commands/delete.js +80 -0
- package/dist/lib/commands/delete.js.map +1 -0
- package/dist/lib/commands/list.d.ts +2 -0
- package/dist/lib/commands/list.d.ts.map +1 -0
- package/dist/lib/commands/list.js +42 -0
- package/dist/lib/commands/list.js.map +1 -0
- package/dist/lib/commands/publish.d.ts +2 -0
- package/dist/lib/commands/publish.d.ts.map +1 -0
- package/dist/lib/commands/publish.js +166 -0
- package/dist/lib/commands/publish.js.map +1 -0
- package/dist/lib/const.d.ts +4 -0
- package/dist/lib/const.d.ts.map +1 -0
- package/dist/lib/const.js +4 -0
- package/dist/lib/const.js.map +1 -0
- package/dist/lib/files.d.ts +13 -0
- package/dist/lib/files.d.ts.map +1 -0
- package/dist/lib/files.js +156 -0
- package/dist/lib/files.js.map +1 -0
- package/dist/lib/utils.d.ts +22 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +90 -0
- package/dist/lib/utils.js.map +1 -0
- package/package.json +39 -28
- package/CHANGELOG.md +0 -74
- package/src/bin/cli.js +0 -97
- package/src/index.js +0 -1
- package/src/lib/Installer.js +0 -185
- package/src/lib/build.js +0 -18
- package/src/lib/buildExport.js +0 -11
- package/src/lib/const.js +0 -1
- package/src/lib/install.js +0 -28
- package/src/lib/preview.js +0 -18
- package/src/lib/publish.js +0 -8
- package/src/lib/upgrade.js +0 -8
- package/src/lib/utils/exit.js +0 -3
- package/src/lib/utils/index.js +0 -5
- package/src/lib/utils/isSubdir.js +0 -6
- package/src/lib/utils/logger.js +0 -19
- package/src/lib/utils/sendEvent.js +0 -5
- package/src/lib/utils/spinner.js +0 -49
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../lib/const.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,eAAO,MAAM,OAAO,QAAwD,CAAC;AAC7E,eAAO,MAAM,OAAO,QAAqD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../lib/const.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,8BAA8B,CAAC;AAC7E,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface FileInfo {
|
|
2
|
+
originalPath: string;
|
|
3
|
+
path: string;
|
|
4
|
+
size: number;
|
|
5
|
+
sha: string;
|
|
6
|
+
extension: string;
|
|
7
|
+
content: Buffer;
|
|
8
|
+
projectName?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function discoverFiles(inputPaths: string | string[]): FileInfo[];
|
|
11
|
+
export declare function getProjectName(files: FileInfo[]): string;
|
|
12
|
+
export declare function validateFiles(files: FileInfo[]): boolean;
|
|
13
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../lib/files.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,QAAQ;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAuFD,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,QAAQ,EAAE,CAmFvE;AAKD,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CASxD;AAKD,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,CAWxD"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { readFileSync, statSync, readdirSync, existsSync } from "fs";
|
|
2
|
+
import { join, basename, extname, relative, sep } from "path";
|
|
3
|
+
import { createHash } from "crypto";
|
|
4
|
+
import ignore from "ignore";
|
|
5
|
+
const DEFAULT_IGNORE_PATTERNS = [
|
|
6
|
+
".git/",
|
|
7
|
+
".gitignore",
|
|
8
|
+
"node_modules/",
|
|
9
|
+
".DS_Store",
|
|
10
|
+
"Thumbs.db",
|
|
11
|
+
".env",
|
|
12
|
+
".env.*",
|
|
13
|
+
"!.env.example",
|
|
14
|
+
"*.log",
|
|
15
|
+
".cache/",
|
|
16
|
+
"dist/",
|
|
17
|
+
"build/",
|
|
18
|
+
".next/",
|
|
19
|
+
".vercel/",
|
|
20
|
+
".turbo/",
|
|
21
|
+
"coverage/",
|
|
22
|
+
".nyc_output/",
|
|
23
|
+
];
|
|
24
|
+
function loadGitignore(baseDir) {
|
|
25
|
+
const ig = ignore();
|
|
26
|
+
ig.add(DEFAULT_IGNORE_PATTERNS);
|
|
27
|
+
const gitignorePath = join(baseDir, ".gitignore");
|
|
28
|
+
if (existsSync(gitignorePath)) {
|
|
29
|
+
try {
|
|
30
|
+
const gitignoreContent = readFileSync(gitignorePath, "utf-8");
|
|
31
|
+
ig.add(gitignoreContent);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.warn(`Warning: Could not read .gitignore file: ${error}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return ig;
|
|
38
|
+
}
|
|
39
|
+
function shouldIncludeFile(filePath, ig) {
|
|
40
|
+
const normalizedPath = filePath.split(sep).join("/");
|
|
41
|
+
return !ig.ignores(normalizedPath);
|
|
42
|
+
}
|
|
43
|
+
function calculateSha(content) {
|
|
44
|
+
return createHash("sha1").update(content).digest("hex");
|
|
45
|
+
}
|
|
46
|
+
function getExtension(filePath) {
|
|
47
|
+
const ext = extname(filePath);
|
|
48
|
+
return ext ? ext.slice(1).toLowerCase() : "";
|
|
49
|
+
}
|
|
50
|
+
function scanDirectory(dirPath, baseDir = dirPath) {
|
|
51
|
+
const files = [];
|
|
52
|
+
const ig = loadGitignore(baseDir);
|
|
53
|
+
function scan(currentPath) {
|
|
54
|
+
const entries = readdirSync(currentPath, { withFileTypes: true });
|
|
55
|
+
for (const entry of entries) {
|
|
56
|
+
const fullPath = join(currentPath, entry.name);
|
|
57
|
+
const relativePath = relative(baseDir, fullPath);
|
|
58
|
+
if (!shouldIncludeFile(relativePath, ig)) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (entry.isDirectory()) {
|
|
62
|
+
scan(fullPath);
|
|
63
|
+
}
|
|
64
|
+
else if (entry.isFile()) {
|
|
65
|
+
files.push(fullPath);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
scan(dirPath);
|
|
70
|
+
return files;
|
|
71
|
+
}
|
|
72
|
+
export function discoverFiles(inputPaths) {
|
|
73
|
+
const paths = Array.isArray(inputPaths) ? inputPaths : [inputPaths];
|
|
74
|
+
if (paths.length === 0) {
|
|
75
|
+
throw new Error("No paths provided");
|
|
76
|
+
}
|
|
77
|
+
const allFiles = [];
|
|
78
|
+
let projectName = null;
|
|
79
|
+
for (let i = 0; i < paths.length; i++) {
|
|
80
|
+
const inputPath = paths[i];
|
|
81
|
+
if (!inputPath)
|
|
82
|
+
continue;
|
|
83
|
+
const stats = statSync(inputPath);
|
|
84
|
+
const isFirstPath = i === 0;
|
|
85
|
+
if (stats.isFile()) {
|
|
86
|
+
const extension = getExtension(inputPath);
|
|
87
|
+
const fileName = basename(inputPath, extname(inputPath));
|
|
88
|
+
const content = readFileSync(inputPath);
|
|
89
|
+
let targetPath;
|
|
90
|
+
if (isFirstPath) {
|
|
91
|
+
targetPath = extension === "mdx" ? "README.mdx" : "README.md";
|
|
92
|
+
projectName = fileName;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
targetPath = basename(inputPath);
|
|
96
|
+
}
|
|
97
|
+
allFiles.push({
|
|
98
|
+
originalPath: inputPath,
|
|
99
|
+
path: targetPath,
|
|
100
|
+
size: stats.size,
|
|
101
|
+
sha: calculateSha(content),
|
|
102
|
+
extension,
|
|
103
|
+
content,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
else if (stats.isDirectory()) {
|
|
107
|
+
const dirName = basename(inputPath);
|
|
108
|
+
const dirFiles = scanDirectory(inputPath);
|
|
109
|
+
if (isFirstPath && !projectName) {
|
|
110
|
+
projectName = dirName;
|
|
111
|
+
}
|
|
112
|
+
for (const filePath of dirFiles) {
|
|
113
|
+
const content = readFileSync(filePath);
|
|
114
|
+
const extension = getExtension(filePath);
|
|
115
|
+
const relativePath = relative(inputPath, filePath);
|
|
116
|
+
const fileStats = statSync(filePath);
|
|
117
|
+
allFiles.push({
|
|
118
|
+
originalPath: filePath,
|
|
119
|
+
path: relativePath,
|
|
120
|
+
size: fileStats.size,
|
|
121
|
+
sha: calculateSha(content),
|
|
122
|
+
extension,
|
|
123
|
+
content,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
throw new Error(`Invalid path: ${inputPath} is neither a file nor a directory`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (allFiles.length > 0 && projectName) {
|
|
132
|
+
allFiles[0].projectName = projectName;
|
|
133
|
+
}
|
|
134
|
+
return allFiles;
|
|
135
|
+
}
|
|
136
|
+
export function getProjectName(files) {
|
|
137
|
+
if (files.length === 0) {
|
|
138
|
+
throw new Error("No files discovered");
|
|
139
|
+
}
|
|
140
|
+
const projectName = files[0]?.projectName;
|
|
141
|
+
if (!projectName) {
|
|
142
|
+
throw new Error("Project name not found in files");
|
|
143
|
+
}
|
|
144
|
+
return projectName;
|
|
145
|
+
}
|
|
146
|
+
export function validateFiles(files) {
|
|
147
|
+
if (files.length === 0) {
|
|
148
|
+
throw new Error("No files found to publish");
|
|
149
|
+
}
|
|
150
|
+
const hasMarkdown = files.some((f) => ["md", "mdx"].includes(f.extension));
|
|
151
|
+
if (!hasMarkdown) {
|
|
152
|
+
console.warn("Warning: No markdown files found. The site will be empty.");
|
|
153
|
+
}
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../lib/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,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C,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IACD,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC;IAC1C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAKD,MAAM,UAAU,aAAa,CAAC,KAAiB;IAC7C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3E,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;IAC5E,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
interface BlobStatus {
|
|
2
|
+
path: string;
|
|
3
|
+
syncStatus: "PENDING" | "SUCCESS" | "ERROR";
|
|
4
|
+
syncError?: string;
|
|
5
|
+
}
|
|
6
|
+
interface SyncResult {
|
|
7
|
+
success: boolean;
|
|
8
|
+
blobs: BlobStatus[];
|
|
9
|
+
errors?: BlobStatus[];
|
|
10
|
+
timeout?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
13
|
+
export declare function formatDate(date: string | Date): string;
|
|
14
|
+
export declare function getSiteUrl(projectName: string, username: string): string;
|
|
15
|
+
export declare function getDashboardUrl(siteId: string): string;
|
|
16
|
+
export declare function waitForSync(siteId: string, maxWaitSeconds?: number): Promise<SyncResult>;
|
|
17
|
+
export declare function displayPublishSuccess(projectName: string, username: string): void;
|
|
18
|
+
export declare function displayError(message: string): void;
|
|
19
|
+
export declare function displayWarning(message: string): void;
|
|
20
|
+
export declare function displayInfo(message: string): void;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"AAKA,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAcD,UAAU,UAAU;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAKD,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;AAKD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAEtD;AAKD,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExE;AAKD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtD;AAMD,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,cAAc,GAAE,MAAY,GAC3B,OAAO,CAAC,UAAU,CAAC,CAwFrB;AAKD,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACf,IAAI,CAIN;AAKD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAElD;AAKD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEpD;AAKD,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEjD"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import cliProgress from "cli-progress";
|
|
3
|
+
import { getSiteStatus } from "./api-client.js";
|
|
4
|
+
import { API_URL, APP_URL } from "./const.js";
|
|
5
|
+
export function sleep(ms) {
|
|
6
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
7
|
+
}
|
|
8
|
+
export function formatDate(date) {
|
|
9
|
+
return new Date(date).toLocaleString();
|
|
10
|
+
}
|
|
11
|
+
export function getSiteUrl(projectName, username) {
|
|
12
|
+
return `${APP_URL}/@${username}/${projectName}`;
|
|
13
|
+
}
|
|
14
|
+
export function getDashboardUrl(siteId) {
|
|
15
|
+
return `${API_URL}/site/${siteId}/settings`;
|
|
16
|
+
}
|
|
17
|
+
export async function waitForSync(siteId, maxWaitSeconds = 180) {
|
|
18
|
+
const startTime = Date.now();
|
|
19
|
+
const maxWaitMs = maxWaitSeconds * 1000;
|
|
20
|
+
let progressBar = null;
|
|
21
|
+
let totalFiles = 0;
|
|
22
|
+
while (Date.now() - startTime < maxWaitMs) {
|
|
23
|
+
const statusData = await getSiteStatus(siteId);
|
|
24
|
+
const blobs = statusData.blobs || [];
|
|
25
|
+
if (blobs.length === 0) {
|
|
26
|
+
if (progressBar) {
|
|
27
|
+
progressBar.stop();
|
|
28
|
+
}
|
|
29
|
+
return { success: true, blobs: [] };
|
|
30
|
+
}
|
|
31
|
+
const pending = blobs.filter((b) => b.syncStatus === "PENDING");
|
|
32
|
+
const errors = blobs.filter((b) => b.syncStatus === "ERROR");
|
|
33
|
+
const success = blobs.filter((b) => b.syncStatus === "SUCCESS");
|
|
34
|
+
if (!progressBar && blobs.length > 0) {
|
|
35
|
+
totalFiles = blobs.length;
|
|
36
|
+
progressBar = new cliProgress.SingleBar({
|
|
37
|
+
format: "Processing |" +
|
|
38
|
+
chalk.cyan("{bar}") +
|
|
39
|
+
"| {percentage}% | {value}/{total} files",
|
|
40
|
+
barCompleteChar: "\u2588",
|
|
41
|
+
barIncompleteChar: "\u2591",
|
|
42
|
+
hideCursor: true,
|
|
43
|
+
}, cliProgress.Presets.shades_classic);
|
|
44
|
+
progressBar.start(totalFiles, success.length);
|
|
45
|
+
}
|
|
46
|
+
if (progressBar) {
|
|
47
|
+
progressBar.update(success.length + errors.length);
|
|
48
|
+
}
|
|
49
|
+
if (pending.length === 0) {
|
|
50
|
+
if (progressBar) {
|
|
51
|
+
progressBar.stop();
|
|
52
|
+
}
|
|
53
|
+
if (errors.length > 0) {
|
|
54
|
+
console.log(chalk.yellow(`\n⚠️ ${errors.length} file(s) had errors:`));
|
|
55
|
+
for (const blob of errors) {
|
|
56
|
+
console.log(chalk.yellow(` - ${blob.path}: ${blob.syncError || "Unknown error"}`));
|
|
57
|
+
}
|
|
58
|
+
return { success: false, blobs, errors };
|
|
59
|
+
}
|
|
60
|
+
console.log(chalk.green(`✓ All files processed successfully`));
|
|
61
|
+
return { success: true, blobs };
|
|
62
|
+
}
|
|
63
|
+
await sleep(500);
|
|
64
|
+
}
|
|
65
|
+
if (progressBar) {
|
|
66
|
+
progressBar.stop();
|
|
67
|
+
}
|
|
68
|
+
const statusData = await getSiteStatus(siteId);
|
|
69
|
+
const blobs = statusData.blobs || [];
|
|
70
|
+
const pending = blobs.filter((b) => b.syncStatus === "PENDING");
|
|
71
|
+
console.log(chalk.yellow(`\n⚠️ Timeout: ${pending.length} file(s) still processing`));
|
|
72
|
+
for (const blob of pending) {
|
|
73
|
+
console.log(chalk.yellow(` - ${blob.path}`));
|
|
74
|
+
}
|
|
75
|
+
return { success: false, blobs, timeout: true };
|
|
76
|
+
}
|
|
77
|
+
export function displayPublishSuccess(projectName, username) {
|
|
78
|
+
const url = getSiteUrl(projectName, username);
|
|
79
|
+
console.log(chalk.cyan(`\n💐 Visit your site at: ${url}\n`));
|
|
80
|
+
}
|
|
81
|
+
export function displayError(message) {
|
|
82
|
+
console.error(chalk.red(`\n✗ Error: ${message}\n`));
|
|
83
|
+
}
|
|
84
|
+
export function displayWarning(message) {
|
|
85
|
+
console.warn(chalk.yellow(`\n⚠️ Warning: ${message}\n`));
|
|
86
|
+
}
|
|
87
|
+
export function displayInfo(message) {
|
|
88
|
+
console.log(chalk.blue(`ℹ ${message}`));
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AA8B9C,MAAM,UAAU,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAKD,MAAM,UAAU,UAAU,CAAC,IAAmB;IAC5C,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;AACzC,CAAC;AAKD,MAAM,UAAU,UAAU,CAAC,WAAmB,EAAE,QAAgB;IAC9D,OAAO,GAAG,OAAO,KAAK,QAAQ,IAAI,WAAW,EAAE,CAAC;AAClD,CAAC;AAKD,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,GAAG,OAAO,SAAS,MAAM,WAAW,CAAC;AAC9C,CAAC;AAMD,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAc,EACd,iBAAyB,GAAG;IAE5B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAG,cAAc,GAAG,IAAI,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
+
"version": "0.2.0",
|
|
4
|
+
"description": "CLI tool for publishing to FlowerShow",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/cli.js",
|
|
5
7
|
"bin": {
|
|
6
|
-
"flowershow": "
|
|
8
|
+
"flowershow": "./dist/cli.js"
|
|
7
9
|
},
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "tsx cli.ts",
|
|
13
|
+
"prepublishOnly": "pnpm run build"
|
|
12
14
|
},
|
|
13
|
-
"files": [
|
|
14
|
-
"**/*"
|
|
15
|
-
],
|
|
16
15
|
"keywords": [
|
|
17
16
|
"flowershow",
|
|
18
|
-
"cli"
|
|
17
|
+
"cli",
|
|
18
|
+
"publish",
|
|
19
|
+
"markdown"
|
|
19
20
|
],
|
|
20
|
-
"author": "
|
|
21
|
+
"author": "Flowershow",
|
|
21
22
|
"license": "MIT",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/flowershow/cli"
|
|
26
|
+
},
|
|
22
27
|
"bugs": {
|
|
23
28
|
"url": "https://github.com/flowershow/flowershow/issues"
|
|
24
29
|
},
|
|
25
|
-
"homepage": "https://
|
|
26
|
-
"publishConfig": {
|
|
27
|
-
"access": "public"
|
|
28
|
-
},
|
|
30
|
+
"homepage": "https://flowershow.app",
|
|
29
31
|
"dependencies": {
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
32
|
+
"@inquirer/prompts": "^8.1.0",
|
|
33
|
+
"@types/cli-progress": "^3.11.6",
|
|
34
|
+
"chalk": "^5.3.0",
|
|
35
|
+
"cli-progress": "^3.12.0",
|
|
36
|
+
"commander": "^11.0.0",
|
|
37
|
+
"crypto": "^1.0.1",
|
|
38
|
+
"dotenv": "^16.6.1",
|
|
39
|
+
"ignore": "^7.0.5",
|
|
40
|
+
"ora": "^9.0.0"
|
|
37
41
|
},
|
|
38
|
-
"type": "module",
|
|
39
42
|
"engines": {
|
|
40
|
-
"node": ">=
|
|
43
|
+
"node": ">=18.0.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@changesets/cli": "^2.29.8",
|
|
47
|
+
"@types/node": "^25.0.3",
|
|
48
|
+
"tsx": "^4.21.0",
|
|
49
|
+
"typescript": "^5.9.3"
|
|
41
50
|
},
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
"files": [
|
|
52
|
+
"dist",
|
|
53
|
+
"README.md"
|
|
54
|
+
]
|
|
55
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# flowershow
|
|
2
|
-
|
|
3
|
-
## 0.1.9
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Kill subprocesses when parent process is terminated.
|
|
8
|
-
|
|
9
|
-
## 0.1.8
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- Adjust the CLI Installer after migrating Flowershow template to datopian/flowershow-template.
|
|
14
|
-
|
|
15
|
-
## 0.1.7
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- Rename [...slug].tsx to [[...slug]].tsx at installation, so that user can still define their own home pages using MD files.
|
|
20
|
-
|
|
21
|
-
## 0.1.6
|
|
22
|
-
|
|
23
|
-
### Patch Changes
|
|
24
|
-
|
|
25
|
-
- f136048: Remove `pages/index.tsx` file from the copied Flowershow template, to allow users to set their own home page with MD file.
|
|
26
|
-
|
|
27
|
-
## 0.1.5
|
|
28
|
-
|
|
29
|
-
### Patch Changes
|
|
30
|
-
|
|
31
|
-
- Replace config.js with config.mjs
|
|
32
|
-
|
|
33
|
-
## 0.1.4
|
|
34
|
-
|
|
35
|
-
### Patch Changes
|
|
36
|
-
|
|
37
|
-
- Fix: incorrect `config.js` file created by the CLI
|
|
38
|
-
|
|
39
|
-
## 0.1.3
|
|
40
|
-
|
|
41
|
-
### Patch Changes
|
|
42
|
-
|
|
43
|
-
- Remove unneeded dev files from cloned template.
|
|
44
|
-
|
|
45
|
-
## 0.1.0
|
|
46
|
-
|
|
47
|
-
### Minor Changes
|
|
48
|
-
|
|
49
|
-
- 93b7911: Switch from JS to TS.
|
|
50
|
-
|
|
51
|
-
## 0.0.11
|
|
52
|
-
|
|
53
|
-
### Patch Changes
|
|
54
|
-
|
|
55
|
-
- Basic anonymous telemetry (OS, Flowershow version and command being run).
|
|
56
|
-
|
|
57
|
-
## 0.0.10
|
|
58
|
-
|
|
59
|
-
### Patch Changes
|
|
60
|
-
|
|
61
|
-
- Rename `flowershow build-static` to `flowershow export`.
|
|
62
|
-
|
|
63
|
-
## 0.0.9
|
|
64
|
-
|
|
65
|
-
### Patch Changes
|
|
66
|
-
|
|
67
|
-
- CLI support for Windows. Symlink files removed from the template.
|
|
68
|
-
- Add information about missing index.md and/or config.js files that the CLI will automatically create for the user.
|
|
69
|
-
|
|
70
|
-
## 0.0.8
|
|
71
|
-
|
|
72
|
-
### Patch Changes
|
|
73
|
-
|
|
74
|
-
- Disallow installing the template inside the content folder.
|
package/src/bin/cli.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
const require = createRequire(import.meta.url);
|
|
4
|
-
import { warn, exit, sendEvent } from "../lib/utils/index.js";
|
|
5
|
-
import { Command } from "commander";
|
|
6
|
-
// TODO check current vs required node version (package.json engines)
|
|
7
|
-
// const requiredNodeVersion = require("../package.json").engines.node;
|
|
8
|
-
const { version: cli } = require("../../package.json");
|
|
9
|
-
// simplify importing data from package.json with this line after we no longer want to support node 16
|
|
10
|
-
// import packageJson from "#package.json" assert { type: "json" };
|
|
11
|
-
const { version: node, platform, argv } = process;
|
|
12
|
-
if (platform === "win32") {
|
|
13
|
-
warn("This may not work as expected. You're trying to run Flowershow CLI on Windows, which is not thoroughly tested. Please submit an issue if you encounter any problems: https://github.com/flowershow/flowershow/issues");
|
|
14
|
-
}
|
|
15
|
-
const [, , cmd, ...args] = argv;
|
|
16
|
-
sendEvent({
|
|
17
|
-
event: "cli-usage",
|
|
18
|
-
action: cmd,
|
|
19
|
-
meta: {
|
|
20
|
-
args,
|
|
21
|
-
cli,
|
|
22
|
-
node,
|
|
23
|
-
platform,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
process.on("uncaughtException", () => {
|
|
27
|
-
sendEvent({
|
|
28
|
-
event: "cli-error",
|
|
29
|
-
action: cmd,
|
|
30
|
-
meta: {
|
|
31
|
-
args,
|
|
32
|
-
cli,
|
|
33
|
-
node,
|
|
34
|
-
platform,
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
exit(1);
|
|
38
|
-
});
|
|
39
|
-
// CLI commands
|
|
40
|
-
const program = new Command();
|
|
41
|
-
program
|
|
42
|
-
.description("CLI tool for creating, publishing and upgrading Flowershow apps")
|
|
43
|
-
.version(require("../../package.json").version)
|
|
44
|
-
.usage("<command> [options]");
|
|
45
|
-
// choose template
|
|
46
|
-
program
|
|
47
|
-
.command("install")
|
|
48
|
-
.description("install Flowershow template in target directory")
|
|
49
|
-
.argument("[target-dir]", "Path to the folder where you want Flowershow template to be installed", ".")
|
|
50
|
-
// .option('-t, --template [template-name]', 'Flowershow template name to use', 'default')
|
|
51
|
-
.action(async (targetDir) => {
|
|
52
|
-
const { default: install } = await import("../lib/install.js");
|
|
53
|
-
install(targetDir);
|
|
54
|
-
});
|
|
55
|
-
program
|
|
56
|
-
.command("build")
|
|
57
|
-
.description("build Flowershow website")
|
|
58
|
-
.argument("[project-dir]", "Path to the folder where Flowershow template is installed (root folder of .flowershow)", ".")
|
|
59
|
-
.action(async (projectPath) => {
|
|
60
|
-
const { default: build } = await import("../lib/build.js");
|
|
61
|
-
build(projectPath);
|
|
62
|
-
});
|
|
63
|
-
program
|
|
64
|
-
.command("export")
|
|
65
|
-
.description("build a static Flowershow website")
|
|
66
|
-
.argument("[project-dir]", "Path to the folder where Flowershow template is installed (root folder of .flowershow)", ".")
|
|
67
|
-
.action(async (projectPath) => {
|
|
68
|
-
const { default: buildExport } = await import("../lib/buildExport.js");
|
|
69
|
-
buildExport(projectPath);
|
|
70
|
-
});
|
|
71
|
-
program
|
|
72
|
-
.command("preview")
|
|
73
|
-
.description("preview your Flowershow site")
|
|
74
|
-
.argument("[project-dir]", "Path to the folder where Flowershow template is installed (root folder of .flowershow)", ".")
|
|
75
|
-
.action(async (projectPath) => {
|
|
76
|
-
const { default: preview } = await import("../lib/preview.js");
|
|
77
|
-
preview(projectPath);
|
|
78
|
-
});
|
|
79
|
-
// TBD
|
|
80
|
-
program
|
|
81
|
-
.command("publish")
|
|
82
|
-
.description("publish files or directories")
|
|
83
|
-
.argument("[path]", "path to a file or a directory", ".")
|
|
84
|
-
.option("-g, --glob <pattern>", "glob pattern")
|
|
85
|
-
.action(async () => {
|
|
86
|
-
const { default: publish } = await import("../lib/publish.js");
|
|
87
|
-
publish();
|
|
88
|
-
});
|
|
89
|
-
// TBD
|
|
90
|
-
program
|
|
91
|
-
.command("upgrade")
|
|
92
|
-
.description("upgrade your Flowershow template to the latest version")
|
|
93
|
-
.action(async () => {
|
|
94
|
-
const { default: upgrade } = await import("../lib/upgrade.js");
|
|
95
|
-
upgrade();
|
|
96
|
-
});
|
|
97
|
-
program.parse();
|
package/src/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// export * from './lib/cli';
|