-
Notifications
You must be signed in to change notification settings - Fork 79
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
aragon init prepare template for environments #371
Changes from all commits
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 |
---|---|---|
@@ -1,34 +1,27 @@ | ||
import path from 'path' | ||
import fs from 'fs-extra' | ||
|
||
export async function prepareTemplate(basename, appName) { | ||
const arappPath = path.resolve(basename, 'arapp.json') | ||
export async function prepareTemplate(dir, appName) { | ||
const basename = appName.split('.')[0] | ||
const arappPath = path.resolve(dir, 'arapp.json') | ||
const arapp = await fs.readJson(arappPath) | ||
|
||
// TODO remove once the old arapp.json is no longer supported | ||
if (!arapp.environments) { | ||
arapp.environments = {} | ||
} | ||
const defaultEnv = arapp.environments.default | ||
const stagingEnv = arapp.environments.staging | ||
const productionEnv = arapp.environments.production | ||
|
||
const props = { | ||
network: 'development', | ||
appName: appName, | ||
} | ||
defaultEnv.appName = appName | ||
stagingEnv.appName = stagingEnv.appName.replace(/^app/, basename) | ||
productionEnv.appName = productionEnv.appName.replace(/^app/, basename) | ||
|
||
if (arapp.environments.default) { | ||
Object.assign(arapp.environments.default, props) | ||
} else { | ||
arapp.environments.default = props | ||
} | ||
Object.assign(arapp.environments.default, defaultEnv) | ||
Object.assign(arapp.environments.staging, stagingEnv) | ||
Object.assign(arapp.environments.production, productionEnv) | ||
|
||
// remove old arapp.json props | ||
delete arapp.appName | ||
delete arapp.version | ||
const gitFolderPath = path.resolve(dir, '.git') | ||
const licensePath = path.resolve(dir, 'LICENSE') | ||
|
||
const gitFolderPath = path.resolve(basename, '.git') | ||
const licensePath = path.resolve(basename, 'LICENSE') | ||
|
||
const packageJsonPath = path.resolve(basename, 'package.json') | ||
const packageJsonPath = path.resolve(dir, 'package.json') | ||
const packageJson = await fs.readJson(packageJsonPath) | ||
delete packageJson.license | ||
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. Just curious, should we move this to also be in 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. Yes! I already made the same changes in 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. After the next release (5.4) would be a great time! |
||
|
||
|
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.
Just noticed this, but it seems unnecessary to run
documentation lint
on the tests 😄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.
I'll include this change in #359