Skip to content

Commit 9da7a14

Browse files
Salakarlaurenzlong
authored andcommitted
chore(*): Setup Travis configuration (#87)
1 parent eb28499 commit 9da7a14

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+702
-507
lines changed

.prettierignore

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package.json
22
extension.yaml
3-
webpack.config.js
3+
package-lock.json
4+
45
**/node_modules/**
56

67
# generated files
78
README.md
8-
POSTINSTALL.md
9-
PREINSTALL.md
109
**/functions/lib/**
1110
**/dist/**
11+
12+
# extension install md files
13+
# - excluded as prettier escapes variables e.g. `${PROJECT_ID}` becomes `\${PROJECT_ID}`
14+
POSTINSTALL.md
15+
PREINSTALL.md

.prettierrc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
trailingComma: es5
1616
arrowParens: always
1717
overrides:
18-
- files: "*.yaml"
18+
- files: "*.{yml,yaml}"
1919
options:
2020
proseWrap: always

.travis.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
language: node_js
2+
3+
node_js:
4+
- 8
5+
- 10
6+
- 12
7+
8+
stages:
9+
- validate
10+
- test
11+
12+
jobs:
13+
include:
14+
- stage: validate
15+
name: "TypeScript Compile"
16+
script: npm run clean && npm run build
17+
- stage: validate
18+
name: "Prettier Format Check"
19+
script: npm run lint
20+
- stage: test
21+
script: npm run test-coverage

auth-mailchimp-sync/jest.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@ module.exports = {
66
rootDir: "./",
77
preset: "ts-jest",
88
globalSetup: "./jest.setup.js",
9-
globalTeardown: "./jest.teardown.js"
9+
globalTeardown: "./jest.teardown.js",
1010
};
11-
12-

auth-mailchimp-sync/tsconfig.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@
33
"compilerOptions": {
44
"outDir": "functions/lib"
55
},
6-
"include": [
7-
"functions/src"
8-
]
6+
"include": ["functions/src"]
97
}

delete-user-data/functions/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,17 @@ const clearFirestoreData = async (firestorePaths: string, uid: string) => {
118118
const paths = extractUserPaths(firestorePaths, uid);
119119
const promises = paths.map(async (path) => {
120120
try {
121-
const isRecursive = config.firestoreDeleteMode === 'recursive';
121+
const isRecursive = config.firestoreDeleteMode === "recursive";
122122

123123
if (!isRecursive) {
124124
const firestore = admin.firestore();
125125
logs.firestorePathDeleting(path, false);
126126

127127
// Wrapping in transaction to allow for automatic retries (#48)
128-
await firestore.runTransaction((transaction => {
128+
await firestore.runTransaction((transaction) => {
129129
transaction.delete(firestore.doc(path));
130130
return Promise.resolve();
131-
}));
131+
});
132132
logs.firestorePathDeleted(path, false);
133133
} else {
134134
logs.firestorePathDeleting(path, true);

delete-user-data/functions/src/logs.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,19 @@ export const firestoreNotConfigured = () => {
3333
};
3434

3535
export const firestorePathDeleted = (path: string, recursive: boolean) => {
36-
console.log(`Deleted: '${path}' from Cloud Firestore ${recursive ? 'with recursive delete' : ''}`);
36+
console.log(
37+
`Deleted: '${path}' from Cloud Firestore ${
38+
recursive ? "with recursive delete" : ""
39+
}`
40+
);
3741
};
3842

3943
export const firestorePathDeleting = (path: string, recursive: boolean) => {
40-
console.log(`Deleting: '${path}' from Cloud Firestore ${recursive ? 'with recursive delete' : ''}`);
44+
console.log(
45+
`Deleting: '${path}' from Cloud Firestore ${
46+
recursive ? "with recursive delete" : ""
47+
}`
48+
);
4149
};
4250

4351
export const firestorePathError = (path: string, err: Error) => {
@@ -69,7 +77,10 @@ export const rtdbPathDeleting = (path: string) => {
6977
};
7078

7179
export const rtdbPathError = (path: string, err: Error) => {
72-
console.error(`Error when deleting: '${path}' from the Realtime Database`, err);
80+
console.error(
81+
`Error when deleting: '${path}' from the Realtime Database`,
82+
err
83+
);
7384
};
7485

7586
export const start = () => {

delete-user-data/jest.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
const packageJson = require('./package.json');
1+
const packageJson = require("./package.json");
22

33
module.exports = {
44
name: packageJson.name,
55
displayName: packageJson.name,
6-
rootDir: './',
7-
preset: 'ts-jest',
6+
rootDir: "./",
7+
preset: "ts-jest",
88
};

delete-user-data/tsconfig.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@
33
"compilerOptions": {
44
"outDir": "functions/lib"
55
},
6-
"include": [
7-
"functions/src"
8-
]
6+
"include": ["functions/src"]
97
}

firestore-bigquery-export/firestore-bigquery-change-tracker/src/bigquery/index.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
*/
1616

1717
import * as bigquery from "@google-cloud/bigquery";
18-
import {
19-
firestoreToBQTable,
20-
} from "./schema";
18+
import { firestoreToBQTable } from "./schema";
2119
import { latestConsistentSnapshotView } from "./snapshot";
2220

23-
import { ChangeType, FirestoreEventHistoryTracker, FirestoreDocumentChangeEvent } from "../tracker";
21+
import {
22+
ChangeType,
23+
FirestoreEventHistoryTracker,
24+
FirestoreDocumentChangeEvent,
25+
} from "../tracker";
2426
import * as logs from "../logs";
2527
import { BigQuery } from "@google-cloud/bigquery";
2628

@@ -38,7 +40,8 @@ export interface FirestoreBigQueryEventHistoryTrackerConfig {
3840
* - View: Latest view {@link FirestoreBigQueryEventHistoryTracker#rawLatestView}.
3941
* If any subsequent data export fails, it will attempt to reinitialize.
4042
*/
41-
export class FirestoreBigQueryEventHistoryTracker implements FirestoreEventHistoryTracker {
43+
export class FirestoreBigQueryEventHistoryTracker
44+
implements FirestoreEventHistoryTracker {
4245
bq: bigquery.BigQuery;
4346
initialized: boolean = false;
4447

@@ -49,7 +52,7 @@ export class FirestoreBigQueryEventHistoryTracker implements FirestoreEventHisto
4952
async record(events: FirestoreDocumentChangeEvent[]) {
5053
await this.initialize();
5154

52-
const rows = events.map(event => {
55+
const rows = events.map((event) => {
5356
// This must match firestoreToBQTable().
5457
return {
5558
timestamp: event.timestamp,
@@ -132,7 +135,7 @@ export class FirestoreBigQueryEventHistoryTracker implements FirestoreEventHisto
132135
logs.bigQueryTableCreated(changelogName);
133136
}
134137
return table;
135-
};
138+
}
136139

137140
/**
138141
* Creates the latest snapshot view, which returns only latest operations
@@ -146,7 +149,10 @@ export class FirestoreBigQueryEventHistoryTracker implements FirestoreEventHisto
146149
if (viewExists) {
147150
logs.bigQueryViewAlreadyExists(view.id, dataset.id);
148151
} else {
149-
const latestSnapshot = latestConsistentSnapshotView(this.config.datasetId, this.rawChangeLogTableName());
152+
const latestSnapshot = latestConsistentSnapshotView(
153+
this.config.datasetId,
154+
this.rawChangeLogTableName()
155+
);
150156
logs.bigQueryViewCreating(this.rawLatestView(), latestSnapshot.query);
151157
const options = {
152158
friendlyName: this.rawLatestView(),
@@ -166,4 +172,3 @@ export class FirestoreBigQueryEventHistoryTracker implements FirestoreEventHisto
166172
return `${this.config.tableId}_raw_latest`;
167173
}
168174
}
169-

0 commit comments

Comments
 (0)