Skip to content

Commit 73ff584

Browse files
committed
refactor: rename folder to docker for idiomatic relevance
1 parent 0eda7d7 commit 73ff584

File tree

5 files changed

+10
-90
lines changed

5 files changed

+10
-90
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,4 @@ web_modules/
159159
.pnp.*
160160

161161
# ignore data volume
162-
gateways/apps/*/data
162+
docker/apps/*/data

.suite-cli/cli/scripts/assets/fileStructureContent.asset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = ({ answers }) => (
1111
`tests/${answers.service_name}/snapshot`,
1212
`microservices`,
1313
`k8s/${answers.service_name}`,
14-
`gateways/apps`,
14+
`docker/apps`,
1515
...(answers.apis.map((api) => `${api}/app1`)),
1616
]
1717
)

.suite-cli/cli/scripts/assets/k8sComboContent.asset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ spec:
151151
const generateIngress = ({ app, project_base, services }) => {
152152
const content = services.map(({ service, port }) => `
153153
- pathType: Prefix
154-
path: "/${service}/*"
154+
path: "/"
155155
backend:
156156
service:
157157
name: ${service}

.suite-cli/cli/scripts/scripts.module.js

Lines changed: 6 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ const getComponentDirecotories = async ({ components, component_type }) => {
582582

583583
const { workspace_name } = retrieveWorkSpaceName({ package_json_path })
584584

585-
const component_root_dir = join(project_root, `${component_type === 'app' ? `gateways/apps` : 'microservices'}`)
585+
const component_root_dir = join(project_root, `${component_type === 'app' ? `docker/apps` : 'microservices'}`)
586586

587587
// Simulate delay before checking if the component directory exists
588588
await delay(1);
@@ -1538,7 +1538,7 @@ const generateK8sApp = ({ namespace, app_name, k8s_directory, projectName, servi
15381538
const scaffoldApp = ({ answers }) => {
15391539
const { webserver, projectName, services } = readFileContent({ currentDir: cwd() });
15401540
const project_root = generateRootPath({ currentDir: cwd() });
1541-
const app_directory = join(project_root, 'gateways/apps', answers.app_name);
1541+
const app_directory = join(project_root, 'docker/apps', answers.app_name);
15421542
const k8s_directory = join(project_root, `k8s/ns/${answers?.namespace || 'default'}`, answers.app_name);
15431543

15441544
const webserver_dir = join(app_directory, webserver);
@@ -1791,7 +1791,7 @@ const scaffoldGateways = async ({ answers }) => {
17911791
}
17921792

17931793
const scaffoldGateway = ({ project_root, app, answers, webserver, projectName }) => {
1794-
const app_directory = join(project_root, 'gateways/apps', app.name);
1794+
const app_directory = join(project_root, 'docker/apps', app.name);
17951795
const webserver_dir = join(app_directory, webserver);
17961796
const krakend_dir = join(app_directory, 'krakend');
17971797
const services = app.services;
@@ -1836,86 +1836,6 @@ const scaffoldGateway = ({ project_root, app, answers, webserver, projectName })
18361836

18371837
}
18381838

1839-
// /**
1840-
// * Removes a microservice and all associated files.
1841-
// * @param {Object} options - Options for removing the microservice.
1842-
// * @param {string} options.project_root - The root directory of the project.
1843-
// * @param {string} options.service_name - The name of the microservice to be removed.
1844-
// */
1845-
// const removeResource = async ({ answers }) => {
1846-
// const { resource, resource_name, options } = answers;
1847-
// let project_root;
1848-
1849-
// try {
1850-
// project_root = generateRootPath({ currentDir: cwd() });
1851-
// } catch (error) {
1852-
// // Not within a suite repo
1853-
// if (error.message && error.message === 'suite.json and(or) .git not found') {
1854-
// ora('This does not look like a suite repo').warn()
1855-
// ora().info('If it is run <suite init> from project root to reinitialize suite project and try again')
1856-
// exit(1)
1857-
// }
1858-
// else {
1859-
// // rethrow the error
1860-
// throw new Error('Error code 10005.Kindly raise an issue at https://github.com/microservices-suite/node-microservices-suite/issues')
1861-
// }
1862-
// }
1863-
// const spinner = ora();
1864-
// if (options.all) {
1865-
// // Logic to remove all resources of the given type
1866-
1867-
// const resourceEnum = {
1868-
// library: ['shared'],
1869-
// app: ['gateways', 'apps'],
1870-
// service: ['microservices'],
1871-
// gateway: ['gateways', 'apps'],
1872-
// k8s: ['k8s']
1873-
// }
1874-
// if (!resourceEnum[resource]) return ora().warn(`Unkown resource name ${resource}`)
1875-
// const allResourceChildrenPath = path.join(project_root, ...(resourceEnum[resource]));
1876-
// if (!fs.existsSync(allResourceChildrenPath)) {
1877-
// spinner.warn(`No ${resource}(s) found.`);
1878-
// return;
1879-
// }
1880-
1881-
// // Remove all resources
1882-
// const services = fs.readdirSync(allResourceChildrenPath);
1883-
// if (services.length === 0) {
1884-
// spinner.warn(`No ${resource}(s) found.`);
1885-
// return;
1886-
// }
1887-
1888-
// // Synchronous removal of all services
1889-
// services.forEach(service => {
1890-
// const fullPath = path.join(allResourceChildrenPath, service);
1891-
// fs.rmSync(fullPath, { recursive: true, force: true });
1892-
// });
1893-
// spinner.succeed(`All ${resource}(s) have been removed.`);
1894-
1895-
// return;
1896-
// }
1897-
1898-
// // Call the appropriate action handler based on the resource type
1899-
// switch (resource) {
1900-
// case 'service':
1901-
// await removeService({ service_name: resource_name, project_root, sync: true });
1902-
// break;
1903-
// case 'app':
1904-
// await removeApp({ app_name: resource_name, project_root, sync: true });
1905-
// break;
1906-
// case 'library':
1907-
// await removeLibrary({ library_name: resource_name, project_root });
1908-
// break;
1909-
// case 'gateway':
1910-
// await removeGateway({ gateway_name: resource_name, project_root });
1911-
// break;
1912-
// default:
1913-
// throw new Error(`Unknown resource type: ${resource}`);
1914-
// }
1915-
// updateSuiteJson(project_root, resource, resource_name);
1916-
1917-
// };
1918-
19191839
const removeResource = async ({ answers }) => {
19201840
const { resource, resource_name, options } = answers;
19211841
let project_root;
@@ -1935,9 +1855,9 @@ const removeResource = async ({ answers }) => {
19351855
const spinner = ora();
19361856
const resourceEnum = {
19371857
library: ['shared'],
1938-
app: ['gateways', 'apps'],
1858+
app: ['docker', 'apps'],
19391859
service: ['microservices'],
1940-
gateway: ['gateways', 'apps'],
1860+
gateway: ['docker', 'apps'],
19411861
k8s: ['k8s']
19421862
};
19431863

@@ -2080,7 +2000,7 @@ const removeService = async ({ service_name, project_root }) => {
20802000
* @param {string} options.project_root - The root directory of the project.
20812001
*/
20822002
const removeApp = async ({ app_name, project_root }) => {
2083-
const appDockerPath = path.join(project_root, 'gateways', 'apps', app_name);
2003+
const appDockerPath = path.join(project_root, 'docker', 'apps', app_name);
20842004

20852005
// Use glob to locate Kubernetes namespace directories with `app_name`
20862006
const kubeNamespacePaths = glob.sync(path.join(project_root, 'k8s', 'ns', '*', app_name));

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ To easily work with a `@microservices-suite monorepo` you need to install [Suite
1414
| │ │ ├─ cli.js
1515
| │ │ ├─ package.json
1616
| │ │ ├─ README.md
17-
│ ├─ gateways/
17+
│ ├─ docker/
1818
| │ ├─ apps/
1919
| │ | ├─app-1/
2020
| │ │ | ├─ data/

0 commit comments

Comments
 (0)