Skip to content
This repository has been archived by the owner on Apr 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #48 from A-Tokyo/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
a-tokyo committed Mar 7, 2017
2 parents 7019991 + e43534d commit f392d8f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
26 changes: 0 additions & 26 deletions generators/component/src/files.js
Expand Up @@ -23,28 +23,6 @@ module.exports = function(AngularATGenerator) {
'componentModule': _.camelCase(componentName)
};

// if (this.options.r) {
//
// if (pathAsArray.length === 1) {
// try {
// const indexModulesRemoveLine = "require('./components/" + data.componentName + "/" + data.componentName + ".module').name,";
// utils.removeLineFromFile('index.components.js', indexModulesRemoveLine, this.destinationRoot() + '/src/app')
// utils.deleteDirRecursive(this.destinationRoot() + '/src/app/components/' + data.componentName);
// } catch (err) {}
// }else{
// parentName = pathAsArray[pathAsArray.length - 2];
//
// // //module
// // const moduleImportRemoveLine = "import * as " + data.componentModule + " from './components/" + componentName + '/' + componentName + ".module';";
// // utils.addToFile(parentName + '.module.js', moduleImport, utils.IMPORT_MODULE_MARKER, this.destinationRoot() + '/src/app/components/' + parentPath);
// // //dependency
// // const dependencyImport = "'" + data.componentModule + "',";
// // utils.addToFile(parentName + '.module.js', dependencyImport, utils.IMPORT_DEPENDENCY_MARKER, this.destinationRoot() + '/src/app/components/' + parentPath);
//
// }
// return;
// }

//if the component has no parent
if (pathAsArray.length === 1) {
try {
Expand All @@ -66,12 +44,9 @@ module.exports = function(AngularATGenerator) {
// importing files to parent component
try {
//module
// const moduleImport = "import * as " + data.componentModule + " from './components/" + componentName + '/' + componentName + ".module';";
const moduleImport = `import * as ${data.componentModule} from './components/${componentName}/${componentName}.module';`;
// utils.addToFile(parentName + '.module.js', moduleImport, utils.IMPORT_MODULE_MARKER, this.destinationRoot() + '/src/app/components/' + parentPath);
utils.addToFile(`${parentName}.module.js`, moduleImport, utils.IMPORT_MODULE_MARKER, `${this.destinationRoot()}/src/app/components/${parentPath}`);
//dependency
// const dependencyImport = "'" + data.componentModule + "',";
const dependencyImport = `'${data.componentModule}',`;
utils.addToFile(`${parentName}.module.js`, dependencyImport, utils.IMPORT_DEPENDENCY_MARKER, `${this.destinationRoot()}/src/app/components/${parentPath}`);
} catch (err) {
Expand All @@ -81,7 +56,6 @@ module.exports = function(AngularATGenerator) {
}

// checking if the module exists, if so it is a duplicate
// isDuplicate = utils.existsSync(this.destinationPath(this.destinationRoot() + '/src/app/components/' + fullPath + '/' + data.componentName + '.module.js'));
isDuplicate = utils.existsSync(this.destinationPath(`${this.destinationRoot()}/src/app/components/${fullPath}/${data.componentName}.module.js`));

// copy template files, no need for try and catch since file structure already exists from above
Expand Down
2 changes: 1 addition & 1 deletion test/app-spec.js
Expand Up @@ -62,7 +62,7 @@ describe('at-angular --dreidev', function() {

describe('at-angular --default', function() {
beforeEach(function() {
return helpers.run(path.join(__dirname, '../generators/app')).withOptions({default: true}); // Mock some prompt answers, and depend on defaults for others
return helpers.run(path.join(__dirname, '../generators/app')).withOptions({default: true, skipinstall: true}); // Mock some prompt answers, and depend on defaults for others
});

it('should create the expected angular application files', function(done) {
Expand Down

0 comments on commit f392d8f

Please sign in to comment.