Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
126 lines (103 loc) · 3.49 KB

File metadata and controls

126 lines (103 loc) · 3.49 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*!
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
/**************/
/* REQUIRES */
/**************/
var _ = require('lodash');
var gulp = require('gulp');
var pkg = require('./package.json');
// File I/O
var ts = require('gulp-typescript');
var del = require('del');
var header = require('gulp-header');
var filter = require('gulp-filter');
/****************/
/* FILE PATHS */
/****************/
var paths = {
src: [
'src/**/*.ts',
],
test: [
'test/**/*.ts',
'!test/integration/postcheck/typescript/*.ts',
],
build: 'lib/',
};
// Create a separate project for buildProject that overrides the rootDir.
// This ensures that the generated production files are in their own root
// rather than including both src and test in the lib dir. Declaration
// is used by TypeScript to determine if auto-generated typings should be
// emitted.
var buildProject = ts.createProject('tsconfig.json', { rootDir: 'src', declarationMap: true });
// Include dom libraries during test compilation since we use some web SDK
// libraries in our tests.
var buildTest = ts.createProject('tsconfig.json', { lib: ['es2018', 'dom'] });
var banner = `/*! firebase-admin v${pkg.version} */\n`;
/***********/
/* TASKS */
/***********/
gulp.task('cleanup', function() {
return del([
paths.build,
]);
});
// Task used to compile the TypeScript project. If automatic typings
// are set to be generated (determined by TYPE_GENERATION_MODE), declarations
// for files terminating in -internal.d.ts are removed because we do not
// want to expose internally used types to developers. As auto-generated
// typings are a work-in-progress, we remove the *.d.ts files for modules
// which we do not intend to auto-generate typings for yet.
gulp.task('compile', function() {
let workflow = gulp.src(paths.src)
// Compile Typescript into .js and .d.ts files
.pipe(buildProject())
// Add header
.pipe(header(banner));
const configuration = [
'lib/**/*.js',
'lib/**/*.d.ts',
];
workflow = workflow.pipe(filter(configuration));
// Write to build directory
return workflow.pipe(gulp.dest(paths.build))
});
/**
* Task only used to capture typescript compilation errors in the test suite.
* Output is discarded.
*/
gulp.task('compile_test', function() {
return gulp.src(paths.test)
// Compile Typescript into .js and .d.ts files
.pipe(buildTest())
});
gulp.task('copyTypings', function() {
return gulp.src(['src/index.d.ts', 'src/default-namespace.d.ts'])
// Add header
.pipe(header(banner))
.pipe(gulp.dest(paths.build))
});
gulp.task('compile_all', gulp.series('compile', 'copyTypings', 'compile_test'));
// Regenerates js every time a source file changes
gulp.task('watch', function() {
gulp.watch(paths.src.concat(paths.test), { ignoreInitial: false }, gulp.series('compile_all'));
});
// Build task
gulp.task('build', gulp.series('cleanup', 'compile', 'copyTypings'));
// Default task
gulp.task('default', gulp.series('build'));
Morty Proxy This is a proxified and sanitized view of the page, visit original site.