build: add empty material-moment-adapter package (#6086)

This commit is contained in:
Paul Gschwendtner
2017-08-29 01:27:56 +02:00
committed by Jeremy Elbourn
parent ec4ea060a5
commit 412c9fc4bc
11 changed files with 119 additions and 9 deletions
@@ -0,0 +1,9 @@
import {_momentAdapter} from './public_api';
describe('moment-adapter', () => {
it('should be tested when running the tests', () => {
expect(_momentAdapter).toBe(0);
});
});
+9
View File
@@ -0,0 +1,9 @@
/**
* @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
*/
export * from './public_api';
+25
View File
@@ -0,0 +1,25 @@
{
"name": "@angular/material-moment-adapter",
"version": "0.0.0-PLACEHOLDER",
"description": "Angular Material Moment Adapter",
"main": "./bundles/material-moment-adapter.umd.js",
"module": "./@angular/material-moment-adapter.es5.js",
"es2015": "./@angular/material-moment-adapter.js",
"typings": "./material-moment-adapter.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/angular/material2.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/angular/material2/issues"
},
"homepage": "https://github.com/angular/material2#readme",
"peerDependencies": {
"@angular/material": "0.0.0-PLACEHOLDER",
"@angular/core": "^4.0.0"
},
"dependencies": {
"tslib": "^1.7.1"
}
}
@@ -0,0 +1,9 @@
/**
* @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
*/
export const _momentAdapter = 0;
@@ -0,0 +1,37 @@
// TypeScript config file that is used to compile the moment-adapter package. Target environment
// needs to be ES2015 since the build process will create FESM bundles using rollup.
{
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": false,
"experimentalDecorators": true,
"noUnusedParameters": true,
"strictNullChecks": true,
"importHelpers": true,
"newLine": "lf",
"module": "es2015",
"moduleResolution": "node",
"outDir": "../../dist/packages/material-moment-adapter",
"rootDir": ".",
"sourceMap": true,
"inlineSources": true,
"target": "es2015",
"lib": ["es2015", "dom"],
"skipLibCheck": true,
"types": [],
"paths": {
"@angular/material": ["../../dist/packages/material/public_api"]
}
},
"files": [
"public_api.ts"
],
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"strictMetadataEmit": true,
"flatModuleOutFile": "index.js",
"flatModuleId": "@angular/material-moment-adapter",
"skipTemplateCodegen": true
}
}
@@ -0,0 +1,16 @@
// TypeScript config file that extends the default tsconfig file for the moment-adapter.
// This config is used to compile the tests for Karma. Since the code will run inside of the
// browser, the target needs to be ES5. The format needs to be CommonJS for Karma.
{
"extends": "./tsconfig-build",
"compilerOptions": {
"importHelpers": false,
"module": "commonjs",
"target": "es5",
"types": ["jasmine"]
},
"include": [
"**/*.spec.ts",
"index.ts"
]
}
+2 -1
View File
@@ -1,9 +1,10 @@
import {createPackageBuildTasks} from 'material2-build-tools';
import {cdkPackage, examplesPackage, materialPackage} from './packages';
import {cdkPackage, examplesPackage, materialPackage, momentAdapterPackage} from './packages';
createPackageBuildTasks(cdkPackage);
createPackageBuildTasks(materialPackage);
createPackageBuildTasks(examplesPackage);
createPackageBuildTasks(momentAdapterPackage);
import './tasks/ci';
import './tasks/clean';
+2
View File
@@ -4,6 +4,8 @@ import {join} from 'path';
export const cdkPackage = new BuildPackage('cdk');
export const materialPackage = new BuildPackage('material', [cdkPackage]);
export const examplesPackage = new BuildPackage('material-examples', [materialPackage, cdkPackage]);
export const momentAdapterPackage = new BuildPackage('material-moment-adapter',
[materialPackage, cdkPackage]);
// To avoid refactoring of the project the material package will map to the source path `lib/`.
materialPackage.packageRoot = join(buildConfig.packagesDir, 'lib');
+1 -1
View File
@@ -34,7 +34,7 @@ const examplesPath = path.join(packagesDir, 'material-examples');
/** Output path of the module that is being created */
const outputModuleFilename = path.join(examplesPath, 'example-module.ts');
/** Build ecmascript module import statements */
/** Build ES module import statements */
function buildImportsTemplate(metadata: ExampleMetadata): string {
const components = metadata.additionalComponents.concat(metadata.component);
+1
View File
@@ -11,6 +11,7 @@ import * as minimist from 'minimist';
export const releasePackages = [
'cdk',
'material',
'material-moment-adapter'
];
/** Parse command-line arguments for release task. */
+8 -7
View File
@@ -10,8 +10,9 @@ const {packagesDir, projectDir} = buildConfig;
/** Builds everything that is necessary for karma. */
task(':test:build', sequenceTask(
'clean',
// Build ESM output of Material that also includes all test files.
'material:build-tests',
// Build tests for all different packages by just building the tests of the moment-adapter
// package. All dependencies of that package (material, cdk) will be built as well.
'material-moment-adapter:build-tests'
));
/**
@@ -20,7 +21,7 @@ task(':test:build', sequenceTask(
*/
task('test:single-run', [':test:build'], (done: () => void) => {
// Load karma not outside. Karma pollutes Promise with a different implementation.
let karma = require('karma');
const karma = require('karma');
new karma.Server({
configFile: join(projectDir, 'test/karma.conf.js'),
@@ -44,12 +45,12 @@ task('test:single-run', [':test:build'], (done: () => void) => {
* This task should be used when running unit tests locally.
*/
task('test', [':test:build'], () => {
let patternRoot = join(packagesDir, '**/*');
const patternRoot = join(packagesDir, '**/*');
// Load karma not outside. Karma pollutes Promise with a different implementation.
let karma = require('karma');
const karma = require('karma');
// Configure the Karma server and override the autoWatch and singleRun just in case.
let server = new karma.Server({
const server = new karma.Server({
configFile: join(projectDir, 'test/karma.conf.js'),
autoWatch: false,
singleRun: false
@@ -57,7 +58,7 @@ task('test', [':test:build'], () => {
// Refreshes Karma's file list and schedules a test run.
// Tests will only run if TypeScript compilation was successful.
let runTests = (err?: Error) => {
const runTests = (err?: Error) => {
if (!err) {
server.refreshFiles().then(() => server._injector.get('executor').schedule());
}