-
Notifications
You must be signed in to change notification settings - Fork 9
feat: mle-ts-ords-backend template #301 #302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9452d20
0c2868b
af0d0b1
c18d199
03fedbd
17bae72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,7 +207,7 @@ export default class Generate extends Command { | |
'template': Flags.string({ | ||
char: 't', | ||
description: 'Template to use', | ||
options: ['node-vanilla', 'node-react', 'node-vue', 'node-react-todo', 'node-jet', 'node-angular', 'ords-remix-jwt-sample', 'mle-ts-sample'], | ||
options: ['node-vanilla', 'node-react', 'node-vue', 'node-react-todo', 'node-jet', 'node-angular', 'ords-remix-jwt-sample', 'mle-ts-sample', 'mle-ts-ords-backend'], | ||
multiple: false | ||
}), | ||
|
||
|
@@ -314,6 +314,7 @@ export default class Generate extends Command { | |
const databaseServiceName = flags['db-service-name'] ?? ''; | ||
const databaseUsername = flags['db-username'] ?? ''; | ||
const sqlclPath = flags['sqlcl'] ?? ''; | ||
const ordsHost = flags['ords-host'] ?? ''; | ||
|
||
// TODO: Validate and use wallet path | ||
const walletPathDirectory = flags['wallet-path'] ? flags['wallet-path'] : ''; | ||
|
@@ -379,6 +380,11 @@ export default class Generate extends Command { | |
value: 'mle-ts-sample', | ||
description: 'This creates an empty project with MLE and Oracle database connection starter code.' | ||
}, | ||
{ | ||
name: 'mle-ts-ords-backend', | ||
value: 'mle-ts-ords-backend', | ||
description: 'Creates a starter project with MLE integration, Oracle Database connectivity, and scaffolded ORDS REST endpoints.' | ||
}, | ||
], | ||
pageSize: 10, | ||
default: 'node-vanilla' | ||
|
@@ -476,8 +482,10 @@ export default class Generate extends Command { | |
|
||
// This will be config object for the basic connection type. | ||
Object.assign(configObject, { | ||
connectionString: generateConnectionString( protocol, hostname, port, serviceValue ) | ||
}); | ||
connectionString: generateConnectionString( protocol, hostname, port, serviceValue ), | ||
serviceValue: serviceValue, | ||
databasePort: port | ||
}); | ||
} else if( databaseConnectionType === 'walletPath' ) { | ||
let walletPath = ''; | ||
|
||
|
@@ -509,23 +517,29 @@ export default class Generate extends Command { | |
// This is the config object that represents the wallet connection type. | ||
Object.assign(configObject, { | ||
walletPath: walletPath, | ||
walletPassword: walletPassword | ||
walletPassword: walletPassword, | ||
serviceValue: "", | ||
databasePort: 8080, | ||
}); | ||
} | ||
|
||
if(templateChoice !== 'ords-remix-jwt-sample'){ | ||
if(templateChoice !== 'ords-remix-jwt-sample') { | ||
// Ask the user for the database connection username. | ||
let databaseUser = databaseUsername === '' ? await input( | ||
{ | ||
message: 'What\'s your database username?', | ||
validate ( input ) { | ||
return input.trim().length === 0 ? 'This field cannot be empty!' : true; | ||
} | ||
}, | ||
) : databaseUsername; | ||
if (templateChoice === 'mle-ts-ords-backend') { | ||
databaseUser = databaseUser.toLowerCase(); | ||
} | ||
Object.assign( configObject, { | ||
connectionUsername: databaseUsername === '' ? await input( | ||
{ | ||
message: 'What\'s your database username?', | ||
validate ( input ) { | ||
return input.trim().length === 0 ? 'This field cannot be empty!' : true; | ||
} | ||
}, | ||
) : databaseUsername | ||
} ); | ||
|
||
connectionUsername: databaseUser | ||
}); | ||
|
||
// Ask the user for the database connection password. | ||
Object.assign( configObject, { | ||
connectionPassword: await password( | ||
|
@@ -540,7 +554,8 @@ export default class Generate extends Command { | |
} ); | ||
} | ||
|
||
if(templateChoice == 'mle-ts-sample'){ | ||
if(templateChoice == 'mle-ts-sample' || templateChoice == 'mle-ts-ords-backend') | ||
{ | ||
// Ask the user for the path to SQLcl | ||
Object.assign( configObject, { | ||
sqlclPath: sqlclPath === '' ? await input( | ||
|
@@ -552,6 +567,21 @@ export default class Generate extends Command { | |
}, | ||
) : sqlclPath | ||
}); | ||
if (templateChoice == 'mle-ts-ords-backend') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use strict comparison |
||
{ | ||
// Ask the user for the path to SQLcl | ||
Object.assign( configObject, { | ||
ordsHost: ordsHost === '' ? await input( | ||
{ | ||
message: 'Please provide ORDS Base URL: ', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the ORDS base path provided contains a slash at the end, the BASE_URL for tests generates something like |
||
validate ( input ) { | ||
return input.trim().length === 0 ? 'This field cannot be empty!' : true; | ||
}, | ||
default: 'http://localhost:8080/ords' | ||
}, | ||
) : ordsHost | ||
}); | ||
} | ||
} | ||
|
||
generateDatabaseApp( configObject ); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Database User | ||
DB_USER=<%= connectionUsername %> | ||
# Database User Password | ||
DB_PASSWORD=<%= connectionPassword %> | ||
# Connection string to your Autonomous Database/ | ||
# Oracle Database instance | ||
CONNECT_STRING=<%= connectionString %> | ||
# Oracle MLE Module name | ||
MLE_MODULE= | ||
# Optional HTTP Proxy Settings | ||
# HTTPS_PROXY= | ||
# HTTPS_PROXY_PORT= | ||
|
||
# Path to your local SQL Developer Command Line | ||
# installation | ||
SQL_CL_PATH=<%= sqlclPath %> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Path to database wallet | ||
WALLET_PATH=<%= walletPath %> | ||
WALLET_PASSWORD=<%= walletPassword %> | ||
# Database User | ||
DB_USER=<%= connectionUsername %> | ||
# Database User Password | ||
DB_PASSWORD=<%= connectionPassword %> | ||
# Connection string to your Autonomous Database/ | ||
# Oracle Database instance | ||
CONNECT_STRING=<%= connectionString %> | ||
# Oracle MLE Module name | ||
MLE_MODULE= | ||
# Optional HTTP Proxy Settings | ||
# HTTPS_PROXY= | ||
# HTTPS_PROXY_PORT= | ||
|
||
# Path to your local SQL Developer Command Line | ||
# installation | ||
SQL_CL_PATH=<%= sqlclPath %> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.DS_Store | ||
|
||
/.env | ||
/.env.* | ||
!/.env.example | ||
!/.env.*.example | ||
/server/utils/db/wallet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use strict comparison
===
instead