Skip to content

Commit d5dee37

Browse files
committed
Copy blessed-contrib license
1 parent daa52db commit d5dee37

1 file changed

Lines changed: 20 additions & 26 deletions

File tree

.config/rollup.dist.config.mjs

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const {
3333
INLINED_SOCKET_CLI_LEGACY_BUILD,
3434
INLINED_SOCKET_CLI_SENTRY_BUILD,
3535
INSTRUMENT_WITH_SENTRY,
36+
LICENSE,
3637
NODE_MODULES,
3738
ROLLUP_EXTERNAL_SUFFIX,
3839
SHADOW_NPM_BIN,
@@ -56,6 +57,7 @@ const {
5657
const BLESSED = 'blessed'
5758
const BLESSED_CONTRIB = 'blessed-contrib'
5859
const EXTERNAL = 'external'
60+
const LICENSE_MD = `${LICENSE}.md`
5961
const SENTRY_NODE = '@sentry/node'
6062
const SOCKET_DESCRIPTION = 'CLI tool for Socket.dev'
6163
const SOCKET_DESCRIPTION_WITH_SENTRY = `${SOCKET_DESCRIPTION}, includes Sentry error handling, otherwise identical to the regular \`${SOCKET_CLI_BIN_NAME}\` package`
@@ -396,7 +398,7 @@ export default async () => {
396398
)
397399
])
398400

399-
const blessedDestPath = path.join(externalPath, BLESSED)
401+
const blessedExternalPath = path.join(externalPath, BLESSED)
400402
const blessedIgnore = [
401403
'lib/**',
402404
'node_modules/**',
@@ -405,43 +407,35 @@ export default async () => {
405407
'LICENSE*'
406408
]
407409

408-
const blessedContribDestPath = path.join(
410+
// Remove directories.
411+
await removeDirs(blessedExternalPath, { exclude: blessedIgnore })
412+
await removeFiles(blessedExternalPath, { exclude: blessedIgnore })
413+
414+
const blessedContribExternalPath = path.join(
409415
externalPath,
410-
'blessed-contrib'
416+
BLESSED_CONTRIB
411417
)
412-
const blessedContribIgnore = [
413-
'lib/**',
414-
'node_modules/**',
415-
'index.d.ts',
416-
'LICENSE*'
417-
]
418-
419-
// Remove directories.
420-
await Promise.all([
421-
removeDirs(blessedDestPath, { exclude: blessedIgnore }),
422-
removeDirs(blessedContribDestPath, {
423-
exclude: blessedContribIgnore
424-
})
425-
])
418+
const blessedContribNmPath = path.join(nmPath, BLESSED_CONTRIB)
426419

427-
// Remove files.
428-
await Promise.all([
429-
removeFiles(blessedDestPath, { exclude: blessedIgnore }),
430-
removeFiles(blessedContribDestPath, {
431-
exclude: blessedContribIgnore
432-
})
433-
])
420+
// Copy LICENSE.md.
421+
await fs.cp(
422+
`${blessedContribNmPath}/${LICENSE_MD}`,
423+
`${blessedContribExternalPath}/${LICENSE_MD}`
424+
)
434425

435426
// Rewire 'blessed' inside 'blessed-contrib'.
436427
await Promise.all([
437428
...(
438429
await tinyGlob(['**/*.js'], {
439430
absolute: true,
440-
cwd: blessedContribDestPath,
431+
cwd: blessedContribExternalPath,
441432
ignore: ['node_modules/**']
442433
})
443434
).map(async p => {
444-
const relPath = path.relative(path.dirname(p), blessedDestPath)
435+
const relPath = path.relative(
436+
path.dirname(p),
437+
blessedExternalPath
438+
)
445439
const content = await fs.readFile(p, 'utf8')
446440
const modded = content.replace(
447441
/(?<=require\(["'])blessed(?=(?:\/[^"']+)?["']\))/g,

0 commit comments

Comments
 (0)