Skip to content

Commit faf6583

Browse files
committed
set up project for size analysis
1 parent acd89ee commit faf6583

File tree

11 files changed

+255
-2
lines changed

11 files changed

+255
-2
lines changed

lerna.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"packages": [
66
"packages/*",
77
"packages-exp/*",
8-
"integration/*"
8+
"integration/*",
9+
"repo-scripts/*"
910
],
1011
"useWorkspaces": true
1112
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
"workspaces": [
5757
"packages/*",
5858
"packages-exp/*",
59-
"integration/*"
59+
"integration/*",
60+
"repo-scripts/*"
6061
],
6162
"devDependencies": {
6263
"@microsoft/api-documenter": "7.7.20",
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+
};

repo-scripts/size-analysis/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# size-analysis-firebase
2+

repo-scripts/size-analysis/index.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
import { testFxn } from './src';
19+
20+
testFxn();
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "size-analysis-firebase",
3+
"version": "0.1.0",
4+
"private": true,
5+
"description": "A template package for new firebase packages",
6+
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
7+
"main": "dist/index.cjs.js",
8+
"files": [
9+
"dist"
10+
],
11+
"scripts": {
12+
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
13+
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
14+
"build": "rollup -c",
15+
"dev": "rollup -c -w",
16+
"test": "yarn type-check && TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.* --config ../../config/mocharc.node.js",
17+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
18+
"type-check": "tsc -p . --noEmit",
19+
"prepare": "yarn build"
20+
},
21+
"dependencies": {
22+
"typescript": "3.8.3"
23+
},
24+
"license": "Apache-2.0",
25+
"devDependencies": {
26+
"rollup": "2.7.6",
27+
"rollup-plugin-typescript2": "0.27.0"
28+
},
29+
"repository": {
30+
"directory": "packages/template",
31+
"type": "git",
32+
"url": "https://github.com/firebase/firebase-js-sdk.git"
33+
},
34+
"bugs": {
35+
"url": "https://github.com/firebase/firebase-js-sdk/issues"
36+
},
37+
"typings": "dist/index.d.ts",
38+
"nyc": {
39+
"extension": [
40+
".ts"
41+
],
42+
"reportDir": "./coverage/node"
43+
}
44+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* @license
3+
* Copyright 2019 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 typescript from 'typescript';
20+
import pkg from './package.json';
21+
22+
export default [
23+
{
24+
input: 'index.ts',
25+
output: [{ file: pkg.main, format: 'cjs', sourcemap: true }],
26+
plugins: [
27+
typescriptPlugin({
28+
typescript
29+
})
30+
]
31+
}
32+
];
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
import { expect } from 'chai';
19+
import { testFxn } from './index';
20+
21+
describe('Simple test', () => {
22+
it('Should skip this test');
23+
it('Should test this fxn', () => {
24+
expect(testFxn()).to.equal(42);
25+
});
26+
it('Should test this async thing', async () => {
27+
// Do some async assertions, you can use `await` syntax if it helps
28+
const val = await Promise.resolve(42);
29+
expect(val).to.equal(42);
30+
});
31+
});
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
import { TestType } from '@firebase/template-types';
19+
20+
export function testFxn(): number {
21+
const _thing: TestType = {};
22+
console.log('hi');
23+
return 42;
24+
}
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+
},
6+
"exclude": [
7+
"dist/**/*"
8+
]
9+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"name": "@firebase/test-exp",
3+
"version": "0.0.800",
4+
"private": true,
5+
"description": "TestSizeAnalysis",
6+
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
7+
"main": "dist/index.cjs.js",
8+
"browser": "dist/index.esm5.js",
9+
"module": "dist/index.esm5.js",
10+
"esm2017": "dist/index.esm2017.js",
11+
"files": [
12+
"dist"
13+
],
14+
"scripts": {
15+
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
16+
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
17+
"build": "rollup -c",
18+
"build:release": "rollup -c rollup.config.release.js && yarn api-report && yarn typings:public",
19+
"build:deps": "lerna run --scope @firebase/test-exp --include-dependencies build",
20+
"dev": "rollup -c -w",
21+
"test": "yarn type-check && run-p lint test:node",
22+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
23+
"test:browser": "karma start --single-run",
24+
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.ts --config ../../../../../config/mocharc.node.js",
25+
"type-check": "tsc -p . --noEmit",
26+
"prepare": "rollup -c rollup.config.release.js",
27+
"api-report": "api-extractor run --local --verbose",
28+
"predoc": "node ../../scripts/exp/remove-exp.js temp",
29+
"doc": "api-documenter markdown --input temp --output docs",
30+
"build:doc": "yarn build && yarn doc",
31+
"typings:public": "node ./use_public_typings.js --public",
32+
"typings:internal": "node ./use_public_typings.js"
33+
},
34+
"dependencies": {
35+
"@firebase/logger": "0.2.5",
36+
"tslib": "1.11.1",
37+
"typescript": "3.8.3"
38+
},
39+
"license": "Apache-2.0",
40+
"devDependencies": {
41+
"@rollup/plugin-alias": "3.1.1",
42+
"rollup": "1.32.1",
43+
"rollup-plugin-json": "4.0.0",
44+
"rollup-plugin-replace": "2.2.0",
45+
"rollup-plugin-typescript2": "0.27.0",
46+
"typescript": "3.8.3"
47+
},
48+
"repository": {
49+
"directory": "packages-exp/test-exp",
50+
"type": "git",
51+
"url": "https://github.com/firebase/firebase-js-sdk.git"
52+
},
53+
"bugs": {
54+
"url": "https://github.com/firebase/firebase-js-sdk/issues"
55+
},
56+
"typings": "./dist/scripts/exp/modular-export-binary-size-analysis/test/test-exp/src/index.d.ts",
57+
"nyc": {
58+
"extension": [
59+
".ts"
60+
],
61+
"reportDir": "./coverage/node"
62+
}
63+
}

0 commit comments

Comments
 (0)