diff --git a/bin/createFragment/createFragment.js b/bin/createFragment/createFragment.js
new file mode 100644
index 0000000..bc24ec2
--- /dev/null
+++ b/bin/createFragment/createFragment.js
@@ -0,0 +1,61 @@
+const fs = require('fs');
+const path = require('path');
+
+const args = process?.argv?.slice(2);
+const newFragmentName = args?.[0];
+
+if (!newFragmentName) {
+ console.error("Component name is required");
+ return;
+}
+
+const renderComponentTemplate = (componentName, routePath) => (`
+const voltran = require('@voltran/core');
+
+import React from 'react';
+import classNames from 'classnames';
+
+import ROUTE_PATHS from '../../appRoute/routeConstants';
+
+import style from './${componentName}.scss';
+
+function ${componentName}({ initialState }) {
+ return (
+
+
+
Welcome to the VoltranJS
+
+
+ );
+}
+
+const component = voltran.default.withBaseComponent(${componentName}, ROUTE_PATHS.${routePath});
+
+export default component;
+`);
+
+const createComponet = () => {
+ const componetName = newFragmentName;
+ const routeName = newFragmentName?.toUpperCase();
+
+ const fileContents = [{
+ ext: 'js',
+ renderFn: renderComponentTemplate
+ },
+ {
+ ext: 'scss',
+ renderFn: () => ''
+ }
+ ];
+
+ const partialsFolder = path.resolve('src', 'partials', componetName);
+
+ fs.mkdir(partialsFolder, () => {
+ fileContents.map(fileContent => {
+ const componentFolder = path.resolve('src', 'partials', componetName, `${componetName}.${fileContent?.ext}`);
+ fs.writeFileSync(componentFolder, fileContent?.renderFn(componetName, routeName), { encoding: 'utf-8' });
+ })
+ });
+}
+
+createComponet();
\ No newline at end of file
diff --git a/package.json b/package.json
index 86b653a..6275bc1 100644
--- a/package.json
+++ b/package.json
@@ -4,10 +4,11 @@
"author": "Hepsiburada Technology Team",
"license": "MIT",
"dependencies": {
- "voltranjs": "^1.0.16"
+ "voltranjs": "^1.0.22"
},
"scripts": {
"start": "yarn voltran --config voltran-app.config.js --dev",
- "serve": "yarn voltran --config voltran-app.config.js"
+ "serve": "yarn voltran --config voltran-app.config.js",
+ "create-fragment": "node ./bin/createFragment/createFragment.js"
}
-}
+}
\ No newline at end of file
diff --git a/src/appConfig.js b/src/appConfig.js
index ea2451e..472d84c 100644
--- a/src/appConfig.js
+++ b/src/appConfig.js
@@ -1,24 +1,3 @@
const port = 3578;
-module.exports = {
- port: port,
- api: {
- clientUrl: `http://localhost:${port}`,
- serverUrl: `http://localhost:${port}`
- },
- baseUrl: `http://localhost:${port}`,
- mediaUrl: '',
- logLevel: 'info',
- isCssClassNameObfuscationEnabled: false,
- sfBaseUrl: `http://localhost:${port}`,
- services: {
- 'voltranapi': {
- 'clientUrl': 'http://voltran-api.qa.hepsiburada.com',
- 'serverUrl': 'http://voltran-api.qa.hepsiburada.com'
- }
- },
- timeouts: {
- clientApiManager: 20 * 1000,
- serverApiManager: 20 * 1000
- }
-};
+module.exports={"port":3578,"voltranEnv":"local","api":{"clientUrl":"http://localhost:3578","serverUrl":"http://localhost:3578"},"baseUrl":"http://localhost:3578","mediaUrl":"","logLevel":"info","isCssClassNameObfuscationEnabled":false,"sfBaseUrl":"http://localhost:3578","services":{"voltranapi":{"clientUrl":"http://voltran-api.qa.hepsiburada.com","serverUrl":"http://voltran-api.qa.hepsiburada.com"}},"timeouts":{"clientApiManager":20000,"serverApiManager":20000}};
\ No newline at end of file
diff --git a/src/appRoute/routeConstants.js b/src/appRoute/routeConstants.js
index 8fe5d68..b611846 100644
--- a/src/appRoute/routeConstants.js
+++ b/src/appRoute/routeConstants.js
@@ -1,5 +1,5 @@
const ROUTE_PATHS = {
- HELLO_WORLD: '/Desktop/HelloWorld',
+ HELLO_WORLD: '/HelloWorld',
};
export default ROUTE_PATHS;
diff --git a/src/partials/HelloWorld/HelloWorld.js b/src/partials/HelloWorld/HelloWorld.js
index 213327d..ed069f6 100644
--- a/src/partials/HelloWorld/HelloWorld.js
+++ b/src/partials/HelloWorld/HelloWorld.js
@@ -15,7 +15,7 @@ function HelloWorld({ initialState }) {
Welcome to the VoltranJS
Hello World! It is a Micro Frontend Library
-
+
);
diff --git a/src/partials/newComponent/newComponent.js b/src/partials/newComponent/newComponent.js
new file mode 100644
index 0000000..317e427
--- /dev/null
+++ b/src/partials/newComponent/newComponent.js
@@ -0,0 +1,23 @@
+
+const voltran = require('@voltran/core');
+
+import React from 'react';
+import classNames from 'classnames';
+
+import ROUTE_PATHS from '../../appRoute/routeConstants';
+
+import style from './newComponent.scss';
+
+function newComponent({ initialState }) {
+ return (
+
+
+
Welcome to the VoltranJS
+
+
+ );
+}
+
+const component = voltran.default.withBaseComponent(newComponent, ROUTE_PATHS.NEWCOMPONENT);
+
+export default component;
diff --git a/src/partials/newComponent/newComponent.scss b/src/partials/newComponent/newComponent.scss
new file mode 100644
index 0000000..e69de29
diff --git a/yarn.lock b/yarn.lock
index 1426681..5bf61dc 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -8872,10 +8872,10 @@ vm-browserify@^1.0.1:
resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"
integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==
-voltranjs@^1.0.16:
- version "1.0.18"
- resolved "https://registry.yarnpkg.com/voltranjs/-/voltranjs-1.0.18.tgz#845f77d51bf64c4a84c7c8e464f4d5ed9870d9ca"
- integrity sha512-Bvsw1N3Se8Tgn6o4bWIEC3y95c7X1XvzL17d6mx742WacWvt6TF4NzciybvrvjldkAwvbdf0qBLIOLf+wNl4WA==
+voltranjs@^1.0.22:
+ version "1.0.22"
+ resolved "https://registry.yarnpkg.com/voltranjs/-/voltranjs-1.0.22.tgz#57838cc7c036d639d70840447c67f1449561b3de"
+ integrity sha512-vcBYVnZv6Kek9J3a57YKCwAvXk3yAr+Y6cbU7adZNxji6c51COg4V925ueIap6WtbZLfOmEeC3HmKHNEkRAiDA==
dependencies:
"@babel/core" "7.14.3"
"@babel/eslint-parser" "^7.12.1"