-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy LICENSE files when building packages
- Loading branch information
1 parent
3836954
commit 63b79be
Showing
6 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'modular-scripts': minor | ||
--- | ||
|
||
- Fix prefixed logger debug method logging as info | ||
- Copy LICENSE files when building packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -313,6 +313,7 @@ export async function makeBundle( | |
'dist-es', | ||
'dist-types', | ||
'README.md', | ||
'LICENSE', | ||
]), | ||
}; | ||
} |
24 changes: 24 additions & 0 deletions
24
packages/modular-scripts/src/build/buildPackage/maybeCopyRootLicense.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as fs from 'fs-extra'; | ||
import * as path from 'path'; | ||
import getPrefixedLogger from '../../utils/getPrefixedLogger'; | ||
import getModularRoot from '../../utils/getModularRoot'; | ||
|
||
export async function maybeCopyRootLicense( | ||
target: string, | ||
targetOutputDirectory: string, | ||
) { | ||
const logger = getPrefixedLogger(target); | ||
const modularRoot = getModularRoot(); | ||
|
||
const targetOutputLicense = path.join(targetOutputDirectory, 'LICENSE'); | ||
if (!fs.existsSync(targetOutputLicense)) { | ||
logger.debug( | ||
`No license found in ${targetOutputDirectory}. Looking for root license.`, | ||
); | ||
const rootLicense = path.join(modularRoot, 'LICENSE'); | ||
if (fs.existsSync(rootLicense)) { | ||
logger.log(`Copying LICENSE found in ${modularRoot}`); | ||
fs.copyFileSync(rootLicense, targetOutputLicense); | ||
} | ||
} | ||
} |