@keinar/aac-cli 1.0.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/README.md +76 -0
- package/dist/index.cjs +61 -0
- package/package.json +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# AAC CLI
|
|
2
|
+
|
|
3
|
+
> **Agnostic Automation Center CLI** — Prepare any test automation repository to run seamlessly inside the AAC containerized platform.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/keinar/aac-cli/actions/workflows/release.yml)
|
|
6
|
+
[](https://www.npmjs.com/package/aac-cli)
|
|
7
|
+
|
|
8
|
+
## What It Does
|
|
9
|
+
|
|
10
|
+
`aac-cli init` generates the integration files your test automation project needs to run inside the AAC platform:
|
|
11
|
+
|
|
12
|
+
| File | Purpose |
|
|
13
|
+
|---|---|
|
|
14
|
+
| `Dockerfile` | Builds your test suite image (no ENTRYPOINT/CMD — the AAC Worker injects it) |
|
|
15
|
+
| `entrypoint.sh` | Executed by the Worker at runtime: `/app/entrypoint.sh <folder>` |
|
|
16
|
+
| `.dockerignore` | Prevents secrets (`.env`, `.git`) and bloat (`node_modules`, `__pycache__`) from entering the image |
|
|
17
|
+
|
|
18
|
+
### Supported Frameworks
|
|
19
|
+
|
|
20
|
+
- **Playwright** (TypeScript / Node.js)
|
|
21
|
+
- **Pytest** (Python)
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# No installation needed — run directly with npx
|
|
27
|
+
npx aac-cli init
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Installation (optional)
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install -g aac-cli
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Initialize AAC integration in your project directory
|
|
40
|
+
cd my-playwright-tests
|
|
41
|
+
aac-cli init
|
|
42
|
+
|
|
43
|
+
# Check version
|
|
44
|
+
aac-cli --version
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## How It Works
|
|
48
|
+
|
|
49
|
+
1. Run `aac-cli init` inside your test project.
|
|
50
|
+
2. Select your framework (Playwright or Pytest).
|
|
51
|
+
3. The CLI generates `Dockerfile`, `entrypoint.sh`, and `.dockerignore`.
|
|
52
|
+
4. Build & push your Docker image.
|
|
53
|
+
5. Enter the image name in the AAC Dashboard.
|
|
54
|
+
|
|
55
|
+
## Development
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm install
|
|
59
|
+
npm run build
|
|
60
|
+
node dist/index.js init
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Release
|
|
64
|
+
|
|
65
|
+
Tag a new version to trigger the CI/CD pipeline:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git tag v1.0.0
|
|
69
|
+
git push origin v1.0.0
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The workflow will build with tsup, publish to npm, and create a GitHub release.
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
MIT
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
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
|
|
3
|
+
|
|
4
|
+
WORKDIR /app
|
|
5
|
+
|
|
6
|
+
COPY package*.json ./
|
|
7
|
+
RUN npm ci
|
|
8
|
+
|
|
9
|
+
COPY . .
|
|
10
|
+
|
|
11
|
+
RUN chmod +x /app/entrypoint.sh
|
|
12
|
+
`,y=`#!/bin/sh
|
|
13
|
+
|
|
14
|
+
FOLDER=$1
|
|
15
|
+
|
|
16
|
+
if [ -f .env ]; then
|
|
17
|
+
echo "Removing local .env to enforce injected configuration..."
|
|
18
|
+
rm .env
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
if [ -z "$FOLDER" ] || [ "$FOLDER" = "all" ]; then
|
|
22
|
+
echo "Running ALL tests..."
|
|
23
|
+
exec npx playwright test
|
|
24
|
+
else
|
|
25
|
+
echo "Running tests in folder: $FOLDER"
|
|
26
|
+
exec npx playwright test "$FOLDER"
|
|
27
|
+
fi
|
|
28
|
+
`,w=`FROM python:3.11-slim
|
|
29
|
+
|
|
30
|
+
WORKDIR /app
|
|
31
|
+
|
|
32
|
+
COPY requirements.txt ./
|
|
33
|
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
34
|
+
|
|
35
|
+
COPY . .
|
|
36
|
+
|
|
37
|
+
RUN chmod +x /app/entrypoint.sh
|
|
38
|
+
`,O=`#!/bin/sh
|
|
39
|
+
|
|
40
|
+
FOLDER=$1
|
|
41
|
+
|
|
42
|
+
if [ -f .env ]; then
|
|
43
|
+
echo "Removing local .env to enforce injected configuration..."
|
|
44
|
+
rm .env
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
if [ -z "$FOLDER" ] || [ "$FOLDER" = "all" ]; then
|
|
48
|
+
echo "Running ALL tests..."
|
|
49
|
+
exec pytest
|
|
50
|
+
else
|
|
51
|
+
echo "Running tests in folder: $FOLDER"
|
|
52
|
+
exec pytest "$FOLDER"
|
|
53
|
+
fi
|
|
54
|
+
`,E=`.git
|
|
55
|
+
.env
|
|
56
|
+
node_modules
|
|
57
|
+
__pycache__
|
|
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();
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@keinar/aac-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Agnostic Automation Center CLI — Prepare any test automation repo for the AAC platform",
|
|
5
|
+
"author": "keinar",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"aac-cli": "./dist/index.cjs"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"dev": "tsup --watch",
|
|
16
|
+
"build": "tsup",
|
|
17
|
+
"typecheck": "tsc --noEmit",
|
|
18
|
+
"prepublishOnly": "npm run build"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@clack/prompts": "^0.9.1",
|
|
22
|
+
"commander": "^13.1.0",
|
|
23
|
+
"picocolors": "^1.1.1"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^22.13.4",
|
|
27
|
+
"tsup": "^8.4.0",
|
|
28
|
+
"typescript": "^5.7.3"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"cli",
|
|
35
|
+
"automation",
|
|
36
|
+
"testing",
|
|
37
|
+
"docker",
|
|
38
|
+
"playwright",
|
|
39
|
+
"pytest",
|
|
40
|
+
"aac"
|
|
41
|
+
],
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://github.com/keinar/aac-cli.git"
|
|
45
|
+
}
|
|
46
|
+
}
|