-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add blueprint to add ember-basic-dropdown style dependency
- Loading branch information
Francesco Novy
committed
Apr 12, 2017
1 parent
23452c8
commit 2892f5a
Showing
2 changed files
with
44 additions
and
2 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,39 @@ | ||
/* eslint-env node */ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
const fs = require('fs'); | ||
|
||
module.exports = { | ||
normalizeEntityName() { | ||
// this prevents an error when the entityName is | ||
// not specified (since that doesn't actually matter | ||
// to us | ||
}, | ||
|
||
afterInstall() { | ||
let dependencies = this.project.dependencies(); | ||
let type; | ||
let importStatement = "\n@import 'ember-basic-dropdown';\n"; | ||
|
||
if ('ember-cli-sass' in dependencies) { | ||
type = 'scss'; | ||
} | ||
|
||
if (type) { | ||
let stylePath = path.join('app', 'styles'); | ||
let file = path.join(stylePath, `app.${type}`); | ||
|
||
if (!fs.existsSync(stylePath)) { | ||
fs.mkdirSync(stylePath); | ||
} | ||
if (fs.existsSync(file)) { | ||
this.ui.writeLine(`Added import statement to ${file}`); | ||
return this.insertIntoFile(file, importStatement, {}); | ||
} else { | ||
fs.writeFileSync(file, importStatement); | ||
this.ui.writeLine(`Created ${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