@event-driven-io/emmett 0.43.0-beta.13 → 0.43.0-beta.15

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/dist/cli.cjs CHANGED
@@ -1,199 +1,144 @@
1
1
  #!/usr/bin/env node
2
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
3
-
4
-
5
- var _chunkWND32L6Pcjs = require('./chunk-WND32L6P.cjs');
6
-
7
- // src/cli.ts
8
- var _commander = require('commander');
9
-
10
- // src/commandLine/config.ts
11
-
12
- var _fs = require('fs');
13
- var _process = require('process');
14
- var sampleConfig = (plugins = ["emmett-expressjs"]) => {
15
- const pluginsNames = plugins.length > 0 ? `[
16
- ${plugins.map((p) => `"${p}"`).join(",\n")}
17
- ]` : "[]";
18
- return `
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
3
+ const require_plugins = require('./plugins-DB9xe8AV.cjs');
4
+ let commander = require("commander");
5
+ let node_fs = require("node:fs");
6
+ let process$1 = require("process");
7
+ let path = require("path");
8
+ path = require_plugins.__toESM(path, 1);
9
+
10
+ //#region src/commandLine/config.ts
11
+ const sampleConfig = (plugins = ["emmett-expressjs"]) => {
12
+ return `
19
13
  export default {
20
- plugins: ${pluginsNames},
14
+ plugins: ${plugins.length > 0 ? `[\n${plugins.map((p) => `"${p}"`).join(",\n")} \n]` : "[]"},
21
15
  };
22
16
  `;
23
17
  };
24
- var generateConfigFile = (configPath, collectionNames) => {
25
- try {
26
- _fs.writeFileSync.call(void 0, configPath, sampleConfig(collectionNames), "utf8");
27
- console.log(`Configuration file stored at: ${configPath}`);
28
- } catch (error) {
29
- console.error(`Error: Couldn't store config file: ${configPath}!`);
30
- console.error(error);
31
- process.exit(1);
32
- }
18
+ const generateConfigFile = (configPath, collectionNames) => {
19
+ try {
20
+ (0, node_fs.writeFileSync)(configPath, sampleConfig(collectionNames), "utf8");
21
+ console.log(`Configuration file stored at: ${configPath}`);
22
+ } catch (error) {
23
+ console.error(`Error: Couldn't store config file: ${configPath}!`);
24
+ console.error(error);
25
+ process.exit(1);
26
+ }
33
27
  };
34
- var configCommand = new (0, _commander.Command)("config").description(
35
- "Manage Pongo configuration"
36
- );
37
- configCommand.command("sample").description("Generate or print sample configuration").option(
38
- "-plg, --plugins <name>",
39
- "Specify the plugin name",
40
- (value, previous) => {
41
- return previous.concat([value]);
42
- },
43
- []
44
- ).option(
45
- "-f, --file <path>",
46
- "Path to configuration file with collection list"
47
- ).option("-g, --generate", "Generate sample config file").option("-p, --print", "Print sample config file").action((options) => {
48
- const plugins = options.plugin.length > 0 ? options.plugin : ["@event-driven-io/emmett-expressjs"];
49
- if (!("print" in options) && !("generate" in options)) {
50
- console.error(
51
- "Error: Please provide either:\n--print param to print sample config or\n--generate to generate sample config file"
52
- );
53
- _process.exit.call(void 0, 1);
54
- }
55
- if ("print" in options) {
56
- console.log(`${sampleConfig(plugins)}`);
57
- } else if ("generate" in options) {
58
- if (!options.file) {
59
- console.error(
60
- "Error: You need to provide a config file through a --file"
61
- );
62
- _process.exit.call(void 0, 1);
63
- }
64
- generateConfigFile(options.file, plugins);
65
- }
28
+ const configCommand = new commander.Command("config").description("Manage Pongo configuration");
29
+ configCommand.command("sample").description("Generate or print sample configuration").option("-plg, --plugins <name>", "Specify the plugin name", (value, previous) => {
30
+ return previous.concat([value]);
31
+ }, []).option("-f, --file <path>", "Path to configuration file with collection list").option("-g, --generate", "Generate sample config file").option("-p, --print", "Print sample config file").action((options) => {
32
+ const plugins = options.plugin.length > 0 ? options.plugin : ["@event-driven-io/emmett-expressjs"];
33
+ if (!("print" in options) && !("generate" in options)) {
34
+ console.error("Error: Please provide either:\n--print param to print sample config or\n--generate to generate sample config file");
35
+ (0, process$1.exit)(1);
36
+ }
37
+ if ("print" in options) console.log(`${sampleConfig(plugins)}`);
38
+ else if ("generate" in options) {
39
+ if (!options.file) {
40
+ console.error("Error: You need to provide a config file through a --file");
41
+ (0, process$1.exit)(1);
42
+ }
43
+ generateConfigFile(options.file, plugins);
44
+ }
66
45
  });
67
46
 
68
- // src/commandLine/plugins.ts
69
- var _path = require('path'); var _path2 = _interopRequireDefault(_path);
70
- var PluginsConfigImportError = {
71
- missingDefaultExport: `Error: Config should contain default export, e.g.
72
-
73
- ${sampleConfig()}`,
74
- missingPluginsPropertyExport: `Error: Config should contain default export with plugins array, e.g.
75
-
76
- ${sampleConfig()}`,
77
- wrongPluginStructure: `Error: Plugin config should be either string with plugin name or object with plugin name, e.g. { name: 'emmett-expressjs' }`
47
+ //#endregion
48
+ //#region src/commandLine/plugins.ts
49
+ const PluginsConfigImportError = {
50
+ missingDefaultExport: `Error: Config should contain default export, e.g.\n\n${sampleConfig()}`,
51
+ missingPluginsPropertyExport: `Error: Config should contain default export with plugins array, e.g.\n\n${sampleConfig()}`,
52
+ wrongPluginStructure: `Error: Plugin config should be either string with plugin name or object with plugin name, e.g. { name: 'emmett-expressjs' }`
78
53
  };
79
- var importPluginsConfig = async (options) => {
80
- const configPath = _path2.default.join(
81
- process.cwd(),
82
- _nullishCoalesce(_optionalChain([options, 'optionalAccess', _ => _.configPath]), () => ( "./dist/emmett.config.js"))
83
- );
84
- console.log("IMPORTING" + configPath);
85
- try {
86
- const imported = await Promise.resolve().then(() => _interopRequireWildcard(require(configPath)));
87
- if (!imported.default) {
88
- return new (0, _chunkWND32L6Pcjs.EmmettError)(PluginsConfigImportError.missingDefaultExport);
89
- }
90
- if (!imported.default.plugins || !Array.isArray(imported.default.plugins)) {
91
- return new (0, _chunkWND32L6Pcjs.EmmettError)(
92
- PluginsConfigImportError.missingPluginsPropertyExport
93
- );
94
- }
95
- if (!imported.default.plugins.every(_chunkWND32L6Pcjs.isPluginConfig)) {
96
- return new (0, _chunkWND32L6Pcjs.EmmettError)(PluginsConfigImportError.wrongPluginStructure);
97
- }
98
- return { plugins: imported.default.plugins };
99
- } catch (error) {
100
- if (!_optionalChain([options, 'optionalAccess', _2 => _2.configPath])) {
101
- console.warn("Didn`t find config file: " + configPath, error);
102
- return { plugins: [] };
103
- }
104
- return new (0, _chunkWND32L6Pcjs.EmmettError)(
105
- `Error: Couldn't load file:` + error.toString()
106
- );
107
- }
54
+ const importPluginsConfig = async (options) => {
55
+ const configPath = path.default.join(process.cwd(), options?.configPath ?? "./dist/emmett.config.js");
56
+ console.log("IMPORTING" + configPath);
57
+ try {
58
+ const imported = await import(configPath);
59
+ if (!imported.default) return new require_plugins.EmmettError(PluginsConfigImportError.missingDefaultExport);
60
+ if (!imported.default.plugins || !Array.isArray(imported.default.plugins)) return new require_plugins.EmmettError(PluginsConfigImportError.missingPluginsPropertyExport);
61
+ if (!imported.default.plugins.every(require_plugins.isPluginConfig)) return new require_plugins.EmmettError(PluginsConfigImportError.wrongPluginStructure);
62
+ return { plugins: imported.default.plugins };
63
+ } catch (error) {
64
+ if (!options?.configPath) {
65
+ console.warn("Didn`t find config file: " + configPath, error);
66
+ return { plugins: [] };
67
+ }
68
+ return new require_plugins.EmmettError(`Error: Couldn't load file:` + error.toString());
69
+ }
108
70
  };
109
- var loadPlugins = async (options) => {
110
- try {
111
- const pluginsConfig = await importPluginsConfig({
112
- configPath: _optionalChain([options, 'optionalAccess', _3 => _3.configPath])
113
- });
114
- if (pluginsConfig instanceof _chunkWND32L6Pcjs.EmmettError) throw pluginsConfig;
115
- if (pluginsConfig.plugins.length === 0) {
116
- console.log(`No extensions specified in config ${_optionalChain([options, 'optionalAccess', _4 => _4.configPath])}.`);
117
- return [];
118
- }
119
- const pluginsToLoad = filterPluginsByType(
120
- pluginsConfig.plugins,
121
- _optionalChain([options, 'optionalAccess', _5 => _5.pluginType])
122
- );
123
- const pluginsPromises = pluginsToLoad.map(async (pluginConfig) => {
124
- const importPath = getImportPath(pluginConfig, _optionalChain([options, 'optionalAccess', _6 => _6.pluginType]));
125
- try {
126
- const plugin = await Promise.resolve().then(() => _interopRequireWildcard(require(importPath)));
127
- console.info(`Loaded plugin: ${importPath}`);
128
- if (!plugin.default) {
129
- throw new Error(`Plugin: ${importPath} is missing default export`);
130
- }
131
- return plugin.default;
132
- } catch (error) {
133
- console.error(`Failed to load extension "${importPath}":`, error);
134
- return void 0;
135
- }
136
- });
137
- return (await Promise.all(pluginsPromises)).filter(
138
- (plugin) => plugin !== void 0
139
- );
140
- } catch (error) {
141
- console.error(`Failed to load config ${_optionalChain([options, 'optionalAccess', _7 => _7.configPath])}:`, error);
142
- return [];
143
- }
71
+ const loadPlugins = async (options) => {
72
+ try {
73
+ const pluginsConfig = await importPluginsConfig({ configPath: options?.configPath });
74
+ if (pluginsConfig instanceof require_plugins.EmmettError) throw pluginsConfig;
75
+ if (pluginsConfig.plugins.length === 0) {
76
+ console.log(`No extensions specified in config ${options?.configPath}.`);
77
+ return [];
78
+ }
79
+ const pluginsPromises = filterPluginsByType(pluginsConfig.plugins, options?.pluginType).map(async (pluginConfig) => {
80
+ const importPath = getImportPath(pluginConfig, options?.pluginType);
81
+ try {
82
+ const plugin = await import(importPath);
83
+ console.info(`Loaded plugin: ${importPath}`);
84
+ if (!plugin.default) throw new Error(`Plugin: ${importPath} is missing default export`);
85
+ return plugin.default;
86
+ } catch (error) {
87
+ console.error(`Failed to load extension "${importPath}":`, error);
88
+ return;
89
+ }
90
+ });
91
+ return (await Promise.all(pluginsPromises)).filter((plugin) => plugin !== void 0);
92
+ } catch (error) {
93
+ console.error(`Failed to load config ${options?.configPath}:`, error);
94
+ return [];
95
+ }
144
96
  };
145
- var registerCliPlugins = async (program2, plugins) => {
146
- const result = [];
147
- for (const plugin of plugins) {
148
- const pluginName = plugin.name;
149
- if (!("registerCommands" in plugin)) {
150
- console.warn(`No registerCommands function found in ${pluginName}`);
151
- }
152
- await plugin.registerCommands(program2);
153
- console.log(`Loaded extension: ${plugin.name}`);
154
- result.push(plugin);
155
- }
97
+ const registerCliPlugins = async (program, plugins) => {
98
+ const result = [];
99
+ for (const plugin of plugins) {
100
+ const pluginName = plugin.name;
101
+ if (!("registerCommands" in plugin)) console.warn(`No registerCommands function found in ${pluginName}`);
102
+ await plugin.registerCommands(program);
103
+ console.log(`Loaded extension: ${plugin.name}`);
104
+ result.push(plugin);
105
+ }
156
106
  };
157
- var filterPluginsByType = (plugins, pluginType) => plugins.filter(
158
- (p) => typeof p === "string" || pluginType && (p.register === void 0 || p.register.some((r) => r.pluginType === pluginType))
159
- );
160
- var getImportPath = (pluginConfig, pluginType) => {
161
- if (typeof pluginConfig === "string") {
162
- return pluginType ? `${pluginConfig}/${pluginType}` : pluginConfig;
163
- }
164
- const pluginSubpath = _nullishCoalesce(_optionalChain([pluginConfig, 'access', _8 => _8.register, 'access', _9 => _9.find, 'call', _10 => _10((r) => pluginType && r.pluginType === pluginType), 'optionalAccess', _11 => _11.path]), () => ( pluginType));
165
- return pluginSubpath ? `${pluginConfig.name}/${pluginSubpath}` : pluginConfig.name;
107
+ const filterPluginsByType = (plugins, pluginType) => plugins.filter((p) => typeof p === "string" || pluginType && (p.register === void 0 || p.register.some((r) => r.pluginType === pluginType)));
108
+ const getImportPath = (pluginConfig, pluginType) => {
109
+ if (typeof pluginConfig === "string") return pluginType ? `${pluginConfig}/${pluginType}` : pluginConfig;
110
+ const pluginSubpath = pluginConfig.register.find((r) => pluginType && r.pluginType === pluginType)?.path ?? pluginType;
111
+ return pluginSubpath ? `${pluginConfig.name}/${pluginSubpath}` : pluginConfig.name;
166
112
  };
167
113
 
168
- // src/cli.ts
169
- var program = new (0, _commander.Command)();
114
+ //#endregion
115
+ //#region src/cli.ts
116
+ const program = new commander.Command();
170
117
  program.name("emmett").description("CLI tool for Emmett").option("--config <path>", "Path to the configuration file");
171
- var initCLI = async () => {
172
- const configIndex = process.argv.indexOf("--config");
173
- const configPath = configIndex !== -1 && process.argv.length > configIndex + 1 ? process.argv[configIndex + 1] : void 0;
174
- try {
175
- const plugins = await loadPlugins({
176
- pluginType: "cli",
177
- configPath
178
- });
179
- await registerCliPlugins(program, plugins);
180
- program.parse(process.argv);
181
- } catch (err) {
182
- console.error(`Failed to load config from ${configPath}:`, err);
183
- }
118
+ const initCLI = async () => {
119
+ const configIndex = process.argv.indexOf("--config");
120
+ const configPath = configIndex !== -1 && process.argv.length > configIndex + 1 ? process.argv[configIndex + 1] : void 0;
121
+ try {
122
+ await registerCliPlugins(program, await loadPlugins({
123
+ pluginType: "cli",
124
+ configPath
125
+ }));
126
+ program.parse(process.argv);
127
+ } catch (err) {
128
+ console.error(`Failed to load config from ${configPath}:`, err);
129
+ }
184
130
  };
185
131
  initCLI().catch((err) => {
186
- console.error(`CLI initialization failed:`);
187
- console.error(err);
132
+ console.error(`CLI initialization failed:`);
133
+ console.error(err);
188
134
  });
189
- var cli_default = program;
190
-
191
-
192
-
193
-
194
-
195
-
196
-
197
135
 
198
- exports.configCommand = configCommand; exports.default = cli_default; exports.generateConfigFile = generateConfigFile; exports.importPluginsConfig = importPluginsConfig; exports.loadPlugins = loadPlugins; exports.registerCliPlugins = registerCliPlugins; exports.sampleConfig = sampleConfig;
136
+ //#endregion
137
+ exports.configCommand = configCommand;
138
+ exports.default = program;
139
+ exports.generateConfigFile = generateConfigFile;
140
+ exports.importPluginsConfig = importPluginsConfig;
141
+ exports.loadPlugins = loadPlugins;
142
+ exports.registerCliPlugins = registerCliPlugins;
143
+ exports.sampleConfig = sampleConfig;
199
144
  //# sourceMappingURL=cli.cjs.map
package/dist/cli.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/emmett/emmett/src/packages/emmett/dist/cli.cjs","../src/cli.ts","../src/commandLine/config.ts","../src/commandLine/plugins.ts"],"names":[],"mappings":"AAAA;AACA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACLA,sCAAwB;ADOxB;AACA;AETA;AAEA,wBAA8B;AAC9B,kCAAqB;AAEd,IAAM,aAAA,EAAe,CAAC,QAAA,EAAoB,CAAC,kBAAkB,CAAA,EAAA,GAAM;AACxE,EAAA,MAAM,aAAA,EACJ,OAAA,CAAQ,OAAA,EAAS,EAAA,EACb,CAAA;AAAA,EAAM,OAAA,CAAQ,GAAA,CAAI,CAAC,CAAA,EAAA,GAAM,CAAA,CAAA,EAAI,CAAC,CAAA,CAAA,CAAG,CAAA,CAAE,IAAA,CAAK,KAAK,CAAC,CAAA;AAAA,CAAA,EAAA,EAC9C,IAAA;AAEN,EAAA,OAAO,CAAA;AAAA;AAAA,WAAA,EAEI,YAAY,CAAA;AAAA;AAAA,CAAA;AAGzB,CAAA;AAEO,IAAM,mBAAA,EAAqB,CAChC,UAAA,EACA,eAAA,EAAA,GACS;AACT,EAAA,IAAI;AACF,IAAA,+BAAA,UAAc,EAAY,YAAA,CAAa,eAAe,CAAA,EAAG,MAAM,CAAA;AAC/D,IAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,8BAAA,EAAiC,UAAU,CAAA,CAAA;AACzC,EAAA;AACsC,IAAA;AACjC,IAAA;AACL,IAAA;AAChB,EAAA;AACF;AAEsD;AACpD,EAAA;AACF;AAee;AAEX,EAAA;AACA,EAAA;AACuC,EAAA;AAEP,IAAA;AAChC,EAAA;AACC,EAAA;AAEF;AACC,EAAA;AACA,EAAA;AAGD;AAIe,EAAA;AAGyC,E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;AACkB,IAAA;AACxD,EAAA;AAGoC,EAAA;AAIR,EAAA;AAE9B;AHa4D;AACA;ACnKhC;AAKzB;AAGyB;AACyB,EAAA;AAGd,EAAA;AAIjC,EAAA;AACgC,IAAA;AACpB,MAAA;AACZ,MAAA;AACD,IAAA;AACwC,IAAA;AAGf,IAAA;AACd,EAAA;AAC0C,IAAA;AACxD,EAAA;AACF;AAGyB;AACmB,EAAA;AACzB,EAAA;AAClB;AAEc;ADqJ6C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/emmett/emmett/src/packages/emmett/dist/cli.cjs","sourcesContent":[null,"#!/usr/bin/env node\nimport { Command } from 'commander';\nimport { loadPlugins, registerCliPlugins } from './commandLine';\n\nconst program = new Command();\n\nprogram\n .name('emmett')\n .description('CLI tool for Emmett')\n .option('--config <path>', 'Path to the configuration file');\n\n// Load extensions and parse CLI arguments\nconst initCLI = async () => {\n const configIndex = process.argv.indexOf('--config');\n\n const configPath =\n configIndex !== -1 && process.argv.length > configIndex + 1\n ? process.argv[configIndex + 1]\n : undefined;\n\n try {\n const plugins = await loadPlugins({\n pluginType: 'cli',\n configPath: configPath,\n });\n await registerCliPlugins(program, plugins);\n\n // Parse the CLI arguments\n program.parse(process.argv);\n } catch (err) {\n console.error(`Failed to load config from ${configPath}:`, err);\n }\n};\n\n//Initialize CLI and handle errors\ninitCLI().catch((err) => {\n console.error(`CLI initialization failed:`);\n console.error(err);\n});\n\nexport default program;\nexport * from './commandLine';\n","import { Command as CliCommand } from 'commander';\n// eslint-disable-next-line no-restricted-imports\nimport { writeFileSync } from 'node:fs';\nimport { exit } from 'process';\n\nexport const sampleConfig = (plugins: string[] = ['emmett-expressjs']) => {\n const pluginsNames =\n plugins.length > 0\n ? `[\\n${plugins.map((p) => `\"${p}\"`).join(',\\n')} \\n]`\n : '[]';\n\n return `\nexport default {\n plugins: ${pluginsNames},\n};\n`;\n};\n\nexport const generateConfigFile = (\n configPath: string,\n collectionNames: string[],\n): void => {\n try {\n writeFileSync(configPath, sampleConfig(collectionNames), 'utf8');\n console.log(`Configuration file stored at: ${configPath}`);\n } catch (error) {\n console.error(`Error: Couldn't store config file: ${configPath}!`);\n console.error(error);\n process.exit(1);\n }\n};\n\nexport const configCommand = new CliCommand('config').description(\n 'Manage Pongo configuration',\n);\n\ntype SampleConfigOptions =\n | {\n plugin: string[];\n print?: boolean;\n }\n | {\n plugin: string[];\n generate?: boolean;\n file?: string;\n };\n\nconfigCommand\n .command('sample')\n .description('Generate or print sample configuration')\n .option(\n '-plg, --plugins <name>',\n 'Specify the plugin name',\n (value: string, previous: string[]) => {\n // Accumulate plugins names into an array (explicitly typing `previous` as `string[]`)\n return previous.concat([value]);\n },\n [] as string[],\n )\n .option(\n '-f, --file <path>',\n 'Path to configuration file with collection list',\n )\n .option('-g, --generate', 'Generate sample config file')\n .option('-p, --print', 'Print sample config file')\n .action((options: SampleConfigOptions) => {\n const plugins =\n options.plugin.length > 0\n ? options.plugin\n : ['@event-driven-io/emmett-expressjs'];\n\n if (!('print' in options) && !('generate' in options)) {\n console.error(\n 'Error: Please provide either:\\n--print param to print sample config or\\n--generate to generate sample config file',\n );\n exit(1);\n }\n\n if ('print' in options) {\n console.log(`${sampleConfig(plugins)}`);\n } else if ('generate' in options) {\n if (!options.file) {\n console.error(\n 'Error: You need to provide a config file through a --file',\n );\n exit(1);\n }\n\n generateConfigFile(options.file, plugins);\n }\n });\n","import type { Command as CliCommand } from 'commander';\nimport path from 'path';\nimport {\n isPluginConfig,\n type EmmettCliCommand,\n type EmmettCliPlugin,\n type EmmettPlugin,\n type EmmettPluginConfig,\n type EmmettPluginsConfig,\n type EmmettPluginType,\n} from '../config';\nimport { EmmettError } from '../errors';\nimport { sampleConfig } from './config';\n\nconst PluginsConfigImportError = {\n missingDefaultExport: `Error: Config should contain default export, e.g.\\n\\n${sampleConfig()}`,\n missingPluginsPropertyExport: `Error: Config should contain default export with plugins array, e.g.\\n\\n${sampleConfig()}`,\n wrongPluginStructure: `Error: Plugin config should be either string with plugin name or object with plugin name, e.g. { name: 'emmett-expressjs' }`,\n};\nexport const importPluginsConfig = async (options?: {\n configPath?: string | undefined;\n}): Promise<EmmettPluginsConfig | EmmettError> => {\n const configPath = path.join(\n process.cwd(),\n options?.configPath ?? './dist/emmett.config.js',\n );\n\n console.log('IMPORTING' + configPath);\n\n try {\n const imported = (await import(configPath)) as {\n default: Partial<EmmettPluginsConfig>;\n };\n\n if (!imported.default) {\n return new EmmettError(PluginsConfigImportError.missingDefaultExport);\n }\n\n if (!imported.default.plugins || !Array.isArray(imported.default.plugins)) {\n return new EmmettError(\n PluginsConfigImportError.missingPluginsPropertyExport,\n );\n }\n\n if (!imported.default.plugins.every(isPluginConfig)) {\n return new EmmettError(PluginsConfigImportError.wrongPluginStructure);\n }\n\n return { plugins: imported.default.plugins };\n } catch (error) {\n if (!options?.configPath) {\n console.warn('Didn`t find config file: ' + configPath, error);\n return { plugins: [] };\n }\n return new EmmettError(\n `Error: Couldn't load file:` + (error as Error).toString(),\n );\n }\n};\n\nexport const loadPlugins = async (options?: {\n pluginType?: EmmettPluginType;\n configPath?: string;\n}): Promise<EmmettPlugin[]> => {\n try {\n const pluginsConfig = await importPluginsConfig({\n configPath: options?.configPath,\n });\n\n if (pluginsConfig instanceof EmmettError) throw pluginsConfig;\n\n if (pluginsConfig.plugins.length === 0) {\n console.log(`No extensions specified in config ${options?.configPath}.`);\n return [];\n }\n\n const pluginsToLoad = filterPluginsByType(\n pluginsConfig.plugins,\n options?.pluginType,\n );\n\n const pluginsPromises = pluginsToLoad.map(async (pluginConfig) => {\n const importPath = getImportPath(pluginConfig, options?.pluginType);\n try {\n const plugin = (await import(importPath)) as { default: EmmettPlugin };\n\n console.info(`Loaded plugin: ${importPath}`);\n\n if (!plugin.default) {\n throw new Error(`Plugin: ${importPath} is missing default export`);\n }\n\n return plugin.default;\n } catch (error) {\n console.error(`Failed to load extension \"${importPath}\":`, error);\n return undefined;\n }\n });\n\n return (await Promise.all(pluginsPromises)).filter(\n (plugin) => plugin !== undefined,\n );\n } catch (error) {\n console.error(`Failed to load config ${options?.configPath}:`, error);\n return [];\n }\n};\n\nexport const registerCliPlugins = async (\n program: CliCommand,\n plugins: EmmettCliPlugin[],\n): Promise<void> => {\n const result: EmmettCliPlugin[] = [];\n\n for (const plugin of plugins) {\n const pluginName = plugin.name;\n\n if (!('registerCommands' in plugin)) {\n console.warn(`No registerCommands function found in ${pluginName}`);\n }\n await plugin.registerCommands(program as EmmettCliCommand);\n console.log(`Loaded extension: ${plugin.name}`);\n result.push(plugin);\n }\n};\n\nconst filterPluginsByType = (\n plugins: EmmettPluginConfig[],\n pluginType?: EmmettPluginType,\n): EmmettPluginConfig[] =>\n plugins.filter(\n (p) =>\n typeof p === 'string' ||\n (pluginType &&\n (p.register === undefined ||\n p.register.some((r) => r.pluginType === pluginType))),\n );\n\nconst getImportPath = (\n pluginConfig: EmmettPluginConfig,\n pluginType: EmmettPluginType | undefined,\n) => {\n if (typeof pluginConfig === 'string') {\n return pluginType ? `${pluginConfig}/${pluginType}` : pluginConfig;\n }\n\n const pluginSubpath =\n pluginConfig.register.find((r) => pluginType && r.pluginType === pluginType)\n ?.path ?? pluginType;\n\n return pluginSubpath\n ? `${pluginConfig.name}/${pluginSubpath}`\n : pluginConfig.name;\n};\n"]}
1
+ {"version":3,"file":"cli.cjs","names":["CliCommand","EmmettError","isPluginConfig","Command"],"sources":["../src/commandLine/config.ts","../src/commandLine/plugins.ts","../src/cli.ts"],"sourcesContent":["import { Command as CliCommand } from 'commander';\n// eslint-disable-next-line no-restricted-imports\nimport { writeFileSync } from 'node:fs';\nimport { exit } from 'process';\n\nexport const sampleConfig = (plugins: string[] = ['emmett-expressjs']) => {\n const pluginsNames =\n plugins.length > 0\n ? `[\\n${plugins.map((p) => `\"${p}\"`).join(',\\n')} \\n]`\n : '[]';\n\n return `\nexport default {\n plugins: ${pluginsNames},\n};\n`;\n};\n\nexport const generateConfigFile = (\n configPath: string,\n collectionNames: string[],\n): void => {\n try {\n writeFileSync(configPath, sampleConfig(collectionNames), 'utf8');\n console.log(`Configuration file stored at: ${configPath}`);\n } catch (error) {\n console.error(`Error: Couldn't store config file: ${configPath}!`);\n console.error(error);\n process.exit(1);\n }\n};\n\nexport const configCommand = new CliCommand('config').description(\n 'Manage Pongo configuration',\n);\n\ntype SampleConfigOptions =\n | {\n plugin: string[];\n print?: boolean;\n }\n | {\n plugin: string[];\n generate?: boolean;\n file?: string;\n };\n\nconfigCommand\n .command('sample')\n .description('Generate or print sample configuration')\n .option(\n '-plg, --plugins <name>',\n 'Specify the plugin name',\n (value: string, previous: string[]) => {\n // Accumulate plugins names into an array (explicitly typing `previous` as `string[]`)\n return previous.concat([value]);\n },\n [] as string[],\n )\n .option(\n '-f, --file <path>',\n 'Path to configuration file with collection list',\n )\n .option('-g, --generate', 'Generate sample config file')\n .option('-p, --print', 'Print sample config file')\n .action((options: SampleConfigOptions) => {\n const plugins =\n options.plugin.length > 0\n ? options.plugin\n : ['@event-driven-io/emmett-expressjs'];\n\n if (!('print' in options) && !('generate' in options)) {\n console.error(\n 'Error: Please provide either:\\n--print param to print sample config or\\n--generate to generate sample config file',\n );\n exit(1);\n }\n\n if ('print' in options) {\n console.log(`${sampleConfig(plugins)}`);\n } else if ('generate' in options) {\n if (!options.file) {\n console.error(\n 'Error: You need to provide a config file through a --file',\n );\n exit(1);\n }\n\n generateConfigFile(options.file, plugins);\n }\n });\n","import type { Command as CliCommand } from 'commander';\nimport path from 'path';\nimport {\n isPluginConfig,\n type EmmettCliCommand,\n type EmmettCliPlugin,\n type EmmettPlugin,\n type EmmettPluginConfig,\n type EmmettPluginsConfig,\n type EmmettPluginType,\n} from '../config';\nimport { EmmettError } from '../errors';\nimport { sampleConfig } from './config';\n\nconst PluginsConfigImportError = {\n missingDefaultExport: `Error: Config should contain default export, e.g.\\n\\n${sampleConfig()}`,\n missingPluginsPropertyExport: `Error: Config should contain default export with plugins array, e.g.\\n\\n${sampleConfig()}`,\n wrongPluginStructure: `Error: Plugin config should be either string with plugin name or object with plugin name, e.g. { name: 'emmett-expressjs' }`,\n};\nexport const importPluginsConfig = async (options?: {\n configPath?: string | undefined;\n}): Promise<EmmettPluginsConfig | EmmettError> => {\n const configPath = path.join(\n process.cwd(),\n options?.configPath ?? './dist/emmett.config.js',\n );\n\n console.log('IMPORTING' + configPath);\n\n try {\n const imported = (await import(configPath)) as {\n default: Partial<EmmettPluginsConfig>;\n };\n\n if (!imported.default) {\n return new EmmettError(PluginsConfigImportError.missingDefaultExport);\n }\n\n if (!imported.default.plugins || !Array.isArray(imported.default.plugins)) {\n return new EmmettError(\n PluginsConfigImportError.missingPluginsPropertyExport,\n );\n }\n\n if (!imported.default.plugins.every(isPluginConfig)) {\n return new EmmettError(PluginsConfigImportError.wrongPluginStructure);\n }\n\n return { plugins: imported.default.plugins };\n } catch (error) {\n if (!options?.configPath) {\n console.warn('Didn`t find config file: ' + configPath, error);\n return { plugins: [] };\n }\n return new EmmettError(\n `Error: Couldn't load file:` + (error as Error).toString(),\n );\n }\n};\n\nexport const loadPlugins = async (options?: {\n pluginType?: EmmettPluginType;\n configPath?: string;\n}): Promise<EmmettPlugin[]> => {\n try {\n const pluginsConfig = await importPluginsConfig({\n configPath: options?.configPath,\n });\n\n if (pluginsConfig instanceof EmmettError) throw pluginsConfig;\n\n if (pluginsConfig.plugins.length === 0) {\n console.log(`No extensions specified in config ${options?.configPath}.`);\n return [];\n }\n\n const pluginsToLoad = filterPluginsByType(\n pluginsConfig.plugins,\n options?.pluginType,\n );\n\n const pluginsPromises = pluginsToLoad.map(async (pluginConfig) => {\n const importPath = getImportPath(pluginConfig, options?.pluginType);\n try {\n const plugin = (await import(importPath)) as { default: EmmettPlugin };\n\n console.info(`Loaded plugin: ${importPath}`);\n\n if (!plugin.default) {\n throw new Error(`Plugin: ${importPath} is missing default export`);\n }\n\n return plugin.default;\n } catch (error) {\n console.error(`Failed to load extension \"${importPath}\":`, error);\n return undefined;\n }\n });\n\n return (await Promise.all(pluginsPromises)).filter(\n (plugin) => plugin !== undefined,\n );\n } catch (error) {\n console.error(`Failed to load config ${options?.configPath}:`, error);\n return [];\n }\n};\n\nexport const registerCliPlugins = async (\n program: CliCommand,\n plugins: EmmettCliPlugin[],\n): Promise<void> => {\n const result: EmmettCliPlugin[] = [];\n\n for (const plugin of plugins) {\n const pluginName = plugin.name;\n\n if (!('registerCommands' in plugin)) {\n console.warn(`No registerCommands function found in ${pluginName}`);\n }\n await plugin.registerCommands(program as EmmettCliCommand);\n console.log(`Loaded extension: ${plugin.name}`);\n result.push(plugin);\n }\n};\n\nconst filterPluginsByType = (\n plugins: EmmettPluginConfig[],\n pluginType?: EmmettPluginType,\n): EmmettPluginConfig[] =>\n plugins.filter(\n (p) =>\n typeof p === 'string' ||\n (pluginType &&\n (p.register === undefined ||\n p.register.some((r) => r.pluginType === pluginType))),\n );\n\nconst getImportPath = (\n pluginConfig: EmmettPluginConfig,\n pluginType: EmmettPluginType | undefined,\n) => {\n if (typeof pluginConfig === 'string') {\n return pluginType ? `${pluginConfig}/${pluginType}` : pluginConfig;\n }\n\n const pluginSubpath =\n pluginConfig.register.find((r) => pluginType && r.pluginType === pluginType)\n ?.path ?? pluginType;\n\n return pluginSubpath\n ? `${pluginConfig.name}/${pluginSubpath}`\n : pluginConfig.name;\n};\n","#!/usr/bin/env node\nimport { Command } from 'commander';\nimport { loadPlugins, registerCliPlugins } from './commandLine';\n\nconst program = new Command();\n\nprogram\n .name('emmett')\n .description('CLI tool for Emmett')\n .option('--config <path>', 'Path to the configuration file');\n\n// Load extensions and parse CLI arguments\nconst initCLI = async () => {\n const configIndex = process.argv.indexOf('--config');\n\n const configPath =\n configIndex !== -1 && process.argv.length > configIndex + 1\n ? process.argv[configIndex + 1]\n : undefined;\n\n try {\n const plugins = await loadPlugins({\n pluginType: 'cli',\n configPath: configPath,\n });\n await registerCliPlugins(program, plugins);\n\n // Parse the CLI arguments\n program.parse(process.argv);\n } catch (err) {\n console.error(`Failed to load config from ${configPath}:`, err);\n }\n};\n\n//Initialize CLI and handle errors\ninitCLI().catch((err) => {\n console.error(`CLI initialization failed:`);\n console.error(err);\n});\n\nexport default program;\nexport * from './commandLine';\n"],"mappings":";;;;;;;;;;AAKA,MAAa,gBAAgB,UAAoB,CAAC,mBAAmB,KAAK;AAMxE,QAAO;;aAJL,QAAQ,SAAS,IACb,MAAM,QAAQ,KAAK,MAAM,IAAI,EAAE,GAAG,CAAC,KAAK,MAAM,CAAC,SAC/C,KAIkB;;;;AAK1B,MAAa,sBACX,YACA,oBACS;AACT,KAAI;AACF,6BAAc,YAAY,aAAa,gBAAgB,EAAE,OAAO;AAChE,UAAQ,IAAI,iCAAiC,aAAa;UACnD,OAAO;AACd,UAAQ,MAAM,sCAAsC,WAAW,GAAG;AAClE,UAAQ,MAAM,MAAM;AACpB,UAAQ,KAAK,EAAE;;;AAInB,MAAa,gBAAgB,IAAIA,kBAAW,SAAS,CAAC,YACpD,6BACD;AAaD,cACG,QAAQ,SAAS,CACjB,YAAY,yCAAyC,CACrD,OACC,0BACA,4BACC,OAAe,aAAuB;AAErC,QAAO,SAAS,OAAO,CAAC,MAAM,CAAC;GAEjC,EAAE,CACH,CACA,OACC,qBACA,kDACD,CACA,OAAO,kBAAkB,8BAA8B,CACvD,OAAO,eAAe,2BAA2B,CACjD,QAAQ,YAAiC;CACxC,MAAM,UACJ,QAAQ,OAAO,SAAS,IACpB,QAAQ,SACR,CAAC,oCAAoC;AAE3C,KAAI,EAAE,WAAW,YAAY,EAAE,cAAc,UAAU;AACrD,UAAQ,MACN,oHACD;AACD,sBAAK,EAAE;;AAGT,KAAI,WAAW,QACb,SAAQ,IAAI,GAAG,aAAa,QAAQ,GAAG;UAC9B,cAAc,SAAS;AAChC,MAAI,CAAC,QAAQ,MAAM;AACjB,WAAQ,MACN,4DACD;AACD,uBAAK,EAAE;;AAGT,qBAAmB,QAAQ,MAAM,QAAQ;;EAE3C;;;;AC5EJ,MAAM,2BAA2B;C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mB,SAAS,MAJZ,YAAY;GAChC,YAAY;GACA;GACb,CAAC,CACwC;AAG1C,UAAQ,MAAM,QAAQ,KAAK;UACpB,KAAK;AACZ,UAAQ,MAAM,8BAA8B,WAAW,IAAI,IAAI;;;AAKnE,SAAS,CAAC,OAAO,QAAQ;AACvB,SAAQ,MAAM,6BAA6B;AAC3C,SAAQ,MAAM,IAAI;EAClB"}
package/dist/cli.d.cts CHANGED
@@ -1,20 +1,23 @@
1
- #!/usr/bin/env node
2
- import { Command } from 'commander';
3
- import { E as EmmettPluginsConfig, a as EmmettError, b as EmmettPluginType, c as EmmettPlugin, d as EmmettCliPlugin } from './index-D13Bsibj.cjs';
1
+ import { d as EmmettCliPlugin, g as EmmettPluginType, l as EmmettPluginsConfig, p as EmmettPlugin, r as EmmettError } from "./index-BXN5muYb.cjs";
2
+ import { Command } from "commander";
4
3
 
4
+ //#region src/commandLine/config.d.ts
5
5
  declare const sampleConfig: (plugins?: string[]) => string;
6
6
  declare const generateConfigFile: (configPath: string, collectionNames: string[]) => void;
7
7
  declare const configCommand: Command;
8
-
8
+ //#endregion
9
+ //#region src/commandLine/plugins.d.ts
9
10
  declare const importPluginsConfig: (options?: {
10
- configPath?: string | undefined;
11
+ configPath?: string | undefined;
11
12
  }) => Promise<EmmettPluginsConfig | EmmettError>;
12
13
  declare const loadPlugins: (options?: {
13
- pluginType?: EmmettPluginType;
14
- configPath?: string;
14
+ pluginType?: EmmettPluginType;
15
+ configPath?: string;
15
16
  }) => Promise<EmmettPlugin[]>;
16
17
  declare const registerCliPlugins: (program: Command, plugins: EmmettCliPlugin[]) => Promise<void>;
17
-
18
+ //#endregion
19
+ //#region src/cli.d.ts
18
20
  declare const program: Command;
19
-
21
+ //#endregion
20
22
  export { configCommand, program as default, generateConfigFile, importPluginsConfig, loadPlugins, registerCliPlugins, sampleConfig };
23
+ //# sourceMappingURL=cli.d.cts.map
package/dist/cli.d.ts CHANGED
@@ -1,20 +1,23 @@
1
- #!/usr/bin/env node
2
- import { Command } from 'commander';
3
- import { E as EmmettPluginsConfig, a as EmmettError, b as EmmettPluginType, c as EmmettPlugin, d as EmmettCliPlugin } from './index-D13Bsibj.js';
1
+ import { d as EmmettCliPlugin, g as EmmettPluginType, l as EmmettPluginsConfig, p as EmmettPlugin, r as EmmettError } from "./index-C0agmFA7.js";
2
+ import { Command } from "commander";
4
3
 
4
+ //#region src/commandLine/config.d.ts
5
5
  declare const sampleConfig: (plugins?: string[]) => string;
6
6
  declare const generateConfigFile: (configPath: string, collectionNames: string[]) => void;
7
7
  declare const configCommand: Command;
8
-
8
+ //#endregion
9
+ //#region src/commandLine/plugins.d.ts
9
10
  declare const importPluginsConfig: (options?: {
10
- configPath?: string | undefined;
11
+ configPath?: string | undefined;
11
12
  }) => Promise<EmmettPluginsConfig | EmmettError>;
12
13
  declare const loadPlugins: (options?: {
13
- pluginType?: EmmettPluginType;
14
- configPath?: string;
14
+ pluginType?: EmmettPluginType;
15
+ configPath?: string;
15
16
  }) => Promise<EmmettPlugin[]>;
16
17
  declare const registerCliPlugins: (program: Command, plugins: EmmettCliPlugin[]) => Promise<void>;
17
-
18
+ //#endregion
19
+ //#region src/cli.d.ts
18
20
  declare const program: Command;
19
-
21
+ //#endregion
20
22
  export { configCommand, program as default, generateConfigFile, importPluginsConfig, loadPlugins, registerCliPlugins, sampleConfig };
23
+ //# sourceMappingURL=cli.d.ts.map