forked from openshift/console
-
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.
Add infrastructure for Console dynamic plugins
- Loading branch information
1 parent
104774f
commit ed2eb27
Showing
65 changed files
with
4,271 additions
and
237 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
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,8 +1,9 @@ | ||
.yarn | ||
__coverage__ | ||
public/dist | ||
**/node_modules | ||
**/dist | ||
*.min.js | ||
public/lib | ||
**/node_modules | ||
Godeps | ||
@types | ||
dynamic-demo-plugin |
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,5 +1,4 @@ | ||
node_modules | ||
bower_components | ||
.cache-loader | ||
.yarn | ||
public/dist | ||
node_modules | ||
public/dist |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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 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,24 @@ | ||
{ | ||
"$schema": "../packages/console-dynamic-plugin-sdk/dist/schema/console-extensions.json", | ||
"data": [ | ||
{ | ||
"type": "console.flag", | ||
"properties": { | ||
"handler": { | ||
"$codeRef": "barUtils.testHandler" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "console.flag/model", | ||
"properties": { | ||
"flag": "EXAMPLE", | ||
"model": { | ||
"group": "kubevirt.io", | ||
"version": "v1alpha3", | ||
"kind": "ExampleModel" | ||
} | ||
} | ||
} | ||
] | ||
} |
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,34 @@ | ||
{ | ||
"name": "@console/dynamic-demo-plugin", | ||
"version": "0.0.0-fixed", | ||
"private": true, | ||
"scripts": { | ||
"clean": "rm -rf ./dist", | ||
"build": "yarn clean && yarn ts-node ./node_modules/.bin/webpack", | ||
"http-server": "http-server ./dist -p 9001 -c-1 --cors", | ||
"ts-node": "ts-node -O '{\"module\":\"commonjs\"}' -I '/node_modules/(?!(@console)/)/'" | ||
}, | ||
"dependencies": { | ||
"react": "16.9.0" | ||
}, | ||
"devDependencies": { | ||
"@console/dynamic-plugin-sdk": "link:../packages/console-dynamic-plugin-sdk", | ||
"@types/react": "16.8.13", | ||
"http-server": "0.12.x", | ||
"ts-loader": "6.2.2", | ||
"ts-node": "5.0.1", | ||
"typescript": "3.8.3", | ||
"webpack": "5.0.0-beta.16", | ||
"webpack-cli": "3.3.9" | ||
}, | ||
"consolePlugin": { | ||
"displayName": "Dynamic Demo Plugin", | ||
"description": "Plasma reactors online. Initiating hyper drive.", | ||
"exposedModules": { | ||
"barUtils": "./utils/bar" | ||
}, | ||
"dependencies": { | ||
"@console/pluginAPI": "~0.0.1" | ||
} | ||
} | ||
} |
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,5 @@ | ||
import * as React from 'react'; | ||
|
||
const Foo: React.FC<{ label: string }> = ({ label }) => <h2>Hello {label} Component!</h2>; | ||
|
||
export default Foo; |
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,8 @@ | ||
import { FeatureFlagHandler } from '@console/dynamic-plugin-sdk/src/extensions/feature-flags'; | ||
|
||
export default (label: string) => `Hello ${label} Function!`; | ||
|
||
export const testHandler: FeatureFlagHandler = function() { | ||
// eslint-disable-next-line no-console | ||
console.log('testHandler called', arguments); | ||
}; |
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,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"target": "es2016", | ||
"jsx": "react", | ||
"allowJs": true, | ||
"strict": true, | ||
"noUnusedLocals": true | ||
}, | ||
"include": ["src"] | ||
} |
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,51 @@ | ||
/* eslint-env node */ | ||
|
||
import * as webpack from 'webpack'; | ||
import * as path from 'path'; | ||
import { ConsoleRemotePlugin } from '@console/dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin'; | ||
|
||
const config: webpack.Configuration = { | ||
context: path.resolve(__dirname, 'src'), | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
publicPath: 'http://localhost:9001/', | ||
filename: '[name]-bundle.js', | ||
chunkFilename: '[name]-chunk.js', | ||
}, | ||
resolve: { | ||
extensions: ['.ts', '.tsx', '.js', '.jsx'], | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /(\.jsx?)|(\.tsx?)$/, | ||
exclude: /node_modules/, | ||
use: [ | ||
{ | ||
loader: 'ts-loader', | ||
options: { | ||
configFile: path.resolve(__dirname, 'tsconfig.json'), | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
plugins: [new ConsoleRemotePlugin()], | ||
mode: 'development', | ||
devtool: 'source-map', | ||
optimization: { | ||
chunkIds: 'named', | ||
minimize: false, | ||
}, | ||
}; | ||
|
||
if (process.env.NODE_ENV === 'production') { | ||
config.output.filename = '[name]-bundle-[hash].min.js'; | ||
config.output.chunkFilename = '[name]-chunk-[chunkhash].min.js'; | ||
config.mode = 'production'; | ||
config.optimization.chunkIds = 'deterministic'; | ||
config.optimization.minimize = true; | ||
} | ||
|
||
export default config; |
Oops, something went wrong.