@keinar/aac-cli 1.0.0 → 1.0.1

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 -8
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var L=Object.create;var d=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var D=(e,t,o,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of x(t))!A.call(e,a)&&a!==o&&d(e,a,{get:()=>t[a],enumerable:!(c=C(t,a))||c.enumerable});return e};var l=(e,t,o)=>(o=e!=null?L(T(e)):{},D(t||!e||!e.__esModule?d(o,"default",{value:e,enumerable:!0}):o,e));var P=require("commander"),n=l(require("@clack/prompts"),1),p=l(require("picocolors"),1);var f=require("fs/promises"),h=require("path"),i=l(require("@clack/prompts"),1),s=l(require("picocolors"),1);var R=`FROM mcr.microsoft.com/playwright:v1.50.0-jammy
2
+ "use strict";var v=Object.create;var y=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var A=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of T(t))!x.call(e,r)&&r!==n&&y(e,r,{get:()=>t[r],enumerable:!(o=D(t,r))||o.enumerable});return e};var f=(e,t,n)=>(n=e!=null?v(k(e)):{},A(t||!e||!e.__esModule?y(n,"default",{value:e,enumerable:!0}):n,e));var L=require("commander"),a=f(require("@clack/prompts"),1),l=f(require("picocolors"),1);var p=require("fs/promises"),d=require("path"),i=f(require("@clack/prompts"),1),c=f(require("picocolors"),1);var g="1.50.0";function w(e){return`FROM mcr.microsoft.com/playwright:v${e}-jammy
3
3
 
4
4
  WORKDIR /app
5
5
 
@@ -9,7 +9,7 @@ RUN npm ci
9
9
  COPY . .
10
10
 
11
11
  RUN chmod +x /app/entrypoint.sh
12
- `,y=`#!/bin/sh
12
+ `}var R=`#!/bin/sh
13
13
 
14
14
  FOLDER=$1
15
15
 
@@ -25,7 +25,7 @@ else
25
25
  echo "Running tests in folder: $FOLDER"
26
26
  exec npx playwright test "$FOLDER"
27
27
  fi
28
- `,w=`FROM python:3.11-slim
28
+ `,O=`FROM python:3.11-slim
29
29
 
30
30
  WORKDIR /app
31
31
 
@@ -35,7 +35,7 @@ RUN pip install --no-cache-dir -r requirements.txt
35
35
  COPY . .
36
36
 
37
37
  RUN chmod +x /app/entrypoint.sh
38
- `,O=`#!/bin/sh
38
+ `,E=`#!/bin/sh
39
39
 
40
40
  FOLDER=$1
41
41
 
@@ -51,11 +51,11 @@ else
51
51
  echo "Running tests in folder: $FOLDER"
52
52
  exec pytest "$FOLDER"
53
53
  fi
54
- `,E=`.git
54
+ `,F=`.git
55
55
  .env
56
56
  node_modules
57
57
  __pycache__
58
58
  .venv
59
- `;function v(e){let t=e==="playwright";return[{name:".dockerignore",content:E,mode:420},{name:"entrypoint.sh",content:t?y:O,mode:493},{name:"Dockerfile",content:t?R:w,mode:420}]}async function k(e){try{return await(0,f.stat)(e),!0}catch{return!1}}function I(e){return e.replace(/\r\n/g,`
60
- `)}async function F(e,t){let o=v(e),c=new Set;for(let r of o){let g=(0,h.join)(t,r.name);if(await k(g)){let m=await i.confirm({message:`File ${s.default.yellow(r.name)} already exists. Overwrite?`});i.isCancel(m)&&(i.cancel("Operation cancelled."),process.exit(0)),m||c.add(r.name)}}if(c.size===o.length){i.log.warn("All files were skipped. No changes were made.");return}let a=[];for(let r of o){if(c.has(r.name))continue;let g=(0,h.join)(t,r.name),m=I(r.content);await(0,f.writeFile)(g,m,{mode:r.mode}),a.push(r.name)}for(let r of a)i.log.success(`Created ${s.default.green(r)}`);i.note([`${s.default.bold("1.")} docker build -t your-username/my-automation-tests:latest .`,`${s.default.bold("2.")} docker push your-username/my-automation-tests:latest`,`${s.default.bold("3.")} Enter this image name in the AAC Dashboard.`].join(`
61
- `),`${s.default.green("\u2705")} Next steps to connect your project to the AAC`)}var u=new P.Command;u.name("aac-cli").description("Agnostic Automation Center CLI \u2014 Prepare any test automation repo for the AAC platform").version("1.0.0");u.command("init").description("Generate Dockerfile, entrypoint.sh, and .dockerignore for the AAC platform").action(async()=>{n.intro(p.default.bgCyan(p.default.black(" AAC CLI ")));let e=await n.select({message:"Select your automation project framework:",options:[{value:"playwright",label:"Playwright (TypeScript/Node.js)"},{value:"pytest",label:"Pytest (Python)"}]});n.isCancel(e)&&(n.cancel("Operation cancelled."),process.exit(0));let t=n.spinner();t.start("Generating AAC integration files..."),await new Promise(o=>setTimeout(o,300)),t.stop("Files ready."),await F(e,process.cwd()),n.outro(p.default.green("Done!")+" "+p.default.dim("Run `aac-cli init` again anytime."))});u.parse();
59
+ `;async function C(e){try{let t=await(0,p.readFile)((0,d.join)(e,"package.json"),"utf-8"),n=JSON.parse(t),o=n.devDependencies?.["@playwright/test"]??n.dependencies?.["@playwright/test"];return o?o.replace(/^[^\d]*/,"")||g:g}catch{return g}}async function N(e,t){let n=e==="playwright",o;if(n){let r=await C(t);i.log.info(`Detected Playwright version: ${c.default.cyan("v"+r)}`),o=w(r)}else o=O;return[{name:".dockerignore",content:F,mode:420},{name:"entrypoint.sh",content:n?R:E,mode:493},{name:"Dockerfile",content:o,mode:420}]}async function I(e){try{return await(0,p.stat)(e),!0}catch{return!1}}function $(e){return e.replace(/\r\n/g,`
60
+ `)}async function P(e,t){let n=await N(e,t),o=new Set;for(let s of n){let h=(0,d.join)(t,s.name);if(await I(h)){let m=await i.confirm({message:`File ${c.default.yellow(s.name)} already exists. Overwrite?`});i.isCancel(m)&&(i.cancel("Operation cancelled."),process.exit(0)),m||o.add(s.name)}}if(o.size===n.length){i.log.warn("All files were skipped. No changes were made.");return}let r=[];for(let s of n){if(o.has(s.name))continue;let h=(0,d.join)(t,s.name),m=$(s.content);await(0,p.writeFile)(h,m,{mode:s.mode}),r.push(s.name)}for(let s of r)i.log.success(`Created ${c.default.green(s)}`);i.note([`${c.default.bold("1.")} docker build -t your-username/my-automation-tests:latest .`,`${c.default.bold("2.")} docker push your-username/my-automation-tests:latest`,`${c.default.bold("3.")} Enter this image name in the AAC Dashboard.`].join(`
61
+ `),`${c.default.green("\u2705")} Next steps to connect your project to the AAC`)}var u=new L.Command;u.name("aac-cli").description("Agnostic Automation Center CLI \u2014 Prepare any test automation repo for the AAC platform").version("1.0.0");u.command("init").description("Generate Dockerfile, entrypoint.sh, and .dockerignore for the AAC platform").action(async()=>{a.intro(l.default.bgCyan(l.default.black(" AAC CLI ")));let e=await a.select({message:"Select your automation project framework:",options:[{value:"playwright",label:"Playwright (TypeScript/Node.js)"},{value:"pytest",label:"Pytest (Python)"}]});a.isCancel(e)&&(a.cancel("Operation cancelled."),process.exit(0));let t=a.spinner();t.start("Generating AAC integration files..."),await new Promise(n=>setTimeout(n,300)),t.stop("Files ready."),await P(e,process.cwd()),a.outro(l.default.green("Done!")+" "+l.default.dim("Run `aac-cli init` again anytime."))});u.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keinar/aac-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Agnostic Automation Center CLI — Prepare any test automation repo for the AAC platform",
5
5
  "author": "keinar",
6
6
  "license": "MIT",