|
| 1 | +import {join} from 'path'; |
| 2 | +import {DIST_BUNDLES, DIST_ROOT, SOURCE_ROOT, PROJECT_ROOT} from '../constants'; |
| 3 | +import {copyFiles} from '../util/copy-files'; |
| 4 | +import {addPureAnnotationsToFile} from './pure-annotations'; |
| 5 | +import {updatePackageVersion} from './package-versions'; |
| 6 | +import {inlinePackageMetadataFiles} from './metadata-inlining'; |
| 7 | +import {createTypingsReexportFile} from './typings-reexport'; |
| 8 | +import {createMetadataReexportFile} from './metadata-reexport'; |
| 9 | + |
| 10 | +/** |
| 11 | + * Copies different output files into a folder structure that follows the `angular/angular` |
| 12 | + * release folder structure. The output will also contain a README and the according package.json |
| 13 | + * file. Additionally the package will be Closure Compiler and AOT compatible. |
| 14 | + */ |
| 15 | +export function composeRelease(packageName: string) { |
| 16 | + // To avoid refactoring of the project the package material will map to the source path `lib/`. |
| 17 | + const sourcePath = join(SOURCE_ROOT, packageName === 'material' ? 'lib' : packageName); |
| 18 | + const packagePath = join(DIST_ROOT, 'packages', packageName); |
| 19 | + const releasePath = join(DIST_ROOT, 'releases', packageName); |
| 20 | + |
| 21 | + inlinePackageMetadataFiles(packagePath); |
| 22 | + |
| 23 | + copyFiles(packagePath, '**/*.+(d.ts|metadata.json)', join(releasePath, 'typings')); |
| 24 | + copyFiles(DIST_BUNDLES, `${packageName}.umd?(.min).js?(.map)`, join(releasePath, 'bundles')); |
| 25 | + copyFiles(DIST_BUNDLES, `${packageName}?(.es5).js?(.map)`, join(releasePath, '@angular')); |
| 26 | + copyFiles(PROJECT_ROOT, 'LICENSE', releasePath); |
| 27 | + copyFiles(SOURCE_ROOT, 'README.md', releasePath); |
| 28 | + copyFiles(sourcePath, 'package.json', releasePath); |
| 29 | + |
| 30 | + updatePackageVersion(releasePath); |
| 31 | + createTypingsReexportFile(releasePath, packageName); |
| 32 | + createMetadataReexportFile(releasePath, packageName); |
| 33 | + addPureAnnotationsToFile(join(releasePath, '@angular', `${packageName}.es5.js`)); |
| 34 | +} |
0 commit comments