Skip to content

Commit

Permalink
fix(init): add a default README.md file (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
awgaan committed Mar 26, 2020
1 parent d1fe0a9 commit 49b85ec
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
37 changes: 37 additions & 0 deletions cli/config/init.README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
This project was bootstrapped with [DHIS2 Application Platform](https://github.com/dhis2/app-platform).

## Available Scripts

In the project directory, you can run:

### `yarn start`

Runs the app in the development mode.<br />
Open [http:https://localhost:3000](http:https://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br />
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner and runs all available tests found in `/src`.<br />

See the section about [running tests](https://platform.dhis2.nu/#/scripts/test) for more information.

### `yarn build`

Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br />
A deployable `.zip` file can be found in `build/bundle`!

See the section about [building](https://platform.dhis2.nu/#/scripts/build) for more information.

## Learn More

You can learn more about the platform in the [DHIS2 Application Platform Documentation](https://platform.dhis2.nu/).

You can learn more about the runtime in the [DHIS2 Application Runtime Documentation](https://runtime.dhis2.nu/).

To learn React, check out the [React documentation](https://reactjs.org/).
7 changes: 7 additions & 0 deletions cli/src/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,13 @@ const handler = async ({ force, name, cwd, lib }) => {
const sections = parseGitignore(gitignoreFile)
writeGitignore(gitignoreFile, sections)

if (fs.existsSync(paths.readme) && !force) {
reporter.warn('A README already exists, use --force to overwrite it')
} else {
reporter.info('Writing README...')
fs.copyFileSync(paths.readmeDefault, paths.readme)
}

reporter.print('')
reporter.info('SUCCESS!')
const cdCmd = name != '.' ? `cd ${name} && ` : ''
Expand Down
2 changes: 2 additions & 0 deletions cli/src/lib/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = (cwd = process.cwd()) => {
'../../config/d2.config.lib.js'
),
jestConfigDefaults: path.join(__dirname, '../../config/jest.config.js'),
readmeDefault: path.join(__dirname, '../../config/init.README.md'),

shellSource,
shellSourceEntrypoint: path.join(shellSource, 'src/App.js'),
Expand All @@ -28,6 +29,7 @@ module.exports = (cwd = process.cwd()) => {
package: path.join(base, './package.json'),
dotenv: path.join(base, './.env'),
config: path.join(base, './d2.config.js'),
readme: path.join(base, './README.md'),
src: path.join(base, './src'),
public: path.join(base, './public'),
jestConfig: path.join(base, 'jest.config.js'),
Expand Down

0 comments on commit 49b85ec

Please sign in to comment.