@stackone/cli 1.2.2 → 1.3.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/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const e=require(`./cliCore-
|
|
2
|
+
const e=require(`./cliCore-CV8bk3AR.cjs`),t=new e.CLI;t.run();
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{CLI as e}from"./cliCore-
|
|
2
|
+
import{CLI as e}from"./cliCore-CxdTXo92.js";const t=new e;t.run();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const e=require(`./chunk-CUT6urMc.cjs`),t=e.__toESM(require(`chalk`)),n=e.__toESM(require(`commander`)),r=e.__toESM(require(`@stackone/connect-sdk`)),i=e.__toESM(require(`fs`)),a=e.__toESM(require(`ora`)),o=e.__toESM(require(`path`)),s=e.__toESM(require(`url`));var c=class{static info(e){console.info(t.default.blue(`ℹ`),e)}static warn(e){console.info(t.default.yellow(`⚠`),e)}static error(e){console.info(t.default.red(`✗`),e)}static success(e){console.info(t.default.green(`✓`),e)}},l=class{async execute(e){let{watchMode:n,fileOrDir:r}=e,o=(0,a.default)(`Watching for changes...`),s=()=>{console.clear(),console.info(t.default.yellow(`Watch mode enabled. Press "q" to quit.
|
|
2
2
|
`))};if(r){try{(0,i.statSync)(r)}catch{c.error(`File or directory not found: ${r}`),process.exit(1)}if(n){let{watch:e}=await Promise.resolve().then(()=>require(`./esm-Chmlhd00.cjs`)),n=await import(`readline`),i=n.createInterface({input:process.stdin,output:process.stdout});process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.setEncoding(`utf8`);let a=()=>{console.info(t.default.grey(`
|
|
3
3
|
|
|
4
|
-
Exiting watch mode...`)),c.close(),o.stop(),i.close(),process.exit(0)};s(),console.info(t.default.blue(`Running connector(s) validations...`)),await u(r),o.start();let c=e(r||`.`,{ignored:/(^|[/\\])\../,persistent:!0});c.on(`change`,async e=>{s(),o.stop(),console.info(t.default.blue(`File change detected. Running connector(s) validations...`)),await u(r),o.start()}),process.stdin.on(`data`,e=>{e.toString()===`q`&&a()}),process.on(`SIGINT`,()=>{a()})}else await u(r),process.exit(0)}}};const u=async e=>{let t=(0,i.statSync)(e);if(t.isDirectory()){let t=(0,i.readdirSync)(e),n=t.filter(e=>e.endsWith(`.s1.yaml`));if(n.length===0){c.error(`No StackOne connectors found in directory: ${e}. Connector files need to have the extension .s1.yaml.\n`);return}let r=0,a=0;for(let t of n){let n=`${e}/${t}`,o=(0,i.statSync)(n);if(o.isFile()){let e=await d(n);e?r++:a++}}c.info(`Validation completed: ${r} valid, ${a} invalid connectors.\n`)}else t.isFile()&&e.endsWith(`s1.yaml`)?await d(e):c.error(`No StackOne connector found: ${e}. Connector files need to have the extension .s1.yaml.\n`)},d=async e=>{let n=(0,
|
|
4
|
+
Exiting watch mode...`)),c.close(),o.stop(),i.close(),process.exit(0)};s(),console.info(t.default.blue(`Running connector(s) validations...`)),await u(r),o.start();let c=e(r||`.`,{ignored:/(^|[/\\])\../,persistent:!0});c.on(`change`,async e=>{s(),o.stop(),console.info(t.default.blue(`File change detected. Running connector(s) validations...`)),await u(r),o.start()}),process.stdin.on(`data`,e=>{e.toString()===`q`&&a()}),process.on(`SIGINT`,()=>{a()})}else await u(r),process.exit(0)}}};const u=async e=>{let t=(0,i.statSync)(e);if(t.isDirectory()){let t=(0,i.readdirSync)(e),n=t.filter(e=>e.endsWith(`.s1.yaml`));if(n.length===0){c.error(`No StackOne connectors found in directory: ${e}. Connector files need to have the extension .s1.yaml.\n`);return}let r=0,a=0;for(let t of n){let n=`${e}/${t}`,o=(0,i.statSync)(n);if(o.isFile()){let e=await d(n);e?r++:a++}}c.info(`Validation completed: ${r} valid, ${a} invalid connectors.\n`)}else t.isFile()&&e.endsWith(`s1.yaml`)?await d(e):c.error(`No StackOne connector found: ${e}. Connector files need to have the extension .s1.yaml.\n`)},d=async e=>{let n=(0,r.loadConnector)(e),i=(0,r.validateYamlConnector)(n),a=i?.errors??[];if(i.success){let t=e.split(`/`).pop()||e;return c.success(`Connector ${t} is valid!\n`),!0}else if(a.length>0)return c.error(`Connector ${e} is not valid. Please fix the following errors:\n`),a.forEach(e=>{console.info(t.default.red(`- ${e.message} | Line: ${e.line}`))}),console.info(`
|
|
5
5
|
`),!1;else return c.error(`Connector ${e} is not valid. Please check the file for errors.`),!1},f=()=>{try{let e=(0,s.fileURLToPath)(require(`url`).pathToFileURL(__filename).href),t=(0,o.dirname)(e),n=(0,o.join)(t,`..`,`package.json`),r=JSON.parse((0,i.readFileSync)(n,`utf8`));return r.version}catch{return`unknown`}};var p=class{constructor(e=new n.Command,t=f()){this.program=e,this.version=t,this.setupProgram(),this.registerCommands()}setupProgram(){this.program.name(`stackone`).description(`StackOne CLI`).version(this.version)}registerCommands(){let e=new l;this.program.configureOutput({writeOut:e=>process.stdout.write(e),writeErr:e=>process.stderr.write(e),outputError:(e,n)=>{n(t.default.red(e))}}),this.program.command(`validate`).option(`-w, --watch`,`Run in watch mode`).addArgument(new n.Argument(`<path>`,`Connector file or directory with connectors to validate`)).description(`Validate a StackOne connector`).action((t,n)=>{e.execute({watchMode:n.watch,fileOrDir:t})}),this.program.command(`version`).description(`Show version information`).action(()=>{console.info(`${t.default.greenBright(`StackOne`)} ${t.default.grey(`CLI`)} ${t.default.whiteBright(this.version)}`),process.exit(0)})}run(){this.program.parse(process.argv)}};Object.defineProperty(exports,`CLI`,{enumerable:!0,get:function(){return p}});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import e from"chalk";import{Argument as t,Command as n}from"commander";import{loadConnector as r,validateYamlConnector as i}from"@stackone/connect-sdk";import{readFileSync as a,readdirSync as o,statSync as s}from"fs";import c from"ora";import{dirname as l,join as u}from"path";import{fileURLToPath as d}from"url";var f=class{static info(t){console.info(e.blue(`ℹ`),t)}static warn(t){console.info(e.yellow(`⚠`),t)}static error(t){console.info(e.red(`✗`),t)}static success(t){console.info(e.green(`✓`),t)}},p=class{async execute(t){let{watchMode:n,fileOrDir:r}=t,i=c(`Watching for changes...`),a=()=>{console.clear(),console.info(e.yellow(`Watch mode enabled. Press "q" to quit.
|
|
2
|
+
`))};if(r){try{s(r)}catch{f.error(`File or directory not found: ${r}`),process.exit(1)}if(n){let{watch:t}=await import(`./esm-BenXeAeS.js`),n=await import(`readline`),o=n.createInterface({input:process.stdin,output:process.stdout});process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.setEncoding(`utf8`);let s=()=>{console.info(e.grey(`
|
|
3
|
+
|
|
4
|
+
Exiting watch mode...`)),c.close(),i.stop(),o.close(),process.exit(0)};a(),console.info(e.blue(`Running connector(s) validations...`)),await m(r),i.start();let c=t(r||`.`,{ignored:/(^|[/\\])\../,persistent:!0});c.on(`change`,async t=>{a(),i.stop(),console.info(e.blue(`File change detected. Running connector(s) validations...`)),await m(r),i.start()}),process.stdin.on(`data`,e=>{e.toString()===`q`&&s()}),process.on(`SIGINT`,()=>{s()})}else await m(r),process.exit(0)}}};const m=async e=>{let t=s(e);if(t.isDirectory()){let t=o(e),n=t.filter(e=>e.endsWith(`.s1.yaml`));if(n.length===0){f.error(`No StackOne connectors found in directory: ${e}. Connector files need to have the extension .s1.yaml.\n`);return}let r=0,i=0;for(let t of n){let n=`${e}/${t}`,a=s(n);if(a.isFile()){let e=await h(n);e?r++:i++}}f.info(`Validation completed: ${r} valid, ${i} invalid connectors.\n`)}else t.isFile()&&e.endsWith(`s1.yaml`)?await h(e):f.error(`No StackOne connector found: ${e}. Connector files need to have the extension .s1.yaml.\n`)},h=async t=>{let n=r(t),a=i(n),o=a?.errors??[];if(a.success){let e=t.split(`/`).pop()||t;return f.success(`Connector ${e} is valid!\n`),!0}else if(o.length>0)return f.error(`Connector ${t} is not valid. Please fix the following errors:\n`),o.forEach(t=>{console.info(e.red(`- ${t.message} | Line: ${t.line}`))}),console.info(`
|
|
5
|
+
`),!1;else return f.error(`Connector ${t} is not valid. Please check the file for errors.`),!1},g=()=>{try{let e=d(import.meta.url),t=l(e),n=u(t,`..`,`package.json`),r=JSON.parse(a(n,`utf8`));return r.version}catch{return`unknown`}};var _=class{constructor(e=new n,t=g()){this.program=e,this.version=t,this.setupProgram(),this.registerCommands()}setupProgram(){this.program.name(`stackone`).description(`StackOne CLI`).version(this.version)}registerCommands(){let n=new p;this.program.configureOutput({writeOut:e=>process.stdout.write(e),writeErr:e=>process.stderr.write(e),outputError:(t,n)=>{n(e.red(t))}}),this.program.command(`validate`).option(`-w, --watch`,`Run in watch mode`).addArgument(new t(`<path>`,`Connector file or directory with connectors to validate`)).description(`Validate a StackOne connector`).action((e,t)=>{n.execute({watchMode:t.watch,fileOrDir:e})}),this.program.command(`version`).description(`Show version information`).action(()=>{console.info(`${e.greenBright(`StackOne`)} ${e.grey(`CLI`)} ${e.whiteBright(this.version)}`),process.exit(0)})}run(){this.program.parse(process.argv)}};export{_ as CLI};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./cliCore-
|
|
1
|
+
const e=require(`./cliCore-CV8bk3AR.cjs`);exports.CLI=e.CLI;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CLI as e}from"./cliCore-
|
|
1
|
+
import{CLI as e}from"./cliCore-CxdTXo92.js";export{e as CLI};
|
package/package.json
CHANGED
package/dist/cliCore-B4dGs2_5.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import e from"chalk";import{Argument as t,Command as n}from"commander";import{validateYamlConnector as r}from"@stackone/connect-sdk";import{readFileSync as i,readdirSync as a,statSync as o}from"fs";import s from"ora";import{dirname as c,join as l}from"path";import{fileURLToPath as u}from"url";var d=class{static info(t){console.info(e.blue(`ℹ`),t)}static warn(t){console.info(e.yellow(`⚠`),t)}static error(t){console.info(e.red(`✗`),t)}static success(t){console.info(e.green(`✓`),t)}},f=class{async execute(t){let{watchMode:n,fileOrDir:r}=t,i=s(`Watching for changes...`),a=()=>{console.clear(),console.info(e.yellow(`Watch mode enabled. Press "q" to quit.
|
|
2
|
-
`))};if(r){try{o(r)}catch{d.error(`File or directory not found: ${r}`),process.exit(1)}if(n){let{watch:t}=await import(`./esm-BenXeAeS.js`),n=await import(`readline`),o=n.createInterface({input:process.stdin,output:process.stdout});process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.setEncoding(`utf8`);let s=()=>{console.info(e.grey(`
|
|
3
|
-
|
|
4
|
-
Exiting watch mode...`)),c.close(),i.stop(),o.close(),process.exit(0)};a(),console.info(e.blue(`Running connector(s) validations...`)),await p(r),i.start();let c=t(r||`.`,{ignored:/(^|[/\\])\../,persistent:!0});c.on(`change`,async t=>{a(),i.stop(),console.info(e.blue(`File change detected. Running connector(s) validations...`)),await p(r),i.start()}),process.stdin.on(`data`,e=>{e.toString()===`q`&&s()}),process.on(`SIGINT`,()=>{s()})}else await p(r),process.exit(0)}}};const p=async e=>{let t=o(e);if(t.isDirectory()){let t=a(e),n=t.filter(e=>e.endsWith(`.s1.yaml`));if(n.length===0){d.error(`No StackOne connectors found in directory: ${e}. Connector files need to have the extension .s1.yaml.\n`);return}let r=0,i=0;for(let t of n){let n=`${e}/${t}`,a=o(n);if(a.isFile()){let e=await m(n);e?r++:i++}}d.info(`Validation completed: ${r} valid, ${i} invalid connectors.\n`)}else t.isFile()&&e.endsWith(`s1.yaml`)?await m(e):d.error(`No StackOne connector found: ${e}. Connector files need to have the extension .s1.yaml.\n`)},m=async t=>{let n=i(t,`utf8`),a=r(n),o=a?.errors??[];if(a.success){let e=t.split(`/`).pop()||t;return d.success(`Connector ${e} is valid!\n`),!0}else if(o.length>0)return d.error(`Connector ${t} is not valid. Please fix the following errors:\n`),o.forEach(t=>{console.info(e.red(`- ${t.message} | Line: ${t.line}`))}),console.info(`
|
|
5
|
-
`),!1;else return d.error(`Connector ${t} is not valid. Please check the file for errors.`),!1},h=()=>{try{let e=u(import.meta.url),t=c(e),n=l(t,`..`,`package.json`),r=JSON.parse(i(n,`utf8`));return r.version}catch{return`unknown`}};var g=class{constructor(e=new n,t=h()){this.program=e,this.version=t,this.setupProgram(),this.registerCommands()}setupProgram(){this.program.name(`stackone`).description(`StackOne CLI`).version(this.version)}registerCommands(){let n=new f;this.program.configureOutput({writeOut:e=>process.stdout.write(e),writeErr:e=>process.stderr.write(e),outputError:(t,n)=>{n(e.red(t))}}),this.program.command(`validate`).option(`-w, --watch`,`Run in watch mode`).addArgument(new t(`<path>`,`Connector file or directory with connectors to validate`)).description(`Validate a StackOne connector`).action((e,t)=>{n.execute({watchMode:t.watch,fileOrDir:e})}),this.program.command(`version`).description(`Show version information`).action(()=>{console.info(`${e.greenBright(`StackOne`)} ${e.grey(`CLI`)} ${e.whiteBright(this.version)}`),process.exit(0)})}run(){this.program.parse(process.argv)}};export{g as CLI};
|