feat(bazel): add an ng_package rule (#22221)
This produces a directory following the Angular Package layout spec. Includes integration test coverage by making a minimal ng_package in integration/bazel. Unit tests verify the content of the @angular/core and @angular/common packages. This doesn't totally match our current output, but is good enough to unblock some early adopters. It re-uses logic from the rollup_bundle rule in rules_nodejs. It should also eventually have the .pack and .publish secondary targets like npm_package rule. PR Close #22221
This commit is contained in:

committed by
Victor Berchet

parent
1dcbc12fd3
commit
b43b164a61
50
packages/bazel/test/ng_package/common_package.spec.ts
Normal file
50
packages/bazel/test/ng_package/common_package.spec.ts
Normal file
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import * as shx from 'shelljs';
|
||||
|
||||
shx.cd(path.join(process.env['TEST_SRCDIR'], 'angular', 'packages', 'common', 'npm_package'));
|
||||
|
||||
describe('ng_package', () => {
|
||||
it('should have right bundle files', () => {
|
||||
expect(shx.ls('-R', 'bundles').stdout.split('\n').filter(n => !!n).sort()).toEqual([
|
||||
'common-http-testing.umd.js',
|
||||
'common-http-testing.umd.js.map',
|
||||
'common-http-testing.umd.min.js',
|
||||
'common-http-testing.umd.min.js.map',
|
||||
'common-http.umd.js',
|
||||
'common-http.umd.js.map',
|
||||
'common-http.umd.min.js',
|
||||
'common-http.umd.min.js.map',
|
||||
'common-testing.umd.js',
|
||||
'common-testing.umd.js.map',
|
||||
'common-testing.umd.min.js',
|
||||
'common-testing.umd.min.js.map',
|
||||
'common.umd.js',
|
||||
'common.umd.js.map',
|
||||
'common.umd.min.js',
|
||||
'common.umd.min.js.map',
|
||||
]);
|
||||
});
|
||||
it('should have right fesm files', () => {
|
||||
const expected = [
|
||||
'common.js',
|
||||
'common.js.map',
|
||||
'http',
|
||||
'http.js',
|
||||
'http.js.map',
|
||||
'http/testing.js',
|
||||
'http/testing.js.map',
|
||||
'testing.js',
|
||||
'testing.js.map',
|
||||
];
|
||||
expect(shx.ls('-R', 'esm5').stdout.split('\n').filter(n => !!n).sort()).toEqual(expected);
|
||||
expect(shx.ls('-R', 'esm2015').stdout.split('\n').filter(n => !!n).sort()).toEqual(expected);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user