Skip to content

Commit 77caeca

Browse files
committed
Change workflow to return package names instead
1 parent 5cc2127 commit 77caeca

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

.github/actions/info/dist.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ async function findPackages(directory, maxDepth) {
1212
const fullPath = pathlib.join(currentDir, item.name);
1313
if (item.isFile()) {
1414
if (item.name === "package.json") {
15-
yield fullPath;
15+
try {
16+
const { default: { name } } = await import(fullPath, { with: { type: "json" } });
17+
if (name) yield name;
18+
} catch {
19+
}
1620
}
1721
continue;
1822
}

.github/actions/info/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ async function findPackages(directory: string, maxDepth?: number) {
1616
const fullPath = pathlib.join(currentDir, item.name);
1717
if (item.isFile()) {
1818
if (item.name === 'package.json') {
19-
yield fullPath;
19+
try {
20+
const { default: { name } } = await import(fullPath, { with: { type: 'json' }});
21+
if (name) yield name;
22+
} catch {}
2023
}
2124
continue;
2225
}

.github/workflows/new-workflow.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ jobs:
1616
matrix:
1717
type: ['lib', 'bundles', 'tabs']
1818

19+
outputs:
20+
packages: ${{ steps.find.outputs.packages }}
21+
1922
steps:
2023
- name: Check out source code
2124
uses: actions/checkout@v4
@@ -37,6 +40,3 @@ jobs:
3740
uses: ./.github/actions/info
3841
with:
3942
type: ${{ matrix.type }}
40-
41-
- name: Print
42-
run: echo ${{ steps.find.outputs.packages }}

eslint.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ export default tseslint.config(
137137
'jsdoc/check-alignment': 'warn',
138138
'jsdoc/require-asterisk-prefix': 'warn',
139139

140+
'no-empty': ['error', { allowEmptyCatch: true }],
141+
140142
'@sourceacademy/region-comment': 'error',
141143

142144
'@stylistic/brace-style': ['warn', '1tbs', { allowSingleLine: true }],
@@ -277,7 +279,6 @@ export default tseslint.config(
277279
rules: {
278280
'func-style': 'off',
279281
'import/extensions': ['error', 'never', { json: 'always' }],
280-
'no-empty': ['error', { allowEmptyCatch: true }],
281282
'no-constant-condition': 'off', // Was 'error',
282283
'no-fallthrough': 'off',
283284

0 commit comments

Comments
 (0)