-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement removal of lines of file that will be removed * Implement removal of example files and cleanup script * Add info about the `cleanup` npm script to README
- Loading branch information
1 parent
ecd937f
commit 1e319db
Showing
9 changed files
with
104 additions
and
6 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
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,53 @@ | ||
const path = require('path'); | ||
const replace = require('replace-in-file').sync; | ||
const remove = require('del').sync; | ||
|
||
const srcPath = path.join(__dirname, '..', 'src'); | ||
const testPath = path.join(__dirname, '..', 'test'); | ||
const srcAndTestPath = `{${testPath},${srcPath}}`; | ||
const routerPath = path.join(srcPath, 'interfaces', 'http', 'router.js'); | ||
const containerPath = path.join(srcPath, 'container.js'); | ||
|
||
// Remove the references of the files that will be removed | ||
|
||
replace({ | ||
files: routerPath, | ||
from: /\s*apiRouter.*UsersController'\)\);/, | ||
to: '' | ||
}); | ||
|
||
replace({ | ||
files: containerPath, | ||
from: [ | ||
/\s*const.*app\/user'\);/, | ||
/\s*const.*UsersRepository'\);/, | ||
/\, User: UserModel/, | ||
/\s*usersRepository.*\}\]/, | ||
/\,\s*UserModel/, | ||
/createUser.*\n/, | ||
/\s*getAllUsers.*GetAllUsers/, | ||
], | ||
to: '' | ||
}); | ||
|
||
// Remove example app files | ||
|
||
remove([ | ||
path.join(srcAndTestPath, 'app', 'user', '**'), | ||
path.join(srcAndTestPath, 'domain', 'user', '**'), | ||
path.join(srcAndTestPath, 'infra', 'user', '**'), | ||
path.join(srcPath, 'infra', 'database', 'migrate', '*.js'), | ||
path.join(srcPath, 'infra', 'database', 'seeds', '*.js'), | ||
path.join(srcPath, 'infra', 'database', 'models', 'User.js'), | ||
path.join(srcPath, 'interfaces', 'http', 'user', '**'), | ||
path.join(testPath, 'api', 'users', '**'), | ||
path.join(testPath, 'support', 'factories', '*.js') | ||
]); | ||
|
||
// Remove `cleanup` command from package.json | ||
|
||
replace({ | ||
files: path.join(__dirname, '..', 'package.json'), | ||
from: /\,\s*\"cleanup.*cleanup\.js\"/, | ||
to: '' | ||
}); |
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
Empty file.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
const container = require('src/container'); | ||
const database = container.resolve('database'); | ||
|
||
module.exports = () => database.truncate({ cascade: true }); | ||
module.exports = () => database && database.truncate({ cascade: true }); |
Empty file.
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