This repository was archived by the owner on Apr 4, 2025. It is now read-only.
This repository was archived by the owner on Apr 4, 2025. It is now read-only.
Creating a new application in a temp folder and deleting all of its files, doesn't remove all temp files #492
Closed
Description
My use case is, as follows.
I need to generate a new ng application in a temp folder.
Then I need to get some of the files (like .angular-cli.json
, package.json
and .gitignore
) to merge them with my current project.
Then I need to clean up => delete the temp folder.
However, app.component.html
, app.component.spec.ts
, app.component.ts
and app.module.ts
seem to be immune to tree.delete(filename)
.
Bug Report or Feature Request (mark with an x
)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Area
- [ ] devkit
- [x] schematics
Versions
"@angular-devkit/core": "^0.4.5",
"@angular-devkit/schematics": "^0.4.5",
"@schematics/angular": "^0.4.5",
Repro steps
If I run this chain of rules
export default function(): Rule {
return chain([
createNgProject(),
deleteNgProject
])
}
const createNgProject = () => {
const options: ApplicationSchema = {
name: 'tmp-name',
directory: 'tmp',
skipInstall: true
}
return externalSchematic('@schematics/angular', 'application', options);
}
const deleteNgProject = (tree: Tree) => {
tree.visit(file => {
if (file.startsWith('/tmp')) {
tree.delete(file);
}
})
return tree;
}
The log given by the failure
No errors, but the log will display:
create tmp/src/app/app.component.html (1141 bytes)
create tmp/src/app/app.component.spec.ts (986 bytes)
create tmp/src/app/app.component.ts (207 bytes)
create tmp/src/app/app.module.ts (316 bytes)
Desired functionality
When I run the application
schematic, I should be able, to delete all of the files it creates.