Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poc/web ext 2 #978

Merged
merged 5 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .release-it-web-ext.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://unpkg.com/release-it@17/schema/release-it.json",
"plugins": {
"@release-it/bumper": {
"in": "apps/jetstream-web-extension/src/manifest.json",
"out": "apps/jetstream-web-extension/src/manifest.json"
}
},
"git": {
"tagAnnotation": "Release web extension ${version}",
"commitMessage": "chore: release web extension ${version}",
"tag": true,
"tagName": "web-ext-v${version}"
},
"npm": false,
"github": {
"release": true,
"releaseName": "Jetstream Web Extension ${version}",
"assets": ["dist/jetstream-web-extension-${version}.zip"]
},
"hooks": {
"after:bump": [
"npx prettier --write apps/jetstream-web-extension/src/manifest.json",
"yarn build:web-extension",
"rm -f dist/apps/jetstream-web-extension-${version}.zip *",
"cd dist/apps/jetstream-web-extension && zip -r -9 ../../jetstream-web-extension-${version}.zip *"
],
"after:release": "echo Successfully released ${name} v${version}."
}
}
4 changes: 3 additions & 1 deletion .release-it.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://unpkg.com/release-it@17/schema/release-it.json",
"plugins": {},
"git": {
"commitMessage": "chore: release ${version}",
Expand All @@ -10,7 +11,8 @@
"publish": false
},
"github": {
"release": true
"release": true,
"releaseName": "Jetstream ${version}"
},
"hooks": {
"before:init": ["yarn test:all", "SKIP_ROLLBAR=true yarn build"],
Expand Down
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,
};
10 changes: 10 additions & 0 deletions apps/jetstream-web-extension/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-disable */
export default {
displayName: 'jetstream-web-extension',
preset: '../../jest.preset.js',
transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
};
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"
}
}
}
}
Empty file.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.

Large diffs are not rendered by default.

Loading