@keinar/aac-cli 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.cjs +8 -12
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,11 +1,10 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var I=Object.create;var b=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var _=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var U=(t,n,o,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of Y(n))!j.call(t,i)&&i!==o&&b(t,i,{get:()=>n[i],enumerable:!(r=S(n,i))||r.enumerable});return t};var g=(t,n,o)=>(o=t!=null?I(_(t)):{},U(n||!t||!t.__esModule?b(o,"default",{value:t,enumerable:!0}):o,t));var N=require("commander"),s=g(require("@clack/prompts"),1),y=g(require("picocolors"),1);var f=require("fs/promises"),R=require("path"),c=g(require("@clack/prompts"),1),p=g(require("picocolors"),1);var w="1.50.0";function E(t){return`FROM mcr.microsoft.com/playwright:v${t}-jammy
2
+ "use strict";var N=Object.create;var x=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var _=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var U=(t,n,o,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of Y(n))!j.call(t,i)&&i!==o&&x(t,i,{get:()=>n[i],enumerable:!(r=S(n,i))||r.enumerable});return t};var g=(t,n,o)=>(o=t!=null?N(_(t)):{},U(n||!t||!t.__esModule?x(o,"default",{value:t,enumerable:!0}):o,t));var T=require("commander"),s=g(require("@clack/prompts"),1),y=g(require("picocolors"),1);var f=require("fs/promises"),R=require("path"),c=g(require("@clack/prompts"),1),p=g(require("picocolors"),1);var w="1.50.0";function E(t){return`FROM mcr.microsoft.com/playwright:v${t}-jammy
3
3
 
4
4
  WORKDIR /app
5
5
 
6
6
  COPY package*.json ./
7
7
  RUN npm ci
8
- RUN npm install -g allure-commandline
9
8
 
10
9
  COPY . .
11
10
 
@@ -28,9 +27,6 @@ else
28
27
  echo "Running tests in folder: $FOLDER"
29
28
  npx playwright test "$FOLDER"
30
29
  fi
31
-
32
- echo "Generating Allure Report..."
33
- npx allure generate allure-results --clean -o allure-report
34
30
  `,P=`FROM python:3.11-slim
35
31
 
36
32
  WORKDIR /app
@@ -52,19 +48,19 @@ fi
52
48
 
53
49
  if [ -z "$FOLDER" ] || [ "$FOLDER" = "all" ]; then
54
50
  echo "Running ALL tests..."
55
- exec pytest
51
+ pytest
56
52
  else
57
53
  echo "Running tests in folder: $FOLDER"
58
- exec pytest "$FOLDER"
54
+ pytest "$FOLDER"
59
55
  fi
60
56
  `,$=`.git
61
57
  .env
62
58
  node_modules
63
59
  __pycache__
64
60
  .venv
65
- `;async function G(t){try{let n=await(0,f.readFile)((0,R.join)(t,"package.json"),"utf-8"),o=JSON.parse(n),r=o.devDependencies?.["@playwright/test"]??o.dependencies?.["@playwright/test"];return r?r.replace(/^[^\d]*/,"")||w:w}catch{return w}}async function B(t,n){let o=t==="playwright",r;if(o){let i=await G(n);c.log.info(`Detected Playwright version: ${p.default.cyan("v"+i)}`),r=E(i)}else r=P;return[{name:".dockerignore",content:$,mode:420},{name:"entrypoint.sh",content:o?O:C,mode:493},{name:"Dockerfile",content:r,mode:420}]}async function H(t){try{return await(0,f.stat)(t),!0}catch{return!1}}function q(t){return t.replace(/\r\n/g,`
66
- `)}async function A(t,n){let o=await B(t,n),r=new Set;for(let a of o){let d=(0,R.join)(n,a.name);if(await H(d)){let m=await c.confirm({message:`File ${p.default.yellow(a.name)} already exists. Overwrite?`});c.isCancel(m)&&(c.cancel("Operation cancelled."),process.exit(0)),m||r.add(a.name)}}if(r.size===o.length){c.log.warn("All files were skipped. No changes were made.");return}let i=[];for(let a of o){if(r.has(a.name))continue;let d=(0,R.join)(n,a.name),m=q(a.content);await(0,f.writeFile)(d,m,{mode:a.mode}),i.push(a.name)}for(let a of i)c.log.success(`Created ${p.default.green(a)}`);c.note([`${p.default.bold("1.")} docker build -t your-username/my-automation-tests:latest .`,`${p.default.bold("2.")} docker push your-username/my-automation-tests:latest`,`${p.default.bold("3.")} Enter this image name in the AAC Dashboard.`].join(`
67
- `),`${p.default.green("\u2705")} Next steps to connect your project to the AAC`)}var D=require("child_process"),F=require("fs/promises"),v=require("path"),e=g(require("@clack/prompts"),1),l=g(require("picocolors"),1);async function W(t){try{let n=await(0,F.readFile)((0,v.join)(t,"package.json"),"utf-8"),o=JSON.parse(n);return o.name?o.name.replace(/^@[^/]+\//,""):null}catch{return null}}async function L(t){let n=await e.confirm({message:"Do you have a Docker Hub account?"});if(e.isCancel(n)){e.cancel("Deployment cancelled.");return}n||(e.note(`Create a free account at ${l.default.cyan("https://hub.docker.com")}
68
- Press Enter when you're ready to continue.`,l.default.yellow("Docker Hub Account Required")),await e.text({message:"Press Enter to continue...",defaultValue:"",placeholder:""}));let o=await e.text({message:"What is your Docker Hub username?",validate:u=>{if(!u.trim())return"Username is required."}});if(e.isCancel(o)){e.cancel("Deployment cancelled.");return}let r=await W(t),i;if(r){let u=await e.confirm({message:`Detected project name "${l.default.cyan(r)}". Use this for the image?`});if(e.isCancel(u)){e.cancel("Deployment cancelled.");return}if(u)i=r;else{let h=await e.text({message:"Enter the image name:",validate:T=>{if(!T.trim())return"Image name is required."}});if(e.isCancel(h)){e.cancel("Deployment cancelled.");return}i=h.trim()}}else{let u=await e.text({message:"Enter the image name:",validate:h=>{if(!h.trim())return"Image name is required."}});if(e.isCancel(u)){e.cancel("Deployment cancelled.");return}i=u.trim()}let a=`${o.trim()}/${i}:latest`,d=await e.confirm({message:"I need to log you into Docker. Send a login request?"});if(e.isCancel(d)){e.cancel("Deployment cancelled.");return}if(d){e.log.step("Opening Docker login...");try{(0,D.execSync)("docker login",{stdio:"inherit",cwd:t}),e.log.success("Docker login successful.")}catch{e.log.error("Docker login failed. Please try again manually.");return}}let m=await e.confirm({message:`Build multi-platform image ${l.default.cyan(a)} and push to Docker Hub?`});if(e.isCancel(m)||!m){e.log.warn("Build skipped."),e.note([`${l.default.bold("1.")} docker buildx create --name aac-builder --use`,`${l.default.bold("2.")} docker buildx build --platform linux/amd64,linux/arm64 -t ${a} --push .`].join(`
61
+ `;async function B(t){try{let n=await(0,f.readFile)((0,R.join)(t,"package.json"),"utf-8"),o=JSON.parse(n),r=o.devDependencies?.["@playwright/test"]??o.dependencies?.["@playwright/test"];return r?r.replace(/^[^\d]*/,"")||w:w}catch{return w}}async function G(t,n){let o=t==="playwright",r;if(o){let i=await B(n);c.log.info(`Detected Playwright version: ${p.default.cyan("v"+i)}`),r=E(i)}else r=P;return[{name:".dockerignore",content:$,mode:420},{name:"entrypoint.sh",content:o?O:C,mode:493},{name:"Dockerfile",content:r,mode:420}]}async function H(t){try{return await(0,f.stat)(t),!0}catch{return!1}}function q(t){return t.replace(/\r\n/g,`
62
+ `)}async function F(t,n){let o=await G(t,n),r=new Set;for(let a of o){let d=(0,R.join)(n,a.name);if(await H(d)){let m=await c.confirm({message:`File ${p.default.yellow(a.name)} already exists. Overwrite?`});c.isCancel(m)&&(c.cancel("Operation cancelled."),process.exit(0)),m||r.add(a.name)}}if(r.size===o.length){c.log.warn("All files were skipped. No changes were made.");return}let i=[];for(let a of o){if(r.has(a.name))continue;let d=(0,R.join)(n,a.name),m=q(a.content);await(0,f.writeFile)(d,m,{mode:a.mode}),i.push(a.name)}for(let a of i)c.log.success(`Created ${p.default.green(a)}`);c.note([`${p.default.bold("1.")} docker build -t your-username/my-automation-tests:latest .`,`${p.default.bold("2.")} docker push your-username/my-automation-tests:latest`,`${p.default.bold("3.")} Enter this image name in the AAC Dashboard.`].join(`
63
+ `),`${p.default.green("\u2705")} Next steps to connect your project to the AAC`)}var D=require("child_process"),v=require("fs/promises"),A=require("path"),e=g(require("@clack/prompts"),1),l=g(require("picocolors"),1);async function W(t){try{let n=await(0,v.readFile)((0,A.join)(t,"package.json"),"utf-8"),o=JSON.parse(n);return o.name?o.name.replace(/^@[^/]+\//,""):null}catch{return null}}async function L(t){let n=await e.confirm({message:"Do you have a Docker Hub account?"});if(e.isCancel(n)){e.cancel("Deployment cancelled.");return}n||(e.note(`Create a free account at ${l.default.cyan("https://hub.docker.com")}
64
+ Press Enter when you're ready to continue.`,l.default.yellow("Docker Hub Account Required")),await e.text({message:"Press Enter to continue...",defaultValue:"",placeholder:""}));let o=await e.text({message:"What is your Docker Hub username?",validate:u=>{if(!u.trim())return"Username is required."}});if(e.isCancel(o)){e.cancel("Deployment cancelled.");return}let r=await W(t),i;if(r){let u=await e.confirm({message:`Detected project name "${l.default.cyan(r)}". Use this for the image?`});if(e.isCancel(u)){e.cancel("Deployment cancelled.");return}if(u)i=r;else{let h=await e.text({message:"Enter the image name:",validate:I=>{if(!I.trim())return"Image name is required."}});if(e.isCancel(h)){e.cancel("Deployment cancelled.");return}i=h.trim()}}else{let u=await e.text({message:"Enter the image name:",validate:h=>{if(!h.trim())return"Image name is required."}});if(e.isCancel(u)){e.cancel("Deployment cancelled.");return}i=u.trim()}let a=`${o.trim()}/${i}:latest`,d=await e.confirm({message:"I need to log you into Docker. Send a login request?"});if(e.isCancel(d)){e.cancel("Deployment cancelled.");return}if(d){e.log.step("Opening Docker login...");try{(0,D.execSync)("docker login",{stdio:"inherit",cwd:t}),e.log.success("Docker login successful.")}catch{e.log.error("Docker login failed. Please try again manually.");return}}let m=await e.confirm({message:`Build multi-platform image ${l.default.cyan(a)} and push to Docker Hub?`});if(e.isCancel(m)||!m){e.log.warn("Build skipped."),e.note([`${l.default.bold("1.")} docker buildx create --name aac-builder --use`,`${l.default.bold("2.")} docker buildx build --platform linux/amd64,linux/arm64 -t ${a} --push .`].join(`
69
65
  `),"You can build manually later");return}let k=e.spinner();try{k.start("Setting up Docker Buildx builder..."),(0,D.execSync)("docker buildx create --name aac-builder --use",{stdio:"pipe",cwd:t}),k.stop("Buildx builder ready.")}catch{k.stop("Using existing Buildx builder.")}e.log.step(`Building & pushing ${l.default.cyan(a)}...`);try{(0,D.execSync)(`docker buildx build --platform linux/amd64,linux/arm64 -t ${a} --push .`,{stdio:"inherit",cwd:t}),e.log.success(`Image ${l.default.green(a)} pushed successfully!`),e.note(`Go to the ${l.default.bold("AAC Dashboard")} and enter:
70
- ${l.default.cyan(a)}`,l.default.green("\u2705 Deployment Complete"))}catch{e.log.error("Docker build failed. Check the output above for details.")}}var x=new N.Command;x.name("aac-cli").description("Agnostic Automation Center CLI \u2014 Prepare any test automation repo for the AAC platform").version("1.1.0");x.command("init").description("Generate AAC integration files and optionally build & push your Docker image").action(async()=>{s.intro(y.default.bgCyan(y.default.black(" AAC CLI ")));let t=await s.select({message:"Select your automation project framework:",options:[{value:"playwright",label:"Playwright (TypeScript/Node.js)"},{value:"pytest",label:"Pytest (Python)"}]});s.isCancel(t)&&(s.cancel("Operation cancelled."),process.exit(0));let n=s.spinner();n.start("Generating AAC integration files..."),await new Promise(i=>setTimeout(i,300)),n.stop("Files ready.");let o=process.cwd();await A(t,o);let r=await s.confirm({message:"Do you want to build and push the image to Docker Hub right now?"});s.isCancel(r)&&(s.cancel("Operation cancelled."),process.exit(0)),r&&await L(o),s.outro(y.default.green("Done!")+" "+y.default.dim("Run `aac-cli init` again anytime."))});x.parse();
66
+ ${l.default.cyan(a)}`,l.default.green("\u2705 Deployment Complete"))}catch{e.log.error("Docker build failed. Check the output above for details.")}}var b=new T.Command;b.name("aac-cli").description("Agnostic Automation Center CLI \u2014 Prepare any test automation repo for the AAC platform").version("1.1.0");b.command("init").description("Generate AAC integration files and optionally build & push your Docker image").action(async()=>{s.intro(y.default.bgCyan(y.default.black(" AAC CLI ")));let t=await s.select({message:"Select your automation project framework:",options:[{value:"playwright",label:"Playwright (TypeScript/Node.js)"},{value:"pytest",label:"Pytest (Python)"}]});s.isCancel(t)&&(s.cancel("Operation cancelled."),process.exit(0));let n=s.spinner();n.start("Generating AAC integration files..."),await new Promise(i=>setTimeout(i,300)),n.stop("Files ready.");let o=process.cwd();await F(t,o);let r=await s.confirm({message:"Do you want to build and push the image to Docker Hub right now?"});s.isCancel(r)&&(s.cancel("Operation cancelled."),process.exit(0)),r&&await L(o),s.outro(y.default.green("Done!")+" "+y.default.dim("Run `aac-cli init` again anytime."))});b.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keinar/aac-cli",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Agnostic Automation Center CLI — Prepare any test automation repo for the AAC platform",
5
5
  "author": "keinar",
6
6
  "license": "MIT",