зеркало из https://github.com/mozilla/fxa.git
feat(next): add glean-generate script
Because: - Have project target to generate glean code. This commit: - Adds glean metrics library. - Adds blank subplat-backend-metrics.yaml - Add glean-generate target to project. Closes #FXA-9996
This commit is contained in:
Родитель
932b7ad48d
Коммит
e15e7e718b
|
@ -12,7 +12,7 @@
|
|||
"outputPath": "dist/apps/payments/next",
|
||||
"postcssConfig": "apps/payments/next/postcss.config.js"
|
||||
},
|
||||
"dependsOn": ["l10n-bundle"]
|
||||
"dependsOn": ["l10n-bundle", "glean-generate"]
|
||||
},
|
||||
"dev": {
|
||||
"options": {
|
||||
|
@ -37,7 +37,8 @@
|
|||
"outputs": ["{options.outputFile}"],
|
||||
"options": {
|
||||
"lintFilePatterns": ["apps/payments/next/**/*.{ts,tsx,js,jsx}"]
|
||||
}
|
||||
},
|
||||
"dependsOn": ["glean-lint"]
|
||||
},
|
||||
"start": {
|
||||
"command": "pm2 start apps/payments/next/pm2.config.js && yarn check:url localhost:3035/__heartbeat__"
|
||||
|
@ -70,6 +71,13 @@
|
|||
"dependsOn": ["l10n-prime"],
|
||||
"command": "node -r esbuild-register apps/payments/next/app/_lib/scripts/convert.ts"
|
||||
},
|
||||
"glean-generate": {
|
||||
"dependsOn": ["glean-lint"],
|
||||
"command": "yarn glean translate libs/shared/metrics/glean/src/registry/subplat-backend-metrics.yaml -f typescript_server -o apps/payments/next/lib/metrics/glean"
|
||||
},
|
||||
"glean-lint": {
|
||||
"command": "yarn glean glinter libs/shared/metrics/glean/src/registry/subplat-backend-metrics.yaml"
|
||||
},
|
||||
"storybook": {
|
||||
"executor": "@nx/storybook:storybook",
|
||||
"options": {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"extends": ["../../../../.eslintrc.json"],
|
||||
"ignorePatterns": ["!**/*"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.ts", "*.tsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.js", "*.jsx"],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"jsc": {
|
||||
"target": "es2017",
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"decorators": true,
|
||||
"dynamicImport": true
|
||||
},
|
||||
"transform": {
|
||||
"decoratorMetadata": true,
|
||||
"legacyDecorator": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
# shared-glean
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Building
|
||||
|
||||
Run `nx build shared-glean` to build the library.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `nx run shared-glean:test-unit` to execute the unit tests via [Jest](https://jestjs.io).
|
||||
|
||||
## Running integration tests
|
||||
|
||||
Run `nx run shared-glean:test-integration` to execute the integration tests via [Jest](https://jestjs.io).
|
|
@ -0,0 +1,30 @@
|
|||
/* eslint-disable */
|
||||
import { readFileSync } from 'fs';
|
||||
|
||||
// Reading the SWC compilation config and remove the "exclude"
|
||||
// for the test files to be compiled by SWC
|
||||
const { exclude: _, ...swcJestConfig } = JSON.parse(
|
||||
readFileSync(`${__dirname}/.swcrc`, 'utf-8')
|
||||
);
|
||||
|
||||
// disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves.
|
||||
// If we do not disable this, SWC Core will read .swcrc and won't transform our test files due to "exclude"
|
||||
if (swcJestConfig.swcrc === undefined) {
|
||||
swcJestConfig.swcrc = false;
|
||||
}
|
||||
|
||||
// Uncomment if using global setup/teardown files being transformed via swc
|
||||
// https://nx.dev/packages/jest/documents/overview#global-setup/teardown-with-nx-libraries
|
||||
// jest needs EsModule Interop to find the default exported setup/teardown functions
|
||||
// swcJestConfig.module.noInterop = false;
|
||||
|
||||
export default {
|
||||
displayName: 'shared-glean',
|
||||
preset: '../../../../jest.preset.js',
|
||||
testEnvironment: 'node',
|
||||
transform: {
|
||||
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig],
|
||||
},
|
||||
moduleFileExtensions: ['ts', 'js', 'html'],
|
||||
coverageDirectory: '../../../../coverage/libs/shared/metrics/glean',
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "@fxa/shared/glean",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {},
|
||||
"type": "commonjs",
|
||||
"main": "./index.cjs",
|
||||
"private": true
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"name": "shared-glean",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "libs/shared/metrics/glean/src",
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/esbuild:esbuild",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/shared/metrics/glean",
|
||||
"main": "libs/shared/metrics/glean/src/index.ts",
|
||||
"tsConfig": "libs/shared/metrics/glean/tsconfig.lib.json",
|
||||
"assets": ["libs/shared/metrics/glean/*.md"],
|
||||
"generatePackageJson": true,
|
||||
"declaration": true,
|
||||
"format": ["cjs"]
|
||||
}
|
||||
},
|
||||
"test-unit": {
|
||||
"executor": "@nx/jest:jest",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"options": {
|
||||
"jestConfig": "libs/shared/metrics/glean/jest.config.ts",
|
||||
"testPathPattern": ["^(?!.*\\.in\\.spec\\.ts$).*$"]
|
||||
}
|
||||
},
|
||||
"test-integration": {
|
||||
"executor": "@nx/jest:jest",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"options": {
|
||||
"jestConfig": "libs/shared/metrics/glean/jest.config.ts",
|
||||
"testPathPattern": ["\\.in\\.spec\\.ts$"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
# Schema
|
||||
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noImplicitOverride": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.spec.json"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../../dist/out-tsc",
|
||||
"declaration": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../../dist/out-tsc",
|
||||
"module": "commonjs",
|
||||
"types": ["jest", "node"]
|
||||
},
|
||||
"include": [
|
||||
"jest.config.ts",
|
||||
"src/**/*.test.ts",
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
|
@ -50,6 +50,7 @@
|
|||
"@google-cloud/pubsub": "^4.3.1",
|
||||
"@google-cloud/translate": "^8.2.0",
|
||||
"@grpc/grpc-js": "^1.11.1",
|
||||
"@mozilla/glean": "^5.0.3",
|
||||
"@nestjs/apollo": "^12.1.0",
|
||||
"@nestjs/common": "^10.3.4",
|
||||
"@nestjs/config": "^3.2.0",
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
],
|
||||
"@fxa/shared/error": ["libs/shared/error/src/index.ts"],
|
||||
"@fxa/shared/geodb": ["libs/shared/geodb/src/index.ts"],
|
||||
"@fxa/shared/glean": ["libs/shared/metrics/glean/src/index.ts"],
|
||||
"@fxa/shared/l10n": ["libs/shared/l10n/src/index.ts"],
|
||||
"@fxa/shared/l10n/client": ["libs/shared/l10n/src/client.ts"],
|
||||
"@fxa/shared/l10n/server": ["libs/shared/l10n/src/server.ts"],
|
||||
|
|
14
yarn.lock
14
yarn.lock
|
@ -12774,6 +12774,19 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@mozilla/glean@npm:^5.0.3":
|
||||
version: 5.0.3
|
||||
resolution: "@mozilla/glean@npm:5.0.3"
|
||||
dependencies:
|
||||
fflate: ^0.8.0
|
||||
tslib: ^2.3.1
|
||||
uuid: ^9.0.0
|
||||
bin:
|
||||
glean: dist/cli/cli.js
|
||||
checksum: 58ec9e831855d57f319738378694ca04b99217c10fee2c370f62624e61ca9b65b799cd16d499cd3cf9a2d18fc1ea512360c10fba2da0af62971e409e43aaa88d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@mrmlnc/readdir-enhanced@npm:^2.2.1":
|
||||
version: 2.2.1
|
||||
resolution: "@mrmlnc/readdir-enhanced@npm:2.2.1"
|
||||
|
@ -40115,6 +40128,7 @@ fsevents@~2.1.1:
|
|||
"@graphql-codegen/typescript": ^4.0.1
|
||||
"@graphql-codegen/typescript-document-nodes": ^4.0.1
|
||||
"@grpc/grpc-js": ^1.11.1
|
||||
"@mozilla/glean": ^5.0.3
|
||||
"@nestjs/apollo": ^12.1.0
|
||||
"@nestjs/cli": ^10.4.2
|
||||
"@nestjs/common": ^10.3.4
|
||||
|
|
Загрузка…
Ссылка в новой задаче