-
Notifications
You must be signed in to change notification settings - Fork 68
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 (#2050)
* Fix prefixed logger debug being logged incorrectly * Copy LICENSE files when building packages * Remove explicit README and LICENSE from files array
- Loading branch information
1 parent
15a417c
commit 2241c2b
Showing
13 changed files
with
64 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
'modular-scripts': patch | ||
'modular-template-app': patch | ||
'modular-template-esm-view': patch | ||
'modular-template-node-env-app': patch | ||
'modular-template-package': patch | ||
'modular-template-view': patch | ||
--- | ||
|
||
Remove explicit package.json and license entry in files array |
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
35 changes: 35 additions & 0 deletions
35
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,35 @@ | ||
import * as fs from 'fs-extra'; | ||
import * as path from 'path'; | ||
import globby from 'globby'; | ||
import getPrefixedLogger from '../../utils/getPrefixedLogger'; | ||
import getModularRoot from '../../utils/getModularRoot'; | ||
|
||
const licenseGlob = 'LICEN@(C|S)E*'; | ||
|
||
export async function maybeCopyRootLicense( | ||
target: string, | ||
targetOutputDirectory: string, | ||
) { | ||
const logger = getPrefixedLogger(target); | ||
const modularRoot = getModularRoot(); | ||
const matches = globby.sync(path.join(targetOutputDirectory, licenseGlob), { | ||
cwd: modularRoot, | ||
onlyFiles: true, | ||
}); | ||
if (matches.length === 0) { | ||
logger.debug( | ||
`No license found in ${targetOutputDirectory}. Looking for root license.`, | ||
); | ||
const rootLicenses = globby.sync(path.join(modularRoot, licenseGlob), { | ||
cwd: modularRoot, | ||
onlyFiles: true, | ||
}); | ||
if (rootLicenses.length > 0) { | ||
rootLicenses.forEach((license) => { | ||
const filename = path.basename(license); | ||
logger.log(`Copying ${filename} found in ${modularRoot}`); | ||
fs.copyFileSync(license, path.join(targetOutputDirectory, filename)); | ||
}); | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -10,7 +10,6 @@ | |
}, | ||
"license": "Apache-2.0", | ||
"files": [ | ||
"README.md", | ||
"public", | ||
"src" | ||
] | ||
|
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 |
---|---|---|
|
@@ -10,7 +10,6 @@ | |
}, | ||
"license": "Apache-2.0", | ||
"files": [ | ||
"README.md", | ||
"src" | ||
] | ||
} |
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 |
---|---|---|
|
@@ -14,7 +14,6 @@ | |
}, | ||
"license": "Apache-2.0", | ||
"files": [ | ||
"README.md", | ||
"public", | ||
"src" | ||
] | ||
|
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 |
---|---|---|
|
@@ -11,7 +11,6 @@ | |
}, | ||
"license": "Apache-2.0", | ||
"files": [ | ||
"README.md", | ||
"src" | ||
] | ||
} |
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 |
---|---|---|
|
@@ -11,7 +11,6 @@ | |
"templateType": "view" | ||
}, | ||
"files": [ | ||
"README.md", | ||
"src" | ||
] | ||
} |