Skip to content

Commit

Permalink
Merge branch 'master' into update-node-dependencies-scripting-2024-11-22
Browse files Browse the repository at this point in the history
  • Loading branch information
tkmcmaster committed Nov 22, 2024
2 parents 874dc29 + ac15d4f commit 78403fd
Show file tree
Hide file tree
Showing 12 changed files with 6,387 additions and 6,693 deletions.
10 changes: 5 additions & 5 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"dotenv": "^16.0.0",
"dotenv-flow": "^4.0.1",
"expiry-map": "^2.0.0",
"express": "^4.18.2",
"express": "^5.0.1",
"rimraf": "^5.0.0",
"semver": "^7.5.2"
},
Expand All @@ -49,15 +49,15 @@
"@eslint/js": "^9.8.0",
"@types/bunyan": "~1.8.8",
"@types/chai": "^4.3.5",
"@types/express": "^4.17.17",
"@types/express": "^5.0.0",
"@types/mocha": "^10.0.0",
"@types/node": "^22.0.0",
"@types/semver": "^7.5.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"@typescript-eslint/eslint-plugin": "^8.15.0",
"@typescript-eslint/parser": "^8.15.0",
"axios": "~1.7.0",
"chai": "^4.3.7",
"eslint": "^9.8.0",
"eslint": "^9.15.0",
"mocha": "^10.2.0",
"nyc": "^17.0.0",
"typescript": "^5.3.0"
Expand Down
6 changes: 3 additions & 3 deletions common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@
"@types/chai": "^4.3.5",
"@types/mocha": "^10.0.0",
"@types/node": "^22.0.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"@typescript-eslint/eslint-plugin": "^8.15.0",
"@typescript-eslint/parser": "^8.15.0",
"aws-sdk-client-mock": "^4.0.0",
"chai": "^4.3.7",
"dotenv": "^16.0.0",
"dotenv-flow": "^4.0.1",
"eslint": "^9.8.0",
"eslint": "^9.15.0",
"mocha": "^10.2.0",
"nyc": "^17.0.0",
"typescript": "^5.3.0"
Expand Down
6 changes: 3 additions & 3 deletions common/src/util/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { join as pathJoin } from "path";
export { LogLevel } ;

export const config = {
LogFileName: process.env.LogFileName || "ppaas-common",
LoggingLevel: process.env.LoggingLevel as Logger.LogLevel || "info",
LoggingLevelConsole: process.env.LoggingLevelConsole as Logger.LogLevel || "warn",
LogFileName: process.env.LOG_FILE_NAME || process.env.LogFileName || "ppaas-common",
LoggingLevel: process.env.LOGGING_LEVEL as Logger.LogLevel || process.env.LoggingLevel as Logger.LogLevel || "info",
LoggingLevelConsole: process.env.LOGGING_LEVEL_CONSOLE as Logger.LogLevel || process.env.LoggingLevelConsole as Logger.LogLevel || "warn",
LogFileLocation: process.env.LOG_FILE_LOCATION || "."
};

Expand Down
5 changes: 4 additions & 1 deletion common/src/yamlparser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ export class YamlParser {
config = new Config(
fileBuffer,
varMap,
typeof logConfig.LoggingLevel === "number" ? undefined : logConfig.LoggingLevel,
// If RUST_LOG is set use that, otherwise use LoggingLevel
process.env.RUST_LOG || (typeof logConfig.LoggingLevel === "number"
? undefined
: logConfig.LoggingLevel),
validateLegacyOnly
);
yamlValid = true;
Expand Down
84 changes: 39 additions & 45 deletions controller/next.config.js → controller/next.config.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
// @ts-check
// These environment variables are exported to the client-side code. Do not put any variables with secure information here.

const { access, symlink } = require('fs/promises');
const { join } = require('path');
const CopyPlugin = require("copy-webpack-plugin");
const { platform } = require('os');
import { access, symlink } from "fs/promises";
import CopyPlugin from "copy-webpack-plugin";
import type { NextConfig } from "next";
import { join } from "path";
import { platform } from "os";

if (process.env.BASE_PATH && !process.env.BASE_PATH.startsWith("/")) {
const errorMessage = "process.env.BASE_PATH must start with a '/' found " + process.env.BASE_PATH;
// eslint-disable-next-line no-console
console.error(errorMessage);
throw new Error(errorMessage);
}
/** @type {import('next').NextConfig} */
const nextConfig = {
const nextConfig: NextConfig = {
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: true,
ignoreDuringBuilds: true
},
swcMinify: true,
// swcMinify: true,
// Base path doesn't work because it changes the path on the local server. We actually are running via a proxy base path
// https://nextjs.org/docs/api-reference/next.config.js/basepath
// https://stackoverflow.com/questions/60452054/nextjs-deploy-to-a-specific-url-path
Expand All @@ -29,32 +28,32 @@ const nextConfig = {
compiler: {
styledComponents: {
displayName: true,
ssr: true,
ssr: true
// ["styled-components", { "ssr": true, "displayName": true, "preprocess": false } ]
}
},
experimental: {
typedRoutes: true,
instrumentationHook: true,
typedRoutes: true
// instrumentationHook: true,
},
webpack: (config, { isServer, dir: optionsDir }) => {
const wasmExtensionRegExp = /\.wasm$/;

config.resolve.extensions.push(".wasm");
config.module.rules.forEach(rule => {
(rule.oneOf || []).forEach(oneOf => {

config.module.rules.forEach((rule: any) => {
(rule.oneOf || []).forEach((oneOf: any) => {
if (oneOf.loader && oneOf.loader.indexOf("file-loader") >= 0) {
// Make file-loader ignore WASM files
oneOf.exclude.push(wasmExtensionRegExp);
}
});
});

config.output.webassemblyModuleFilename = 'static/wasm/[modulehash].wasm'
config.output.webassemblyModuleFilename = "static/wasm/[modulehash].wasm";
if (!config.experiments) { config.experiments = {}; }
config.experiments.asyncWebAssembly = true;

// https://github.com/vercel/next.js/issues/25852
// Compiling we run into an issue where it can't find the config wasm.
// On Linux the workaround is to create a symlink to the correct location
Expand All @@ -64,49 +63,53 @@ const nextConfig = {
// https://github.com/vercel/next.js/issues/25852#issuecomment-1727385542
? new CopyPlugin({
patterns: [
{ from: "../lib/config-wasm/pkg/config_wasm_bg.wasm", to: "./" },
],
{ from: "../lib/config-wasm/pkg/config_wasm_bg.wasm", to: "./" }
]
})
// https://github.com/vercel/next.js/issues/25852#issuecomment-1057059000
: new (class {
apply(compiler) {
apply (compiler: any) {
compiler.hooks.afterEmit.tapPromise(
'SymlinkWebpackPlugin',
async (compiler) => {
"SymlinkWebpackPlugin",
// eslint-disable-next-line @typescript-eslint/no-shadow
async (compiler: any) => {
if (isServer) {
const from = join(compiler.options.output.path, 'config_wasm_bg.wasm');
const to = join(optionsDir, '../lib/config-wasm/pkg/config_wasm_bg.wasm');
const from = join(compiler.options.output.path, "config_wasm_bg.wasm");
const to = join(optionsDir, "../lib/config-wasm/pkg/config_wasm_bg.wasm");
// options.dir /.../pewpew/controller
// console.log(`from/to: ${from} -> ${to}`);

try {
await access(from);
// eslint-disable-next-line no-console
console.log(`${from} already exists`);
return;
} catch (error) {
if (error.code === 'ENOENT') {
} catch (error: any) {
if (error?.code === "ENOENT") {
// No link exists
} else {
// eslint-disable-next-line no-console
console.error(`access ${from} error ${error}`, error);
throw error;
}
}

await symlink(to, from, 'junction');

await symlink(to, from, "junction");
// eslint-disable-next-line no-console
console.log(`created symlink ${from} -> ${to}`);
}
},
}
);
}
})(),
})()
);

return config;
},
distDir: "dist",
// env: {} // env variables are set at build time, not run time. They are better optimized during the build process
publicRuntimeConfig: { // These are sent to the client and the server and are set at run time
LoggingLevel: process.env.LoggingLevel,
LOGGING_LEVEL: process.env.LOGGING_LEVEL || process.env.LoggingLevel,
APPLICATION_NAME: process.env.APPLICATION_NAME,
SYSTEM_NAME: process.env.SYSTEM_NAME,
FS_SITE: process.env.FS_SITE,
Expand All @@ -131,29 +134,20 @@ const nextConfig = {
AUTH_HEADER_NAME: process.env.AUTH_HEADER_NAME,
COOKIE_DURATION_DAYS: process.env.COOKIE_DURATION_DAYS,
REFRESH_COOKIE_DURATION_DAYS: process.env.REFRESH_COOKIE_DURATION_DAYS,
HIDE_ENVIRONMENT: process.env.HIDE_ENVIRONMENT,
HIDE_ENVIRONMENT: process.env.HIDE_ENVIRONMENT
},
// https://github.com/vercel/next.js/discussions/11493#discussioncomment-14606
env: { // These are sent to the client and the server and are set at build time for static pages
LoggingLevel: process.env.LoggingLevel || "", // Only checks if debug
// @ts-ignore
LOGGING_LEVEL: process.env.LOGGING_LEVEL || process.env.LoggingLevel || "", // Only checks if debug
APPLICATION_NAME: process.env.APPLICATION_NAME,
// @ts-ignore
SYSTEM_NAME: process.env.SYSTEM_NAME,
// @ts-ignore
FS_SITE: process.env.FS_SITE, // Used by auth client/Layout
// @ts-ignore
BASE_PATH: process.env.BASE_PATH, // client utils/Layout
// @ts-ignore
ASSET_PREFIX: process.env.ASSET_PREFIX, // client utils/Layout
// @ts-ignore
HIDE_ENVIRONMENT: process.env.HIDE_ENVIRONMENT, // Used by Layout
// @ts-ignore
AUTH_MODE: process.env.AUTH_MODE, // Used by auth client/Layout
// @ts-ignore
AUTH_COOKIE_NAME: process.env.AUTH_COOKIE_NAME, // Used by auth client/Layout
// @ts-ignore
AUTH_HEADER_NAME: process.env.AUTH_HEADER_NAME, // Used by auth client/Layout
AUTH_HEADER_NAME: process.env.AUTH_HEADER_NAME // Used by auth client/Layout
}
};

Expand Down
18 changes: 10 additions & 8 deletions controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"start": "npm run fix:start && next start -p 8081",
"fix:start": "rimraf \"node_modules/@fs/ppaas-common/node_modules/@fs/config-wasm/\"",
"dev": "next dev",
"dev": "next dev --turbopack",
"build": "npm run build:react && npm run build:test",
"build:react": "next build",
"storybook": "storybook dev -p 5002",
Expand Down Expand Up @@ -37,7 +37,9 @@
"exclude": "**/*.spec.ts"
},
"overrides": {
"eslint": "^9.8.0"
"eslint": "^9.15.0",
"@types/react": "^18.2.12",
"@types/react-dom": "^18.2.5"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.363.0",
Expand All @@ -61,7 +63,7 @@
"formidable": "~3.5.0",
"js-cookie": "^3.0.5",
"js-yaml": "^4.1.0",
"next": "~14.2.0",
"next": "~15.0.3",
"next-cookies": "^2.0.3",
"openid-client": "~5.7.0",
"rc-progress": "^4.0.0",
Expand All @@ -82,7 +84,7 @@
"@aws-sdk/util-stream-node": "^3.363.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.8.0",
"@next/eslint-plugin-next": "~14.2.0",
"@next/eslint-plugin-next": "~15.0.3",
"@storybook/addon-actions": "~8.4.0",
"@storybook/addon-links": "~8.4.0",
"@storybook/nextjs": "~8.4.0",
Expand All @@ -104,16 +106,16 @@
"@types/react-transition-group": "^4.4.6",
"@types/semver": "^7.5.0",
"@types/yauzl": "^2.10.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"@typescript-eslint/eslint-plugin": "^8.15.0",
"@typescript-eslint/parser": "^8.15.0",
"aws-sdk-client-mock": "^4.0.0",
"chai": "^4.3.7",
"copy-webpack-plugin": "^12.0.2",
"dotenv": "^16.0.0",
"dotenv-flow": "^4.0.1",
"esbuild": ">=0.17",
"eslint": "^9.8.0",
"eslint-config-next": "~14.2.0",
"eslint": "^9.15.0",
"eslint-config-next": "~15.0.3",
"form-data": "^4.0.0",
"glob-parent": "^6.0.2",
"immer": "^10.0.2",
Expand Down
1 change: 0 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export default [{
"target/**",
"tests/**",
"next-env.d.ts",
"next.config.js",
"common/lib",
"controller/lib",
"controller/storybook-static",
Expand Down
5 changes: 4 additions & 1 deletion examples/body_json.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ endpoints:
"c": true,
"d": ["array","of","values"],
"e": ${v:port},
"f": { g: "sub", h: "object" }
"f": {
"g": "sub",
"h": "object"
}
}'
peak_load: 1hps
logs:
Expand Down
Loading

0 comments on commit 78403fd

Please sign in to comment.