@lumiflora/fsdk 0.1.4
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 +150 -0
- package/dist/commands/add-component.d.ts +7 -0
- package/dist/commands/add-component.d.ts.map +1 -0
- package/dist/commands/add-component.js +93 -0
- package/dist/commands/add-page.d.ts +8 -0
- package/dist/commands/add-page.d.ts.map +1 -0
- package/dist/commands/add-page.js +98 -0
- package/dist/commands/add-store.d.ts +6 -0
- package/dist/commands/add-store.d.ts.map +1 -0
- package/dist/commands/add-store.js +204 -0
- package/dist/commands/completion.d.ts +8 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +271 -0
- package/dist/commands/create-app.d.ts +10 -0
- package/dist/commands/create-app.d.ts.map +1 -0
- package/dist/commands/create-app.js +174 -0
- package/dist/commands/index.d.ts +9 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +8 -0
- package/dist/commands/preview.d.ts +8 -0
- package/dist/commands/preview.d.ts.map +1 -0
- package/dist/commands/preview.js +162 -0
- package/dist/commands/sync-template.d.ts +6 -0
- package/dist/commands/sync-template.d.ts.map +1 -0
- package/dist/commands/sync-template.js +94 -0
- package/dist/commands/validate.d.ts +7 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +136 -0
- package/dist/completion/completion-scripts.d.ts +4 -0
- package/dist/completion/completion-scripts.d.ts.map +1 -0
- package/dist/completion/completion-scripts.js +193 -0
- package/dist/completion/index.d.ts +2 -0
- package/dist/completion/index.d.ts.map +1 -0
- package/dist/completion/index.js +1 -0
- package/dist/core/config-loader.d.ts +91 -0
- package/dist/core/config-loader.d.ts.map +1 -0
- package/dist/core/config-loader.js +118 -0
- package/dist/core/hot-reload.d.ts +24 -0
- package/dist/core/hot-reload.d.ts.map +1 -0
- package/dist/core/hot-reload.js +97 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +4 -0
- package/dist/core/plugin-system.d.ts +32 -0
- package/dist/core/plugin-system.d.ts.map +1 -0
- package/dist/core/plugin-system.js +69 -0
- package/dist/core/template-engine.d.ts +22 -0
- package/dist/core/template-engine.d.ts.map +1 -0
- package/dist/core/template-engine.js +89 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +214 -0
- package/dist/plugins/add-component-plugin.d.ts +4 -0
- package/dist/plugins/add-component-plugin.d.ts.map +1 -0
- package/dist/plugins/add-component-plugin.js +23 -0
- package/dist/plugins/add-page-plugin.d.ts +4 -0
- package/dist/plugins/add-page-plugin.d.ts.map +1 -0
- package/dist/plugins/add-page-plugin.js +23 -0
- package/dist/plugins/add-store-plugin.d.ts +4 -0
- package/dist/plugins/add-store-plugin.d.ts.map +1 -0
- package/dist/plugins/add-store-plugin.js +23 -0
- package/dist/plugins/core-plugin.d.ts +4 -0
- package/dist/plugins/core-plugin.d.ts.map +1 -0
- package/dist/plugins/core-plugin.js +22 -0
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +4 -0
- package/dist/utils/command-helpers.d.ts +15 -0
- package/dist/utils/command-helpers.d.ts.map +1 -0
- package/dist/utils/command-helpers.js +40 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/logger.d.ts +19 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +32 -0
- package/dist/utils/path.d.ts +9 -0
- package/dist/utils/path.d.ts.map +1 -0
- package/dist/utils/path.js +66 -0
- package/dist/utils/spinner.d.ts +23 -0
- package/dist/utils/spinner.d.ts.map +1 -0
- package/dist/utils/spinner.js +61 -0
- package/package.json +37 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-store-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/add-store-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,kBAAkB,CAAC;AAGlE,eAAO,MAAM,cAAc,EAAE,UAyB5B,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { logger } from '../utils/index.js';
|
|
2
|
+
export const addStorePlugin = {
|
|
3
|
+
name: 'add-store',
|
|
4
|
+
version: '0.1.0',
|
|
5
|
+
enabled: true,
|
|
6
|
+
async beforeRegister(context) {
|
|
7
|
+
logger.debug('AddStore plugin: beforeRegister');
|
|
8
|
+
},
|
|
9
|
+
async afterRegister(context) {
|
|
10
|
+
logger.debug('AddStore plugin: afterRegister');
|
|
11
|
+
},
|
|
12
|
+
async beforeExec(context, storeName, type) {
|
|
13
|
+
logger.debug(`AddStore plugin: beforeExec storeName=${storeName}, type=${type}`);
|
|
14
|
+
},
|
|
15
|
+
async afterExec(context, storeName, result) {
|
|
16
|
+
logger.debug(`AddStore plugin: afterExec storeName=${storeName}`);
|
|
17
|
+
logger.success(`Store ${storeName} added successfully via plugin`);
|
|
18
|
+
},
|
|
19
|
+
onError(error, context) {
|
|
20
|
+
logger.error('AddStore plugin: error caught', error.message);
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export default addStorePlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/core-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,kBAAkB,CAAC;AAGlE,eAAO,MAAM,UAAU,EAAE,UAwBxB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { logger } from '../utils/index.js';
|
|
2
|
+
export const corePlugin = {
|
|
3
|
+
name: 'core',
|
|
4
|
+
version: '0.1.0',
|
|
5
|
+
enabled: true,
|
|
6
|
+
async beforeRegister(context) {
|
|
7
|
+
logger.debug('Core plugin: beforeRegister');
|
|
8
|
+
},
|
|
9
|
+
async afterRegister(context) {
|
|
10
|
+
logger.debug('Core plugin: afterRegister');
|
|
11
|
+
},
|
|
12
|
+
async beforeExec(context, command) {
|
|
13
|
+
logger.debug(`Core plugin: beforeExec command=${command}`);
|
|
14
|
+
},
|
|
15
|
+
async afterExec(context, command, result) {
|
|
16
|
+
logger.debug(`Core plugin: afterExec command=${command}`);
|
|
17
|
+
},
|
|
18
|
+
onError(error, context) {
|
|
19
|
+
logger.error('Core plugin: error caught', error.message);
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export default corePlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enable debug mode by setting the DEBUG environment variable
|
|
3
|
+
*/
|
|
4
|
+
export declare function enableDebugMode(debug?: boolean): void;
|
|
5
|
+
/**
|
|
6
|
+
* Resolve the current working directory
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveCwd(cwd?: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* String conversion utilities
|
|
11
|
+
*/
|
|
12
|
+
export declare function toPascalCase(str: string): string;
|
|
13
|
+
export declare function toKebabCase(str: string): string;
|
|
14
|
+
export declare function toCamelCase(str: string): string;
|
|
15
|
+
//# sourceMappingURL=command-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/command-helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAIrD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKhD;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAU/C"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enable debug mode by setting the DEBUG environment variable
|
|
3
|
+
*/
|
|
4
|
+
export function enableDebugMode(debug) {
|
|
5
|
+
if (debug) {
|
|
6
|
+
process.env.DEBUG = '1';
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Resolve the current working directory
|
|
11
|
+
*/
|
|
12
|
+
export function resolveCwd(cwd) {
|
|
13
|
+
return cwd || process.cwd();
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* String conversion utilities
|
|
17
|
+
*/
|
|
18
|
+
export function toPascalCase(str) {
|
|
19
|
+
return str
|
|
20
|
+
.split(/[-_]/)
|
|
21
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
|
22
|
+
.join('');
|
|
23
|
+
}
|
|
24
|
+
export function toKebabCase(str) {
|
|
25
|
+
return str
|
|
26
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
|
27
|
+
.replace(/[\s_]+/g, '-')
|
|
28
|
+
.toLowerCase();
|
|
29
|
+
}
|
|
30
|
+
export function toCamelCase(str) {
|
|
31
|
+
return str
|
|
32
|
+
.split(/[-_]/)
|
|
33
|
+
.map((word, index) => {
|
|
34
|
+
if (index === 0) {
|
|
35
|
+
return word.toLowerCase();
|
|
36
|
+
}
|
|
37
|
+
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
38
|
+
})
|
|
39
|
+
.join('');
|
|
40
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { logger, type Logger, type LogLevel } from './logger.js';
|
|
2
|
+
export * from './path.js';
|
|
3
|
+
export { enableDebugMode, resolveCwd, toPascalCase, toKebabCase, toCamelCase, } from './command-helpers.js';
|
|
4
|
+
export { Spinner } from './spinner.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjE,cAAc,WAAW,CAAC;AAC1B,OAAO,EACL,eAAe,EACf,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type LogLevel = 'info' | 'success' | 'warning' | 'error' | 'debug';
|
|
2
|
+
export interface Logger {
|
|
3
|
+
info(message: string, ...args: unknown[]): void;
|
|
4
|
+
success(message: string, ...args: unknown[]): void;
|
|
5
|
+
warning(message: string, ...args: unknown[]): void;
|
|
6
|
+
error(message: string, ...args: unknown[]): void;
|
|
7
|
+
debug(message: string, ...args: unknown[]): void;
|
|
8
|
+
}
|
|
9
|
+
declare class ChalkLogger implements Logger {
|
|
10
|
+
private format;
|
|
11
|
+
info(message: string, ...args: unknown[]): void;
|
|
12
|
+
success(message: string, ...args: unknown[]): void;
|
|
13
|
+
warning(message: string, ...args: unknown[]): void;
|
|
14
|
+
error(message: string, ...args: unknown[]): void;
|
|
15
|
+
debug(message: string, ...args: unknown[]): void;
|
|
16
|
+
}
|
|
17
|
+
export declare const logger: ChalkLogger;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAE1E,MAAM,WAAW,MAAM;IACrB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACnD,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACnD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CAClD;AAED,cAAM,WAAY,YAAW,MAAM;IACjC,OAAO,CAAC,MAAM;IAYd,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI/C,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAIlD,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAIlD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAIhD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;CAKjD;AAED,eAAO,MAAM,MAAM,aAAoB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
class ChalkLogger {
|
|
3
|
+
format(level, message) {
|
|
4
|
+
const timestamp = new Date().toLocaleTimeString('zh-CN', { hour12: false });
|
|
5
|
+
const prefix = {
|
|
6
|
+
info: chalk.blue('[INFO]'),
|
|
7
|
+
success: chalk.green('[SUCCESS]'),
|
|
8
|
+
warning: chalk.yellow('[WARN]'),
|
|
9
|
+
error: chalk.red('[ERROR]'),
|
|
10
|
+
debug: chalk.gray('[DEBUG]'),
|
|
11
|
+
}[level];
|
|
12
|
+
return `${chalk.gray(timestamp)} ${prefix} ${message}`;
|
|
13
|
+
}
|
|
14
|
+
info(message, ...args) {
|
|
15
|
+
console.log(this.format('info', message), ...args);
|
|
16
|
+
}
|
|
17
|
+
success(message, ...args) {
|
|
18
|
+
console.log(this.format('success', message), ...args);
|
|
19
|
+
}
|
|
20
|
+
warning(message, ...args) {
|
|
21
|
+
console.warn(this.format('warning', message), ...args);
|
|
22
|
+
}
|
|
23
|
+
error(message, ...args) {
|
|
24
|
+
console.error(this.format('error', message), ...args);
|
|
25
|
+
}
|
|
26
|
+
debug(message, ...args) {
|
|
27
|
+
if (process.env.DEBUG) {
|
|
28
|
+
console.log(this.format('debug', message), ...args);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export const logger = new ChalkLogger();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function getCliRoot(): string;
|
|
2
|
+
export declare function getTemplatesRoot(): string;
|
|
3
|
+
export declare function getPluginsRoot(): string;
|
|
4
|
+
export declare function resolveTemplatePath(templateName: string, ...segments: string[]): string;
|
|
5
|
+
export declare function resolvePluginPath(pluginName: string, ...segments: string[]): string;
|
|
6
|
+
export declare function normalizePath(inputPath: string): string;
|
|
7
|
+
export declare function isAbsolutePath(inputPath: string): boolean;
|
|
8
|
+
export declare function makeRelative(to: string, from: string): string;
|
|
9
|
+
//# sourceMappingURL=path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/utils/path.ts"],"names":[],"mappings":"AAMA,wBAAgB,UAAU,IAAI,MAAM,CA+BnC;AAMD,wBAAgB,gBAAgB,IAAI,MAAM,CAMzC;AAED,wBAAgB,cAAc,IAAI,MAAM,CAMvC;AAED,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAEvF;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAEnF;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7D"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
// Get CLI root from global (set in index.ts)
|
|
4
|
+
let _cliRoot;
|
|
5
|
+
export function getCliRoot() {
|
|
6
|
+
// Try to use the global __cliRoot set by index.ts
|
|
7
|
+
const globalRoot = global.__cliRoot;
|
|
8
|
+
if (globalRoot) {
|
|
9
|
+
return globalRoot;
|
|
10
|
+
}
|
|
11
|
+
// Use cached value if available
|
|
12
|
+
if (_cliRoot) {
|
|
13
|
+
return _cliRoot;
|
|
14
|
+
}
|
|
15
|
+
// Fallback: calculate from current module location
|
|
16
|
+
// This happens when path.ts is imported before index.ts sets __cliRoot
|
|
17
|
+
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
const isDist = currentDir.endsWith('dist') || currentDir.includes(path.sep + 'dist' + path.sep);
|
|
19
|
+
if (isDist) {
|
|
20
|
+
// We're in dist/utils or dist/commands, need to go up to cli/
|
|
21
|
+
// path.dirname(dist/utils) = dist, path.dirname(dist) = cli
|
|
22
|
+
_cliRoot = path.dirname(path.dirname(currentDir));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
const isSrc = currentDir.endsWith('src') || currentDir.includes(path.sep + 'src' + path.sep);
|
|
26
|
+
if (isSrc) {
|
|
27
|
+
_cliRoot = path.dirname(path.dirname(currentDir));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
_cliRoot = currentDir;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return _cliRoot;
|
|
34
|
+
}
|
|
35
|
+
// Cached path roots
|
|
36
|
+
let _templatesRoot;
|
|
37
|
+
let _pluginsRoot;
|
|
38
|
+
export function getTemplatesRoot() {
|
|
39
|
+
if (_templatesRoot) {
|
|
40
|
+
return _templatesRoot;
|
|
41
|
+
}
|
|
42
|
+
_templatesRoot = path.resolve(getCliRoot(), '..', 'templates');
|
|
43
|
+
return _templatesRoot;
|
|
44
|
+
}
|
|
45
|
+
export function getPluginsRoot() {
|
|
46
|
+
if (_pluginsRoot) {
|
|
47
|
+
return _pluginsRoot;
|
|
48
|
+
}
|
|
49
|
+
_pluginsRoot = path.resolve(getCliRoot(), '..', 'plugins');
|
|
50
|
+
return _pluginsRoot;
|
|
51
|
+
}
|
|
52
|
+
export function resolveTemplatePath(templateName, ...segments) {
|
|
53
|
+
return path.resolve(getTemplatesRoot(), templateName, ...segments);
|
|
54
|
+
}
|
|
55
|
+
export function resolvePluginPath(pluginName, ...segments) {
|
|
56
|
+
return path.resolve(getPluginsRoot(), pluginName, ...segments);
|
|
57
|
+
}
|
|
58
|
+
export function normalizePath(inputPath) {
|
|
59
|
+
return path.normalize(inputPath).replace(/\\/g, '/');
|
|
60
|
+
}
|
|
61
|
+
export function isAbsolutePath(inputPath) {
|
|
62
|
+
return path.isAbsolute(inputPath);
|
|
63
|
+
}
|
|
64
|
+
export function makeRelative(to, from) {
|
|
65
|
+
return path.relative(from, to).replace(/\\/g, '/');
|
|
66
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spinner wrapper that silently handles disabled/no-op cases.
|
|
3
|
+
* This encapsulates the conditional spinner logic and eliminates
|
|
4
|
+
* the need for "if (spinner)" checks throughout command functions.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Spinner {
|
|
7
|
+
private ora;
|
|
8
|
+
constructor(enabled: boolean, text: string);
|
|
9
|
+
set text(message: string);
|
|
10
|
+
succeed(message?: string): void;
|
|
11
|
+
fail(message?: string): void;
|
|
12
|
+
info(message?: string): void;
|
|
13
|
+
warn(message?: string): void;
|
|
14
|
+
start(text?: string): this;
|
|
15
|
+
stop(): void;
|
|
16
|
+
stopAndPersist(options?: {
|
|
17
|
+
text?: string;
|
|
18
|
+
symbol?: string;
|
|
19
|
+
}): void;
|
|
20
|
+
clear(): void;
|
|
21
|
+
get isEnabled(): boolean;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=spinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/utils/spinner.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,GAAG,CAAa;gBAEZ,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM;IAI1C,IAAI,IAAI,CAAC,OAAO,EAAE,MAAM,EAIvB;IAED,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAM/B,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAM5B,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAM5B,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAM5B,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAO1B,IAAI,IAAI,IAAI;IAMZ,cAAc,CAAC,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAMlE,KAAK,IAAI,IAAI;IAMb,IAAI,SAAS,IAAI,OAAO,CAEvB;CACF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import ora from 'ora';
|
|
2
|
+
/**
|
|
3
|
+
* Spinner wrapper that silently handles disabled/no-op cases.
|
|
4
|
+
* This encapsulates the conditional spinner logic and eliminates
|
|
5
|
+
* the need for "if (spinner)" checks throughout command functions.
|
|
6
|
+
*/
|
|
7
|
+
export class Spinner {
|
|
8
|
+
ora;
|
|
9
|
+
constructor(enabled, text) {
|
|
10
|
+
this.ora = enabled ? ora(text).start() : null;
|
|
11
|
+
}
|
|
12
|
+
set text(message) {
|
|
13
|
+
if (this.ora) {
|
|
14
|
+
this.ora.text = message;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
succeed(message) {
|
|
18
|
+
if (this.ora) {
|
|
19
|
+
this.ora.succeed(message);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
fail(message) {
|
|
23
|
+
if (this.ora) {
|
|
24
|
+
this.ora.fail(message);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
info(message) {
|
|
28
|
+
if (this.ora) {
|
|
29
|
+
this.ora.info(message);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
warn(message) {
|
|
33
|
+
if (this.ora) {
|
|
34
|
+
this.ora.warn(message);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
start(text) {
|
|
38
|
+
if (this.ora) {
|
|
39
|
+
this.ora.start(text);
|
|
40
|
+
}
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
stop() {
|
|
44
|
+
if (this.ora) {
|
|
45
|
+
this.ora.stop();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
stopAndPersist(options) {
|
|
49
|
+
if (this.ora) {
|
|
50
|
+
this.ora.stopAndPersist(options);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
clear() {
|
|
54
|
+
if (this.ora) {
|
|
55
|
+
this.ora.clear();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
get isEnabled() {
|
|
59
|
+
return this.ora !== null;
|
|
60
|
+
}
|
|
61
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lumiflora/fsdk",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"fsdk": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"dev": "tsx src/index.ts",
|
|
14
|
+
"build": "tsc && node scripts/fix-bin.js",
|
|
15
|
+
"typecheck": "tsc --noEmit"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"cac": "^6.7.14",
|
|
19
|
+
"chalk": "^5.3.0",
|
|
20
|
+
"chokidar": "^3.5.3",
|
|
21
|
+
"ejs": "^3.1.9",
|
|
22
|
+
"fast-glob": "^3.3.2",
|
|
23
|
+
"fs-extra": "^11.2.0",
|
|
24
|
+
"json5": "^2.2.3",
|
|
25
|
+
"ora": "^8.0.1",
|
|
26
|
+
"prompts": "^2.4.2",
|
|
27
|
+
"zod": "^3.22.4"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/ejs": "^3.1.2",
|
|
31
|
+
"@types/fs-extra": "^11.0.4",
|
|
32
|
+
"@types/node": "^20.11.0",
|
|
33
|
+
"@types/prompts": "^2.4.9",
|
|
34
|
+
"tsx": "^4.7.0",
|
|
35
|
+
"typescript": "^5.6.0"
|
|
36
|
+
}
|
|
37
|
+
}
|