Skip to content

Commit

Permalink
Removes UI Framework KUI doc site
Browse files Browse the repository at this point in the history
* KUI components are no longer being developed and the dependencies for
  the doc site are related to CVEs.
* Refactors grunt tasks for compiling KUI CSS.
* Removes doc site related grunt tasks.
* Removes all unused dependencies from the osd/ui-framework package.

### Issues
Prerequisite for resolving #1096 (along with the EUI upgrade)

Signed-off-by: Tommy Markley <[email protected]>
  • Loading branch information
Tommy Markley committed Apr 15, 2022
1 parent b854a13 commit 460bb68
Show file tree
Hide file tree
Showing 167 changed files with 51 additions and 11,403 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ target
/packages/osd-test/src/functional_test_runner/__tests__/fixtures/
/packages/osd-test/src/functional_test_runner/lib/config/__tests__/fixtures/
/packages/osd-ui-framework/dist
/packages/osd-ui-framework/doc_site/build
/packages/osd-ui-shared-deps/flot_charts
2 changes: 0 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ module.exports = {
{
files: [
'**/public/**/*.js',
'packages/osd-ui-framework/doc_site/src/**/*.js',
'src/fixtures/**/*.js', // TODO: this directory needs to be more obviously "public" (or go away)
],
settings: {
Expand Down Expand Up @@ -440,7 +439,6 @@ module.exports = {
{
files: [
'packages/osd-ui-framework/**/*.test.js',
'packages/osd-ui-framework/doc_site/**/*.js',
'packages/osd-ui-framework/Gruntfile.js',
'packages/osd-opensearch/src/**/*.js',
'packages/osd-interpreter/tasks/**/*.js',
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ selenium
*.swp
*.swo
*.out
/packages/osd-ui-framework/doc_site/build/*
!/packages/osd-ui-framework/doc_site/build/index.html
package-lock.json
.yo-rc.json
.vscode
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@
"lint:es": "node scripts/eslint",
"lint:style": "node scripts/stylelint",
"makelogs": "node scripts/makelogs",
"uiFramework:start": "cd packages/osd-ui-framework && yarn docSiteStart",
"uiFramework:build": "cd packages/osd-ui-framework && yarn docSiteBuild",
"uiFramework:compileCss": "cd packages/osd-ui-framework && yarn compileCss",
"osd:watch": "node scripts/opensearch_dashboards --dev --logging.json=false",
"build:types": "rm -rf ./target/types && tsc --p tsconfig.types.json",
"docs:acceptApiChanges": "node --max-old-space-size=6144 scripts/check_published_api_changes.js --accept",
Expand Down
158 changes: 7 additions & 151 deletions packages/osd-ui-framework/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@
const sass = require('node-sass');
const postcss = require('postcss');
const postcssConfig = require('@osd/optimizer/postcss.config.js');
const chokidar = require('chokidar');
const { debounce } = require('lodash');

const platform = require('os').platform();
const isPlatformWindows = /^win/.test(platform);

module.exports = function (grunt) {
grunt.initConfig({
Expand Down Expand Up @@ -71,122 +66,18 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-babel');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('prodBuild', ['clean:target', 'copy:makeProdBuild', 'babel:prodBuild']);

grunt.registerTask('docSiteBuild', function () {
const done = this.async();

const serverCmd = {
cmd: isPlatformWindows ? '.\\node_modules\\.bin\\webpack.cmd' : './node_modules/.bin/webpack',
args: [
'-p',
'--config=doc_site/webpack.config.js',
'--devtool=null', // Prevent the source map from being generated
],
opts: { stdio: 'inherit' },
};

const uiFrameworkServerBuild = new Promise((resolve, reject) => {
grunt.util.spawn(serverCmd, (error, result, code) => {
if (error || code !== 0) {
const message = result.stderr || result.stdout;

grunt.log.error(message);

return reject();
}

grunt.log.writeln(result);

resolve();
});
});

uiFrameworkServerBuild.then(done);
});

grunt.registerTask('docSiteStart', function () {
const done = this.async();
Promise.all([uiFrameworkWatch(), uiFrameworkServerStart()]).then(done);
});

grunt.registerTask('compileCssLight', function () {
const done = this.async();
uiFrameworkCompileLight().then(done);
});
grunt.registerTask('prodBuild', ['clean:target', 'copy:makeProdBuild', 'babel:prodBuild']);

grunt.registerTask('compileCssDark', function () {
grunt.registerTask('compileCss', function () {
const done = this.async();
uiFrameworkCompileDark().then(done);
Promise.all([
uiFrameworkCompile('src/kui_light.scss', 'dist/kui_light.css'),
uiFrameworkCompile('src/kui_dark.scss', 'dist/kui_dark.css'),
]).then(done);
});

function uiFrameworkServerStart() {
const serverCmd = {
cmd: isPlatformWindows
? '.\\node_modules\\.bin\\webpack-dev-server.cmd'
: './node_modules/.bin/webpack-dev-server',
args: [
'--config=doc_site/webpack.config.js',
'--hot',
'--inline',
'--content-base=doc_site/build',
'--host=0.0.0.0',
'--port=8020',
],
opts: { stdio: 'inherit' },
};

return new Promise((resolve, reject) => {
grunt.util.spawn(serverCmd, (error, result, code) => {
if (error || code !== 0) {
const message = result.stderr || result.stdout;

grunt.log.error(message);

return reject();
}

grunt.log.writeln(result);

resolve();
});
});
}

function uiFrameworkCompileLight() {
const src = 'src/kui_light.scss';
const dest = 'dist/kui_light.css';

return new Promise((resolve) => {
sass.render(
{
file: src,
},
function (error, result) {
if (error) {
grunt.log.error(error);
}

postcss([postcssConfig])
.process(result.css, { from: src, to: dest })
.then((result) => {
grunt.file.write(dest, result.css);

if (result.map) {
grunt.file.write(`${dest}.map`, result.map);
}

resolve();
});
}
);
});
}

function uiFrameworkCompileDark() {
const src = 'src/kui_dark.scss';
const dest = 'dist/kui_dark.css';

function uiFrameworkCompile(src, dest) {
return new Promise((resolve) => {
sass.render(
{
Expand All @@ -212,39 +103,4 @@ module.exports = function (grunt) {
);
});
}

function uiFrameworkWatch() {
const debouncedCompile = debounce(
() => {
// Compile the SCSS in a separate process because node-sass throws a fatal error if it fails
// to compile.
grunt.util.spawn(
{
cmd: isPlatformWindows
? '.\\node_modules\\.bin\\grunt.cmd'
: './node_modules/.bin/grunt',
args: ['compileCssLight', 'compileCssDark'],
},
(error, result) => {
if (error) {
grunt.log.error(result.stdout);
} else {
grunt.log.writeln(result);
}
}
);
},
400,
{ leading: true }
);

return new Promise(() => {
debouncedCompile();

chokidar.watch('src', { ignoreInitial: true }).on('all', (event, path) => {
grunt.log.writeln(event, path);
debouncedCompile();
});
});
}
};
7 changes: 1 addition & 6 deletions packages/osd-ui-framework/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ This framework was used to build legacy layouts in Kibana 5.x and 6.x and is rep

## Documentation

Compile the CSS with `./node_modules/grunt/bin/grunt uiFramework:compileCss` (OS X) or
`.\node_modules\grunt\bin\grunt uiFramework:compileCss` (Windows).

You can view interactive documentation by running `yarn uiFramework:start` and then visiting
[http://localhost:8020/](http://localhost:8020/). This will also start watching the SCSS files, and will recompile the CSS
automatically for you when you make changes.
Compile the CSS with `yarn uiFramework:compileCss`.

You can run `node scripts/jest --watch` to watch for changes and run the tests as you code.

Expand Down
13 changes: 0 additions & 13 deletions packages/osd-ui-framework/doc_site/build/index.html

This file was deleted.

45 changes: 0 additions & 45 deletions packages/osd-ui-framework/doc_site/src/actions/action_types.js

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 460bb68

Please sign in to comment.