create-pb-tririga-react-app 1.0.4 → 1.0.6
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 +1 -4
- package/index.js +1 -3
- package/package.json +1 -1
- package/template/README.md +19 -10
- package/template/src/services/tririgaService.ts +2 -4
- package/template/vite.config.ts +2 -2
package/README.md
CHANGED
|
@@ -23,7 +23,4 @@ npx create-pb-tririga-react-app my-tririga-app
|
|
|
23
23
|
Once created:
|
|
24
24
|
|
|
25
25
|
1. `cd my-tririga-app`
|
|
26
|
-
2.
|
|
27
|
-
2. `pnpm install`
|
|
28
|
-
3. Update configuration files (see `README.md`)
|
|
29
|
-
4. `pnpm run build:deploy`
|
|
26
|
+
2. Follow setup instructions in the project `README.md`
|
package/index.js
CHANGED
|
@@ -49,6 +49,4 @@ pkgJson.name = projectName;
|
|
|
49
49
|
fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
|
|
50
50
|
|
|
51
51
|
console.log(`Success! Created ${projectName}.`);
|
|
52
|
-
console.log(`cd ${projectName}
|
|
53
|
-
console.log(`pnpm install`);
|
|
54
|
-
console.log(`pnpm run dev`);
|
|
52
|
+
console.log(`cd ${projectName} and see the Readme.md inside the project folder for further instructions.`);
|
package/package.json
CHANGED
package/template/README.md
CHANGED
|
@@ -15,31 +15,40 @@ This is a template for building IBM TRIRIGA UX applications using React, TypeScr
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
3. **Configure Environment**
|
|
18
|
-
|
|
18
|
+
Copy `.env.example` to `.env` and update the values for your local development and deployment settings.
|
|
19
19
|
```
|
|
20
|
-
|
|
20
|
+
cp .env.example .env
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
3. **Run Locally**
|
|
24
|
-
```
|
|
25
|
-
npm run dev
|
|
26
|
-
```
|
|
27
|
-
Open [http://localhost:5173](http://localhost:5173) (or the port shown in terminal).
|
|
28
|
-
|
|
29
23
|
## Deployment
|
|
30
24
|
|
|
31
25
|
To deploy to a TRIRIGA environment:
|
|
32
26
|
|
|
33
27
|
1. **Install Depoyment Tool** (If not already installed globally)
|
|
34
28
|
```
|
|
35
|
-
|
|
29
|
+
npm install -g @tririga/tri-deploy
|
|
36
30
|
```
|
|
37
31
|
*Note: If you prefer not to install globally, you can add `@tririga/tri-deploy` to your devDependencies.*
|
|
38
32
|
|
|
39
33
|
2. **Configure Credentials**
|
|
34
|
+
Copy `.env.example` to `.env` and update the values for your deployment settings.
|
|
35
|
+
```
|
|
36
|
+
cp .env.example .env
|
|
37
|
+
```
|
|
40
38
|
Ensure your `.env` file has the correct `TRI_URL`, `TRI_USER`, and `TRI_PASSWORD`.
|
|
41
39
|
|
|
42
|
-
3. **
|
|
40
|
+
3. **Configure tririgaService.js file**
|
|
41
|
+
Update the TriAppConfig values `modelAndView` and `appExposedName` to match your app configuration in TRIRIGA.
|
|
42
|
+
Example:
|
|
43
|
+
`modelAndView: "myReactApp",`
|
|
44
|
+
`appExposedName: "myReactApp",`
|
|
45
|
+
|
|
46
|
+
3. **Configure vite.config.ts file**
|
|
47
|
+
Update the base value to match your application's exposed name in TRIRIGA.
|
|
48
|
+
Example:
|
|
49
|
+
base: '/app/myReactApp/',
|
|
50
|
+
|
|
51
|
+
4. **Run Deployment**
|
|
43
52
|
The view name will be taken from the `name` field in `package.json`.
|
|
44
53
|
```
|
|
45
54
|
pnpm run build:deploy
|
|
@@ -26,16 +26,14 @@ export async function initTriAppConfig(): Promise<TriAppConfig> {
|
|
|
26
26
|
if (segments[0] === 'app' && segments[1]) {
|
|
27
27
|
appPath = `/app/${segments[1]}/`;
|
|
28
28
|
}
|
|
29
|
-
// Assume view name matches exposed name valid for standard deployments
|
|
30
|
-
const viewName = segments[1] || 'unknownView';
|
|
31
29
|
|
|
32
30
|
const config: TriAppConfig = {
|
|
33
31
|
instanceId: "-1",
|
|
34
32
|
tririgaUrl: window.location.origin,
|
|
35
33
|
contextPath: "/app",
|
|
36
|
-
modelAndView:
|
|
34
|
+
modelAndView: "modelAndView", //update to match your TRIRIGA application
|
|
37
35
|
appPath: appPath,
|
|
38
|
-
appExposedName:
|
|
36
|
+
appExposedName: "appExposedName", //update to match your TRIRIGA application
|
|
39
37
|
sso: false
|
|
40
38
|
};
|
|
41
39
|
|
package/template/vite.config.ts
CHANGED
|
@@ -3,7 +3,7 @@ import react from '@vitejs/plugin-react'
|
|
|
3
3
|
|
|
4
4
|
// https://vite.dev/config/
|
|
5
5
|
export default defineConfig({
|
|
6
|
-
|
|
7
|
-
base: '
|
|
6
|
+
// Base path must match the TRIRIGA view name /app/<appName>/
|
|
7
|
+
base: '/app/appName/',
|
|
8
8
|
plugins: [react()],
|
|
9
9
|
})
|