@corva/create-app 0.0.0-2576df8 → 0.0.0-5fb771a
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/README.md +8 -6
- package/common/python/Makefile +8 -5
- package/common/python/pyproject.toml +25 -0
- package/common/python/uv.lock +381 -0
- package/common/ui/config/vite/corva-vite-config.mjs +352 -0
- package/common/ui/devApp.js +1 -0
- package/common/ui/index.html +17 -0
- package/common/ui/isolatedApp.js +1 -0
- package/common/ui/public/DevCenterIsolatedAppPage.html +26 -0
- package/common/ui/public/favicon.ico +0 -0
- package/common/ui/vite.config.mjs +3 -0
- package/common/ui/vitest.global-setup.js +4 -0
- package/common/ui/vitest.setup.js +24 -0
- package/lib/commands/create.js +11 -3
- package/lib/commands/release.js +17 -2
- package/lib/constants/cli.js +5 -8
- package/lib/constants/manifest.js +3 -3
- package/lib/constants/package.js +75 -65
- package/lib/flow.js +6 -0
- package/lib/flows/lib/manifest.js +1 -1
- package/lib/flows/release.js +4 -0
- package/lib/flows/steps/release/resolve-prebuilt-zip.js +35 -0
- package/lib/flows/steps/zip-file-list-resolve.js +3 -2
- package/lib/flows/zip-simple.js +2 -0
- package/lib/helpers/cli-version.js +14 -1
- package/lib/helpers/resolve-app-runtime.js +25 -14
- package/lib/helpers/utils.js +7 -3
- package/lib/main.js +2 -3
- package/lib/options/zip-file-name.js +18 -0
- package/package.json +1 -1
- package/templates/ui/javascript/.eslintrc +1 -2
- package/templates/ui/javascript/AGENTS.md +13 -11
- package/templates/ui/javascript/src/{App.completion.js → App.completion.jsx} +3 -3
- package/templates/ui/javascript/src/{App.drilling.js → App.drilling.jsx} +3 -3
- package/templates/ui/javascript/src/{AppSettings.js → AppSettings.jsx} +1 -1
- package/templates/ui/javascript/src/__tests__/{AppSettings.test.js → AppSettings.test.jsx} +1 -1
- package/templates/ui/typescript/AGENTS.md +10 -8
- package/templates/ui/typescript/src/App.completion.tsx +1 -1
- package/templates/ui/typescript/src/App.drilling.tsx +1 -1
- package/templates/ui/typescript/src/__tests__/AppSettings.test.tsx +1 -1
- package/templates/ui/typescript/tsconfig.json +17 -4
- package/common/python/requirements.txt +0 -2
- package/templates/ui/javascript/config/jest/babelTransform.js +0 -16
- package/templates/ui/javascript/config/jest/cssTransform.js +0 -16
- package/templates/ui/javascript/config/jest/fileTransform.js +0 -48
- package/templates/ui/javascript/config/jest/globalSetup.js +0 -5
- package/templates/ui/javascript/config/jest/setupTests.js +0 -30
- package/templates/ui/javascript/config-overrides.js +0 -10
- package/templates/ui/typescript/config/jest/babelTransform.js +0 -16
- package/templates/ui/typescript/config/jest/cssTransform.js +0 -16
- package/templates/ui/typescript/config/jest/fileTransform.js +0 -48
- package/templates/ui/typescript/config/jest/globalSetup.js +0 -5
- package/templates/ui/typescript/config/jest/setupTests.js +0 -30
- package/templates/ui/typescript/config-overrides.js +0 -10
- /package/templates/ui/javascript/src/{App.scss → App.module.scss} +0 -0
- /package/templates/ui/javascript/src/__tests__/{App.test.js → App.test.jsx} +0 -0
- /package/templates/ui/javascript/src/__tests__/{TestsExample.test.js → TestsExample.test.jsx} +0 -0
- /package/templates/ui/typescript/src/{App.scss → App.module.scss} +0 -0
|
@@ -4,7 +4,7 @@ import { useAppCommons } from '@corva/ui/effects';
|
|
|
4
4
|
import { DEFAULT_SETTINGS } from './constants';
|
|
5
5
|
import logo from './assets/logo.svg';
|
|
6
6
|
|
|
7
|
-
import styles from './App.scss';
|
|
7
|
+
import styles from './App.module.scss';
|
|
8
8
|
|
|
9
9
|
const App = () => {
|
|
10
10
|
const { appKey, rig, well, appSettings } = useAppCommons();
|
|
@@ -16,7 +16,7 @@ const App = () => {
|
|
|
16
16
|
<div className={styles.container}>
|
|
17
17
|
<img src={logo} alt="logo" className={styles.logo} />
|
|
18
18
|
<p>
|
|
19
|
-
Edit <code>src/App.
|
|
19
|
+
Edit <code>src/App.jsx</code> and save to reload.
|
|
20
20
|
<br />
|
|
21
21
|
<br />
|
|
22
22
|
</p>
|
|
@@ -44,6 +44,6 @@ const App = () => {
|
|
|
44
44
|
);
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
// Important: Do not change root component default export (App.
|
|
47
|
+
// Important: Do not change root component default export (App.jsx). Use it as container
|
|
48
48
|
// for your App. It's required to make build and zip scripts work as expected;
|
|
49
49
|
export default App;
|
|
@@ -23,6 +23,6 @@ const AppSettings = () => {
|
|
|
23
23
|
);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
// Important: Do not change root component default export (AppSettings.
|
|
26
|
+
// Important: Do not change root component default export (AppSettings.jsx). Use it as container
|
|
27
27
|
// for your App Settings. It's required to make build and zip scripts work as expected;
|
|
28
28
|
export default AppSettings;
|
|
@@ -6,7 +6,7 @@ import AppSettings from '../AppSettings';
|
|
|
6
6
|
|
|
7
7
|
describe('<AppSettings />', () => {
|
|
8
8
|
it('should call onChange with a changed setting on settings change', async () => {
|
|
9
|
-
const handleSettingChange =
|
|
9
|
+
const handleSettingChange = vi.fn();
|
|
10
10
|
|
|
11
11
|
render(
|
|
12
12
|
<AppTestWrapper
|
|
@@ -22,12 +22,14 @@ src/
|
|
|
22
22
|
constants.ts — Default settings values
|
|
23
23
|
types.ts — Custom app settings interface
|
|
24
24
|
custom.d.ts — Module declarations for CSS/SVG imports
|
|
25
|
-
App.scss — Component styles (SCSS modules)
|
|
26
|
-
__tests__/ —
|
|
25
|
+
App.module.scss — Component styles (SCSS modules)
|
|
26
|
+
__tests__/ — Vitest test files
|
|
27
27
|
__mocks__/mockData.ts — Mock data for tests
|
|
28
28
|
assets/ — Static assets (SVGs, images)
|
|
29
|
-
config/
|
|
30
|
-
config
|
|
29
|
+
config/vite/ — Shared Corva Vite config
|
|
30
|
+
vite.config.mjs — Vite entry config
|
|
31
|
+
vitest.setup.js — Test environment setup
|
|
32
|
+
index.html — Dev server host page
|
|
31
33
|
tsconfig.json — TypeScript configuration
|
|
32
34
|
manifest.json — Corva platform app metadata (generated at scaffold time)
|
|
33
35
|
```
|
|
@@ -117,7 +119,7 @@ transition: transition(color, background-color);
|
|
|
117
119
|
**Import in component:**
|
|
118
120
|
|
|
119
121
|
```typescript
|
|
120
|
-
import styles from './App.scss';
|
|
122
|
+
import styles from './App.module.scss';
|
|
121
123
|
// Use: <div className={styles.container}>
|
|
122
124
|
```
|
|
123
125
|
|
|
@@ -295,12 +297,12 @@ General rules:
|
|
|
295
297
|
|
|
296
298
|
## Testing
|
|
297
299
|
|
|
298
|
-
- **Framework:**
|
|
300
|
+
- **Framework:** Vitest + React Testing Library
|
|
299
301
|
- **Wrapper:** Use `AppTestWrapper` from `@corva/ui/testing` to wrap components — it provides `useAppCommons()` context
|
|
300
302
|
- **Pattern:** Pass data via `AppTestWrapper` props, render components with no props
|
|
301
|
-
- **Mocking:** Mock network requests (
|
|
303
|
+
- **Mocking:** Mock network requests (`vi.mock`/`vi.fn` or msw), never call real APIs
|
|
302
304
|
- **Timezone:** UTC is enforced (`process.env.TZ = 'UTC'`)
|
|
303
|
-
- **Mocked globals:** `ResizeObserver`, `MutationObserver` (in `
|
|
305
|
+
- **Mocked globals:** `ResizeObserver`, `MutationObserver` (in `vitest.setup.js`)
|
|
304
306
|
|
|
305
307
|
```tsx
|
|
306
308
|
// Test pattern — data flows through AppTestWrapper context
|
|
@@ -4,7 +4,7 @@ import { useAppCommons } from '@corva/ui/effects';
|
|
|
4
4
|
import { DEFAULT_SETTINGS } from './constants';
|
|
5
5
|
import logo from './assets/logo.svg';
|
|
6
6
|
|
|
7
|
-
import styles from './App.scss';
|
|
7
|
+
import styles from './App.module.scss';
|
|
8
8
|
|
|
9
9
|
const App = () => {
|
|
10
10
|
const { appKey, fracFleet, well, wells, appSettings } = useAppCommons();
|
|
@@ -4,7 +4,7 @@ import { useAppCommons } from '@corva/ui/effects';
|
|
|
4
4
|
import { DEFAULT_SETTINGS } from './constants';
|
|
5
5
|
import logo from './assets/logo.svg';
|
|
6
6
|
|
|
7
|
-
import styles from './App.scss';
|
|
7
|
+
import styles from './App.module.scss';
|
|
8
8
|
|
|
9
9
|
const App = () => {
|
|
10
10
|
const { appKey, rig, well, appSettings } = useAppCommons();
|
|
@@ -6,7 +6,7 @@ import AppSettings from '../AppSettings';
|
|
|
6
6
|
|
|
7
7
|
describe('<AppSettings />', () => {
|
|
8
8
|
it('should call onChange with a changed setting on settings change', async () => {
|
|
9
|
-
const handleSettingChange =
|
|
9
|
+
const handleSettingChange = vi.fn();
|
|
10
10
|
|
|
11
11
|
render(
|
|
12
12
|
<AppTestWrapper
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "@tsconfig/create-react-app/tsconfig.json",
|
|
3
2
|
"compilerOptions": {
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"types": ["vite/client", "vitest/globals", "@testing-library/jest-dom/vitest"],
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"forceConsistentCasingInFileNames": true,
|
|
16
|
+
"noEmit": true,
|
|
17
|
+
"paths": { "~/*": ["./src/*"] }
|
|
18
|
+
},
|
|
19
|
+
"include": ["src"]
|
|
7
20
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
const babelJest = require('babel-jest').default;
|
|
4
|
-
|
|
5
|
-
module.exports = babelJest.createTransformer({
|
|
6
|
-
presets: [
|
|
7
|
-
[
|
|
8
|
-
require.resolve('babel-preset-react-app'),
|
|
9
|
-
{
|
|
10
|
-
runtime: 'automatic',
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
|
-
],
|
|
14
|
-
babelrc: false,
|
|
15
|
-
configFile: false,
|
|
16
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
// This is a custom Jest transformer turning style imports into empty objects.
|
|
4
|
-
// http://facebook.github.io/jest/docs/en/webpack.html
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
process() {
|
|
8
|
-
return {
|
|
9
|
-
code: 'module.exports = {};',
|
|
10
|
-
};
|
|
11
|
-
},
|
|
12
|
-
getCacheKey() {
|
|
13
|
-
// The output is always the same.
|
|
14
|
-
return 'cssTransform';
|
|
15
|
-
},
|
|
16
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
// This is a custom Jest transformer turning file imports into filenames.
|
|
6
|
-
// http://facebook.github.io/jest/docs/en/webpack.html
|
|
7
|
-
|
|
8
|
-
const toPascalCase = str => {
|
|
9
|
-
const allWordsIterator = str.matchAll(/\w+/g);
|
|
10
|
-
|
|
11
|
-
return Array.from(allWordsIterator).reduce((acc, matchResult) => {
|
|
12
|
-
const word = matchResult[0];
|
|
13
|
-
return acc + word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
14
|
-
}, '');
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
module.exports = {
|
|
18
|
-
process(src, filename) {
|
|
19
|
-
const assetFilename = JSON.stringify(path.basename(filename));
|
|
20
|
-
|
|
21
|
-
if (filename.match(/\.svg$/)) {
|
|
22
|
-
// Based on how SVGR generates a component name:
|
|
23
|
-
// https://github.com/smooth-code/svgr/blob/01b194cf967347d43d4cbe6b434404731b87cf27/packages/core/src/state.js#L6
|
|
24
|
-
const pascalCaseFilename = toPascalCase(path.parse(filename).name);
|
|
25
|
-
const componentName = `Svg${pascalCaseFilename}`;
|
|
26
|
-
return {
|
|
27
|
-
code: `const React = require('react');
|
|
28
|
-
module.exports = {
|
|
29
|
-
__esModule: true,
|
|
30
|
-
default: ${assetFilename},
|
|
31
|
-
ReactComponent: React.forwardRef(function ${componentName}(props, ref) {
|
|
32
|
-
return {
|
|
33
|
-
$$typeof: Symbol.for('react.element'),
|
|
34
|
-
type: 'svg',
|
|
35
|
-
ref: ref,
|
|
36
|
-
key: null,
|
|
37
|
-
props: Object.assign({}, props, {
|
|
38
|
-
children: ${assetFilename}
|
|
39
|
-
})
|
|
40
|
-
};
|
|
41
|
-
}),
|
|
42
|
-
};`,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return { code: `module.exports = ${assetFilename};` };
|
|
47
|
-
},
|
|
48
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
|
4
|
-
// allows you to do things like:
|
|
5
|
-
// expect(element).toHaveTextContent(/react/i)
|
|
6
|
-
// learn more: https://github.com/testing-library/jest-dom
|
|
7
|
-
// eslint-disable-next-line
|
|
8
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
9
|
-
|
|
10
|
-
// Set UTC timezone for tests to not use the environment timezone
|
|
11
|
-
process.env.TZ = 'UTC';
|
|
12
|
-
|
|
13
|
-
// Mock ResizeObserver & MutationObserver
|
|
14
|
-
class FakeObserver {
|
|
15
|
-
observe() {}
|
|
16
|
-
unobserve() {}
|
|
17
|
-
disconnect() {}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
global.ResizeObserver = FakeObserver;
|
|
21
|
-
global.MutationObserver = FakeObserver;
|
|
22
|
-
|
|
23
|
-
// Suppressing "Could not parse CSS stylesheet" from JSDOM
|
|
24
|
-
const originalConsoleError = global.console.error;
|
|
25
|
-
global.console.error = (message, ...optionalParams) => {
|
|
26
|
-
if (message.includes('Could not parse CSS stylesheet')) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
originalConsoleError(message, ...optionalParams);
|
|
30
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const { getWebpackConfig } = require('@corva/dc-platform-shared/cjs');
|
|
2
|
-
const { merge } = require('webpack-merge');
|
|
3
|
-
|
|
4
|
-
module.exports = (env, argv) => {
|
|
5
|
-
return merge(
|
|
6
|
-
getWebpackConfig(env, argv),
|
|
7
|
-
// NOTE: Custom webpack 5 plugins and module rules can be provided here
|
|
8
|
-
{}
|
|
9
|
-
);
|
|
10
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
const babelJest = require('babel-jest').default;
|
|
4
|
-
|
|
5
|
-
module.exports = babelJest.createTransformer({
|
|
6
|
-
presets: [
|
|
7
|
-
[
|
|
8
|
-
require.resolve('babel-preset-react-app'),
|
|
9
|
-
{
|
|
10
|
-
runtime: 'automatic',
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
|
-
],
|
|
14
|
-
babelrc: false,
|
|
15
|
-
configFile: false,
|
|
16
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
// This is a custom Jest transformer turning style imports into empty objects.
|
|
4
|
-
// http://facebook.github.io/jest/docs/en/webpack.html
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
process() {
|
|
8
|
-
return {
|
|
9
|
-
code: 'module.exports = {};',
|
|
10
|
-
};
|
|
11
|
-
},
|
|
12
|
-
getCacheKey() {
|
|
13
|
-
// The output is always the same.
|
|
14
|
-
return 'cssTransform';
|
|
15
|
-
},
|
|
16
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
// This is a custom Jest transformer turning file imports into filenames.
|
|
6
|
-
// http://facebook.github.io/jest/docs/en/webpack.html
|
|
7
|
-
|
|
8
|
-
const toPascalCase = str => {
|
|
9
|
-
const allWordsIterator = str.matchAll(/\w+/g);
|
|
10
|
-
|
|
11
|
-
return Array.from(allWordsIterator).reduce((acc, matchResult) => {
|
|
12
|
-
const word = matchResult[0];
|
|
13
|
-
return acc + word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
14
|
-
}, '');
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
module.exports = {
|
|
18
|
-
process(src, filename) {
|
|
19
|
-
const assetFilename = JSON.stringify(path.basename(filename));
|
|
20
|
-
|
|
21
|
-
if (filename.match(/\.svg$/)) {
|
|
22
|
-
// Based on how SVGR generates a component name:
|
|
23
|
-
// https://github.com/smooth-code/svgr/blob/01b194cf967347d43d4cbe6b434404731b87cf27/packages/core/src/state.js#L6
|
|
24
|
-
const pascalCaseFilename = toPascalCase(path.parse(filename).name);
|
|
25
|
-
const componentName = `Svg${pascalCaseFilename}`;
|
|
26
|
-
return {
|
|
27
|
-
code: `const React = require('react');
|
|
28
|
-
module.exports = {
|
|
29
|
-
__esModule: true,
|
|
30
|
-
default: ${assetFilename},
|
|
31
|
-
ReactComponent: React.forwardRef(function ${componentName}(props, ref) {
|
|
32
|
-
return {
|
|
33
|
-
$$typeof: Symbol.for('react.element'),
|
|
34
|
-
type: 'svg',
|
|
35
|
-
ref: ref,
|
|
36
|
-
key: null,
|
|
37
|
-
props: Object.assign({}, props, {
|
|
38
|
-
children: ${assetFilename}
|
|
39
|
-
})
|
|
40
|
-
};
|
|
41
|
-
}),
|
|
42
|
-
};`,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return { code: `module.exports = ${assetFilename};` };
|
|
47
|
-
},
|
|
48
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
|
4
|
-
// allows you to do things like:
|
|
5
|
-
// expect(element).toHaveTextContent(/react/i)
|
|
6
|
-
// learn more: https://github.com/testing-library/jest-dom
|
|
7
|
-
// eslint-disable-next-line
|
|
8
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
9
|
-
|
|
10
|
-
// Set UTC timezone for tests to not use the environment timezone
|
|
11
|
-
process.env.TZ = 'UTC';
|
|
12
|
-
|
|
13
|
-
// Mock ResizeObserver & MutationObserver
|
|
14
|
-
class FakeObserver {
|
|
15
|
-
observe() {}
|
|
16
|
-
unobserve() {}
|
|
17
|
-
disconnect() {}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
global.ResizeObserver = FakeObserver;
|
|
21
|
-
global.MutationObserver = FakeObserver;
|
|
22
|
-
|
|
23
|
-
// Suppressing "Could not parse CSS stylesheet" from JSDOM
|
|
24
|
-
const originalConsoleError = global.console.error;
|
|
25
|
-
global.console.error = (message, ...optionalParams) => {
|
|
26
|
-
if (message.includes('Could not parse CSS stylesheet')) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
originalConsoleError(message, ...optionalParams);
|
|
30
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const { getWebpackConfig } = require('@corva/dc-platform-shared/cjs');
|
|
2
|
-
const { merge } = require('webpack-merge');
|
|
3
|
-
|
|
4
|
-
module.exports = (env, argv) => {
|
|
5
|
-
return merge(
|
|
6
|
-
getWebpackConfig(env, argv),
|
|
7
|
-
// NOTE: Custom webpack 5 plugins and module rules can be provided here
|
|
8
|
-
{}
|
|
9
|
-
);
|
|
10
|
-
};
|
|
File without changes
|
|
File without changes
|
/package/templates/ui/javascript/src/__tests__/{TestsExample.test.js → TestsExample.test.jsx}
RENAMED
|
File without changes
|
|
File without changes
|