Skip to content

Commit

Permalink
add playground (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderPolosatov authored Jul 27, 2023
1 parent 718a6db commit 14f911b
Show file tree
Hide file tree
Showing 7 changed files with 2,303 additions and 518 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
.vscode/
.cache/
.http-log
/playground/css
/playground/js
38 changes: 38 additions & 0 deletions _develop/prepare_playground.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { existsSync, mkdirSync, cpSync } from 'fs';
import { join } from 'path';

const DEVEXTREME_PATH = '../DevExtreme';
const PLAYGROUND_PATH = './playground';
const DEVEXTREME_ARTIFACTS_PATH = '../DevExtreme/packages/devextreme/artifacts';

const ARTIFACTS_JS_PATH = join(DEVEXTREME_ARTIFACTS_PATH, 'js');
const ARTIFACTS_CSS_PATH = join(DEVEXTREME_ARTIFACTS_PATH, 'css');
const PLAYGROUND_JS_PATH = join(PLAYGROUND_PATH, 'js');
const PLAYGROUND_CSS_PATH = join(PLAYGROUND_PATH, 'css');

function prepareFolders() {
[PLAYGROUND_CSS_PATH, PLAYGROUND_JS_PATH].forEach((folder) => {
if (!existsSync(folder)) {
mkdirSync(folder);
}
});
}

function copyJsFiles() {
cpSync(ARTIFACTS_JS_PATH, PLAYGROUND_JS_PATH, { recursive: true });
}

function copyCssFiles() {
cpSync(ARTIFACTS_CSS_PATH, PLAYGROUND_CSS_PATH, { recursive: true });
}

(() => {
if (existsSync(DEVEXTREME_PATH)) {
prepareFolders();
copyJsFiles();
copyCssFiles();
console.log('Playground is ready');
} else {
console.log('DevExtreme folder was not found');
}
})();
11 changes: 10 additions & 1 deletion _develop/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,14 @@ module.exports = (env) => {
return baseConfig;
}

return baseConfig;
baseConfig.output.publicPath = '/dist';
return {
...baseConfig,
devServer: {
static: ['dist', 'playground'],
hot: true,
open: true,
port: 9002,
},
};
};
Loading

0 comments on commit 14f911b

Please sign in to comment.