create-playwright-pom-start 1.0.0 → 1.0.2

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 (3) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +61 -10
  3. package/package.json +15 -1
package/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Gabriel Dali
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # create-playwright-pom-start
2
2
 
3
- Scaffold a **Playwright Page Object Model (POM)** project with one command.
3
+ Scaffold a **Playwright Page Object Model (POM)** structure for test projects in **JavaScript** or **TypeScript** with one command. Creates a base page, optional page classes, folders, global setup/teardown, and installs Playwright when needed.
4
4
 
5
5
  ## How to start
6
6
 
@@ -10,19 +10,70 @@ From an empty folder (or where you want the project):
10
10
  npm init playwright-pom-start
11
11
  ```
12
12
 
13
+ Or with a project name:
14
+
15
+ ```bash
16
+ npm init playwright-pom-start my-playwright-project
17
+ ```
18
+
13
19
  You’ll be prompted for:
14
20
 
15
- 1. **Language** — JavaScript or TypeScript (arrow keys + Enter)
16
- 2. **Project name** — if you didn’t pass it (e.g. `npm init playwright-pom-start my-project`)
17
- 3. **Page names** — optional; space-separated, or Enter to skip
18
- 4. **Playwright** — installed automatically if missing
21
+ 1. **Language** — JavaScript or TypeScript (arrow keys + Enter). Default is JS.
22
+ 2. **Page names** — optional; space-separated, or Enter to skip. Names are normalized to PascalCase + `Page` (e.g. `dashboard` `DashboardPage`).
23
+ 3. **Playwright** — installed automatically if missing.
24
+
25
+ **Requirements:** Node.js **v18** or later. Supported on **Windows**, **macOS**, and **Linux**.
26
+
27
+ ## Alternative: install then run
28
+
29
+ ```bash
30
+ npm i playwright-pom
31
+ npx playwright-pom
32
+ ```
33
+
34
+ Or scaffold in a subfolder: `npx playwright-pom my-project`
35
+
36
+ ## Flow
37
+
38
+ - If Playwright is **already installed** in the folder, the CLI detects JS or TS and skips the language question.
39
+ - Templates are copied, folders and placeholder files are created.
40
+ - If Playwright isn’t installed yet, the CLI runs `npm init playwright@latest -- --quiet --lang=js` or `--lang=ts` to match the chosen language.
41
+ - If the folder already has a scaffold (e.g. `pages/BasePage.js` or `pages/BasePage.ts`), the CLI prints **"Project already set up. Skipping."** and may run `npm install`.
42
+
43
+ ## Generated structure
44
+
45
+ ```
46
+ <project>/
47
+ ├── pages/
48
+ │ ├── BasePage.js or BasePage.ts
49
+ │ └── ... (any pages you added)
50
+ ├── utils/
51
+ │ ├── logger.js or logger.ts
52
+ │ └── auth/
53
+ ├── fixtures/
54
+ ├── constants/
55
+ ├── states/ # in .gitignore
56
+ ├── global-setup.js or .ts
57
+ ├── global-teardown.js or .ts
58
+ └── .gitignore # includes states
59
+ ```
60
+
61
+ - **BasePage** — Shared class with the Playwright `page`; other pages extend it.
62
+ - **utils/logger** — Placeholder for your logger.
63
+ - **utils/auth** — For auth-related helpers.
64
+ - **global-setup** / **global-teardown** — Default async functions; wire them in `playwright.config.*` if you use them.
65
+
66
+ ## Page naming
19
67
 
20
- Then you get a ready-to-use structure: `pages/`, `utils/`, `fixtures/`, base page, global setup/teardown, and Playwright config.
68
+ - Letters only (no numbers, `.js`/`.ts`, or symbols).
69
+ - Converted to PascalCase + `Page` (e.g. `checkout` → `CheckoutPage`, `userProfile` → `UserProfilePage`).
70
+ - Invalid tokens and existing files are skipped (reported in the console).
21
71
 
22
- **Requirements:** Node.js **v18** or later.
72
+ ## Repository & docs
23
73
 
24
- ## More options
74
+ - **GitHub:** [github.com/GabrielDali/pom-pw-js](https://github.com/GabrielDali/playwright-pom)
75
+ - **Main package (playwright-pom):** [npmjs.com/package/playwright-pom](https://www.npmjs.com/package/playwright-pom)
25
76
 
26
- - **Install the CLI and run it:** `npm i playwright-pom` then `npx playwright-pom` or `npx playwright-pom my-project`
27
- - **Full docs:** [playwright-pom](https://www.npmjs.com/package/playwright-pom) on npm
77
+ ## License
28
78
 
79
+ MIT
package/package.json CHANGED
@@ -1,7 +1,17 @@
1
1
  {
2
2
  "name": "create-playwright-pom-start",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Scaffold a Playwright POM project (run via npm init playwright-pom-start)",
5
+ "keywords": [
6
+ "playwright",
7
+ "cli",
8
+ "scaffold",
9
+ "generator",
10
+ "qa",
11
+ "page-object-model",
12
+ "pom",
13
+ "npm-init"
14
+ ],
5
15
  "type": "module",
6
16
  "engines": {
7
17
  "node": ">=18"
@@ -15,6 +25,10 @@
15
25
  ],
16
26
  "author": "Gabriel Dali <https://www.linkedin.com/in/gabriel-dali-qa/>",
17
27
  "license": "MIT",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/GabrielDali/pom-pw-js.git"
31
+ },
18
32
  "dependencies": {
19
33
  "playwright-pom": "1.0.0-beta.3"
20
34
  }