|
1 | | -require = require('esm')(module); |
2 | | - |
3 | 1 | const { relative, resolve } = require('path'); |
4 | | -const core = require('@actions/core') |
| 2 | +const core = require('@actions/core'); |
| 3 | + |
| 4 | +(async () => { |
| 5 | + const { root } = await import('../../../scripts/lib/repo.mjs'); |
| 6 | + const { execute } = await import('../../../scripts/lib/cli.mjs'); |
| 7 | + const { ls } = await import('../../../scripts/lib/lerna.mjs'); |
5 | 8 |
|
6 | | -const { root } = require('../../../scripts/lib/repo.mjs'); |
7 | | -const { execute } = require('../../../scripts/lib/cli.mjs'); |
8 | | -const { ls } = require('../../../scripts/lib/lerna.mjs'); |
| 9 | + execute(async () => { |
| 10 | + const files = JSON.parse(core.getInput('files', '[]')).map(f => resolve(root, f)); |
| 11 | + const packages = await ls(); |
| 12 | + const changedPackages = packages.filter(pkg => files.some(f => f.startsWith(pkg.location))); |
| 13 | + const paths = JSON.stringify(changedPackages.map(pkg => relative(root, pkg.location))); |
9 | 14 |
|
10 | | -execute(async () => { |
11 | | - const files = JSON.parse(core.getInput('files', '[]')).map(f => resolve(root, f)); |
12 | | - const packages = await ls(); |
13 | | - const changedPackages = packages.filter(pkg => files.some(f => f.startsWith(pkg.location))); |
14 | | - const paths = JSON.stringify(changedPackages.map(pkg => relative(root, pkg.location))); |
| 15 | + core.info(`Changed package paths: ${paths}`); |
| 16 | + core.setOutput('paths', paths); |
| 17 | + }); |
| 18 | +})(); |
15 | 19 |
|
16 | | - core.info(`Changed package paths: ${paths}`); |
17 | | - core.setOutput('paths', paths); |
18 | | -}); |
|
0 commit comments