├── .gitignore
├── .prettierrc
├── CHANGELOG.md
├── LICENSE
├── README.md
├── package-lock.json
├── package.json
├── src
├── cli.ts
├── commands.ts
└── project.ts
├── template-files
└── README.md
└── tsconfig.json
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | .env
3 | .vscode
4 | .idea
5 | .DS_Store
6 | dist
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "semi": true,
3 | "trailingComma": "all",
4 | "singleQuote": true,
5 | "quoteProps": "as-needed",
6 | "printWidth": 120,
7 | "tabWidth": 2,
8 | "bracketSpacing": true,
9 | "arrowParens": "avoid",
10 | "endOfLine": "lf"
11 | }
12 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## [1.7.1] - 2024-09-19
4 |
5 | ### Bug Fixes
6 |
7 | - Fixed issues encountered during the migration from `download-git-repo` to `simple-git` for cloning repositories. This resolves problems related to URL redirection and branch checkout.
8 |
9 | ## [1.7.0] - 2024-09-19
10 |
11 | ### Updated Dependencies
12 |
13 | - Updated all the dependencies to their latest versions.
14 | - Replaced `download-git-repo` with `simple-git` for cloning repositories.
15 |
16 | ## [1.6.6] - 2024-03-26
17 |
18 | ### Bug Fixes
19 |
20 | - **Copy README.md**: Copy the README.md file using node-fetch.
21 |
22 | ## [1.6.1] - 2024-03-26
23 |
24 | ### Bug Fixes
25 |
26 | - **Copy README.md**: Fixed the issue to copy the correct README.md file.
27 |
28 | ## [1.6.0] - 2024-03-26
29 |
30 | ### Features
31 |
32 | - Added a basic `README.md` file to the project. This file includes a link to the Playwright template repository, providing users with additional resources and information about the project structure and usage.
33 |
34 | ### Updated Dependencies
35 |
36 | - Updated all the dependencies to their latest versions.
37 |
38 | ## [0.5.1] - 2024-01-17
39 |
40 | ### Updated Dependencies
41 |
42 | - Updated all the dependencies to their latest versions.
43 |
44 | ## [0.5.0] - 2023-08-26
45 |
46 | ### Features
47 |
48 | - **Windows Support**: Introduced the ability to successfully initialize the repository on Windows systems using the `npm vasu-playwright-ci init` command.
49 |
50 | ## [0.4.2] - 2023-08-23
51 |
52 | ### Improvements
53 |
54 | - **Husky Setup**: Removed the Husky setup process when initializing the framework as a subdirectory, simplifying the initialization process.
55 |
56 | ## [0.4.1] - 2023-08-23
57 |
58 | ### Improvements
59 |
60 | - **Husky Installation**: Enhanced Husky installation to be conditional, installing only if the framework is not a subproject of an existing Git repository. This change improves compatibility and avoids conflicts in various project structures.
61 |
62 | ## [0.4.0] - 2023-08-23
63 |
64 | ### Features
65 |
66 | - **Project Initialization**: Created a new Playwright framework project using the [vasu-playwright-template](https://github.com/vasu31dev/playwright-ts-template).
67 | - **Package.json**: Improved logic for modifying `package.json` as needed.
68 | - **Documentation**: Added comprehensive Readme documentation, including sections for running tests and viewing reports.
69 |
70 | ## [0.3.2] - 2023-08-23
71 |
72 | ### Documentation
73 |
74 | - **Readme**: Enhanced the Readme with prerequisites, refined installation steps, and comprehensive explanations.
75 |
76 | ## [0.3.1] - 2023-08-22
77 |
78 | ### Bug Fixes
79 |
80 | - **Post-Install Script**: Removed the post-install script to avoid potential issues during installation.
81 |
82 | ## [0.3.0] - 2023-08-22
83 |
84 | ### Features
85 |
86 | - **Code Formatting**: Introduced `.prettierrc` and applied formatting to TypeScript files.
87 | - **Logging**: Enhanced console logging for better readability.
88 | - **Git Initialization**: Added logic to initialize as a Git repository only under specific conditions.
89 |
90 | ### Bug Fixes
91 |
92 | - **Git Warning**: Resolved a Git warning related to the initial branch name.
93 |
94 | ## [0.2.2] - 2023-08-22
95 |
96 | ### Improvements
97 |
98 | - **Template Cloning**: Aligned the cloning structure of `vasu-playwright-template` with `vasu-playwright-lib@0.4.4`.
99 |
100 | ## [0.2.1] - 2023-08-21
101 |
102 | ### Bug Fixes
103 |
104 | - **Module Error**: Fixed a "Cannot find Module" error that occurred during project initialization.
105 |
106 | ## [0.2.0] - 2023-08-21
107 |
108 | ### Features
109 |
110 | - **Build System**: Switched from `esbuild` to `tsc` for building the project.
111 | - **Repository Cloning**: Moved from SSH to HTTPS for cloning the repository.
112 | - **Cleanup**: Implemented logic to remove the `temp-repo` directory if present.
113 | - **Git Branch**: Set the default Git branch name to "main."
114 |
115 | ### Documentation
116 |
117 | - **ReadMe**: Updated the ReadMe document with the latest changes.
118 |
119 | ## [0.1.0] - 2023-08-20
120 |
121 | ### Features
122 |
123 | - **Initial Release**: The first stable release of the project.
124 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Vasudeva Annam
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Playwright TypeScript CLI
2 |
3 | | [](https://github.com/vasu31dev/playwright-ts-cli/stargazers) |  |  | [](https://www.npmjs.com/package/vasu-playwright-cli) |
| [vasu31dev@gmail.com](mailto:vasu31dev@gmail.com) |
4 | | :-------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------: |
5 |
6 | ## About
7 |
8 | `playwright-ts-cli` is a powerful command-line tool designed to initialize and update projects with the [Playwright TypeScript template](https://github.com/vasu31dev/playwright-ts-template). It simplifies the process of setting up a new project with specific configurations, dependencies, and structure, allowing developers to kickstart their Playwright testing with ease.
9 |
10 | ## Features
11 |
12 | - **Initialize Project**: Quickly scaffold a new project with predefined Playwright TypeScript configurations, dependencies, and structure.
13 | - **Update Project**: Seamlessly update existing projects with the latest files and configurations from the Playwright TypeScript template.
14 | - **Compatibility**: Works with the [vasu-playwright-utils](https://www.npmjs.com/package/vasu-playwright-utils) library, offering additional utilities and functionalities.
15 |
16 | ## Prerequisites
17 |
18 | Ensure you have the following software installed on your machine:
19 |
20 | - **[npm (v8.0.0 or later)](https://docs.npmjs.com/cli/v9/configuring-npm)**: Package manager for JavaScript, used to install and manage software packages.
21 | - To verify your current version, use the command `npm -v`.
22 | - If npm isn't installed, follow the [npm installation guide](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm).
23 | - **[Node.js (v16.0.0 or later)](https://nodejs.org/en/download)**: JavaScript runtime built on Chrome's V8 JavaScript engine, allowing the execution of JavaScript server-side.
24 | - To verify your current version, use the command `node -v`.
25 | - **[Git](https://git-scm.com/downloads)**: Distributed version control system used to track changes in source code during software development.
26 | - To check if Git is installed, run the command `git --version`.
27 | - If Git isn't installed, download and install it from the [official Git website](https://git-scm.com/downloads).
28 |
29 | ## Installation
30 |
31 | ### 1. Install Node.js
32 |
33 | Before installing the CLI, make sure to have Node.js installed on your system. Here are two ways to install Node.js:
34 |
35 | 1. **Using Official Website**:
36 |
37 | - Visit the [official Node.js website](https://nodejs.org/en/download/).
38 | - Download and install the latest stable version.
39 |
40 | 2. **Using Command Line (nvm)**:
41 | ```bash
42 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
43 | source ~/.nvm/nvm.sh
44 | nvm install --lts
45 | ```
46 |
47 | ### 2. Create a Playwright Test Directory
48 |
49 | ```bash
50 | mkdir playwright-e2e-tests
51 | cd playwright-e2e-tests
52 | ```
53 |
54 | ### 3. Install `vasu-playwright-cli`
55 |
56 | ```bash
57 | npm i -D vasu-playwright-cli
58 | ```
59 |
60 | ## Usage
61 |
62 | ### Initialize a New Project
63 |
64 | Navigate to the desired directory and run:
65 |
66 | ```bash
67 | npx vasu-playwright-cli init
68 | ```
69 |
70 | This command will set up a new project with ready to use Playwright TypeScript framework, including:
71 |
72 | - Setup the Playwright TypeScript framework template with sample tests.
73 | - Create a new `package.json` file with all the necessary dependencies.
74 | - Initializing a new Git repository if neither the current nor parent directory is a Git repository.
75 | - Installing all the npm packages including the playwright utils library which contains playwright helper methods.
76 |
77 | ### Update an Existing Project with future updates
78 |
79 | Navigate to the project directory and run:
80 |
81 | ```bash
82 | npx vasu-playwright-cli update
83 | ```
84 |
85 | This command will update specific files or directories within the project, aligning them with the latest updates to the [Playwright TypeScript template](https://github.com/vasu31dev/playwright-ts-template).
86 |
87 | ### Update Playwright Library
88 |
89 | Keep your Playwright library up to date with the latest playwright utilities which contain the helper methods that are updated regularly:
90 |
91 | ```bash
92 | npm i -D vasu-playwright-utils@latest
93 | ```
94 |
95 | ### Running Tests
96 |
97 | To make sure the project framework is working as expected, you can run the following command to run the sample tests:
98 |
99 | ```bash
100 | npm run test:chromium-headed -- sauce-demo-all-pass.spec.ts
101 | ```
102 |
103 | View the report with:
104 |
105 | ```bash
106 | npx playwright show-report
107 | ```
108 |
109 | ## Issues and Feedback
110 |
111 | If you encounter any issues or have feedback, please [Raise an Issue](https://github.com/vasu31dev/playwright-ts-cli/issues) on GitHub.
112 |
113 | ## Contributing
114 |
115 | We welcome contributions! Feel free to submit a [Pull Request](https://github.com/vasu31dev/playwright-ts-cli/pulls) on GitHub.
116 |
117 | ## License
118 |
119 | This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
120 |
--------------------------------------------------------------------------------
/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vasu-playwright-cli",
3 | "version": "1.7.0",
4 | "lockfileVersion": 3,
5 | "requires": true,
6 | "packages": {
7 | "": {
8 | "name": "vasu-playwright-cli",
9 | "version": "1.7.0",
10 | "license": "MIT",
11 | "dependencies": {
12 | "@types/cross-spawn": "^6.0.6",
13 | "@types/fs-extra": "^11.0.4",
14 | "@types/node": "^22.5.5",
15 | "axios": "^1.7.7",
16 | "commander": "^12.1.0",
17 | "cross-spawn": "^7.0.3",
18 | "fs-extra": "^11.2.0",
19 | "rimraf": "^6.0.1",
20 | "simple-git": "^3.27.0",
21 | "ts-node": "^10.9.2",
22 | "typescript": "5.6.2"
23 | },
24 | "bin": {
25 | "vasu-playwright-cli": "dist/cli.js"
26 | },
27 | "engines": {
28 | "node": ">=18.0.0"
29 | }
30 | },
31 | "node_modules/@cspotcode/source-map-support": {
32 | "version": "0.8.1",
33 | "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
34 | "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
35 | "license": "MIT",
36 | "dependencies": {
37 | "@jridgewell/trace-mapping": "0.3.9"
38 | },
39 | "engines": {
40 | "node": ">=12"
41 | }
42 | },
43 | "node_modules/@isaacs/cliui": {
44 | "version": "8.0.2",
45 | "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
46 | "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==",
47 | "license": "ISC",
48 | "dependencies": {
49 | "string-width": "^5.1.2",
50 | "string-width-cjs": "npm:string-width@^4.2.0",
51 | "strip-ansi": "^7.0.1",
52 | "strip-ansi-cjs": "npm:strip-ansi@^6.0.1",
53 | "wrap-ansi": "^8.1.0",
54 | "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0"
55 | },
56 | "engines": {
57 | "node": ">=12"
58 | }
59 | },
60 | "node_modules/@jridgewell/resolve-uri": {
61 | "version": "3.1.2",
62 | "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
63 | "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
64 | "license": "MIT",
65 | "engines": {
66 | "node": ">=6.0.0"
67 | }
68 | },
69 | "node_modules/@jridgewell/sourcemap-codec": {
70 | "version": "1.5.0",
71 | "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
72 | "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==",
73 | "license": "MIT"
74 | },
75 | "node_modules/@jridgewell/trace-mapping": {
76 | "version": "0.3.9",
77 | "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
78 | "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
79 | "license": "MIT",
80 | "dependencies": {
81 | "@jridgewell/resolve-uri": "^3.0.3",
82 | "@jridgewell/sourcemap-codec": "^1.4.10"
83 | }
84 | },
85 | "node_modules/@kwsites/file-exists": {
86 | "version": "1.1.1",
87 | "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz",
88 | "integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==",
89 | "license": "MIT",
90 | "dependencies": {
91 | "debug": "^4.1.1"
92 | }
93 | },
94 | "node_modules/@kwsites/promise-deferred": {
95 | "version": "1.1.1",
96 | "resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz",
97 | "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==",
98 | "license": "MIT"
99 | },
100 | "node_modules/@pkgjs/parseargs": {
101 | "version": "0.11.0",
102 | "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
103 | "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
104 | "license": "MIT",
105 | "optional": true,
106 | "engines": {
107 | "node": ">=14"
108 | }
109 | },
110 | "node_modules/@tsconfig/node10": {
111 | "version": "1.0.11",
112 | "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz",
113 | "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==",
114 | "license": "MIT"
115 | },
116 | "node_modules/@tsconfig/node12": {
117 | "version": "1.0.11",
118 | "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
119 | "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
120 | "license": "MIT"
121 | },
122 | "node_modules/@tsconfig/node14": {
123 | "version": "1.0.3",
124 | "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
125 | "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
126 | "license": "MIT"
127 | },
128 | "node_modules/@tsconfig/node16": {
129 | "version": "1.0.4",
130 | "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
131 | "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
132 | "license": "MIT"
133 | },
134 | "node_modules/@types/cross-spawn": {
135 | "version": "6.0.6",
136 | "resolved": "https://registry.npmjs.org/@types/cross-spawn/-/cross-spawn-6.0.6.tgz",
137 | "integrity": "sha512-fXRhhUkG4H3TQk5dBhQ7m/JDdSNHKwR2BBia62lhwEIq9xGiQKLxd6LymNhn47SjXhsUEPmxi+PKw2OkW4LLjA==",
138 | "license": "MIT",
139 | "dependencies": {
140 | "@types/node": "*"
141 | }
142 | },
143 | "node_modules/@types/fs-extra": {
144 | "version": "11.0.4",
145 | "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.4.tgz",
146 | "integrity": "sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==",
147 | "license": "MIT",
148 | "dependencies": {
149 | "@types/jsonfile": "*",
150 | "@types/node": "*"
151 | }
152 | },
153 | "node_modules/@types/jsonfile": {
154 | "version": "6.1.4",
155 | "resolved": "https://registry.npmjs.org/@types/jsonfile/-/jsonfile-6.1.4.tgz",
156 | "integrity": "sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==",
157 | "license": "MIT",
158 | "dependencies": {
159 | "@types/node": "*"
160 | }
161 | },
162 | "node_modules/@types/node": {
163 | "version": "22.5.5",
164 | "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.5.tgz",
165 | "integrity": "sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==",
166 | "license": "MIT",
167 | "dependencies": {
168 | "undici-types": "~6.19.2"
169 | }
170 | },
171 | "node_modules/acorn": {
172 | "version": "8.12.1",
173 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz",
174 | "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==",
175 | "license": "MIT",
176 | "bin": {
177 | "acorn": "bin/acorn"
178 | },
179 | "engines": {
180 | "node": ">=0.4.0"
181 | }
182 | },
183 | "node_modules/acorn-walk": {
184 | "version": "8.3.4",
185 | "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz",
186 | "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==",
187 | "license": "MIT",
188 | "dependencies": {
189 | "acorn": "^8.11.0"
190 | },
191 | "engines": {
192 | "node": ">=0.4.0"
193 | }
194 | },
195 | "node_modules/ansi-regex": {
196 | "version": "6.1.0",
197 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz",
198 | "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==",
199 | "license": "MIT",
200 | "engines": {
201 | "node": ">=12"
202 | },
203 | "funding": {
204 | "url": "https://github.com/chalk/ansi-regex?sponsor=1"
205 | }
206 | },
207 | "node_modules/ansi-styles": {
208 | "version": "6.2.1",
209 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz",
210 | "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==",
211 | "license": "MIT",
212 | "engines": {
213 | "node": ">=12"
214 | },
215 | "funding": {
216 | "url": "https://github.com/chalk/ansi-styles?sponsor=1"
217 | }
218 | },
219 | "node_modules/arg": {
220 | "version": "4.1.3",
221 | "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
222 | "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
223 | "license": "MIT"
224 | },
225 | "node_modules/asynckit": {
226 | "version": "0.4.0",
227 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
228 | "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
229 | "license": "MIT"
230 | },
231 | "node_modules/axios": {
232 | "version": "1.7.7",
233 | "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz",
234 | "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==",
235 | "license": "MIT",
236 | "dependencies": {
237 | "follow-redirects": "^1.15.6",
238 | "form-data": "^4.0.0",
239 | "proxy-from-env": "^1.1.0"
240 | }
241 | },
242 | "node_modules/balanced-match": {
243 | "version": "1.0.2",
244 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
245 | "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
246 | "license": "MIT"
247 | },
248 | "node_modules/brace-expansion": {
249 | "version": "2.0.1",
250 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
251 | "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
252 | "license": "MIT",
253 | "dependencies": {
254 | "balanced-match": "^1.0.0"
255 | }
256 | },
257 | "node_modules/color-convert": {
258 | "version": "2.0.1",
259 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
260 | "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
261 | "license": "MIT",
262 | "dependencies": {
263 | "color-name": "~1.1.4"
264 | },
265 | "engines": {
266 | "node": ">=7.0.0"
267 | }
268 | },
269 | "node_modules/color-name": {
270 | "version": "1.1.4",
271 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
272 | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
273 | "license": "MIT"
274 | },
275 | "node_modules/combined-stream": {
276 | "version": "1.0.8",
277 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
278 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
279 | "license": "MIT",
280 | "dependencies": {
281 | "delayed-stream": "~1.0.0"
282 | },
283 | "engines": {
284 | "node": ">= 0.8"
285 | }
286 | },
287 | "node_modules/commander": {
288 | "version": "12.1.0",
289 | "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz",
290 | "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==",
291 | "license": "MIT",
292 | "engines": {
293 | "node": ">=18"
294 | }
295 | },
296 | "node_modules/create-require": {
297 | "version": "1.1.1",
298 | "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
299 | "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
300 | "license": "MIT"
301 | },
302 | "node_modules/cross-spawn": {
303 | "version": "7.0.3",
304 | "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
305 | "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
306 | "license": "MIT",
307 | "dependencies": {
308 | "path-key": "^3.1.0",
309 | "shebang-command": "^2.0.0",
310 | "which": "^2.0.1"
311 | },
312 | "engines": {
313 | "node": ">= 8"
314 | }
315 | },
316 | "node_modules/debug": {
317 | "version": "4.3.7",
318 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
319 | "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
320 | "license": "MIT",
321 | "dependencies": {
322 | "ms": "^2.1.3"
323 | },
324 | "engines": {
325 | "node": ">=6.0"
326 | },
327 | "peerDependenciesMeta": {
328 | "supports-color": {
329 | "optional": true
330 | }
331 | }
332 | },
333 | "node_modules/delayed-stream": {
334 | "version": "1.0.0",
335 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
336 | "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
337 | "license": "MIT",
338 | "engines": {
339 | "node": ">=0.4.0"
340 | }
341 | },
342 | "node_modules/diff": {
343 | "version": "4.0.2",
344 | "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
345 | "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
346 | "license": "BSD-3-Clause",
347 | "engines": {
348 | "node": ">=0.3.1"
349 | }
350 | },
351 | "node_modules/eastasianwidth": {
352 | "version": "0.2.0",
353 | "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
354 | "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
355 | "license": "MIT"
356 | },
357 | "node_modules/emoji-regex": {
358 | "version": "9.2.2",
359 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
360 | "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",
361 | "license": "MIT"
362 | },
363 | "node_modules/follow-redirects": {
364 | "version": "1.15.9",
365 | "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
366 | "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
367 | "funding": [
368 | {
369 | "type": "individual",
370 | "url": "https://github.com/sponsors/RubenVerborgh"
371 | }
372 | ],
373 | "license": "MIT",
374 | "engines": {
375 | "node": ">=4.0"
376 | },
377 | "peerDependenciesMeta": {
378 | "debug": {
379 | "optional": true
380 | }
381 | }
382 | },
383 | "node_modules/foreground-child": {
384 | "version": "3.3.0",
385 | "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz",
386 | "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==",
387 | "license": "ISC",
388 | "dependencies": {
389 | "cross-spawn": "^7.0.0",
390 | "signal-exit": "^4.0.1"
391 | },
392 | "engines": {
393 | "node": ">=14"
394 | },
395 | "funding": {
396 | "url": "https://github.com/sponsors/isaacs"
397 | }
398 | },
399 | "node_modules/form-data": {
400 | "version": "4.0.0",
401 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
402 | "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
403 | "license": "MIT",
404 | "dependencies": {
405 | "asynckit": "^0.4.0",
406 | "combined-stream": "^1.0.8",
407 | "mime-types": "^2.1.12"
408 | },
409 | "engines": {
410 | "node": ">= 6"
411 | }
412 | },
413 | "node_modules/fs-extra": {
414 | "version": "11.2.0",
415 | "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz",
416 | "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==",
417 | "license": "MIT",
418 | "dependencies": {
419 | "graceful-fs": "^4.2.0",
420 | "jsonfile": "^6.0.1",
421 | "universalify": "^2.0.0"
422 | },
423 | "engines": {
424 | "node": ">=14.14"
425 | }
426 | },
427 | "node_modules/glob": {
428 | "version": "11.0.0",
429 | "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.0.tgz",
430 | "integrity": "sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==",
431 | "license": "ISC",
432 | "dependencies": {
433 | "foreground-child": "^3.1.0",
434 | "jackspeak": "^4.0.1",
435 | "minimatch": "^10.0.0",
436 | "minipass": "^7.1.2",
437 | "package-json-from-dist": "^1.0.0",
438 | "path-scurry": "^2.0.0"
439 | },
440 | "bin": {
441 | "glob": "dist/esm/bin.mjs"
442 | },
443 | "engines": {
444 | "node": "20 || >=22"
445 | },
446 | "funding": {
447 | "url": "https://github.com/sponsors/isaacs"
448 | }
449 | },
450 | "node_modules/graceful-fs": {
451 | "version": "4.2.11",
452 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
453 | "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
454 | "license": "ISC"
455 | },
456 | "node_modules/is-fullwidth-code-point": {
457 | "version": "3.0.0",
458 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
459 | "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
460 | "license": "MIT",
461 | "engines": {
462 | "node": ">=8"
463 | }
464 | },
465 | "node_modules/isexe": {
466 | "version": "2.0.0",
467 | "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
468 | "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
469 | "license": "ISC"
470 | },
471 | "node_modules/jackspeak": {
472 | "version": "4.0.1",
473 | "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.1.tgz",
474 | "integrity": "sha512-cub8rahkh0Q/bw1+GxP7aeSe29hHHn2V4m29nnDlvCdlgU+3UGxkZp7Z53jLUdpX3jdTO0nJZUDl3xvbWc2Xog==",
475 | "license": "BlueOak-1.0.0",
476 | "dependencies": {
477 | "@isaacs/cliui": "^8.0.2"
478 | },
479 | "engines": {
480 | "node": "20 || >=22"
481 | },
482 | "funding": {
483 | "url": "https://github.com/sponsors/isaacs"
484 | },
485 | "optionalDependencies": {
486 | "@pkgjs/parseargs": "^0.11.0"
487 | }
488 | },
489 | "node_modules/jsonfile": {
490 | "version": "6.1.0",
491 | "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
492 | "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
493 | "license": "MIT",
494 | "dependencies": {
495 | "universalify": "^2.0.0"
496 | },
497 | "optionalDependencies": {
498 | "graceful-fs": "^4.1.6"
499 | }
500 | },
501 | "node_modules/lru-cache": {
502 | "version": "11.0.1",
503 | "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.1.tgz",
504 | "integrity": "sha512-CgeuL5uom6j/ZVrg7G/+1IXqRY8JXX4Hghfy5YE0EhoYQWvndP1kufu58cmZLNIDKnRhZrXfdS9urVWx98AipQ==",
505 | "license": "ISC",
506 | "engines": {
507 | "node": "20 || >=22"
508 | }
509 | },
510 | "node_modules/make-error": {
511 | "version": "1.3.6",
512 | "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
513 | "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
514 | "license": "ISC"
515 | },
516 | "node_modules/mime-db": {
517 | "version": "1.52.0",
518 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
519 | "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
520 | "license": "MIT",
521 | "engines": {
522 | "node": ">= 0.6"
523 | }
524 | },
525 | "node_modules/mime-types": {
526 | "version": "2.1.35",
527 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
528 | "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
529 | "license": "MIT",
530 | "dependencies": {
531 | "mime-db": "1.52.0"
532 | },
533 | "engines": {
534 | "node": ">= 0.6"
535 | }
536 | },
537 | "node_modules/minimatch": {
538 | "version": "10.0.1",
539 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz",
540 | "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==",
541 | "license": "ISC",
542 | "dependencies": {
543 | "brace-expansion": "^2.0.1"
544 | },
545 | "engines": {
546 | "node": "20 || >=22"
547 | },
548 | "funding": {
549 | "url": "https://github.com/sponsors/isaacs"
550 | }
551 | },
552 | "node_modules/minipass": {
553 | "version": "7.1.2",
554 | "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
555 | "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
556 | "license": "ISC",
557 | "engines": {
558 | "node": ">=16 || 14 >=14.17"
559 | }
560 | },
561 | "node_modules/ms": {
562 | "version": "2.1.3",
563 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
564 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
565 | "license": "MIT"
566 | },
567 | "node_modules/package-json-from-dist": {
568 | "version": "1.0.0",
569 | "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz",
570 | "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==",
571 | "license": "BlueOak-1.0.0"
572 | },
573 | "node_modules/path-key": {
574 | "version": "3.1.1",
575 | "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
576 | "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
577 | "license": "MIT",
578 | "engines": {
579 | "node": ">=8"
580 | }
581 | },
582 | "node_modules/path-scurry": {
583 | "version": "2.0.0",
584 | "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz",
585 | "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==",
586 | "license": "BlueOak-1.0.0",
587 | "dependencies": {
588 | "lru-cache": "^11.0.0",
589 | "minipass": "^7.1.2"
590 | },
591 | "engines": {
592 | "node": "20 || >=22"
593 | },
594 | "funding": {
595 | "url": "https://github.com/sponsors/isaacs"
596 | }
597 | },
598 | "node_modules/proxy-from-env": {
599 | "version": "1.1.0",
600 | "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
601 | "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
602 | "license": "MIT"
603 | },
604 | "node_modules/rimraf": {
605 | "version": "6.0.1",
606 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.0.1.tgz",
607 | "integrity": "sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A==",
608 | "license": "ISC",
609 | "dependencies": {
610 | "glob": "^11.0.0",
611 | "package-json-from-dist": "^1.0.0"
612 | },
613 | "bin": {
614 | "rimraf": "dist/esm/bin.mjs"
615 | },
616 | "engines": {
617 | "node": "20 || >=22"
618 | },
619 | "funding": {
620 | "url": "https://github.com/sponsors/isaacs"
621 | }
622 | },
623 | "node_modules/shebang-command": {
624 | "version": "2.0.0",
625 | "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
626 | "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
627 | "license": "MIT",
628 | "dependencies": {
629 | "shebang-regex": "^3.0.0"
630 | },
631 | "engines": {
632 | "node": ">=8"
633 | }
634 | },
635 | "node_modules/shebang-regex": {
636 | "version": "3.0.0",
637 | "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
638 | "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
639 | "license": "MIT",
640 | "engines": {
641 | "node": ">=8"
642 | }
643 | },
644 | "node_modules/signal-exit": {
645 | "version": "4.1.0",
646 | "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
647 | "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
648 | "license": "ISC",
649 | "engines": {
650 | "node": ">=14"
651 | },
652 | "funding": {
653 | "url": "https://github.com/sponsors/isaacs"
654 | }
655 | },
656 | "node_modules/simple-git": {
657 | "version": "3.27.0",
658 | "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.27.0.tgz",
659 | "integrity": "sha512-ivHoFS9Yi9GY49ogc6/YAi3Fl9ROnF4VyubNylgCkA+RVqLaKWnDSzXOVzya8csELIaWaYNutsEuAhZrtOjozA==",
660 | "license": "MIT",
661 | "dependencies": {
662 | "@kwsites/file-exists": "^1.1.1",
663 | "@kwsites/promise-deferred": "^1.1.1",
664 | "debug": "^4.3.5"
665 | },
666 | "funding": {
667 | "type": "github",
668 | "url": "https://github.com/steveukx/git-js?sponsor=1"
669 | }
670 | },
671 | "node_modules/string-width": {
672 | "version": "5.1.2",
673 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
674 | "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
675 | "license": "MIT",
676 | "dependencies": {
677 | "eastasianwidth": "^0.2.0",
678 | "emoji-regex": "^9.2.2",
679 | "strip-ansi": "^7.0.1"
680 | },
681 | "engines": {
682 | "node": ">=12"
683 | },
684 | "funding": {
685 | "url": "https://github.com/sponsors/sindresorhus"
686 | }
687 | },
688 | "node_modules/string-width-cjs": {
689 | "name": "string-width",
690 | "version": "4.2.3",
691 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
692 | "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
693 | "license": "MIT",
694 | "dependencies": {
695 | "emoji-regex": "^8.0.0",
696 | "is-fullwidth-code-point": "^3.0.0",
697 | "strip-ansi": "^6.0.1"
698 | },
699 | "engines": {
700 | "node": ">=8"
701 | }
702 | },
703 | "node_modules/string-width-cjs/node_modules/ansi-regex": {
704 | "version": "5.0.1",
705 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
706 | "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
707 | "license": "MIT",
708 | "engines": {
709 | "node": ">=8"
710 | }
711 | },
712 | "node_modules/string-width-cjs/node_modules/emoji-regex": {
713 | "version": "8.0.0",
714 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
715 | "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
716 | "license": "MIT"
717 | },
718 | "node_modules/string-width-cjs/node_modules/strip-ansi": {
719 | "version": "6.0.1",
720 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
721 | "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
722 | "license": "MIT",
723 | "dependencies": {
724 | "ansi-regex": "^5.0.1"
725 | },
726 | "engines": {
727 | "node": ">=8"
728 | }
729 | },
730 | "node_modules/strip-ansi": {
731 | "version": "7.1.0",
732 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz",
733 | "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==",
734 | "license": "MIT",
735 | "dependencies": {
736 | "ansi-regex": "^6.0.1"
737 | },
738 | "engines": {
739 | "node": ">=12"
740 | },
741 | "funding": {
742 | "url": "https://github.com/chalk/strip-ansi?sponsor=1"
743 | }
744 | },
745 | "node_modules/strip-ansi-cjs": {
746 | "name": "strip-ansi",
747 | "version": "6.0.1",
748 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
749 | "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
750 | "license": "MIT",
751 | "dependencies": {
752 | "ansi-regex": "^5.0.1"
753 | },
754 | "engines": {
755 | "node": ">=8"
756 | }
757 | },
758 | "node_modules/strip-ansi-cjs/node_modules/ansi-regex": {
759 | "version": "5.0.1",
760 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
761 | "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
762 | "license": "MIT",
763 | "engines": {
764 | "node": ">=8"
765 | }
766 | },
767 | "node_modules/ts-node": {
768 | "version": "10.9.2",
769 | "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
770 | "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
771 | "license": "MIT",
772 | "dependencies": {
773 | "@cspotcode/source-map-support": "^0.8.0",
774 | "@tsconfig/node10": "^1.0.7",
775 | "@tsconfig/node12": "^1.0.7",
776 | "@tsconfig/node14": "^1.0.0",
777 | "@tsconfig/node16": "^1.0.2",
778 | "acorn": "^8.4.1",
779 | "acorn-walk": "^8.1.1",
780 | "arg": "^4.1.0",
781 | "create-require": "^1.1.0",
782 | "diff": "^4.0.1",
783 | "make-error": "^1.1.1",
784 | "v8-compile-cache-lib": "^3.0.1",
785 | "yn": "3.1.1"
786 | },
787 | "bin": {
788 | "ts-node": "dist/bin.js",
789 | "ts-node-cwd": "dist/bin-cwd.js",
790 | "ts-node-esm": "dist/bin-esm.js",
791 | "ts-node-script": "dist/bin-script.js",
792 | "ts-node-transpile-only": "dist/bin-transpile.js",
793 | "ts-script": "dist/bin-script-deprecated.js"
794 | },
795 | "peerDependencies": {
796 | "@swc/core": ">=1.2.50",
797 | "@swc/wasm": ">=1.2.50",
798 | "@types/node": "*",
799 | "typescript": ">=2.7"
800 | },
801 | "peerDependenciesMeta": {
802 | "@swc/core": {
803 | "optional": true
804 | },
805 | "@swc/wasm": {
806 | "optional": true
807 | }
808 | }
809 | },
810 | "node_modules/typescript": {
811 | "version": "5.6.2",
812 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz",
813 | "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==",
814 | "license": "Apache-2.0",
815 | "bin": {
816 | "tsc": "bin/tsc",
817 | "tsserver": "bin/tsserver"
818 | },
819 | "engines": {
820 | "node": ">=14.17"
821 | }
822 | },
823 | "node_modules/undici-types": {
824 | "version": "6.19.8",
825 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
826 | "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
827 | "license": "MIT"
828 | },
829 | "node_modules/universalify": {
830 | "version": "2.0.1",
831 | "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
832 | "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",
833 | "license": "MIT",
834 | "engines": {
835 | "node": ">= 10.0.0"
836 | }
837 | },
838 | "node_modules/v8-compile-cache-lib": {
839 | "version": "3.0.1",
840 | "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
841 | "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
842 | "license": "MIT"
843 | },
844 | "node_modules/which": {
845 | "version": "2.0.2",
846 | "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
847 | "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
848 | "license": "ISC",
849 | "dependencies": {
850 | "isexe": "^2.0.0"
851 | },
852 | "bin": {
853 | "node-which": "bin/node-which"
854 | },
855 | "engines": {
856 | "node": ">= 8"
857 | }
858 | },
859 | "node_modules/wrap-ansi": {
860 | "version": "8.1.0",
861 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",
862 | "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
863 | "license": "MIT",
864 | "dependencies": {
865 | "ansi-styles": "^6.1.0",
866 | "string-width": "^5.0.1",
867 | "strip-ansi": "^7.0.1"
868 | },
869 | "engines": {
870 | "node": ">=12"
871 | },
872 | "funding": {
873 | "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
874 | }
875 | },
876 | "node_modules/wrap-ansi-cjs": {
877 | "name": "wrap-ansi",
878 | "version": "7.0.0",
879 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
880 | "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
881 | "license": "MIT",
882 | "dependencies": {
883 | "ansi-styles": "^4.0.0",
884 | "string-width": "^4.1.0",
885 | "strip-ansi": "^6.0.0"
886 | },
887 | "engines": {
888 | "node": ">=10"
889 | },
890 | "funding": {
891 | "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
892 | }
893 | },
894 | "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": {
895 | "version": "5.0.1",
896 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
897 | "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
898 | "license": "MIT",
899 | "engines": {
900 | "node": ">=8"
901 | }
902 | },
903 | "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": {
904 | "version": "4.3.0",
905 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
906 | "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
907 | "license": "MIT",
908 | "dependencies": {
909 | "color-convert": "^2.0.1"
910 | },
911 | "engines": {
912 | "node": ">=8"
913 | },
914 | "funding": {
915 | "url": "https://github.com/chalk/ansi-styles?sponsor=1"
916 | }
917 | },
918 | "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": {
919 | "version": "8.0.0",
920 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
921 | "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
922 | "license": "MIT"
923 | },
924 | "node_modules/wrap-ansi-cjs/node_modules/string-width": {
925 | "version": "4.2.3",
926 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
927 | "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
928 | "license": "MIT",
929 | "dependencies": {
930 | "emoji-regex": "^8.0.0",
931 | "is-fullwidth-code-point": "^3.0.0",
932 | "strip-ansi": "^6.0.1"
933 | },
934 | "engines": {
935 | "node": ">=8"
936 | }
937 | },
938 | "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": {
939 | "version": "6.0.1",
940 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
941 | "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
942 | "license": "MIT",
943 | "dependencies": {
944 | "ansi-regex": "^5.0.1"
945 | },
946 | "engines": {
947 | "node": ">=8"
948 | }
949 | },
950 | "node_modules/yn": {
951 | "version": "3.1.1",
952 | "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
953 | "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
954 | "license": "MIT",
955 | "engines": {
956 | "node": ">=6"
957 | }
958 | }
959 | }
960 | }
961 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vasu-playwright-cli",
3 | "version": "1.7.1",
4 | "description": "Playwright TypeScript CLI to initialize/update with sample Playwright tests, framework setup and utilities",
5 | "repository": {
6 | "type": "git",
7 | "url": "git+https://github.com/vasu31dev/playwright-ts-cli.git"
8 | },
9 | "homepage": "https://github.com/vasu31dev/playwright-ts-template#readme",
10 | "bugs": {
11 | "url": "https://github.com/vasu31dev/playwright-ts-cli/issues"
12 | },
13 | "author": {
14 | "name": "Vasudeva Annam",
15 | "email": "vasu31dev@gmail.com"
16 | },
17 | "engines": {
18 | "node": ">=18.0.0"
19 | },
20 | "main": "./dist/cli.js",
21 | "bin": {
22 | "vasu-playwright-cli": "dist/cli.js"
23 | },
24 | "keywords": [
25 | "playwright",
26 | "typescript",
27 | "cli",
28 | "framework",
29 | "template"
30 | ],
31 | "license": "MIT",
32 | "publishConfig": {
33 | "access": "public"
34 | },
35 | "files": [
36 | "dist"
37 | ],
38 | "scripts": {
39 | "start": "ts-node ./index.ts",
40 | "clean": "rimraf dist",
41 | "ready": "rimraf dist node_modules package-lock.json && npm i",
42 | "prebuild": "npm run clean",
43 | "build": "tsc",
44 | "watch": "npm run build -- --watch",
45 | "prepublishOnly": "npm run build",
46 | "link": "npm run build && npm link",
47 | "test": "playwright test"
48 | },
49 | "dependencies": {
50 | "@types/cross-spawn": "^6.0.6",
51 | "@types/fs-extra": "^11.0.4",
52 | "@types/node": "^22.5.5",
53 | "axios": "^1.7.7",
54 | "commander": "^12.1.0",
55 | "cross-spawn": "^7.0.3",
56 | "fs-extra": "^11.2.0",
57 | "rimraf": "^6.0.1",
58 | "simple-git": "^3.27.0",
59 | "ts-node": "^10.9.2",
60 | "typescript": "5.6.2"
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/cli.ts:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | import { Command } from 'commander';
3 | import { initProject, updateProject } from './project';
4 |
5 | const program = new Command();
6 |
7 | program.command('init').description('Initialize a new project').action(initProject);
8 | program.command('update').description('Update the project').action(updateProject);
9 |
10 | program.parse(process.argv);
11 |
--------------------------------------------------------------------------------
/src/commands.ts:
--------------------------------------------------------------------------------
1 | import spawn from 'cross-spawn';
2 |
3 | export function runCommand(command: string, args: string[], description: string): Promise {
4 | return new Promise((resolve, reject) => {
5 | const child = spawn(command, args, { stdio: 'inherit' });
6 |
7 | child.on('close', code => {
8 | if (code !== 0) {
9 | console.error(`${description} exited with code ${code}`);
10 | reject(new Error(`${description} failed`));
11 | } else {
12 | console.log(`${description} completed successfully!`);
13 | resolve();
14 | }
15 | });
16 |
17 | child.on('error', error => {
18 | console.error(`Failed to start child process: ${error}`);
19 | reject(error);
20 | });
21 | });
22 | }
23 |
--------------------------------------------------------------------------------
/src/project.ts:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | import * as fs from 'fs-extra';
3 | import * as path from 'path';
4 | import { runCommand } from './commands';
5 | import { exec } from 'child_process';
6 | import axios from 'axios';
7 | import simpleGit from 'simple-git';
8 |
9 | const git = simpleGit();
10 |
11 | const REPO_URL = 'https://github.com/vasu31dev/playwright-ts-template.git';
12 | const REPO_BRANCH = 'main';
13 | const TEMP_REPO_DIR = 'temp-repo';
14 | const README_PATH = 'template-files/README.md';
15 | const DOWNLOAD_URL = 'https://raw.githubusercontent.com/vasu31dev/playwright-ts-cli/main/template-files/README.md';
16 | const DESTINATION_PATH = path.join(process.cwd(), 'README.md');
17 |
18 | // Define the fields to modify in package.json
19 | const MODIFY_PACKAGE_JSON_FIELDS = {
20 | name: 'playwright-e2e-tests',
21 | repository: '',
22 | author: '',
23 | exclude: ['homepage', 'bugs'],
24 | };
25 |
26 | export async function initProject() {
27 | try {
28 | if (fs.existsSync(TEMP_REPO_DIR)) {
29 | fs.removeSync(TEMP_REPO_DIR);
30 | }
31 | await downloadRepo(REPO_URL, REPO_BRANCH, TEMP_REPO_DIR); // Clone the Playwright-template project into a temp directory
32 | console.log('Playwright-template project cloned successfully.');
33 | const isSubdirectory = await checkAndInitGit();
34 | copyEntireProject(TEMP_REPO_DIR, process.cwd(), isSubdirectory); // Copy the entire TEMP_REPO_DIR directory except README.md file and docs folder
35 | await downloadFile(DOWNLOAD_URL, DESTINATION_PATH).catch(error => console.error('Error downloading file:', error)); // Download README.md file
36 | modifyPackageJson(process.cwd(), isSubdirectory);
37 | fs.removeSync(TEMP_REPO_DIR); // Remove the temp directory
38 | console.log('Copied cloned files.');
39 |
40 | await runCommand('npm', ['install'], 'Running npm install...');
41 | } catch (error) {
42 | console.error('Project initialization failed. See error details below:');
43 | console.error('Error details:', error);
44 | }
45 | }
46 |
47 | export function updateProject() {
48 | // Define the files and directories to update
49 | const filesAndDirsToUpdate: any[] = [
50 | // Add the paths to the files or directories you want to update
51 | ];
52 |
53 | // Update each file or directory
54 | filesAndDirsToUpdate.forEach(item => {
55 | // You can add the logic to update the files or directories here
56 | // Example: fs.copySync(path.join(__dirname, item), path.join(process.cwd(), item), { overwrite: true });
57 | });
58 |
59 | console.log('Project update completed successfully.');
60 | }
61 |
62 | async function downloadRepo(repo: string, branch: string, destination: string): Promise {
63 | try {
64 | await git.clone(repo, destination);
65 | await git.cwd(destination).checkout(branch);
66 | console.log(`Repository cloned to ${destination} and checked out to branch ${branch}`);
67 | } catch (error) {
68 | console.error('Failed to clone repository:', error);
69 | throw error;
70 | }
71 | }
72 |
73 | async function checkAndInitGit() {
74 | return new Promise(resolve => {
75 | // Check if the current directory is inside a Git work tree
76 | exec('git rev-parse --is-inside-work-tree', async (error, stdout) => {
77 | if (error || stdout.trim() !== 'true') {
78 | // Check if the current directory is a subdirectory of another directory
79 | exec('git rev-parse --show-toplevel', async (subDirError, topLevelDir) => {
80 | if (subDirError || !topLevelDir) {
81 | console.log('No existing Git repository detected. Initializing a new Git repository...');
82 | try {
83 | await runCommand('git', ['init', '-b', 'main'], 'Initializing Git repository...');
84 | resolve(false);
85 | } catch (initError) {
86 | console.error('Failed to initialize Git repository:', initError);
87 | resolve(false);
88 | }
89 | } else {
90 | console.log('Project is installed as a subdirectory. Skipping Git initialization.');
91 | resolve(true);
92 | }
93 | });
94 | } else {
95 | console.log('An existing Git repository was detected. Skipping Git initialization.');
96 | resolve(true);
97 | }
98 | });
99 | });
100 | }
101 |
102 | function copyEntireProject(source: string, destination: string, isSubdirectory: boolean) {
103 | fs.copySync(source, destination, {
104 | filter: src => {
105 | const baseName = path.basename(src);
106 | if (baseName === 'README.md' || baseName === 'docs') {
107 | return false; // Exclude README.md file and docs folder
108 | }
109 | return isSubdirectory ? !src.includes('.husky') : true; // Exclude .husky folder if the repo is copied as a subdirectory
110 | },
111 | });
112 | }
113 |
114 | async function downloadFile(url: string, outputPath: string) {
115 | try {
116 | const response = await axios.get(url, { responseType: 'arraybuffer' });
117 | fs.writeFileSync(outputPath, response.data);
118 | console.log(`File downloaded successfully to ${outputPath}`);
119 | } catch (error) {
120 | console.error('Error downloading file:', error);
121 | }
122 | }
123 |
124 | function modifyPackageJson(destination: string, isSubdirectory: boolean) {
125 | const packageJsonPath = path.join(destination, 'package.json');
126 | const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
127 |
128 | // Modify the fields as per requirements
129 | packageJson.name = MODIFY_PACKAGE_JSON_FIELDS.name;
130 | packageJson.repository = MODIFY_PACKAGE_JSON_FIELDS.repository;
131 | packageJson.author = MODIFY_PACKAGE_JSON_FIELDS.author;
132 | MODIFY_PACKAGE_JSON_FIELDS.exclude.forEach(field => delete packageJson[field]);
133 |
134 | // Remove the "prepare": "husky install" script if the repo is copied as a subdirectory
135 | if (isSubdirectory && packageJson.scripts && packageJson.scripts.prepare) {
136 | delete packageJson.scripts.prepare;
137 | }
138 |
139 | fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
140 | }
--------------------------------------------------------------------------------
/template-files/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # 🚀 Elevate Your Automation: Redefining the Future of Testing, Where Precision Meets Efficiency.
4 |
5 | ## Playwright TypeScript Framework: "Your One-Stop Solution for Web (Desktop & Mobile), API, and Electron Automation Testing"
6 |
7 | Welcome to the easy-to-use Playwright TypeScript Framework for Web (Desktop & Mobile), APIs, and Electron Desktop applications. Built with Playwright and TypeScript, its great for everyone from testers to business analysts, making their testing smoother and faster. You can start writing tests quickly without the fuss.
8 |
9 | For more detailed information about the framework, key features, tools, installation, utilities, usage, test execution and reports, please visit the complete documenation [here](https://github.com/vasu31dev/playwright-ts-template#-elevate-your-automation-redefining-the-future-of-testing-where-precision-meets-efficiency).
10 |
11 | ## Getting Started
12 |
13 | ### Tools
14 |
15 | Tools at high level. For more details, please visit the complete documentation [here](https://github.com/vasu31dev/playwright-ts-template#tools--frameworks)
16 | - **[TypeScript](https://www.typescriptlang.org/)**: JavaScript programming language for enhancing code quality and understandability.
17 | - **[Playwright Test](https://playwright.dev/docs/test-configuration)**: A modern end-to-end testing framework, facilitating test creation, execution, fixture management and report generation.
18 | - **[Playwright Assertions](https://playwright.dev/docs/assertions)**: Provides robust assertion capabilities for validating tests.
19 | - **[Allure Report](https://docs.qameta.io/allure/)**: A flexible and visually appealing reporting tool, offering clarity on test results.
20 | - **[ESLint](https://eslint.org/)**: Checks JavaScript and TypeScript code for mistakes and helps to maintain code consistency.
21 | - **[Prettier](https://prettier.io/)**: Code formatter, ensuring consistent code style across the project.
22 | - **[Logger (Winston)](https://www.npmjs.com/package/winston)**: Logging library, producing both file-based logs and color-coded console outputs.
23 | - **[Husky](https://www.npmjs.com/package/husky)**: Manages Git hooks to enforce quality checks before commits.
24 | - **[Github Actions](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions)**: A CI/CD platform integrated with GitHub, automating workflows like test execution on pull requests.
25 |
26 | ### Prerequisites
27 |
28 | Ensure you have the following software installed on your machine. For more information about the sofware and on how to check the versions installed, please visit the complete documentation [here](https://github.com/vasu31dev/playwright-ts-template#prerequisites).
29 |
30 | - **[npm (v8.0.0 or later)](https://docs.npmjs.com/cli/v9/configuring-npm)**:
31 | - If npm isn't installed or the version installed is not the supported version, please follow the [npm installation guide](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm).
32 | - **[Node.js (v16.0.0 or later)](https://nodejs.org/en/download)**:
33 | - if Node.js isn't installed, download and install it from the title link provided.
34 | - **[Git](https://git-scm.com/downloads)**:
35 | - If Git isn't installed, download and install it from the [official Git website](https://git-scm.com/downloads).
36 | - **VSCode Plugins**:
37 | - **[Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)**: A tool for consistent code formatting. Install it directly from the title link provided.
38 | - **[ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)**: A tool for identifying and fixing linting issues. Install it directly from the title link provided.
39 | - **VSCode Settings**: Apply the following configurations in your VSCode settings (use `Cmd+` for Mac and `Ctrl+` for Windows , to access the settings window):
40 | - **Quote Style**: Set `typescript.preferences.quoteStyle` to `single` for consistent quote usage across your code.
41 | - **Format On Save**: Enable `Format On Save Mode` and set it to `file`.
42 |
43 | ### Installation
44 |
45 | To begin with your project, start the installation process either by command-line instructions or by doing it step-by-step manually.
46 |
47 | #### 1) CLI Installation
48 | This is the preferred method of installation, as it automatically installs all the necessary dependencies, libraries, playwright browsers, winston logger and husky pre-commit hook.
49 |
50 | The installation steps are below:
51 |
52 | - Install Node.js
53 | Node.js installation can be done via direct from the website or from CLI. Find the [Node.js installation steps](https://github.com/vasu31dev/playwright-ts-cli#1-install-nodejs) here.
54 |
55 | - Create a Playwright Test Directory
56 | ```bash
57 | mkdir playwright-e2e-tests
58 | cd playwright-e2e-tests
59 | ```
60 | - Install vasu-playwright-cli
61 | ```bash
62 | npm i -D vasu-playwright-cli
63 | ```
64 | This step installs all the above mentioned dependencies, libraries, playwright browsers, logger and pre-commit hook.
65 |
66 | #### Project Initialisation
67 |
68 | Run the below command to initialise a project
69 | ```bash
70 | npx vasu-playwright-cli init
71 | ```
72 | This command will set up a new project with ready to use Playwright TypeScript framework including:
73 | - Setup the Playwright TypeScript framework template with sample tests.
74 | - Create a new `package.json` file with all the necessary dependencies.
75 | - Initializing a new Git repository if neither the current nor parent directory is a Git repository.
76 | - Installing all the npm packages including the playwright utils library which contains playwright helper methods.
77 |
78 | #### 2) Manual Installation
79 | This process involves step-by-step installation of all the dependencies, libraries and playwright browsers manually.
80 |
81 | - Clone the repository:
82 | ```bash
83 | git clone https://github.com/vasu31dev/playwright-ts-template.git
84 | ```
85 |
86 | - Navigate to the project directory:
87 | ```bash
88 | cd playwright-ts-template
89 | ```
90 |
91 | - Install the dependencies:
92 | ```bash
93 | npm install
94 | ```
95 | - Install the Playwright browsers
96 | ```bash
97 | npx playwright install
98 | ```
99 |
100 | ### Project Update Guide
101 |
102 | It is important to keep your project up to date with the latest changes.
103 |
104 | #### 1) Project Installed Through CLI
105 | For the project installed through CLI, please follow the below steps for the project updates:
106 |
107 | - Navigate to the project directory and run:
108 | ```bash
109 | npx vasu-playwright-cli update
110 | ```
111 | This command will update specific files or directories within the project, aligning them with the latest updates to the Playwright TypeScript template.
112 |
113 | - Update Playwright Library
114 | ```bash
115 | npm i -D vasu-playwright-utils@latest
116 | ```
117 | This command keeps your Playwright library up to date with the latest playwright utilities which contain the helper methods that are updated regularly.
118 |
119 | #### 2) Project Installed Manually
120 |
121 | To pull the latest changes and install the latest packages, follow these steps:
122 |
123 | - Pull the latest changes
124 | ```bash
125 | git pull origin
126 | ```
127 | Replace `` with the name of the branch that you want to update.
128 | - Install the latest packages
129 | ```bash
130 | npm install
131 | ```
132 | - If there are dependency errors while installing packages, you can remove the node_modules folder and install the packages again. This step can help resolve potential conflicts or issues with dependencies.
133 | ```bash
134 | rm -rf node_modules
135 | npm install
136 | ```
137 | - Update Playwright browsers as needed
138 | ```bash
139 | npx playwright install
140 | ```
141 | ### Framework and Usage
142 |
143 | Our framework comprises of several utility functions that simplifies page set up, element identification, actions on elements and finally asserting results. These functions help to put together page objects and write tests simply, letting you focus on making effective test cases.
144 |
145 | For more detailed information on framework set up, creating page objects and writing tests in spec files, please visit the complete documentation [here](https://github.com/vasu31dev/playwright-ts-template#project-structure).
146 |
147 | ### Test Execution
148 |
149 | - To make sure the project framework is working as expected, you can run the following command to run the sample tests in headed chromium browser:
150 | ```bash
151 | npm run test:chromium-headed -- sauce-demo-all-pass.spec.ts
152 | ```
153 | - Once your own tests are build, you can choose either to run just one test, a group of tests, or all of them. Tests can be run on one browser or many at the same time. Normally, tests are run in headless mode, and you can see the results right in the terminal.
154 | - Tests can be executed via the `Playwright Test for VSCode` plugin or through the command-line interface.
155 | - For more information on how to execute tests with configured settings in `playwright.config.ts` file, and the scripts defined in `package.json` file with various options for browser headed or headless, reruns, workers please visit the complete documentation for [Executing tests](https://github.com/vasu31dev/playwright-ts-template#executing-tests).
156 |
157 | ### Reports
158 | - Report for the sample tests executed in above step can be viewed with:
159 | ```bash
160 | npx playwright show-report
161 | ```
162 |
163 | - In general, Playwright Test comes with different built-in reporters for various needs, and it also support to integrate your own custom reports.
164 |
165 | - For more information on report viewing via command-line or configured script in package.json file, please visit the complete documentation [here](https://github.com/vasu31dev/playwright-ts-template#report-generation-and-viewing).
166 |
167 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es6",
4 | "module": "CommonJS",
5 | "strict": true,
6 | "esModuleInterop": true,
7 | "allowSyntheticDefaultImports": true,
8 | "moduleResolution": "node",
9 | "skipLibCheck": true,
10 | "forceConsistentCasingInFileNames": true,
11 | "baseUrl": ".",
12 | "outDir": "dist",
13 | "rootDir": "src"
14 | },
15 | "include": ["src/**/*.ts", "src/**/*.d.ts"]
16 | }
17 |
--------------------------------------------------------------------------------