Skip to content

Commit 41dfc69

Browse files
Merge pull request #2320 from KelvinTegelaar/dev
Dev to release
2 parents 57d0bf6 + c518942 commit 41dfc69

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2673
-1050
lines changed

.github/workflows/dev_deploy.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CIPP Development Frontend CI/CD
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
pull_request:
8+
types: [opened, synchronize, reopened, closed]
9+
branches:
10+
- dev
11+
12+
jobs:
13+
build_and_deploy_job:
14+
if: github.event.repository.fork == false && github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
15+
runs-on: ubuntu-latest
16+
name: Build and Deploy Job
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
submodules: true
21+
- name: Build And Deploy
22+
id: builddeploy
23+
uses: Azure/static-web-apps-deploy@v1
24+
with:
25+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} # change this to your repository secret name
26+
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
27+
action: 'upload'
28+
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
29+
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
30+
app_location: '/' # App source code path
31+
api_location: '' # Api source code path - optional
32+
output_location: '' # Built app content directory - optional
33+
###### End of Repository/Build Configurations ######
34+
35+
close_pull_request_job:
36+
if: github.event.repository.fork == false && github.event_name == 'pull_request' && github.event.action == 'closed'
37+
runs-on: ubuntu-latest
38+
name: Close Pull Request Job
39+
steps:
40+
- name: Close Pull Request
41+
id: closepullrequest
42+
uses: Azure/static-web-apps-deploy@v1
43+
with:
44+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} # change this to your repository secret name
45+
action: 'close'

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
dist/
2+
build/
3+
importsMap.jsx
4+
Generate-Import-Map.js

Generate-Import-Map.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Using ES Module syntax compatible with Node.js 18 and ensuring cross-platform compatibility
2+
import fs from 'fs/promises'
3+
import path from 'path'
4+
import { fileURLToPath } from 'url'
5+
6+
// Convert __dirname equivalent for ES Modules
7+
const __filename = fileURLToPath(import.meta.url)
8+
const __dirname = path.dirname(__filename)
9+
10+
// Adjust the relative path as necessary to point to your routes.json location
11+
const routesPath = path.join(__dirname, './src/routes.json') // Example path
12+
13+
// Load routes.json with an import assertion for JSON
14+
const routes = await import(`file://${routesPath}`, { assert: { type: 'json' } }).then(
15+
(module) => module.default,
16+
)
17+
18+
let importsMap = "import React from 'react'\n export const importsMap = {\n"
19+
20+
routes.forEach((route) => {
21+
if (route.component) {
22+
// Adjust the import path to be relative to the importsMap.js file location
23+
const importPath = route.component.replace('views', './views')
24+
// Ensure paths are Unix-like for the dynamic import to work cross-platform
25+
const unixImportPath = importPath.split(path.sep).join('/')
26+
importsMap += ` "${route.path}": React.lazy(() => import('${unixImportPath}')), \n`
27+
}
28+
})
29+
30+
importsMap += '}\nexport default importsMap'
31+
32+
// Specify the output file path for the generated imports map
33+
const outputPath = path.join(__dirname, './src/importsMap.jsx')
34+
await fs.writeFile(outputPath, importsMap)
35+
console.log('Import map generated.')

Importmap.ps1

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// generate-imports-map.js
2+
const fs = require('fs')
3+
const path = require('path')
4+
const routes = require('./path/to/routes.json')
5+
6+
let importsMap = 'export const importsMap = {\n'
7+
8+
routes.forEach(route => {
9+
if (route.component) {
10+
// Convert the path to a format that's relative to where you'll be importing from
11+
const importPath = route.component.replace('views', './views')
12+
const componentName = path.basename(importPath)
13+
14+
// Create an import statement for the component
15+
importsMap += "${route.path}": React.lazy(() = > import('${importPath}')), \n`;
16+
}
17+
})
18+
19+
importsMap += '};\n'
20+
21+
fs.writeFileSync(path.resolve(__dirname,'./src/importsMap.js'), importsMap)
22+
console.log('Import map generated.')

package-lock.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cipp",
3-
"version": "5.4.2",
3+
"version": "5.5.0",
44
"description": "The CyberDrain Improved Partner Portal is a portal to help manage administration for Microsoft Partners.",
55
"homepage": "https://cipp.app/",
66
"bugs": {
@@ -14,6 +14,7 @@
1414
"license": "AGPL-3.0",
1515
"author": "CIPP Contributors",
1616
"scripts": {
17+
"prebuild": "node Generate-Import-Map.js",
1718
"build": "echo react-scripts build && vite build",
1819
"changelog": "auto-changelog --starting-version 3.0.0 --commit-limit false --hide-credit",
1920
"lint": "eslint \"src/**/*.js\"",
@@ -43,6 +44,7 @@
4344
"@rjsf/core": "^5.12.1",
4445
"@rjsf/utils": "^5.12.1",
4546
"@rjsf/validator-ajv8": "^5.12.1",
47+
"@uiw/react-json-view": "^2.0.0-alpha.23",
4648
"axios": "^1.6.2",
4749
"buffer": "^6.0.3",
4850
"chart.js": "^3.5.1",

public/img/augmentt-dark.png

2.7 KB
Loading

public/img/augmentt-light.png

3.69 KB
Loading

public/img/netfriends.png

-3.69 KB
Binary file not shown.

public/img/netfriends_dark.png

-14 KB
Binary file not shown.

0 commit comments

Comments
 (0)