Skip to content

Commit aa84b26

Browse files
committed
init package
1 parent 36be62a commit aa84b26

File tree

7 files changed

+280
-0
lines changed

7 files changed

+280
-0
lines changed

packages-exp/app-compat/.eslintrc.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* @license
3+
* Copyright 2020 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
module.exports = {
19+
extends: '../../config/.eslintrc.js',
20+
parserOptions: {
21+
project: 'tsconfig.json',
22+
// to make vscode-eslint work with monorepo
23+
// https://github.com/typescript-eslint/typescript-eslint/issues/251#issuecomment-463943250
24+
tsconfigRootDir: __dirname
25+
}
26+
};

packages-exp/app-compat/.npmignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Directories not needed by end users
2+
/src
3+
test
4+
5+
# Files not needed by end users
6+
gulpfile.js
7+
index.ts
8+
karma.conf.js
9+
tsconfig.json

packages-exp/app-compat/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# @firebase/app
2+
3+
This package coordinates the communication between the different Firebase components and
4+
exposes the API surface to the user
5+
6+
**This package is not intended for direct usage, and should only be used via the officially supported [firebase](https://www.npmjs.com/package/firebase) package.**

packages-exp/app-compat/karma.conf.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* @license
3+
* Copyright 2017 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
const karma = require('karma');
19+
const path = require('path');
20+
const karmaBase = require('../../config/karma.base');
21+
22+
const files = ['test/**/*', 'src/**/*.test.ts'];
23+
24+
module.exports = function (config) {
25+
const karmaConfig = Object.assign({}, karmaBase, {
26+
// files to load into karma
27+
files: files,
28+
// frameworks to use
29+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
30+
preprocessors: { '**/*.ts': ['webpack', 'sourcemap'] },
31+
frameworks: ['mocha']
32+
});
33+
34+
config.set(karmaConfig);
35+
};
36+
37+
module.exports.files = files;

packages-exp/app-compat/package.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"name": "@firebase/app-compat",
3+
"version": "0.0.800",
4+
"description": "The primary entrypoint to the Firebase JS SDK",
5+
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
6+
"main": "dist/index.node.cjs.js",
7+
"browser": "dist/cjs/index.js",
8+
"module": "dist/esm5/index.js",
9+
"react-native": "dist/index.rn.cjs.js",
10+
"esm2017": "dist/esm2017/index.js",
11+
"lite": "dist/index.lite.js",
12+
"lite-esm2017": "dist/index.lite.esm2017.js",
13+
"files": [
14+
"dist"
15+
],
16+
"scripts": {
17+
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
18+
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
19+
"build": "rollup -c",
20+
"dev": "rollup -c -w",
21+
"test": "yarn type-check && run-p lint test:browser test:node",
22+
"type-check": "tsc -p . --noEmit",
23+
"test:browser": "karma start --single-run",
24+
"test:browser:debug": "karma start --browsers Chrome --auto-watch",
25+
"test:node": "TS_NODE_FILES=true TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha test/**/*.test.* src/**/*.test.ts --opts ../../config/mocha.node.opts",
26+
"prepare": "yarn build"
27+
},
28+
"license": "Apache-2.0",
29+
"dependencies": {
30+
"@firebase/app-types": "0.5.2",
31+
"@firebase/util": "0.2.41",
32+
"@firebase/logger": "0.1.36",
33+
"@firebase/component": "0.1.6",
34+
"tslib": "1.11.1",
35+
"dom-storage": "2.1.0",
36+
"xmlhttprequest": "1.8.0"
37+
},
38+
"devDependencies": {
39+
"rollup": "1.32.1",
40+
"rollup-plugin-json": "4.0.0",
41+
"rollup-plugin-replace": "2.2.0",
42+
"rollup-plugin-typescript2": "0.26.0",
43+
"typescript": "3.8.3"
44+
},
45+
"repository": {
46+
"directory": "packages/app",
47+
"type": "git",
48+
"url": "https://github.com/firebase/firebase-js-sdk.git"
49+
},
50+
"bugs": {
51+
"url": "https://github.com/firebase/firebase-js-sdk/issues"
52+
},
53+
"typings": "dist/packages/app/index.d.ts",
54+
"nyc": {
55+
"extension": [
56+
".ts"
57+
],
58+
"reportDir": "./coverage/node"
59+
}
60+
}
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
/**
2+
* @license
3+
* Copyright 2018 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import typescriptPlugin from 'rollup-plugin-typescript2';
19+
import json from 'rollup-plugin-json';
20+
import typescript from 'typescript';
21+
import pkg from './package.json';
22+
23+
const deps = Object.keys(
24+
Object.assign({}, pkg.peerDependencies, pkg.dependencies)
25+
);
26+
27+
/**
28+
* ES5 Builds
29+
*/
30+
const es5BuildPlugins = [
31+
typescriptPlugin({
32+
typescript
33+
}),
34+
json()
35+
];
36+
37+
const es5Builds = [
38+
{
39+
input: {
40+
index: 'index.ts',
41+
next: 'src/next/index.ts',
42+
'next/internal': 'src/next/internal.ts'
43+
},
44+
output: [
45+
{ dir: 'dist/cjs', format: 'cjs', sourcemap: true },
46+
{ dir: 'dist/esm5', format: 'es', sourcemap: true }
47+
],
48+
plugins: es5BuildPlugins,
49+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
50+
},
51+
{
52+
input: 'index.node.ts',
53+
output: {
54+
file: pkg.main,
55+
format: 'cjs',
56+
sourcemap: true
57+
},
58+
plugins: es5BuildPlugins,
59+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
60+
},
61+
{
62+
input: 'index.rn.ts',
63+
output: {
64+
file: pkg['react-native'],
65+
format: 'cjs',
66+
sourcemap: true
67+
},
68+
plugins: es5BuildPlugins,
69+
external: id =>
70+
[...deps, 'react-native'].some(
71+
dep => id === dep || id.startsWith(`${dep}/`)
72+
)
73+
},
74+
{
75+
input: 'index.lite.ts',
76+
output: {
77+
file: pkg.lite,
78+
format: 'es',
79+
sourcemap: true
80+
},
81+
plugins: es5BuildPlugins,
82+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
83+
}
84+
];
85+
86+
/**
87+
* ES2017 Builds
88+
*/
89+
const es2017BuildPlugins = [
90+
typescriptPlugin({
91+
typescript,
92+
tsconfigOverride: {
93+
compilerOptions: {
94+
target: 'es2017'
95+
}
96+
}
97+
}),
98+
json({
99+
preferConst: true
100+
})
101+
];
102+
103+
const es2017Builds = [
104+
/**
105+
* Browser Builds
106+
*/
107+
{
108+
input: {
109+
index: 'index.ts',
110+
next: 'src/next/index.ts',
111+
'next/internal': 'src/next/internal.ts'
112+
},
113+
output: {
114+
dir: 'dist/esm2017',
115+
format: 'es',
116+
sourcemap: true
117+
},
118+
plugins: es2017BuildPlugins,
119+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
120+
},
121+
{
122+
input: 'index.lite.ts',
123+
output: {
124+
file: pkg['lite-esm2017'],
125+
format: 'es',
126+
sourcemap: true
127+
},
128+
plugins: es2017BuildPlugins,
129+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
130+
}
131+
];
132+
133+
export default [...es5Builds, ...es2017Builds];

packages-exp/app-compat/tsconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../../config/tsconfig.base.json",
3+
"compilerOptions": {
4+
"outDir": "dist",
5+
"resolveJsonModule": true,
6+
"downlevelIteration": true
7+
},
8+
"exclude": ["dist/**/*"]
9+
}

0 commit comments

Comments
 (0)