semmet-angular 0.33.0 → 0.35.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 +26 -2
- package/src/ci/index.js.map +1 -1
- package/src/ci/index.ts +39 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semmet-angular",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.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,25 @@ 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: Cache Playwright browsers
|
|
47
|
+
uses: actions/cache@v4
|
|
48
|
+
with:
|
|
49
|
+
path: ~/.cache/ms-playwright
|
|
50
|
+
key: \${{ runner.os }}-playwright-\${{ hashFiles('package-lock.json', 'pnpm-lock.yaml', 'yarn.lock') }}
|
|
51
|
+
restore-keys: |
|
|
52
|
+
\${{ runner.os }}-playwright-
|
|
53
|
+
|
|
54
|
+
- name: Install Playwright browsers
|
|
55
|
+
run: ${commands.playwrightInstall}
|
|
56
|
+
`
|
|
57
|
+
: '';
|
|
44
58
|
return `name: CI
|
|
45
59
|
|
|
46
60
|
on:
|
|
@@ -64,6 +78,7 @@ ${cacheConfig}
|
|
|
64
78
|
|
|
65
79
|
- name: Install dependencies
|
|
66
80
|
run: ${commands.install}
|
|
81
|
+
${playwrightInstallStep}
|
|
67
82
|
${runSteps}
|
|
68
83
|
`;
|
|
69
84
|
}
|
|
@@ -71,6 +86,7 @@ function getPackageManagerCommands(packageManager, hasNpmLockfile) {
|
|
|
71
86
|
if (packageManager === 'pnpm') {
|
|
72
87
|
return {
|
|
73
88
|
install: 'pnpm install --frozen-lockfile',
|
|
89
|
+
playwrightInstall: 'pnpm exec playwright install --with-deps chromium',
|
|
74
90
|
run: (script) => `pnpm run ${script}`,
|
|
75
91
|
setupStep: ` - name: Setup pnpm
|
|
76
92
|
uses: pnpm/action-setup@v4
|
|
@@ -82,16 +98,24 @@ function getPackageManagerCommands(packageManager, hasNpmLockfile) {
|
|
|
82
98
|
if (packageManager === 'yarn') {
|
|
83
99
|
return {
|
|
84
100
|
install: 'yarn install --frozen-lockfile',
|
|
101
|
+
playwrightInstall: 'yarn playwright install --with-deps chromium',
|
|
85
102
|
run: (script) => `yarn ${script}`,
|
|
86
103
|
cache: 'yarn',
|
|
87
104
|
};
|
|
88
105
|
}
|
|
89
106
|
return {
|
|
90
107
|
install: hasNpmLockfile ? 'npm ci' : 'npm install',
|
|
108
|
+
playwrightInstall: 'npx playwright install --with-deps chromium',
|
|
91
109
|
run: (script) => `npm run ${script}`,
|
|
92
110
|
cache: hasNpmLockfile ? 'npm' : undefined,
|
|
93
111
|
};
|
|
94
112
|
}
|
|
113
|
+
function hasPlaywrightSetup(packageJson) {
|
|
114
|
+
const scripts = packageJson.scripts ?? {};
|
|
115
|
+
const dependencies = packageJson.dependencies ?? {};
|
|
116
|
+
const devDependencies = packageJson.devDependencies ?? {};
|
|
117
|
+
return Boolean(scripts.e2e || dependencies['@playwright/test'] || devDependencies['@playwright/test']);
|
|
118
|
+
}
|
|
95
119
|
function buildRunSteps(commands, scriptNames) {
|
|
96
120
|
const scripts = new Set(scriptNames);
|
|
97
121
|
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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C,OAAO,CAAwB,CAAC;AACpD,CAAC"}
|
package/src/ci/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ type PackageManager = 'npm' | 'pnpm' | 'yarn';
|
|
|
5
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,30 @@ 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: Cache Playwright browsers
|
|
75
|
+
uses: actions/cache@v4
|
|
76
|
+
with:
|
|
77
|
+
path: ~/.cache/ms-playwright
|
|
78
|
+
key: \${{ runner.os }}-playwright-\${{ hashFiles('package-lock.json', 'pnpm-lock.yaml', 'yarn.lock') }}
|
|
79
|
+
restore-keys: |
|
|
80
|
+
\${{ runner.os }}-playwright-
|
|
81
|
+
|
|
82
|
+
- name: Install Playwright browsers
|
|
83
|
+
run: ${commands.playwrightInstall}
|
|
84
|
+
`
|
|
85
|
+
: '';
|
|
61
86
|
|
|
62
87
|
return `name: CI
|
|
63
88
|
|
|
@@ -82,6 +107,7 @@ ${cacheConfig}
|
|
|
82
107
|
|
|
83
108
|
- name: Install dependencies
|
|
84
109
|
run: ${commands.install}
|
|
110
|
+
${playwrightInstallStep}
|
|
85
111
|
${runSteps}
|
|
86
112
|
`;
|
|
87
113
|
}
|
|
@@ -90,6 +116,7 @@ function getPackageManagerCommands(packageManager: PackageManager, hasNpmLockfil
|
|
|
90
116
|
if (packageManager === 'pnpm') {
|
|
91
117
|
return {
|
|
92
118
|
install: 'pnpm install --frozen-lockfile',
|
|
119
|
+
playwrightInstall: 'pnpm exec playwright install --with-deps chromium',
|
|
93
120
|
run: (script) => `pnpm run ${script}`,
|
|
94
121
|
setupStep: ` - name: Setup pnpm
|
|
95
122
|
uses: pnpm/action-setup@v4
|
|
@@ -102,6 +129,7 @@ function getPackageManagerCommands(packageManager: PackageManager, hasNpmLockfil
|
|
|
102
129
|
if (packageManager === 'yarn') {
|
|
103
130
|
return {
|
|
104
131
|
install: 'yarn install --frozen-lockfile',
|
|
132
|
+
playwrightInstall: 'yarn playwright install --with-deps chromium',
|
|
105
133
|
run: (script) => `yarn ${script}`,
|
|
106
134
|
cache: 'yarn',
|
|
107
135
|
};
|
|
@@ -109,11 +137,20 @@ function getPackageManagerCommands(packageManager: PackageManager, hasNpmLockfil
|
|
|
109
137
|
|
|
110
138
|
return {
|
|
111
139
|
install: hasNpmLockfile ? 'npm ci' : 'npm install',
|
|
140
|
+
playwrightInstall: 'npx playwright install --with-deps chromium',
|
|
112
141
|
run: (script) => `npm run ${script}`,
|
|
113
142
|
cache: hasNpmLockfile ? 'npm' : undefined,
|
|
114
143
|
};
|
|
115
144
|
}
|
|
116
145
|
|
|
146
|
+
function hasPlaywrightSetup(packageJson: Record<string, any>): boolean {
|
|
147
|
+
const scripts = packageJson.scripts ?? {};
|
|
148
|
+
const dependencies = packageJson.dependencies ?? {};
|
|
149
|
+
const devDependencies = packageJson.devDependencies ?? {};
|
|
150
|
+
|
|
151
|
+
return Boolean(scripts.e2e || dependencies['@playwright/test'] || devDependencies['@playwright/test']);
|
|
152
|
+
}
|
|
153
|
+
|
|
117
154
|
function buildRunSteps(commands: PackageManagerCommands, scriptNames: string[]): string {
|
|
118
155
|
const scripts = new Set(scriptNames);
|
|
119
156
|
const verificationScripts = scripts.has('verify')
|