-
-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ♻️ Improve setup code Improve setup code
- Loading branch information
Showing
9 changed files
with
420 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const util = require('util') | ||
const writeFile = util.promisify(require('fs').writeFile) | ||
|
||
const newReadmeContent = `# My bento-starter project | ||
## Documentation | ||
Documentation available :point_right: [here](https://bento-starter.netlify.com/)` | ||
|
||
/** | ||
* Replace README.md content | ||
* | ||
* @returns {Promise<any>} | ||
*/ | ||
module.exports = async () => | ||
await writeFile(`${__dirname}/../../README.md`, newReadmeContent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const util = require('util') | ||
const exec = util.promisify(require('child_process').exec) | ||
const shell = require('shelljs') | ||
|
||
/** | ||
* Remove npm dependencies which are only used by this script | ||
* @returns {Promise<any>} | ||
*/ | ||
module.exports = async () => | ||
await exec( | ||
'npm uninstall rimraf compare-versions chalk shelljs read-pkg write-pkg inquirer ora boxen --save-dev' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const path = require('path') | ||
const util = require('util') | ||
const rimraf = util.promisify(require('rimraf')) | ||
|
||
const rootDirname = path.resolve(`${__dirname}/../../`) | ||
|
||
const resourcesPathsToDelete = [ | ||
`${rootDirname}/internals`, | ||
`${rootDirname}/docs`, | ||
`${rootDirname}/.github`, | ||
`${rootDirname}/resources`, | ||
`${rootDirname}/.env.example`, | ||
`${rootDirname}/LICENSE` | ||
] | ||
|
||
/** | ||
* Delete useless resources | ||
* */ | ||
module.exports = async () => | ||
await Promise.all(resourcesPathsToDelete.map(path => rimraf(path))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const readPkg = require('read-pkg') | ||
const writePkg = require('write-pkg') | ||
|
||
/** | ||
* Remove the "setup" script from package.json | ||
* @returns {Promise<any>} | ||
*/ | ||
module.exports = async () => { | ||
const pkg = await readPkg() | ||
|
||
if (!pkg.scripts) { | ||
pkg.scripts = {} | ||
} | ||
|
||
delete pkg.scripts.setup | ||
delete pkg.scripts.presetup | ||
|
||
return writePkg(pkg) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const util = require('util') | ||
const copyFile = util.promisify(require('fs').copyFile) | ||
|
||
/** | ||
* Create '.env.local' file by copying '.env.example' file | ||
* | ||
* @returns {Promise<any>} | ||
*/ | ||
module.exports = async () => | ||
await copyFile( | ||
`${__dirname}/../../.env.example`, | ||
`${__dirname}/../../.env.local` | ||
) |
Oops, something went wrong.