-
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.
Merge pull request #341 from SuperITMan/feature/copy-webpack-files
feat(build) feat(test) Add support and requirement for .angular-cli.json
- Loading branch information
Showing
15 changed files
with
347 additions
and
73 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,39 @@ | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
|
||
function isDirectory(path) { | ||
try { | ||
return fs.statSync(path).isDirectory(); | ||
} catch (_) { | ||
return false; | ||
} | ||
} | ||
|
||
function getDirectoriesNames(source) { | ||
return fs.readdirSync(source).filter(name => isDirectory(path.join(source, name))); | ||
} | ||
|
||
/** | ||
* Validate passed angular cli config based on schema: @angular/cli/lib/config/schema.json | ||
* If the serialized file is equal to the passed json, return the serialized config. | ||
* Otherwise, it returns false. | ||
* | ||
* @param jsonConfig | ||
* @returns {*} | ||
*/ | ||
function validateAngularCLIConfig(jsonConfig) { | ||
const SchemaClassFactory = require("@ngtools/json-schema").SchemaClassFactory; | ||
const schema = require("@angular/cli/lib/config/schema.json"); | ||
|
||
const config = new (SchemaClassFactory(schema))(jsonConfig); | ||
try { | ||
const serializedConfig = JSON.parse(config.$$serialize("application/json")); | ||
return serializedConfig; | ||
} catch(error) { | ||
return false; | ||
} | ||
} | ||
|
||
exports.getDirectoriesNames = getDirectoriesNames; | ||
exports.isDirectory = isDirectory; | ||
exports.validateAngularCLIConfig = validateAngularCLIConfig; |
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
Oops, something went wrong.