-
-
Notifications
You must be signed in to change notification settings - Fork 299
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
subgenerator that cleans up files created in app generator. #1066
Comments
I think this issue might have to do with ordering (see the run loop documentation). Is your generator removing the files really running after the one creating them? |
No it uses the writing function on both. I can verify that it does the create in the app generator and the delete in the child. I'll put together an example when I get back home |
@benmonro did you |
Yes
…On Sat, Apr 14, 2018 at 10:32 PM Simon Boudrias ***@***.***> wrote:
@benmonro <https://github.com/benmonro> did you console.log in each
function to make sure they're called in the order you expect?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1066 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAYXhAgBRFGli0n1_a6HG5cf46c1Mjy9ks5tottwgaJpZM4TTwei>
.
|
I have written a test that shows it should work (it was located in the base.js test file under the '#composeWith()' cateogry describe('share the same fs', () => {
const tmpdir = path.join(os.tmpdir(), 'yeoman-base-storage');
const tmpfile = path.join(tmpdir, 'tempFile');
const DummyWriter = class extends Base {
writing() {
this.fs.write(tmpfile, 'test');
}
};
beforeEach(function() {
fs.mkdirSync(tmpdir);
this.dummyWriter = new DummyWriter([], {
resolved: resolveddir,
namespace: 'dummy',
env: this.env,
'skip-install': true
});
this.dummyWriterCompose = class extends Base {
writing() {
this.fs.delete(tmpfile);
}
};
this.env.registerStub(this.dummyWriterCompose, 'composed:genwriter');
});
afterEach(function() {
rimraf.sync(tmpdir);
});
it('shares fs between the composed generators', function() {
this.dummyWriter.composeWith('composed:genwriter');
return this.dummyWriter.run().then(() => {
assert.equal(fs.existsSync(tmpfile), false);
});
});
}); @benmonro are you sure you are calling the proper delete method like I did in the test?
|
This issue is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 5 days |
I have a subgenerator that removes sample code created by the app generator. I'd like to compose this in the app generator itself, so the user has the choice to include the sample code or not. In a nutshell, the app generator is creating the file, but then the sub generator is deleting it. However, when i try this, the file is still created. is there any way to accomplish this in the "yeoman" way (i.e. not using shell commands to delete the files)
The text was updated successfully, but these errors were encountered: