Typescript project references take 2 (#586)
* More liberal .gitignores on TS output directories * Use project references for Typescript functions project * Use /dist dir for Cloud Functions deployment payload * Fix Github actions functions tsc job
This commit is contained in:
parent
4107d5fedb
commit
0b585d1c98
2
.github/workflows/check.yml
vendored
2
.github/workflows/check.yml
vendored
|
@ -52,4 +52,4 @@ jobs:
|
||||||
- name: Run Typescript checker on cloud functions
|
- name: Run Typescript checker on cloud functions
|
||||||
if: ${{ success() || failure() }}
|
if: ${{ success() || failure() }}
|
||||||
working-directory: functions
|
working-directory: functions
|
||||||
run: tsc --pretty --project tsconfig.json --noEmit
|
run: tsc -b -v --pretty
|
||||||
|
|
5
common/.gitignore
vendored
5
common/.gitignore
vendored
|
@ -1,6 +1,5 @@
|
||||||
# Compiled JavaScript files
|
# Compiled JavaScript files
|
||||||
lib/**/*.js
|
lib/
|
||||||
lib/**/*.js.map
|
|
||||||
|
|
||||||
# TypeScript v1 declaration files
|
# TypeScript v1 declaration files
|
||||||
typings/
|
typings/
|
||||||
|
@ -10,4 +9,4 @@ node_modules/
|
||||||
|
|
||||||
package-lock.json
|
package-lock.json
|
||||||
ui-debug.log
|
ui-debug.log
|
||||||
firebase-debug.log
|
firebase-debug.log
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": "../",
|
"baseUrl": "../",
|
||||||
|
"composite": true,
|
||||||
|
"module": "commonjs",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"outDir": "lib",
|
"outDir": "lib",
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"functions": {
|
"functions": {
|
||||||
"predeploy": "npm --prefix \"$RESOURCE_DIR\" run build",
|
"predeploy": "cd functions && yarn build",
|
||||||
"runtime": "nodejs16",
|
"runtime": "nodejs16",
|
||||||
"source": "functions"
|
"source": "functions/dist"
|
||||||
},
|
},
|
||||||
"firestore": {
|
"firestore": {
|
||||||
"rules": "firestore.rules",
|
"rules": "firestore.rules",
|
||||||
|
|
6
functions/.gitignore
vendored
6
functions/.gitignore
vendored
|
@ -2,9 +2,11 @@
|
||||||
.env*
|
.env*
|
||||||
.runtimeconfig.json
|
.runtimeconfig.json
|
||||||
|
|
||||||
|
# GCP deployment artifact
|
||||||
|
dist/
|
||||||
|
|
||||||
# Compiled JavaScript files
|
# Compiled JavaScript files
|
||||||
lib/**/*.js
|
lib/
|
||||||
lib/**/*.js.map
|
|
||||||
|
|
||||||
# TypeScript v1 declaration files
|
# TypeScript v1 declaration files
|
||||||
typings/
|
typings/
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
"firestore": "dev-mantic-markets.appspot.com"
|
"firestore": "dev-mantic-markets.appspot.com"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "yarn compile && rm -rf dist && mkdir -p dist/functions && cp -R ../common/lib dist/common && cp -R lib/src dist/functions/src && cp ../yarn.lock dist && cp package.json dist",
|
||||||
|
"compile": "tsc -b",
|
||||||
"watch": "tsc -w",
|
"watch": "tsc -w",
|
||||||
"shell": "yarn build && firebase functions:shell",
|
"shell": "yarn build && firebase functions:shell",
|
||||||
"start": "yarn shell",
|
"start": "yarn shell",
|
||||||
|
@ -18,7 +19,7 @@
|
||||||
"db:backup-remote": "yarn db:rename-remote-backup-folder && gcloud firestore export gs://$npm_package_config_firestore/firestore_export/",
|
"db:backup-remote": "yarn db:rename-remote-backup-folder && gcloud firestore export gs://$npm_package_config_firestore/firestore_export/",
|
||||||
"verify": "(cd .. && yarn verify)"
|
"verify": "(cd .. && yarn verify)"
|
||||||
},
|
},
|
||||||
"main": "lib/functions/src/index.js",
|
"main": "functions/src/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@amplitude/node": "1.10.0",
|
"@amplitude/node": "1.10.0",
|
||||||
"fetch": "1.1.0",
|
"fetch": "1.1.0",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": "../",
|
"baseUrl": "../",
|
||||||
|
"composite": true,
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"outDir": "lib",
|
"outDir": "lib",
|
||||||
|
@ -8,6 +9,11 @@
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"target": "es2017"
|
"target": "es2017"
|
||||||
},
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../common"
|
||||||
|
}
|
||||||
|
],
|
||||||
"compileOnSave": true,
|
"compileOnSave": true,
|
||||||
"include": ["src", "../common/**/*.ts"]
|
"include": ["src"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"incremental": true
|
"incremental": true
|
||||||
},
|
},
|
||||||
|
|
||||||
"watchOptions": {
|
"watchOptions": {
|
||||||
"excludeDirectories": [".next"]
|
"excludeDirectories": [".next"]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user