Skip to content
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

Adding folder options to configuration script #7

Merged
merged 1 commit into from
Jun 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions bootstrap/src/configureMe.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function renderIntro() {
}

const boxInfo = boxen(
chalk.hex('#FAAD39').bold("Boemska h54s") + ' ' + chalk.white.bold("React PWA Seed") + '\n\n'
chalk.hex('#FAAD39').bold("Boemska h54s") + ' ' + chalk.white.bold("Create SAS App") + '\n\n'
+ chalk.dim("sha:") + ' ' + info.abbreviatedSha + '\n'
+ chalk.dim("branch:") + ' ' + info.branch + '\n'
+ chalk.dim("root:") + ' ' + info.root
Expand Down Expand Up @@ -93,10 +93,25 @@ function renderIntro() {
prefix: '-',
message: `Is this a SAS Viya or a SAS 9.4 server?`,
choices: sasEnvs
},
{
type: 'input',
name: 'folderLocation',
message: 'SAS Folder path for back-end services?',
prefix: '-',
default: '/Public/AppFactory Apps/My First App/',
validate: async (input) => {
if (!(input.startsWith('/'))) {
return 'Folder path must start with a leading /'
} else {
return true
}
}
}
], function (answers) {
sasLocation = answers.sasLocation;
sasType = answers.sasType;
folderLocation = answers.folderLocation;
});

// list of microservices that our app uses that we want to validate endpoints for
Expand Down Expand Up @@ -197,15 +212,27 @@ function renderIntro() {
templateHttps = ''
}
var templateHost = serverUrl.hostname
// write env file
fs.writeFileSync('./src/adapterService/config.js',
`export default {
metadataRoot: "${promptRes.folderLocation}",
hostUrl: "",
ajaxTimeout: 600000,
sasVersion: "${promptRes.sasType}"
}
`)

// write service config
fs.writeFileSync('./.env', `${templateHttps}SASHOST=${templateHost}\nSASVER=${promptRes.sasType}`)

log(`\nConfiguration ${chalk.greenBright('successful!')} Variables written to ${chalk.hex('#FAAD39')('.env')} file in project root.\nFrom now, start the app in Development mode by runing: \n\n ${chalk.hex('#FAAD39')('yarn start')} \n`);
log(`\nConfiguration ${chalk.greenBright('successful!')} Variables written to ${chalk.hex('#FAAD39')('.env')} file in project root,
and ${chalk.hex('#FAAD39')('src/adapterService/config.js')}. From now, start the app in Development
mode by runing: \n\n ${chalk.hex('#FAAD39')('yarn start')} \n`);
process.exit(0);
} else {
log(`\nConfiguration ${chalk.redBright('not successful!')}. Try again.`);
process.exit(0);
}

}

configureSas()
33 changes: 30 additions & 3 deletions carbon-ui/src/configureMe.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function renderIntro() {
}

const boxInfo = boxen(
chalk.hex('#FAAD39').bold("Boemska h54s") + ' ' + chalk.white.bold("React PWA Seed") + '\n\n'
chalk.hex('#FAAD39').bold("Boemska h54s") + ' ' + chalk.white.bold("Create SAS App") + '\n\n'
+ chalk.dim("sha:") + ' ' + info.abbreviatedSha + '\n'
+ chalk.dim("branch:") + ' ' + info.branch + '\n'
+ chalk.dim("root:") + ' ' + info.root
Expand Down Expand Up @@ -93,10 +93,25 @@ function renderIntro() {
prefix: '-',
message: `Is this a SAS Viya or a SAS 9.4 server?`,
choices: sasEnvs
},
{
type: 'input',
name: 'folderLocation',
message: 'SAS Folder path for back-end services?',
prefix: '-',
default: '/Public/AppFactory Apps/My First App/',
validate: async (input) => {
if (!(input.startsWith('/'))) {
return 'Folder path must start with a leading /'
} else {
return true
}
}
}
], function (answers) {
sasLocation = answers.sasLocation;
sasType = answers.sasType;
folderLocation = answers.folderLocation;
});

// list of microservices that our app uses that we want to validate endpoints for
Expand Down Expand Up @@ -197,15 +212,27 @@ function renderIntro() {
templateHttps = ''
}
var templateHost = serverUrl.hostname
// write env file
fs.writeFileSync('./src/adapterService/config.js',
`export default {
metadataRoot: "${promptRes.folderLocation}",
hostUrl: "",
ajaxTimeout: 600000,
sasVersion: "${promptRes.sasType}"
}
`)

// write service config
fs.writeFileSync('./.env', `${templateHttps}SASHOST=${templateHost}\nSASVER=${promptRes.sasType}`)

log(`\nConfiguration ${chalk.greenBright('successful!')} Variables written to ${chalk.hex('#FAAD39')('.env')} file in project root.\nFrom now, start the app in Development mode by runing: \n\n ${chalk.hex('#FAAD39')('yarn start')} \n`);
log(`\nConfiguration ${chalk.greenBright('successful!')} Variables written to ${chalk.hex('#FAAD39')('.env')} file in project root,
and ${chalk.hex('#FAAD39')('src/adapterService/config.js')}. From now, start the app in Development
mode by runing: \n\n ${chalk.hex('#FAAD39')('yarn start')} \n`);
process.exit(0);
} else {
log(`\nConfiguration ${chalk.redBright('not successful!')}. Try again.`);
process.exit(0);
}

}

configureSas()
33 changes: 30 additions & 3 deletions onsen-ui/src/configureMe.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function renderIntro() {
}

const boxInfo = boxen(
chalk.hex('#FAAD39').bold("Boemska h54s") + ' ' + chalk.white.bold("React PWA Seed") + '\n\n'
chalk.hex('#FAAD39').bold("Boemska h54s") + ' ' + chalk.white.bold("Create SAS App") + '\n\n'
+ chalk.dim("sha:") + ' ' + info.abbreviatedSha + '\n'
+ chalk.dim("branch:") + ' ' + info.branch + '\n'
+ chalk.dim("root:") + ' ' + info.root
Expand Down Expand Up @@ -93,10 +93,25 @@ function renderIntro() {
prefix: '-',
message: `Is this a SAS Viya or a SAS 9.4 server?`,
choices: sasEnvs
},
{
type: 'input',
name: 'folderLocation',
message: 'SAS Folder path for back-end services?',
prefix: '-',
default: '/Public/AppFactory Apps/My First App/',
validate: async (input) => {
if (!(input.startsWith('/'))) {
return 'Folder path must start with a leading /'
} else {
return true
}
}
}
], function (answers) {
sasLocation = answers.sasLocation;
sasType = answers.sasType;
folderLocation = answers.folderLocation;
});

// list of microservices that our app uses that we want to validate endpoints for
Expand Down Expand Up @@ -197,15 +212,27 @@ function renderIntro() {
templateHttps = ''
}
var templateHost = serverUrl.hostname
// write env file
fs.writeFileSync('./src/adapterService/config.js',
`export default {
metadataRoot: "${promptRes.folderLocation}",
hostUrl: "",
ajaxTimeout: 600000,
sasVersion: "${promptRes.sasType}"
}
`)

// write service config
fs.writeFileSync('./.env', `${templateHttps}SASHOST=${templateHost}\nSASVER=${promptRes.sasType}`)

log(`\nConfiguration ${chalk.greenBright('successful!')} Variables written to ${chalk.hex('#FAAD39')('.env')} file in project root.\nFrom now, start the app in Development mode by runing: \n\n ${chalk.hex('#FAAD39')('yarn start')} \n`);
log(`\nConfiguration ${chalk.greenBright('successful!')} Variables written to ${chalk.hex('#FAAD39')('.env')} file in project root,
and ${chalk.hex('#FAAD39')('src/adapterService/config.js')}. From now, start the app in Development
mode by runing: \n\n ${chalk.hex('#FAAD39')('yarn start')} \n`);
process.exit(0);
} else {
log(`\nConfiguration ${chalk.redBright('not successful!')}. Try again.`);
process.exit(0);
}

}

configureSas()