@salesforce/webapp-template-feature-micro-frontend 1.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +82 -0
- package/README.md +32 -0
- package/dist/.a4drules/build-validation.md +81 -0
- package/dist/.a4drules/code-quality.md +150 -0
- package/dist/.a4drules/graphql/tools/knowledge/lds-explore-graphql-schema.md +227 -0
- package/dist/.a4drules/graphql/tools/knowledge/lds-generate-graphql-mutationquery.md +212 -0
- package/dist/.a4drules/graphql/tools/knowledge/lds-generate-graphql-readquery.md +185 -0
- package/dist/.a4drules/graphql/tools/knowledge/lds-guide-graphql.md +205 -0
- package/dist/.a4drules/graphql/tools/schemas/shared.graphqls +1150 -0
- package/dist/.a4drules/graphql.md +408 -0
- package/dist/.a4drules/images.md +13 -0
- package/dist/.a4drules/react.md +361 -0
- package/dist/.a4drules/react_image_processing.md +45 -0
- package/dist/.a4drules/skills/install-feature/SKILL.md +67 -0
- package/dist/.a4drules/skills/install-feature/scripts/copy-feature-assets.sh +36 -0
- package/dist/.a4drules/typescript.md +224 -0
- package/dist/.forceignore +15 -0
- package/dist/.husky/pre-commit +4 -0
- package/dist/.prettierignore +11 -0
- package/dist/.prettierrc +17 -0
- package/dist/CHANGELOG.md +383 -0
- package/dist/README.md +18 -0
- package/dist/config/project-scratch-def.json +13 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/.prettierignore +9 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/.prettierrc +11 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/build/vite.config.d.ts +2 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/build/vite.config.js +74 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/e2e/app.spec.ts +24 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/eslint.config.js +113 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/feature-micro-frontend.webapplication-meta.xml +11 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/index.html +13 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/package-lock.json +7157 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/package.json +45 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/playwright.config.ts +24 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/scripts/rewrite-e2e-assets.mjs +23 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/src/api/graphql-operations-types.ts +127 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/src/api/utils/query/highRevenueAccountsQuery.graphql +29 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/src/app.tsx +13 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/src/appLayout.tsx +9 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/src/assets/icons/book.svg +3 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/src/assets/icons/copy.svg +4 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/src/assets/icons/rocket.svg +3 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/src/assets/icons/star.svg +3 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/src/assets/images/codey-1.png +0 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/src/assets/images/codey-2.png +0 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/src/assets/images/codey-3.png +0 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/src/assets/images/vibe-codey.svg +194 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/src/pages/About.tsx +12 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/src/pages/Home.tsx +12 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/src/pages/NotFound.tsx +18 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/src/routes.tsx +28 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/src/styles/global.css +13 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/tsconfig.json +36 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/tsconfig.node.json +13 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/vite-env.d.ts +1 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/vite.config.ts +83 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/vitest-env.d.ts +2 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/vitest.config.ts +11 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/vitest.setup.ts +1 -0
- package/dist/force-app/main/default/webapplications/feature-micro-frontend/webapplication.json +7 -0
- package/dist/jest.config.js +6 -0
- package/dist/package.json +38 -0
- package/dist/scripts/apex/hello.apex +10 -0
- package/dist/scripts/soql/account.soql +6 -0
- package/dist/sfdx-project.json +12 -0
- package/package.json +32 -0
- package/skills/micro-frontend/SKILL.md +137 -0
package/dist/force-app/main/default/webapplications/feature-micro-frontend/build/vite.config.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { resolve } from 'path';
|
|
5
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
6
|
+
import salesforce from '@salesforce/vite-plugin-webapp-experimental';
|
|
7
|
+
export default defineConfig(function (_a) {
|
|
8
|
+
var mode = _a.mode;
|
|
9
|
+
return {
|
|
10
|
+
plugins: [tailwindcss(), react(), salesforce()],
|
|
11
|
+
// Build configuration for MPA
|
|
12
|
+
build: {
|
|
13
|
+
outDir: resolve(__dirname, 'dist'),
|
|
14
|
+
assetsDir: 'assets',
|
|
15
|
+
sourcemap: false,
|
|
16
|
+
},
|
|
17
|
+
// Resolve aliases (shared between build and test)
|
|
18
|
+
resolve: {
|
|
19
|
+
dedupe: ['react', 'react-dom'],
|
|
20
|
+
alias: {
|
|
21
|
+
'@': path.resolve(__dirname, './src'),
|
|
22
|
+
'@api': path.resolve(__dirname, './src/api'),
|
|
23
|
+
'@components': path.resolve(__dirname, './src/components'),
|
|
24
|
+
'@utils': path.resolve(__dirname, './src/utils'),
|
|
25
|
+
'@styles': path.resolve(__dirname, './src/styles'),
|
|
26
|
+
'@assets': path.resolve(__dirname, './src/assets'),
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
// Vitest configuration
|
|
30
|
+
test: {
|
|
31
|
+
// Override root for tests (build uses src/pages as root)
|
|
32
|
+
root: resolve(__dirname),
|
|
33
|
+
// Use jsdom environment for React component testing
|
|
34
|
+
environment: 'jsdom',
|
|
35
|
+
// Setup files to run before each test
|
|
36
|
+
setupFiles: ['./src/test/setup.ts'],
|
|
37
|
+
// Global test patterns
|
|
38
|
+
include: [
|
|
39
|
+
'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
|
|
40
|
+
'src/**/__tests__/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
|
|
41
|
+
],
|
|
42
|
+
// Coverage configuration
|
|
43
|
+
coverage: {
|
|
44
|
+
provider: 'v8',
|
|
45
|
+
reporter: ['text', 'html', 'clover', 'json'],
|
|
46
|
+
exclude: [
|
|
47
|
+
'node_modules/',
|
|
48
|
+
'src/test/',
|
|
49
|
+
'src/**/*.d.ts',
|
|
50
|
+
'src/main.tsx',
|
|
51
|
+
'src/vite-env.d.ts',
|
|
52
|
+
'src/components/**/index.ts',
|
|
53
|
+
'**/*.config.ts',
|
|
54
|
+
'build/',
|
|
55
|
+
'dist/',
|
|
56
|
+
'coverage/',
|
|
57
|
+
'eslint.config.js',
|
|
58
|
+
],
|
|
59
|
+
thresholds: {
|
|
60
|
+
global: {
|
|
61
|
+
branches: 85,
|
|
62
|
+
functions: 85,
|
|
63
|
+
lines: 85,
|
|
64
|
+
statements: 85,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
// Test timeout
|
|
69
|
+
testTimeout: 10000,
|
|
70
|
+
// Globals for easier testing
|
|
71
|
+
globals: true,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { test, expect } from '@playwright/test';
|
|
2
|
+
|
|
3
|
+
test.describe('base-react-app', () => {
|
|
4
|
+
test('home page loads and shows welcome content', async ({ page }) => {
|
|
5
|
+
await page.goto('/');
|
|
6
|
+
await expect(page.getByRole('heading', { name: 'Home' })).toBeVisible();
|
|
7
|
+
await expect(
|
|
8
|
+
page.getByText('Welcome to your React application.')
|
|
9
|
+
).toBeVisible();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test('about page loads', async ({ page }) => {
|
|
13
|
+
await page.goto('/about');
|
|
14
|
+
await expect(page).toHaveURL(/\/about/);
|
|
15
|
+
await expect(page.getByRole('heading', { name: 'About' })).toBeVisible();
|
|
16
|
+
await expect(page.getByText('This is the about page.')).toBeVisible();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('not found route shows 404', async ({ page }) => {
|
|
20
|
+
await page.goto('/non-existent-route');
|
|
21
|
+
await expect(page.getByRole('heading', { name: '404' })).toBeVisible();
|
|
22
|
+
await expect(page.getByText('Page not found')).toBeVisible();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import tseslint from '@typescript-eslint/eslint-plugin';
|
|
3
|
+
import tsparser from '@typescript-eslint/parser';
|
|
4
|
+
import react from 'eslint-plugin-react';
|
|
5
|
+
import reactHooks from 'eslint-plugin-react-hooks';
|
|
6
|
+
import reactRefresh from 'eslint-plugin-react-refresh';
|
|
7
|
+
import globals from 'globals';
|
|
8
|
+
|
|
9
|
+
export default [
|
|
10
|
+
// Global ignores
|
|
11
|
+
{
|
|
12
|
+
ignores: ['build/**/*', 'dist/**/*', 'coverage/**/*'],
|
|
13
|
+
},
|
|
14
|
+
// Config files and build tools (first to avoid inheritance)
|
|
15
|
+
{
|
|
16
|
+
files: ['*.config.{js,ts}', 'vite.config.ts'],
|
|
17
|
+
languageOptions: {
|
|
18
|
+
parser: tsparser,
|
|
19
|
+
parserOptions: {
|
|
20
|
+
ecmaVersion: 'latest',
|
|
21
|
+
sourceType: 'module',
|
|
22
|
+
},
|
|
23
|
+
globals: {
|
|
24
|
+
...globals.node,
|
|
25
|
+
__dirname: 'readonly',
|
|
26
|
+
process: 'readonly',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
plugins: {
|
|
30
|
+
'@typescript-eslint': tseslint,
|
|
31
|
+
},
|
|
32
|
+
rules: {
|
|
33
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
// Main TypeScript/React files
|
|
37
|
+
{
|
|
38
|
+
files: ['**/*.{ts,tsx}'],
|
|
39
|
+
ignores: [
|
|
40
|
+
'coverage',
|
|
41
|
+
'dist',
|
|
42
|
+
'node_modules',
|
|
43
|
+
'build',
|
|
44
|
+
'*.config.{js,ts}',
|
|
45
|
+
'vite.config.ts',
|
|
46
|
+
],
|
|
47
|
+
languageOptions: {
|
|
48
|
+
ecmaVersion: 2020,
|
|
49
|
+
sourceType: 'module',
|
|
50
|
+
parser: tsparser,
|
|
51
|
+
parserOptions: {
|
|
52
|
+
ecmaFeatures: {
|
|
53
|
+
jsx: true,
|
|
54
|
+
},
|
|
55
|
+
ecmaVersion: 'latest',
|
|
56
|
+
sourceType: 'module',
|
|
57
|
+
project: './tsconfig.json',
|
|
58
|
+
},
|
|
59
|
+
globals: {
|
|
60
|
+
...globals.browser,
|
|
61
|
+
JSX: 'readonly',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
plugins: {
|
|
65
|
+
react,
|
|
66
|
+
'react-hooks': reactHooks,
|
|
67
|
+
'react-refresh': reactRefresh,
|
|
68
|
+
'@typescript-eslint': tseslint,
|
|
69
|
+
},
|
|
70
|
+
rules: {
|
|
71
|
+
...js.configs.recommended.rules,
|
|
72
|
+
...tseslint.configs.recommended.rules,
|
|
73
|
+
...react.configs.recommended.rules,
|
|
74
|
+
...reactHooks.configs.recommended.rules,
|
|
75
|
+
'react/react-in-jsx-scope': 'off',
|
|
76
|
+
'react/prop-types': 'off',
|
|
77
|
+
'react/jsx-no-comment-textnodes': 'off',
|
|
78
|
+
'react/no-unescaped-entities': 'off',
|
|
79
|
+
'@typescript-eslint/no-unused-vars': [
|
|
80
|
+
'error',
|
|
81
|
+
{ argsIgnorePattern: '^_' },
|
|
82
|
+
],
|
|
83
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
84
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
85
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
86
|
+
},
|
|
87
|
+
settings: {
|
|
88
|
+
react: {
|
|
89
|
+
version: 'detect',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
// Test files
|
|
94
|
+
{
|
|
95
|
+
files: [
|
|
96
|
+
'**/*.test.{ts,tsx}',
|
|
97
|
+
'**/test/**/*.{ts,tsx}',
|
|
98
|
+
'src/test/**/*.{ts,tsx}',
|
|
99
|
+
],
|
|
100
|
+
languageOptions: {
|
|
101
|
+
parser: tsparser,
|
|
102
|
+
globals: {
|
|
103
|
+
...globals.browser,
|
|
104
|
+
...globals.node,
|
|
105
|
+
global: 'writable',
|
|
106
|
+
JSX: 'readonly',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
rules: {
|
|
110
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<WebApplication xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
3
|
+
<apiVersion>65.0</apiVersion>
|
|
4
|
+
<masterLabel>feature-micro-frontend</masterLabel>
|
|
5
|
+
<description>A Salesforce Web App to embed as a Micro Frontend.</description>
|
|
6
|
+
<active>true</active>
|
|
7
|
+
<version>1</version>
|
|
8
|
+
<supportedTargets>
|
|
9
|
+
<target>lightningOut</target>
|
|
10
|
+
</supportedTargets>
|
|
11
|
+
</WebApplication>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Welcome to React App</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/app.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|