semmet-angular 0.32.0 → 0.34.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 +1 -1
- package/src/ci/index.js +19 -3
- package/src/ci/index.js.map +1 -1
- package/src/ci/index.ts +32 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semmet-angular",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "Accessible UI Delivery Kit for Angular: schematics that generate ARIA-conformant standalone components with styling, keyboard behavior, unit tests, and Playwright e2e smoke tests.",
|
|
5
5
|
"publisher": "danilodevsilva",
|
|
6
6
|
"license": "MIT",
|
package/src/ci/index.js
CHANGED
|
@@ -11,7 +11,7 @@ function ci(options) {
|
|
|
11
11
|
const packageJson = readJson(tree, '/package.json');
|
|
12
12
|
const scripts = packageJson.scripts ?? {};
|
|
13
13
|
const packageManager = detectPackageManager(tree);
|
|
14
|
-
const workflow = buildWorkflow(packageManager, Object.keys(scripts), tree.exists('/package-lock.json'));
|
|
14
|
+
const workflow = buildWorkflow(packageManager, Object.keys(scripts), hasPlaywrightSetup(packageJson), tree.exists('/package-lock.json'));
|
|
15
15
|
if (tree.exists(workflowPath)) {
|
|
16
16
|
tree.overwrite(workflowPath, workflow);
|
|
17
17
|
}
|
|
@@ -36,11 +36,17 @@ function detectPackageManager(tree) {
|
|
|
36
36
|
}
|
|
37
37
|
return 'npm';
|
|
38
38
|
}
|
|
39
|
-
function buildWorkflow(packageManager, scriptNames, hasNpmLockfile) {
|
|
39
|
+
function buildWorkflow(packageManager, scriptNames, shouldInstallPlaywright, hasNpmLockfile) {
|
|
40
40
|
const commands = getPackageManagerCommands(packageManager, hasNpmLockfile);
|
|
41
41
|
const runSteps = buildRunSteps(commands, scriptNames);
|
|
42
42
|
const setupPackageManagerStep = commands.setupStep ? `${commands.setupStep}\n` : '';
|
|
43
43
|
const cacheConfig = commands.cache ? ` cache: ${commands.cache}\n` : '';
|
|
44
|
+
const playwrightInstallStep = shouldInstallPlaywright
|
|
45
|
+
? `
|
|
46
|
+
- name: Install Playwright browsers
|
|
47
|
+
run: ${commands.playwrightInstall}
|
|
48
|
+
`
|
|
49
|
+
: '';
|
|
44
50
|
return `name: CI
|
|
45
51
|
|
|
46
52
|
on:
|
|
@@ -59,11 +65,12 @@ jobs:
|
|
|
59
65
|
${setupPackageManagerStep} - name: Setup Node
|
|
60
66
|
uses: actions/setup-node@v4
|
|
61
67
|
with:
|
|
62
|
-
node-version:
|
|
68
|
+
node-version: 24
|
|
63
69
|
${cacheConfig}
|
|
64
70
|
|
|
65
71
|
- name: Install dependencies
|
|
66
72
|
run: ${commands.install}
|
|
73
|
+
${playwrightInstallStep}
|
|
67
74
|
${runSteps}
|
|
68
75
|
`;
|
|
69
76
|
}
|
|
@@ -71,6 +78,7 @@ function getPackageManagerCommands(packageManager, hasNpmLockfile) {
|
|
|
71
78
|
if (packageManager === 'pnpm') {
|
|
72
79
|
return {
|
|
73
80
|
install: 'pnpm install --frozen-lockfile',
|
|
81
|
+
playwrightInstall: 'pnpm exec playwright install --with-deps chromium',
|
|
74
82
|
run: (script) => `pnpm run ${script}`,
|
|
75
83
|
setupStep: ` - name: Setup pnpm
|
|
76
84
|
uses: pnpm/action-setup@v4
|
|
@@ -82,16 +90,24 @@ function getPackageManagerCommands(packageManager, hasNpmLockfile) {
|
|
|
82
90
|
if (packageManager === 'yarn') {
|
|
83
91
|
return {
|
|
84
92
|
install: 'yarn install --frozen-lockfile',
|
|
93
|
+
playwrightInstall: 'yarn playwright install --with-deps chromium',
|
|
85
94
|
run: (script) => `yarn ${script}`,
|
|
86
95
|
cache: 'yarn',
|
|
87
96
|
};
|
|
88
97
|
}
|
|
89
98
|
return {
|
|
90
99
|
install: hasNpmLockfile ? 'npm ci' : 'npm install',
|
|
100
|
+
playwrightInstall: 'npx playwright install --with-deps chromium',
|
|
91
101
|
run: (script) => `npm run ${script}`,
|
|
92
102
|
cache: hasNpmLockfile ? 'npm' : undefined,
|
|
93
103
|
};
|
|
94
104
|
}
|
|
105
|
+
function hasPlaywrightSetup(packageJson) {
|
|
106
|
+
const scripts = packageJson.scripts ?? {};
|
|
107
|
+
const dependencies = packageJson.dependencies ?? {};
|
|
108
|
+
const devDependencies = packageJson.devDependencies ?? {};
|
|
109
|
+
return Boolean(scripts.e2e || dependencies['@playwright/test'] || devDependencies['@playwright/test']);
|
|
110
|
+
}
|
|
95
111
|
function buildRunSteps(commands, scriptNames) {
|
|
96
112
|
const scripts = new Set(scriptNames);
|
|
97
113
|
const verificationScripts = scripts.has('verify')
|
package/src/ci/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAaA,gBAwBC;AArCD,2DAA6E;AAa7E,SAAgB,EAAE,CAAC,OAAe;IAChC,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,MAAM,YAAY,GAAG,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAErD,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAChD,MAAM,IAAI,gCAAmB,CAAC,GAAG,YAAY,uDAAuD,CAAC,CAAC;QACxG,CAAC;QAED,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QACpD,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC;QAC1C,MAAM,cAAc,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;QAClD,MAAM,QAAQ,GAAG,aAAa,CAC5B,cAAc,EACd,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EACpB,kBAAkB,CAAC,WAAW,CAAC,EAC/B,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5
|
|
|
6
6
|
interface PackageManagerCommands {
|
|
7
7
|
install: string;
|
|
8
|
+
playwrightInstall: string;
|
|
8
9
|
run: (script: string) => string;
|
|
9
10
|
setupStep?: string;
|
|
10
11
|
cache?: string;
|
|
@@ -21,7 +22,12 @@ export function ci(options: Schema): Rule {
|
|
|
21
22
|
const packageJson = readJson(tree, '/package.json');
|
|
22
23
|
const scripts = packageJson.scripts ?? {};
|
|
23
24
|
const packageManager = detectPackageManager(tree);
|
|
24
|
-
const workflow = buildWorkflow(
|
|
25
|
+
const workflow = buildWorkflow(
|
|
26
|
+
packageManager,
|
|
27
|
+
Object.keys(scripts),
|
|
28
|
+
hasPlaywrightSetup(packageJson),
|
|
29
|
+
tree.exists('/package-lock.json')
|
|
30
|
+
);
|
|
25
31
|
|
|
26
32
|
if (tree.exists(workflowPath)) {
|
|
27
33
|
tree.overwrite(workflowPath, workflow);
|
|
@@ -53,11 +59,22 @@ function detectPackageManager(tree: Tree): PackageManager {
|
|
|
53
59
|
return 'npm';
|
|
54
60
|
}
|
|
55
61
|
|
|
56
|
-
function buildWorkflow(
|
|
62
|
+
function buildWorkflow(
|
|
63
|
+
packageManager: PackageManager,
|
|
64
|
+
scriptNames: string[],
|
|
65
|
+
shouldInstallPlaywright: boolean,
|
|
66
|
+
hasNpmLockfile: boolean
|
|
67
|
+
): string {
|
|
57
68
|
const commands = getPackageManagerCommands(packageManager, hasNpmLockfile);
|
|
58
69
|
const runSteps = buildRunSteps(commands, scriptNames);
|
|
59
70
|
const setupPackageManagerStep = commands.setupStep ? `${commands.setupStep}\n` : '';
|
|
60
71
|
const cacheConfig = commands.cache ? ` cache: ${commands.cache}\n` : '';
|
|
72
|
+
const playwrightInstallStep = shouldInstallPlaywright
|
|
73
|
+
? `
|
|
74
|
+
- name: Install Playwright browsers
|
|
75
|
+
run: ${commands.playwrightInstall}
|
|
76
|
+
`
|
|
77
|
+
: '';
|
|
61
78
|
|
|
62
79
|
return `name: CI
|
|
63
80
|
|
|
@@ -77,11 +94,12 @@ jobs:
|
|
|
77
94
|
${setupPackageManagerStep} - name: Setup Node
|
|
78
95
|
uses: actions/setup-node@v4
|
|
79
96
|
with:
|
|
80
|
-
node-version:
|
|
97
|
+
node-version: 24
|
|
81
98
|
${cacheConfig}
|
|
82
99
|
|
|
83
100
|
- name: Install dependencies
|
|
84
101
|
run: ${commands.install}
|
|
102
|
+
${playwrightInstallStep}
|
|
85
103
|
${runSteps}
|
|
86
104
|
`;
|
|
87
105
|
}
|
|
@@ -90,6 +108,7 @@ function getPackageManagerCommands(packageManager: PackageManager, hasNpmLockfil
|
|
|
90
108
|
if (packageManager === 'pnpm') {
|
|
91
109
|
return {
|
|
92
110
|
install: 'pnpm install --frozen-lockfile',
|
|
111
|
+
playwrightInstall: 'pnpm exec playwright install --with-deps chromium',
|
|
93
112
|
run: (script) => `pnpm run ${script}`,
|
|
94
113
|
setupStep: ` - name: Setup pnpm
|
|
95
114
|
uses: pnpm/action-setup@v4
|
|
@@ -102,6 +121,7 @@ function getPackageManagerCommands(packageManager: PackageManager, hasNpmLockfil
|
|
|
102
121
|
if (packageManager === 'yarn') {
|
|
103
122
|
return {
|
|
104
123
|
install: 'yarn install --frozen-lockfile',
|
|
124
|
+
playwrightInstall: 'yarn playwright install --with-deps chromium',
|
|
105
125
|
run: (script) => `yarn ${script}`,
|
|
106
126
|
cache: 'yarn',
|
|
107
127
|
};
|
|
@@ -109,11 +129,20 @@ function getPackageManagerCommands(packageManager: PackageManager, hasNpmLockfil
|
|
|
109
129
|
|
|
110
130
|
return {
|
|
111
131
|
install: hasNpmLockfile ? 'npm ci' : 'npm install',
|
|
132
|
+
playwrightInstall: 'npx playwright install --with-deps chromium',
|
|
112
133
|
run: (script) => `npm run ${script}`,
|
|
113
134
|
cache: hasNpmLockfile ? 'npm' : undefined,
|
|
114
135
|
};
|
|
115
136
|
}
|
|
116
137
|
|
|
138
|
+
function hasPlaywrightSetup(packageJson: Record<string, any>): boolean {
|
|
139
|
+
const scripts = packageJson.scripts ?? {};
|
|
140
|
+
const dependencies = packageJson.dependencies ?? {};
|
|
141
|
+
const devDependencies = packageJson.devDependencies ?? {};
|
|
142
|
+
|
|
143
|
+
return Boolean(scripts.e2e || dependencies['@playwright/test'] || devDependencies['@playwright/test']);
|
|
144
|
+
}
|
|
145
|
+
|
|
117
146
|
function buildRunSteps(commands: PackageManagerCommands, scriptNames: string[]): string {
|
|
118
147
|
const scripts = new Set(scriptNames);
|
|
119
148
|
const verificationScripts = scripts.has('verify')
|