-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
angular-cli 6 (with webpack 4) compatibility #3491
Changes from all commits
96b5668
575ad6a
b74b4f8
06e6e05
a36fc9f
c8ace6c
48044eb
68c4b61
a41e08a
a25b4cd
45a29df
d4ea7e4
1689458
28a06ac
a32e314
7bbaf8f
9b13bfc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import fs from 'fs'; | ||
import { basename, dirname, normalize, relative, resolve } from '@angular-devkit/core'; | ||
|
||
function isDirectory(assetPath) { | ||
try { | ||
return fs.statSync(assetPath).isDirectory(); | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
|
||
function getAssetsParts(resolvedAssetPath, assetPath) { | ||
if (isDirectory(resolvedAssetPath)) { | ||
return { | ||
glob: '**/*', // Folders get a recursive star glob. | ||
input: assetPath, // Input directory is their original path. | ||
}; | ||
} | ||
|
||
return { | ||
glob: basename(assetPath), // Files are their own glob. | ||
input: dirname(assetPath), // Input directory is their original dirname. | ||
}; | ||
} | ||
|
||
export function isBuildAngularInstalled() { | ||
try { | ||
require.resolve('@angular-devkit/build-angular'); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
|
||
export function normalizeAssetPatterns(assetPatterns, dirToSearch, sourceRoot) { | ||
if (!assetPatterns || !assetPatterns.length) { | ||
return []; | ||
} | ||
|
||
return assetPatterns.map(assetPattern => { | ||
const assetPath = normalize(assetPattern); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @igor-dv sorry to nudge you like this. I'm getting a an error here.
which throws the following error:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, will take a look |
||
const resolvedSourceRoot = resolve(dirToSearch, sourceRoot); | ||
const resolvedAssetPath = resolve(dirToSearch, assetPath); | ||
const parts = getAssetsParts(resolvedAssetPath, assetPath); | ||
|
||
// Output directory for both is the relative path from source root to input. | ||
const output = relative(resolvedSourceRoot, resolve(dirToSearch, parts.input)); | ||
|
||
// Return the asset pattern in object format. | ||
return { | ||
...parts, | ||
output, | ||
}; | ||
}); | ||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone doesn't use angular-cli, will this dep still appear? I assume that it won't, that's why we added the
isBuildAngularInstalled
func