Skip to content

Commit 0278f8c

Browse files
committed
[bin/gentesthtml] supports --include-dependencies parameter
1 parent b2b45a2 commit 0278f8c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎bin/gentesthtml.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as object from '../object.js'
44
import * as env from '../environment.js'
55

66
const script = env.getParam('--script', './test.js')
7+
const includeDeps = env.getParam('--include-dependencies', '').split(',').filter(d => d.length)
78

89
/**
910
* @type {Object<string,string>}
@@ -47,6 +48,10 @@ const readPkg = (pkgJson, pathPrefix, importMap) => {
4748

4849
const rootPkgJson = JSON.parse(fs.readFileSync('./package.json', { encoding: 'utf8' }))
4950
readPkg(rootPkgJson, '.', exports)
51+
includeDeps.forEach(depName => {
52+
const depPkgJson = JSON.parse(fs.readFileSync(`./node_modules/${depName}/package.json`, { encoding: 'utf8' }))
53+
readPkg(depPkgJson, '.', exports)
54+
})
5055

5156
const testHtml = `
5257
<!DOCTYPE html>

0 commit comments

Comments
 (0)