Skip to content

Commit

Permalink
Add Chrome Extension Application
Browse files Browse the repository at this point in the history
  • Loading branch information
paustint committed Jul 14, 2024
1 parent 2d876d0 commit 12a787e
Show file tree
Hide file tree
Showing 129 changed files with 5,605 additions and 1,082 deletions.
8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,11 @@
"statusBarItem.remoteBackground": "#111827",
"statusBarItem.remoteForeground": "#e7e7e7",
"commandCenter.border": "#e7e7e799"
}
},
"json.schemas": [
{
"fileMatch": ["jetstream-web-extension/**/manifest.json"],
"url": "https://json.schemastore.org/chrome-manifest"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import {
RetrievePackageFromExistingServerPackagesRequestSchema,
RetrievePackageFromLisMetadataResultsRequestSchema,
} from '@jetstream/api-types';
import { buildPackageXml, getRetrieveRequestFromListMetadata, getRetrieveRequestFromManifest } from '@jetstream/salesforce-api';
import { RetrieveRequest } from '@jetstream/types';
import JSZip from 'jszip';
import { isString } from 'lodash';
import { z } from 'zod';
import { buildPackageXml, getRetrieveRequestFromListMetadata, getRetrieveRequestFromManifest } from '../services/salesforce.service';
import { UserFacingError } from '../utils/error-handler';
import { sendJson } from '../utils/response.handlers';
import { createRoute } from '../utils/route.utils';
Expand Down
22 changes: 22 additions & 0 deletions apps/jetstream-web-extension-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": ["plugin:playwright/recommended", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["src/**/*.{ts,js,tsx,jsx}"],
"rules": {}
}
]
}
69 changes: 69 additions & 0 deletions apps/jetstream-web-extension-e2e/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { defineConfig, devices } from '@playwright/test';
import { nxE2EPreset } from '@nx/playwright/preset';

import { workspaceRoot } from '@nx/devkit';

// For CI, you may want to set BASE_URL to the deployed application.
const baseURL = process.env['BASE_URL'] || 'http://localhost:4200';

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
...nxE2EPreset(__filename, { testDir: './src' }),
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
baseURL,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},
/* Run your local dev server before starting the tests */
webServer: {
command: 'yarn nx serve jetstream-web-extension',
url: 'http://localhost:4200',
reuseExistingServer: !process.env.CI,
cwd: workspaceRoot,
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},

// Uncomment for mobile browsers support
/* {
name: 'Mobile Chrome',
use: { ...devices['Pixel 5'] },
},
{
name: 'Mobile Safari',
use: { ...devices['iPhone 12'] },
}, */

// Uncomment for branded browsers
/* {
name: 'Microsoft Edge',
use: { ...devices['Desktop Edge'], channel: 'msedge' },
},
{
name: 'Google Chrome',
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
} */
],
});
16 changes: 16 additions & 0 deletions apps/jetstream-web-extension-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "jetstream-web-extension-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/jetstream-web-extension-e2e/src",
"implicitDependencies": ["jetstream-web-extension"],
"targets": {
"e2e": {
"executor": "@nx/playwright:playwright",
"outputs": ["{workspaceRoot}/dist/.playwright/apps/jetstream-web-extension-e2e"],
"options": {
"config": "apps/jetstream-web-extension-e2e/playwright.config.ts"
}
}
}
}
8 changes: 8 additions & 0 deletions apps/jetstream-web-extension-e2e/src/example.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { test, expect } from '@playwright/test';

test('has title', async ({ page }) => {
await page.goto('/');

// Expect h1 to contain a substring.
expect(await page.locator('h1').innerText()).toContain('Welcome');
});
19 changes: 19 additions & 0 deletions apps/jetstream-web-extension-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"sourceMap": false
},
"include": [
"**/*.ts",
"**/*.js",
"playwright.config.ts",
"src/**/*.spec.ts",
"src/**/*.spec.js",
"src/**/*.test.ts",
"src/**/*.test.js",
"src/**/*.d.ts"
]
}
12 changes: 12 additions & 0 deletions apps/jetstream-web-extension/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic",
"importSource": "@emotion/react"
}
]
],
"plugins": ["@emotion/babel-plugin"]
}
25 changes: 25 additions & 0 deletions apps/jetstream-web-extension/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"extends": ["plugin:@nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {
"react-hooks/exhaustive-deps": [
"warn",
{
"additionalHooks": "(useRecoilCallback|useNonInitialEffect)"
}
]
}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
12 changes: 12 additions & 0 deletions apps/jetstream-web-extension/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const environment = {
name: 'Jetstream',
production: true,
rollbarClientAccessToken: process.env.NX_PUBLIC_ROLLBAR_KEY,
amplitudeToken: process.env.NX_PUBLIC_AMPLITUDE_KEY,
authAudience: process.env.NX_PUBLIC_AUTH_AUDIENCE,
MODE: process.env.MODE,
BASE_URL: process.env.BASE_URL,
PROD: process.env.PROD,
DEV: process.env.DEV,
SSR: process.env.SSR,
};
12 changes: 12 additions & 0 deletions apps/jetstream-web-extension/environments/environment.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const environment = {
name: 'JetstreamTest',
production: true,
rollbarClientAccessToken: process.env.NX_PUBLIC_ROLLBAR_KEY,
amplitudeToken: process.env.NX_PUBLIC_AMPLITUDE_KEY,
authAudience: process.env.NX_PUBLIC_AUTH_AUDIENCE,
// MODE: process.env.MODE,
// BASE_URL: process.env.BASE_URL,
// PROD: process.env.PROD,
// DEV: process.env.DEV,
// SSR: process.env.SSR,
};
15 changes: 15 additions & 0 deletions apps/jetstream-web-extension/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This file can be replaced during build by using the `fileReplacements` array.
// When building for production, this file is replaced with `environment.prod.ts`.

export const environment = {
name: 'JetstreamDev',
production: false,
rollbarClientAccessToken: process.env.NX_PUBLIC_ROLLBAR_KEY,
amplitudeToken: process.env.NX_PUBLIC_AMPLITUDE_KEY,
authAudience: process.env.NX_PUBLIC_AUTH_AUDIENCE,
MODE: process.env.MODE,
BASE_URL: process.env.BASE_URL,
PROD: process.env.PROD,
DEV: process.env.DEV,
SSR: process.env.SSR,
};
65 changes: 65 additions & 0 deletions apps/jetstream-web-extension/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "jetstream-web-extension",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/jetstream-web-extension/src",
"projectType": "application",
"tags": [],
"targets": {
"build": {
"executor": "@nx/webpack:webpack",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"compiler": "babel",
"outputPath": "dist/apps/jetstream-web-extension",
"baseHref": "/",
"tsConfig": "apps/jetstream-web-extension/tsconfig.app.json",
"assets": ["apps/jetstream-web-extension/src/assets"],
"styles": [],
"scripts": [],
"webpackConfig": "apps/jetstream-web-extension/webpack.config.js"
},
"configurations": {
"development": {
"extractLicenses": false,
"optimization": false,
"sourceMap": true,
"vendorChunk": true
},
"production": {
"fileReplacements": [],
"optimization": false,
"outputHashing": "none",
"sourceMap": true,
"namedChunks": false,
"extractLicenses": false,
"vendorChunk": false
}
}
},
"serve": {
"executor": "@nx/webpack:dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "jetstream-web-extension:build",
"hmr": true
},
"configurations": {
"development": {
"buildTarget": "jetstream-web-extension:build:development"
},
"production": {
"buildTarget": "jetstream-web-extension:build:production",
"hmr": false
}
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/jetstream-web-extension/jest.config.ts"
}
}
}
}
Loading

0 comments on commit 12a787e

Please sign in to comment.