forked from KelvinTegelaar/CIPP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'KelvinTegelaar:main' into main
- Loading branch information
Showing
56 changed files
with
2,673 additions
and
1,050 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: CIPP Development Frontend CI/CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
pull_request: | ||
types: [opened, synchronize, reopened, closed] | ||
branches: | ||
- dev | ||
|
||
jobs: | ||
build_and_deploy_job: | ||
if: github.event.repository.fork == false && github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') | ||
runs-on: ubuntu-latest | ||
name: Build and Deploy Job | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Build And Deploy | ||
id: builddeploy | ||
uses: Azure/static-web-apps-deploy@v1 | ||
with: | ||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} # change this to your repository secret name | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) | ||
action: 'upload' | ||
###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### | ||
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig | ||
app_location: '/' # App source code path | ||
api_location: '' # Api source code path - optional | ||
output_location: '' # Built app content directory - optional | ||
###### End of Repository/Build Configurations ###### | ||
|
||
close_pull_request_job: | ||
if: github.event.repository.fork == false && github.event_name == 'pull_request' && github.event.action == 'closed' | ||
runs-on: ubuntu-latest | ||
name: Close Pull Request Job | ||
steps: | ||
- name: Close Pull Request | ||
id: closepullrequest | ||
uses: Azure/static-web-apps-deploy@v1 | ||
with: | ||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} # change this to your repository secret name | ||
action: 'close' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
dist/ | ||
build/ | ||
importsMap.jsx | ||
Generate-Import-Map.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Using ES Module syntax compatible with Node.js 18 and ensuring cross-platform compatibility | ||
import fs from 'fs/promises' | ||
import path from 'path' | ||
import { fileURLToPath } from 'url' | ||
|
||
// Convert __dirname equivalent for ES Modules | ||
const __filename = fileURLToPath(import.meta.url) | ||
const __dirname = path.dirname(__filename) | ||
|
||
// Adjust the relative path as necessary to point to your routes.json location | ||
const routesPath = path.join(__dirname, './src/routes.json') // Example path | ||
|
||
// Load routes.json with an import assertion for JSON | ||
const routes = await import(`file://${routesPath}`, { assert: { type: 'json' } }).then( | ||
(module) => module.default, | ||
) | ||
|
||
let importsMap = "import React from 'react'\n export const importsMap = {\n" | ||
|
||
routes.forEach((route) => { | ||
if (route.component) { | ||
// Adjust the import path to be relative to the importsMap.js file location | ||
const importPath = route.component.replace('views', './views') | ||
// Ensure paths are Unix-like for the dynamic import to work cross-platform | ||
const unixImportPath = importPath.split(path.sep).join('/') | ||
importsMap += ` "${route.path}": React.lazy(() => import('${unixImportPath}')), \n` | ||
} | ||
}) | ||
|
||
importsMap += '}\nexport default importsMap' | ||
|
||
// Specify the output file path for the generated imports map | ||
const outputPath = path.join(__dirname, './src/importsMap.jsx') | ||
await fs.writeFile(outputPath, importsMap) | ||
console.log('Import map generated.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// generate-imports-map.js | ||
const fs = require('fs') | ||
const path = require('path') | ||
const routes = require('./path/to/routes.json') | ||
|
||
let importsMap = 'export const importsMap = {\n' | ||
|
||
routes.forEach(route => { | ||
if (route.component) { | ||
// Convert the path to a format that's relative to where you'll be importing from | ||
const importPath = route.component.replace('views', './views') | ||
const componentName = path.basename(importPath) | ||
|
||
// Create an import statement for the component | ||
importsMap += "${route.path}": React.lazy(() = > import('${importPath}')), \n`; | ||
} | ||
}) | ||
|
||
importsMap += '};\n' | ||
|
||
fs.writeFileSync(path.resolve(__dirname,'./src/importsMap.js'), importsMap) | ||
console.log('Import map generated.') |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
5.4.2 | ||
5.5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.