@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.
- package/dist/index.cjs +8 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
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
|
-
|
|
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
|
-
`,
|
|
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
|
-
`,
|
|
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
|
-
`,
|
|
54
|
+
`,F=`.git
|
|
55
55
|
.env
|
|
56
56
|
node_modules
|
|
57
57
|
__pycache__
|
|
58
58
|
.venv
|
|
59
|
-
`;function
|
|
60
|
-
`)}async function
|
|
61
|
-
`),`${
|
|
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();
|