semmet-angular 0.43.0 → 0.44.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 CHANGED
@@ -21,6 +21,7 @@ ng add semmet-angular
21
21
  ng generate semmet-angular:button cta-button
22
22
  ng generate semmet-angular:list-group feature-list
23
23
  ng generate semmet-angular:block section-card
24
+ ng generate semmet-angular:e2e
24
25
  ng generate semmet-angular:ci
25
26
  ng generate semmet-angular:docker
26
27
  ng generate semmet-angular:deploy
@@ -41,7 +42,7 @@ Playwright e2e specs are opt-in:
41
42
  ng generate semmet-angular:button cta-button --e2e
42
43
  ```
43
44
 
44
- Only pass `--e2e` when the consuming app has Playwright configured. The current roadmap is to move Playwright setup into an explicit schematic instead of doing it by default in `ng add`.
45
+ Only pass `--e2e` when the consuming app has Playwright configured run `ng generate semmet-angular:e2e` first if it doesn't. `ng add semmet-angular` no longer configures Playwright by default; e2e infrastructure is opt-in and explicit.
45
46
 
46
47
  ## Components vs Starter Blocks
47
48
 
@@ -152,6 +153,7 @@ Example after generating `feature-list`:
152
153
  ## Delivery Schematics
153
154
 
154
155
  ```bash
156
+ ng generate semmet-angular:e2e
155
157
  ng generate semmet-angular:ci
156
158
  ng generate semmet-angular:docker
157
159
  ng generate semmet-angular:deploy
@@ -159,6 +161,7 @@ ng generate semmet-angular:deploy
159
161
 
160
162
  The delivery schematics are explicit and optional:
161
163
 
164
+ - `e2e` configures Playwright (dependency, npm scripts, `playwright.config.ts`) and folds `npm run e2e` into an existing `verify` script.
162
165
  - `ci` generates a GitHub Actions workflow from existing package scripts.
163
166
  - `docker` generates Docker/Nginx packaging files for an Angular SPA.
164
167
  - `deploy` generates minimal deployment configuration for supported platforms.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semmet-angular",
3
- "version": "0.43.0",
3
+ "version": "0.44.0",
4
4
  "description": "Accessible UI delivery dev kit in Angular: schematics that generate components, compositions, tests, and delivery scaffolds as native editable Angular code.",
5
5
  "publisher": "danilodevsilva",
6
6
  "license": "MIT",
@@ -2,10 +2,15 @@
2
2
  "$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
3
3
  "schematics": {
4
4
  "ng-add": {
5
- "description": "Configures Semmet Angular in an Angular workspace, including Playwright e2e support.",
5
+ "description": "Configures Semmet Angular in an Angular workspace.",
6
6
  "factory": "./ng-add/index#ngAdd",
7
7
  "schema": "./ng-add/schema.json"
8
8
  },
9
+ "e2e": {
10
+ "description": "Configures Playwright e2e support for an Angular workspace.",
11
+ "factory": "./e2e/index#e2e",
12
+ "schema": "./e2e/schema.json"
13
+ },
9
14
  "ci": {
10
15
  "description": "Generates a GitHub Actions CI workflow using existing package scripts.",
11
16
  "factory": "./ci/index#ci",
@@ -0,0 +1,2 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ export declare function e2e(): Rule;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.e2e = e2e;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const tasks_1 = require("@angular-devkit/schematics/tasks");
6
+ const PLAYWRIGHT_VERSION = '^1.61.1';
7
+ const TYPES_NODE_VERSION = '^20.11.0';
8
+ function e2e() {
9
+ return (0, schematics_1.chain)([addPlaywrightDependency, addPackageScripts, extendVerificationScript, addPlaywrightConfig, installPackages]);
10
+ }
11
+ function addPlaywrightDependency(tree) {
12
+ const packageJson = readJson(tree, '/package.json');
13
+ const devDependencies = packageJson.devDependencies ?? {};
14
+ packageJson.devDependencies = {
15
+ ...devDependencies,
16
+ '@playwright/test': devDependencies['@playwright/test'] ?? PLAYWRIGHT_VERSION,
17
+ '@types/node': devDependencies['@types/node'] ?? TYPES_NODE_VERSION,
18
+ };
19
+ writeJson(tree, '/package.json', packageJson);
20
+ }
21
+ function addPackageScripts(tree) {
22
+ const packageJson = readJson(tree, '/package.json');
23
+ const scripts = packageJson.scripts ?? {};
24
+ packageJson.scripts = {
25
+ ...scripts,
26
+ e2e: scripts.e2e ?? 'playwright test',
27
+ 'e2e:ui': scripts['e2e:ui'] ?? 'playwright test --ui',
28
+ 'e2e:report': scripts['e2e:report'] ?? 'playwright show-report',
29
+ };
30
+ writeJson(tree, '/package.json', packageJson);
31
+ }
32
+ /** Folds `npm run e2e` into a `verify` script that `ng add` may have already created without it. */
33
+ function extendVerificationScript(tree) {
34
+ const packageJson = readJson(tree, '/package.json');
35
+ const scripts = packageJson.scripts ?? {};
36
+ if (!scripts.verify || scripts.verify.includes('npm run e2e')) {
37
+ return;
38
+ }
39
+ packageJson.scripts = {
40
+ ...scripts,
41
+ verify: `${scripts.verify} && npm run e2e`,
42
+ };
43
+ writeJson(tree, '/package.json', packageJson);
44
+ }
45
+ function addPlaywrightConfig(tree) {
46
+ if (tree.exists('/playwright.config.ts')) {
47
+ return;
48
+ }
49
+ tree.create('/playwright.config.ts', `/// <reference types="node" />
50
+
51
+ import { defineConfig, devices } from '@playwright/test';
52
+
53
+ export default defineConfig({
54
+ testDir: './src',
55
+ testMatch: '**/*.e2e-spec.ts',
56
+ fullyParallel: true,
57
+ forbidOnly: !!process.env['CI'],
58
+ retries: process.env['CI'] ? 2 : 0,
59
+ workers: process.env['CI'] ? 1 : undefined,
60
+ reporter: 'html',
61
+ use: {
62
+ baseURL: 'http://localhost:4200',
63
+ trace: 'on-first-retry',
64
+ },
65
+ webServer: {
66
+ command: 'npm run start',
67
+ url: 'http://localhost:4200',
68
+ reuseExistingServer: !process.env['CI'],
69
+ timeout: 120 * 1000,
70
+ },
71
+ projects: [
72
+ {
73
+ name: 'chromium',
74
+ use: { ...devices['Desktop Chrome'] },
75
+ },
76
+ ],
77
+ });
78
+ `);
79
+ }
80
+ function installPackages(_tree, context) {
81
+ context.addTask(new tasks_1.NodePackageInstallTask());
82
+ }
83
+ function readJson(tree, path) {
84
+ const content = tree.readText(path);
85
+ return JSON.parse(content);
86
+ }
87
+ function writeJson(tree, path, value) {
88
+ tree.overwrite(path, `${JSON.stringify(value, null, 2)}\n`);
89
+ }
90
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAMA,kBAEC;AARD,2DAAiF;AACjF,4DAA0E;AAE1E,MAAM,kBAAkB,GAAG,SAAS,CAAC;AACrC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAEtC,SAAgB,GAAG;IACjB,OAAO,IAAA,kBAAK,EAAC,CAAC,uBAAuB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,eAAe,CAAC,CAAC,CAAC;AAC7H,CAAC;AAED,SAAS,uBAAuB,CAAC,IAAU;IACzC,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IACpD,MAAM,eAAe,GAAG,WAAW,CAAC,eAAe,IAAI,EAAE,CAAC;IAE1D,WAAW,CAAC,eAAe,GAAG;QAC5B,GAAG,eAAe;QAClB,kBAAkB,EAAE,eAAe,CAAC,kBAAkB,CAAC,IAAI,kBAAkB;QAC7E,aAAa,EAAE,eAAe,CAAC,aAAa,CAAC,IAAI,kBAAkB;KACpE,CAAC;IAEF,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAU;IACnC,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IACpD,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC;IAE1C,WAAW,CAAC,OAAO,GAAG;QACpB,GAAG,OAAO;QACV,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,iBAAiB;QACrC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,sBAAsB;QACrD,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,IAAI,wBAAwB;KAChE,CAAC;IAEF,SAAS,CAAC,IAA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;AAC9D,CAAC"}
@@ -0,0 +1,106 @@
1
+ import { Rule, SchematicContext, Tree, chain } from '@angular-devkit/schematics';
2
+ import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
3
+
4
+ const PLAYWRIGHT_VERSION = '^1.61.1';
5
+ const TYPES_NODE_VERSION = '^20.11.0';
6
+
7
+ export function e2e(): Rule {
8
+ return chain([addPlaywrightDependency, addPackageScripts, extendVerificationScript, addPlaywrightConfig, installPackages]);
9
+ }
10
+
11
+ function addPlaywrightDependency(tree: Tree): void {
12
+ const packageJson = readJson(tree, '/package.json');
13
+ const devDependencies = packageJson.devDependencies ?? {};
14
+
15
+ packageJson.devDependencies = {
16
+ ...devDependencies,
17
+ '@playwright/test': devDependencies['@playwright/test'] ?? PLAYWRIGHT_VERSION,
18
+ '@types/node': devDependencies['@types/node'] ?? TYPES_NODE_VERSION,
19
+ };
20
+
21
+ writeJson(tree, '/package.json', packageJson);
22
+ }
23
+
24
+ function addPackageScripts(tree: Tree): void {
25
+ const packageJson = readJson(tree, '/package.json');
26
+ const scripts = packageJson.scripts ?? {};
27
+
28
+ packageJson.scripts = {
29
+ ...scripts,
30
+ e2e: scripts.e2e ?? 'playwright test',
31
+ 'e2e:ui': scripts['e2e:ui'] ?? 'playwright test --ui',
32
+ 'e2e:report': scripts['e2e:report'] ?? 'playwright show-report',
33
+ };
34
+
35
+ writeJson(tree, '/package.json', packageJson);
36
+ }
37
+
38
+ /** Folds `npm run e2e` into a `verify` script that `ng add` may have already created without it. */
39
+ function extendVerificationScript(tree: Tree): void {
40
+ const packageJson = readJson(tree, '/package.json');
41
+ const scripts = packageJson.scripts ?? {};
42
+
43
+ if (!scripts.verify || scripts.verify.includes('npm run e2e')) {
44
+ return;
45
+ }
46
+
47
+ packageJson.scripts = {
48
+ ...scripts,
49
+ verify: `${scripts.verify} && npm run e2e`,
50
+ };
51
+
52
+ writeJson(tree, '/package.json', packageJson);
53
+ }
54
+
55
+ function addPlaywrightConfig(tree: Tree): void {
56
+ if (tree.exists('/playwright.config.ts')) {
57
+ return;
58
+ }
59
+
60
+ tree.create(
61
+ '/playwright.config.ts',
62
+ `/// <reference types="node" />
63
+
64
+ import { defineConfig, devices } from '@playwright/test';
65
+
66
+ export default defineConfig({
67
+ testDir: './src',
68
+ testMatch: '**/*.e2e-spec.ts',
69
+ fullyParallel: true,
70
+ forbidOnly: !!process.env['CI'],
71
+ retries: process.env['CI'] ? 2 : 0,
72
+ workers: process.env['CI'] ? 1 : undefined,
73
+ reporter: 'html',
74
+ use: {
75
+ baseURL: 'http://localhost:4200',
76
+ trace: 'on-first-retry',
77
+ },
78
+ webServer: {
79
+ command: 'npm run start',
80
+ url: 'http://localhost:4200',
81
+ reuseExistingServer: !process.env['CI'],
82
+ timeout: 120 * 1000,
83
+ },
84
+ projects: [
85
+ {
86
+ name: 'chromium',
87
+ use: { ...devices['Desktop Chrome'] },
88
+ },
89
+ ],
90
+ });
91
+ `
92
+ );
93
+ }
94
+
95
+ function installPackages(_tree: Tree, context: SchematicContext): void {
96
+ context.addTask(new NodePackageInstallTask());
97
+ }
98
+
99
+ function readJson(tree: Tree, path: string): Record<string, any> {
100
+ const content = tree.readText(path);
101
+ return JSON.parse(content) as Record<string, any>;
102
+ }
103
+
104
+ function writeJson(tree: Tree, path: string, value: Record<string, any>): void {
105
+ tree.overwrite(path, `${JSON.stringify(value, null, 2)}\n`);
106
+ }
@@ -0,0 +1,2 @@
1
+ export interface Schema {
2
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["schema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "SemmetAngularE2e",
4
+ "title": "Semmet Angular E2E Options Schema",
5
+ "type": "object",
6
+ "description": "Configures Playwright e2e support for an Angular workspace.",
7
+ "additionalProperties": false,
8
+ "properties": {}
9
+ }
@@ -0,0 +1 @@
1
+ export interface Schema {}
@@ -1,3 +1,3 @@
1
1
  import { Rule } from '@angular-devkit/schematics';
2
2
  import { Schema } from './schema';
3
- export declare function ngAdd(options: Schema): Rule;
3
+ export declare function ngAdd(_options: Schema): Rule;
@@ -1,40 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ngAdd = ngAdd;
4
- const schematics_1 = require("@angular-devkit/schematics");
5
- const tasks_1 = require("@angular-devkit/schematics/tasks");
6
- const PLAYWRIGHT_VERSION = '^1.61.1';
7
- const TYPES_NODE_VERSION = '^20.11.0';
8
- function ngAdd(options) {
9
- const skipRule = () => undefined;
10
- return (0, schematics_1.chain)([
11
- options.skipE2e ? skipRule : addPlaywrightDependency,
12
- options.skipE2e ? skipRule : addPackageScripts,
13
- addDeliveryVerificationScript,
14
- options.skipE2e ? skipRule : addPlaywrightConfig,
15
- options.skipE2e ? skipRule : installPackages,
16
- ]);
17
- }
18
- function addPlaywrightDependency(tree) {
19
- const packageJson = readJson(tree, '/package.json');
20
- const devDependencies = packageJson.devDependencies ?? {};
21
- packageJson.devDependencies = {
22
- ...devDependencies,
23
- '@playwright/test': devDependencies['@playwright/test'] ?? PLAYWRIGHT_VERSION,
24
- '@types/node': devDependencies['@types/node'] ?? TYPES_NODE_VERSION,
25
- };
26
- writeJson(tree, '/package.json', packageJson);
27
- }
28
- function addPackageScripts(tree) {
29
- const packageJson = readJson(tree, '/package.json');
30
- const scripts = packageJson.scripts ?? {};
31
- packageJson.scripts = {
32
- ...scripts,
33
- e2e: scripts.e2e ?? 'playwright test',
34
- 'e2e:ui': scripts['e2e:ui'] ?? 'playwright test --ui',
35
- 'e2e:report': scripts['e2e:report'] ?? 'playwright show-report',
36
- };
37
- writeJson(tree, '/package.json', packageJson);
4
+ function ngAdd(_options) {
5
+ return addDeliveryVerificationScript;
38
6
  }
39
7
  function addDeliveryVerificationScript(tree) {
40
8
  const packageJson = readJson(tree, '/package.json');
@@ -57,44 +25,6 @@ function addDeliveryVerificationScript(tree) {
57
25
  };
58
26
  writeJson(tree, '/package.json', packageJson);
59
27
  }
60
- function addPlaywrightConfig(tree) {
61
- if (tree.exists('/playwright.config.ts')) {
62
- return;
63
- }
64
- tree.create('/playwright.config.ts', `/// <reference types="node" />
65
-
66
- import { defineConfig, devices } from '@playwright/test';
67
-
68
- export default defineConfig({
69
- testDir: './src',
70
- testMatch: '**/*.e2e-spec.ts',
71
- fullyParallel: true,
72
- forbidOnly: !!process.env['CI'],
73
- retries: process.env['CI'] ? 2 : 0,
74
- workers: process.env['CI'] ? 1 : undefined,
75
- reporter: 'html',
76
- use: {
77
- baseURL: 'http://localhost:4200',
78
- trace: 'on-first-retry',
79
- },
80
- webServer: {
81
- command: 'npm run start',
82
- url: 'http://localhost:4200',
83
- reuseExistingServer: !process.env['CI'],
84
- timeout: 120 * 1000,
85
- },
86
- projects: [
87
- {
88
- name: 'chromium',
89
- use: { ...devices['Desktop Chrome'] },
90
- },
91
- ],
92
- });
93
- `);
94
- }
95
- function installPackages(_tree, context) {
96
- context.addTask(new tasks_1.NodePackageInstallTask());
97
- }
98
28
  function readJson(tree, path) {
99
29
  const content = tree.readText(path);
100
30
  return JSON.parse(content);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAOA,sBAUC;AAjBD,2DAAiF;AACjF,4DAA0E;AAG1E,MAAM,kBAAkB,GAAG,SAAS,CAAC;AACrC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAEtC,SAAgB,KAAK,CAAC,OAAe;IACnC,MAAM,QAAQ,GAAS,GAAG,EAAE,CAAC,SAAS,CAAC;IAEvC,OAAO,IAAA,kBAAK,EAAC;QACX,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,uBAAuB;QACpD,OAAO,CAAC,OAAO,C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EF,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,QAAQ,CAAC,IAAU,EAAE,IAAY;IACxC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAwB,CAAC;AACpD,CAAC;AAED,SAAS,SAAS,CAAC,IAAU,EAAE,IAAY,EAAE,KAA0B;IACrE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC"}
@@ -1,47 +1,8 @@
1
- import { Rule, SchematicContext, Tree, chain } from '@angular-devkit/schematics';
2
- import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
1
+ import { Rule, Tree } from '@angular-devkit/schematics';
3
2
  import { Schema } from './schema';
4
3
 
5
- const PLAYWRIGHT_VERSION = '^1.61.1';
6
- const TYPES_NODE_VERSION = '^20.11.0';
7
-
8
- export function ngAdd(options: Schema): Rule {
9
- const skipRule: Rule = () => undefined;
10
-
11
- return chain([
12
- options.skipE2e ? skipRule : addPlaywrightDependency,
13
- options.skipE2e ? skipRule : addPackageScripts,
14
- addDeliveryVerificationScript,
15
- options.skipE2e ? skipRule : addPlaywrightConfig,
16
- options.skipE2e ? skipRule : installPackages,
17
- ]);
18
- }
19
-
20
- function addPlaywrightDependency(tree: Tree): void {
21
- const packageJson = readJson(tree, '/package.json');
22
- const devDependencies = packageJson.devDependencies ?? {};
23
-
24
- packageJson.devDependencies = {
25
- ...devDependencies,
26
- '@playwright/test': devDependencies['@playwright/test'] ?? PLAYWRIGHT_VERSION,
27
- '@types/node': devDependencies['@types/node'] ?? TYPES_NODE_VERSION,
28
- };
29
-
30
- writeJson(tree, '/package.json', packageJson);
31
- }
32
-
33
- function addPackageScripts(tree: Tree): void {
34
- const packageJson = readJson(tree, '/package.json');
35
- const scripts = packageJson.scripts ?? {};
36
-
37
- packageJson.scripts = {
38
- ...scripts,
39
- e2e: scripts.e2e ?? 'playwright test',
40
- 'e2e:ui': scripts['e2e:ui'] ?? 'playwright test --ui',
41
- 'e2e:report': scripts['e2e:report'] ?? 'playwright show-report',
42
- };
43
-
44
- writeJson(tree, '/package.json', packageJson);
4
+ export function ngAdd(_options: Schema): Rule {
5
+ return addDeliveryVerificationScript;
45
6
  }
46
7
 
47
8
  function addDeliveryVerificationScript(tree: Tree): void {
@@ -71,50 +32,6 @@ function addDeliveryVerificationScript(tree: Tree): void {
71
32
  writeJson(tree, '/package.json', packageJson);
72
33
  }
73
34
 
74
- function addPlaywrightConfig(tree: Tree): void {
75
- if (tree.exists('/playwright.config.ts')) {
76
- return;
77
- }
78
-
79
- tree.create(
80
- '/playwright.config.ts',
81
- `/// <reference types="node" />
82
-
83
- import { defineConfig, devices } from '@playwright/test';
84
-
85
- export default defineConfig({
86
- testDir: './src',
87
- testMatch: '**/*.e2e-spec.ts',
88
- fullyParallel: true,
89
- forbidOnly: !!process.env['CI'],
90
- retries: process.env['CI'] ? 2 : 0,
91
- workers: process.env['CI'] ? 1 : undefined,
92
- reporter: 'html',
93
- use: {
94
- baseURL: 'http://localhost:4200',
95
- trace: 'on-first-retry',
96
- },
97
- webServer: {
98
- command: 'npm run start',
99
- url: 'http://localhost:4200',
100
- reuseExistingServer: !process.env['CI'],
101
- timeout: 120 * 1000,
102
- },
103
- projects: [
104
- {
105
- name: 'chromium',
106
- use: { ...devices['Desktop Chrome'] },
107
- },
108
- ],
109
- });
110
- `
111
- );
112
- }
113
-
114
- function installPackages(_tree: Tree, context: SchematicContext): void {
115
- context.addTask(new NodePackageInstallTask());
116
- }
117
-
118
35
  function readJson(tree: Tree, path: string): Record<string, any> {
119
36
  const content = tree.readText(path);
120
37
  return JSON.parse(content) as Record<string, any>;
@@ -1,5 +1,4 @@
1
1
  export interface Schema {
2
2
  project?: string;
3
3
  saveDev?: boolean;
4
- skipE2e?: boolean;
5
4
  }
@@ -11,11 +11,6 @@
11
11
  "description": "The name of the project to configure.",
12
12
  "$default": { "$source": "projectName" }
13
13
  },
14
- "skipE2e": {
15
- "type": "boolean",
16
- "default": false,
17
- "description": "Skip Playwright e2e setup."
18
- },
19
14
  "saveDev": {
20
15
  "type": "boolean",
21
16
  "default": false,
@@ -1,5 +1,4 @@
1
1
  export interface Schema {
2
2
  project?: string;
3
3
  saveDev?: boolean;
4
- skipE2e?: boolean;
5
4
  }