semmet-angular 0.18.0 → 0.20.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semmet-angular",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "Angular schematics that generate real, ARIA-conformant standalone components (Accordion, Tabs, Dialog, Disclosure, Tooltip...) with signals-based state and keyboard interaction built in.",
5
5
  "publisher": "danilodevsilva",
6
6
  "license": "MIT",
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
3
3
  "schematics": {
4
+ "ng-add": {
5
+ "description": "Configures Semmet Angular in an Angular workspace, including Playwright e2e support.",
6
+ "factory": "./ng-add/index#ngAdd",
7
+ "schema": "./ng-add/schema.json"
8
+ },
4
9
  "accordion": {
5
10
  "description": "Generates a standalone Angular Accordion component following the W3C ARIA Authoring Practices Guide.",
6
11
  "factory": "./accordion/index#accordion",
@@ -0,0 +1,3 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { Schema } from './schema';
3
+ export declare function ngAdd(options: Schema): Rule;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
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
+ options.skipE2e ? skipRule : addPlaywrightConfig,
14
+ options.skipE2e ? skipRule : installPackages,
15
+ ]);
16
+ }
17
+ function addPlaywrightDependency(tree) {
18
+ const packageJson = readJson(tree, '/package.json');
19
+ const devDependencies = packageJson.devDependencies ?? {};
20
+ packageJson.devDependencies = {
21
+ ...devDependencies,
22
+ '@playwright/test': devDependencies['@playwright/test'] ?? PLAYWRIGHT_VERSION,
23
+ '@types/node': devDependencies['@types/node'] ?? TYPES_NODE_VERSION,
24
+ };
25
+ writeJson(tree, '/package.json', packageJson);
26
+ }
27
+ function addPackageScripts(tree) {
28
+ const packageJson = readJson(tree, '/package.json');
29
+ const scripts = packageJson.scripts ?? {};
30
+ packageJson.scripts = {
31
+ ...scripts,
32
+ e2e: scripts.e2e ?? 'playwright test',
33
+ 'e2e:ui': scripts['e2e:ui'] ?? 'playwright test --ui',
34
+ 'e2e:report': scripts['e2e:report'] ?? 'playwright show-report',
35
+ };
36
+ writeJson(tree, '/package.json', packageJson);
37
+ }
38
+ function addPlaywrightConfig(tree) {
39
+ if (tree.exists('/playwright.config.ts')) {
40
+ return;
41
+ }
42
+ tree.create('/playwright.config.ts', `/// <reference types="node" />
43
+
44
+ import { defineConfig, devices } from '@playwright/test';
45
+
46
+ export default defineConfig({
47
+ testDir: './src',
48
+ testMatch: '**/*.e2e-spec.ts',
49
+ fullyParallel: true,
50
+ forbidOnly: !!process.env['CI'],
51
+ retries: process.env['CI'] ? 2 : 0,
52
+ workers: process.env['CI'] ? 1 : undefined,
53
+ reporter: 'html',
54
+ use: {
55
+ baseURL: 'http://localhost:4200',
56
+ trace: 'on-first-retry',
57
+ },
58
+ webServer: {
59
+ command: 'npm run start',
60
+ url: 'http://localhost:4200',
61
+ reuseExistingServer: !process.env['CI'],
62
+ timeout: 120 * 1000,
63
+ },
64
+ projects: [
65
+ {
66
+ name: 'chromium',
67
+ use: { ...devices['Desktop Chrome'] },
68
+ },
69
+ ],
70
+ });
71
+ `);
72
+ }
73
+ function installPackages(_tree, context) {
74
+ context.addTask(new tasks_1.NodePackageInstallTask());
75
+ }
76
+ function readJson(tree, path) {
77
+ const content = tree.readText(path);
78
+ return JSON.parse(content);
79
+ }
80
+ function writeJson(tree, path, value) {
81
+ tree.overwrite(path, `${JSON.stringify(value, null, 2)}\n`);
82
+ }
83
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAOA,sBASC;AAhBD,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,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,iBAAiB;QAC9C,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,mBAAmB;QAChD,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe;KAC7C,CAAC,CAAC;AACL,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,IAAI,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAU;IACrC,IAAI,IAAI,CAAC,MAAM,CAAC,uBAAuB,CAAC,EAAE,CAAC;QACzC,OAAO;IACT,CAAC;IAED,IAAI,CAAC,MAAM,CACT,uBAAuB,EACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BH,CACE,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,KAAW,EAAE,OAAyB;IAC7D,OAAO,CAAC,OAAO,CAAC,IAAI,8BAAsB,EAAE,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"}
@@ -0,0 +1,97 @@
1
+ import { Rule, SchematicContext, Tree, chain } from '@angular-devkit/schematics';
2
+ import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
3
+ import { Schema } from './schema';
4
+
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
+ options.skipE2e ? skipRule : addPlaywrightConfig,
15
+ options.skipE2e ? skipRule : installPackages,
16
+ ]);
17
+ }
18
+
19
+ function addPlaywrightDependency(tree: Tree): void {
20
+ const packageJson = readJson(tree, '/package.json');
21
+ const devDependencies = packageJson.devDependencies ?? {};
22
+
23
+ packageJson.devDependencies = {
24
+ ...devDependencies,
25
+ '@playwright/test': devDependencies['@playwright/test'] ?? PLAYWRIGHT_VERSION,
26
+ '@types/node': devDependencies['@types/node'] ?? TYPES_NODE_VERSION,
27
+ };
28
+
29
+ writeJson(tree, '/package.json', packageJson);
30
+ }
31
+
32
+ function addPackageScripts(tree: Tree): void {
33
+ const packageJson = readJson(tree, '/package.json');
34
+ const scripts = packageJson.scripts ?? {};
35
+
36
+ packageJson.scripts = {
37
+ ...scripts,
38
+ e2e: scripts.e2e ?? 'playwright test',
39
+ 'e2e:ui': scripts['e2e:ui'] ?? 'playwright test --ui',
40
+ 'e2e:report': scripts['e2e:report'] ?? 'playwright show-report',
41
+ };
42
+
43
+ writeJson(tree, '/package.json', packageJson);
44
+ }
45
+
46
+ function addPlaywrightConfig(tree: Tree): void {
47
+ if (tree.exists('/playwright.config.ts')) {
48
+ return;
49
+ }
50
+
51
+ tree.create(
52
+ '/playwright.config.ts',
53
+ `/// <reference types="node" />
54
+
55
+ import { defineConfig, devices } from '@playwright/test';
56
+
57
+ export default defineConfig({
58
+ testDir: './src',
59
+ testMatch: '**/*.e2e-spec.ts',
60
+ fullyParallel: true,
61
+ forbidOnly: !!process.env['CI'],
62
+ retries: process.env['CI'] ? 2 : 0,
63
+ workers: process.env['CI'] ? 1 : undefined,
64
+ reporter: 'html',
65
+ use: {
66
+ baseURL: 'http://localhost:4200',
67
+ trace: 'on-first-retry',
68
+ },
69
+ webServer: {
70
+ command: 'npm run start',
71
+ url: 'http://localhost:4200',
72
+ reuseExistingServer: !process.env['CI'],
73
+ timeout: 120 * 1000,
74
+ },
75
+ projects: [
76
+ {
77
+ name: 'chromium',
78
+ use: { ...devices['Desktop Chrome'] },
79
+ },
80
+ ],
81
+ });
82
+ `
83
+ );
84
+ }
85
+
86
+ function installPackages(_tree: Tree, context: SchematicContext): void {
87
+ context.addTask(new NodePackageInstallTask());
88
+ }
89
+
90
+ function readJson(tree: Tree, path: string): Record<string, any> {
91
+ const content = tree.readText(path);
92
+ return JSON.parse(content) as Record<string, any>;
93
+ }
94
+
95
+ function writeJson(tree: Tree, path: string, value: Record<string, any>): void {
96
+ tree.overwrite(path, `${JSON.stringify(value, null, 2)}\n`);
97
+ }
@@ -0,0 +1,4 @@
1
+ export interface Schema {
2
+ project?: string;
3
+ skipE2e?: boolean;
4
+ }
@@ -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,20 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "SemmetAngularNgAdd",
4
+ "title": "Semmet Angular ng-add Options Schema",
5
+ "type": "object",
6
+ "description": "Configures Semmet Angular in an Angular workspace.",
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "project": {
10
+ "type": "string",
11
+ "description": "The name of the project to configure.",
12
+ "$default": { "$source": "projectName" }
13
+ },
14
+ "skipE2e": {
15
+ "type": "boolean",
16
+ "default": false,
17
+ "description": "Skip Playwright e2e setup."
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,4 @@
1
+ export interface Schema {
2
+ project?: string;
3
+ skipE2e?: boolean;
4
+ }