Skip to content

Commit

Permalink
Restructure dx for admin portal
Browse files Browse the repository at this point in the history
  • Loading branch information
snaerseljan committed Sep 23, 2024
1 parent c3f0330 commit efcf8f2
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 10 deletions.
34 changes: 28 additions & 6 deletions apps/portals/admin/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/portals/admin/src",
"projectType": "application",
"tags": ["scope:portals-admin"],
"tags": [
"scope:portals-admin"
],
"targets": {
"build": {
"executor": "@nx/webpack:webpack",
"outputs": ["{options.outputPath}"],
"outputs": [
"{options.outputPath}"
],
"defaultConfiguration": "production",
"options": {
"compiler": "babel",
Expand All @@ -22,7 +26,9 @@
"apps/portals/admin/src/mockServiceWorker.js",
"apps/portals/admin/src/assets"
],
"styles": ["apps/portals/admin/src/styles.css"],
"styles": [
"apps/portals/admin/src/styles.css"
],
"scripts": [],
"webpackConfig": "apps/portals/admin/webpack.config.js"
},
Expand All @@ -49,15 +55,23 @@
"node scripts/dockerfile-assets/bash/extract-environment.js apps/portals/admin/src"
]
},
"outputs": ["{workspaceRoot}/apps/portals/admin/src/index.html"]
"outputs": [
"{workspaceRoot}/apps/portals/admin/src/index.html"
]
},
"serve": {
"executor": "@nx/webpack:dev-server",
"options": {
"buildTarget": "portals-admin:build",
"hmr": true,
"proxyConfig": "apps/portals/admin/proxy.config.json",
<<<<<<< HEAD
"ignore": ["libs/services/bff"]
=======
"ignore": [
"libs/services/bff"
]
>>>>>>> cb11e260d1 (Restructure dx for admin portal)
},
"configurations": {
"production": {
Expand All @@ -76,7 +90,9 @@
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/apps/portals/admin"],
"outputs": [
"{workspaceRoot}/coverage/apps/portals/admin"
],
"options": {
"jestConfig": "apps/portals/admin/jest.config.ts"
}
Expand All @@ -90,17 +106,23 @@
"dev-init": {
"executor": "nx:run-commands",
"options": {
"commands": ["yarn get-secrets portals-admin"],
"commands": [
"yarn get-secrets portals-admin"
],
"parallel": false
}
},
"dev": {
"executor": "nx:run-commands",
"options": {
<<<<<<< HEAD
"command": [
"cross-env NODE_ENV=development esbuild apps/portals/admin/start-with-bff.ts --bundle --platform=node --outfile=dist/start-with-bff.js && node --inspect dist/start-with-bff.js"
],
"parallel": true
=======
"command": "cross-env NODE_ENV=development yarn ts-node -P apps/portals/admin/tsconfig.app.json apps/portals/admin/start-with-bff.ts"
>>>>>>> cb11e260d1 (Restructure dx for admin portal)
}
},
"docker-static": {
Expand Down
16 changes: 12 additions & 4 deletions apps/services/bff/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"sourceRoot": "apps/services/bff/src",
"projectType": "application",
"prefix": "services-bff",
"tags": ["scope:services-bff"],
"tags": [
"scope:services-bff"
],
"targets": {
"build": {
"executor": "./tools/executors/node:build",
Expand All @@ -21,7 +23,9 @@
"inspect": false
}
},
"outputs": ["{options.outputPath}"]
"outputs": [
"{options.outputPath}"
]
},
"serve": {
"executor": "@nx/js:node",
Expand All @@ -38,7 +42,9 @@
"jestConfig": "apps/services/bff/jest.config.ts",
"runInBand": true
},
"outputs": ["{workspaceRoot}/coverage/apps/services/bff"]
"outputs": [
"{workspaceRoot}/coverage/apps/services/bff"
]
},
"dev-services": {
"executor": "nx:run-commands",
Expand All @@ -50,7 +56,9 @@
"dev": {
"executor": "nx:run-commands",
"options": {
"commands": ["yarn start services-bff"],
"commands": [
"yarn start services-bff"
],
"parallel": true
}
}
Expand Down
12 changes: 12 additions & 0 deletions libs/services/bff/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,26 @@
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/services/bff/src",
"projectType": "library",
<<<<<<< HEAD
"tags": ["lib:js"],
=======
"tags": [
"lib:js"
],
>>>>>>> cb11e260d1 (Restructure dx for admin portal)
"targets": {
"lint": {
"executor": "@nx/eslint:lint"
},
"test": {
"executor": "@nx/jest:jest",
<<<<<<< HEAD
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
=======
"outputs": [
"{workspaceRoot}/coverage/{projectRoot}"
],
>>>>>>> cb11e260d1 (Restructure dx for admin portal)
"options": {
"jestConfig": "libs/services/bff/jest.config.ts"
}
Expand Down
9 changes: 9 additions & 0 deletions libs/services/bff/src/lib/set-dev-env-vars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,22 @@ export const setDevEnvVars = (key: BffClient) => {
'https://identity-server.dev01.devland.is'
process.env.IDENTITY_SERVER_AUDIENCE = '["@admin.island.is/bff"]'
process.env.BFF_PAR_SUPPORT_ENABLED = 'false'
<<<<<<< HEAD
process.env.BFF_LOGOUT_REDIRECT_PATH = 'http://localhost:4200'
process.env.BFF_PROXY_API_ENDPOINT = 'http://localhost:4444/api/graphql'
process.env.BFF_TOKEN_SECRET_BASE64 =
// This is a valid 32-byte base64 encoded dummy secret.
// You can generate a new one by running `openssl rand -base64 32`
'Y0ROrC3mxDBnveN+EpAnLtSubttyjZZWcV43dyk7OQI='
// This is only needed for local development when proxying requests with the GraphQL API.
=======
process.env.BFF_LOGOUT_REDIRECT_PATH = 'https://beta.dev01.devland.is'
process.env.BFF_PROXY_API_ENDPOINT = 'http://localhost:4444/api/graphql'
process.env.BFF_TOKEN_SECRET_BASE64 =
// This is a valid 32-byte base64 encoded secret.
// You can generate a new one by running `openssl rand -base64 32`
'Y0ROrC3mxDBnveN+EpAnLtSubttyjZZWcV43dyk7OQI='
>>>>>>> cb11e260d1 (Restructure dx for admin portal)
process.env.BFF_LOCAL_DEVELOPMENT_CORS = 'true'

process.env.BFF_API_URL_PREFIX = `/${keyPath}/bff`
Expand Down
7 changes: 7 additions & 0 deletions libs/shared/utils/src/lib/server/startProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,24 @@ export const startProcess = (
): Promise<void> => {
return new Promise((resolve, reject) => {
const child = spawn(command, args, {
<<<<<<< HEAD
env: { ...process.env, ...env },
=======
env: env || process.env,
>>>>>>> cb11e260d1 (Restructure dx for admin portal)
// Use pipe for stdout and stderr to make sure that logs don't log inlined.
stdio: ['inherit', 'pipe', 'pipe'],
shell: true,
})

<<<<<<< HEAD
// Handle process termination on exit
process.on('exit', () => {
child.kill('SIGTERM')
})

=======
>>>>>>> cb11e260d1 (Restructure dx for admin portal)
// Capture and handle stdout
child.stdout?.on('data', (data) => {
process.stdout.write(data.toString())
Expand Down

0 comments on commit efcf8f2

Please sign in to comment.