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

fix(init): add a default README.md file #335

Merged
merged 3 commits into from
Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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://localhost:3000](http://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 in the about the platform in the [DHIS2 Application Platform Documentation](https://platform.dhis2.nu/).
awgaan marked this conversation as resolved.
Show resolved Hide resolved

You can learn more in the 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