Skip to content

Commit

Permalink
Setup post-init script and upgrade configuration usage
Browse files Browse the repository at this point in the history
* executable post init script
* post init script with instructions and copy configuration file
* change instruction according to the new post init script
  • Loading branch information
AurelGit committed Oct 27, 2020
1 parent 6ef0911 commit ed457e5
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 14 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ npx react-native init MyApp --template @thecodingmachine/react-native-boilerplat
Assuming you have all the requirements installed, you can setup and run the project by running:

- `yarn install` to install the dependencies
- create your [configuration file `App/Config/index.js`](App/Config) from `index.dev.js` (if you are in dev environment) and fill the missing values
- run the following steps for your platform

### Android
Expand Down
5 changes: 0 additions & 5 deletions documentation/docs/2_Getting Started/2_1_Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,11 @@ To create a new project using the boilerplate simply run :
npx react-native init MyApp --template @thecodingmachine/react-native-boilerplate
```

:::warning
If you have an error ECACCES this is not bloking, you can use it even if you have this error.
:::

## Running the project

Assuming you have all the requirements installed, you can setup and run the project by running:

- `yarn install` to install the dependencies
- create your [configuration file `src/Config/index.js`](https://github.com/thecodingmachine/react-native-boilerplate/tree/master/template/src/Config) from `index.dev.js` (if you are in dev environment) and fill the missing values
- run the following steps for your platform

### Android
Expand Down
24 changes: 23 additions & 1 deletion post-init.script.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
#!/usr/bin/env node

console.log("This is post init script");
const fs = require('fs')
fs.copyFile('src/Config/index.example.js', 'src/Config/index.js', (err) => {
if (err) throw err;
console.log('src/Config/index.example.js was copied to src/Config/index.js');
});

console.log("TheCodingMachine React-Native Boilerplate initialized with success !");
console.log("" +
" .-` `:: \n" +
" `///////////// `/shhhy+- ://. /sy/ /ss/ :NMN: \n" +
" `sssssyhhhyhhy:` `yMMMMNNMMMd. osss: `hMMMh- .-` `+ss: +MMm/. \n" +
" :MMM+----. `mMMm+:-`.oo/` osssyo` `dMMMMh- ohhh- `oyy+- sMMd/. \n" +
" :MMM+` oMMN/- osssyhs`.mMMMMMh- -hds` .syy+- `hMMh:` \n" +
" :MMM+` hMMd: oss-ohhhMMMhdMMh- `. +NNm/. .dMMy:` \n" +
" :MMM+` oMMN/ oss-`shdMMd:dMMh- :-` sMMd/. -NMMo- \n" +
" :MMM+` `mMMm/` `/+:. oss- `sdMd:.hMMh- hMys- `hMMh:` -hdy-` \n" +
" :MMM+` `yMMMMdssss+ oss. `oh/- hMMh- -hyo: dMMs:` -ss+` \n" +
" .oys:` .+yhyo/- -::` `` -syo- ..` +mo- `// \n" +
" `` ``` `` `. ")

console.log('- If you need to read more about this boilerplate : https://thecodingmachine.github.io/react-native-boilerplate/')
console.log('- If you have some troubles : https://github.com/thecodingmachine/react-native-boilerplate/issues')
console.log('- If you love this boilerplate, give us a star, you will be a ray of sunshine in our lives :) https://github.com/thecodingmachine/react-native-boilerplate')
3 changes: 2 additions & 1 deletion template.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = {
// Directory with the template which will be copied and processed by React Native CLI. Template directory should have package.json with all dependencies specified, including `react-native`.
templateDir: './template',

// Path to script, which will be executed after initialization process, but before installing all the dependencies specified in the template. This script runs as a shell script but you can change that (e.g. to Node) by using a shebang (see example custom template).
// Path to script, which will be executed after initialization process, but before installing all the dependencies specified in the template.
// This script runs as a shell script but you can change that (e.g. to Node) by using a shebang (see example custom template).
postInitScript: './post-init.script.js',
};
File renamed without changes.
3 changes: 0 additions & 3 deletions template/src/Config/index.production.js

This file was deleted.

3 changes: 0 additions & 3 deletions template/src/Config/index.staging.js

This file was deleted.

0 comments on commit ed457e5

Please sign in to comment.