Skip to content

Commit

Permalink
Merge pull request #7019 from vidartf/buildutils-windows
Browse files Browse the repository at this point in the history
Fix build util paths for Windows
  • Loading branch information
blink1073 committed Aug 15, 2019
2 parents 2a7ba40 + 99388f0 commit bef72f1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions buildutils/src/ensure-package.ts
Expand Up @@ -349,7 +349,10 @@ export async function ensureUiComponents(pkgPath: string): Promise<string[]> {
const name = utils.stem(svg);
const nameCamel = utils.camelCase(name) + 'Svg';
_iconImportStatements.push(
`import ${nameCamel} from '${path.relative(iconSrcDir, svg)}';`
`import ${nameCamel} from '${path
.relative(iconSrcDir, svg)
.split(path.sep)
.join('/')}';`
);
_iconModelDeclarations.push(`{ name: '${name}', svg: ${nameCamel} }`);
});
Expand All @@ -376,7 +379,10 @@ export async function ensureUiComponents(pkgPath: string): Promise<string[]> {
const className = 'jp-' + utils.camelCase(name, true) + 'Icon';

_iconCSSUrls.push(
`--${urlName}: url('${path.relative(iconCSSDir, svg)}');`
`--${urlName}: url('${path
.relative(iconCSSDir, svg)
.split(path.sep)
.join('/')}');`
);
_iconCSSDeclarations.push(
`.${className} {background-image: var(--${urlName})}`
Expand Down Expand Up @@ -485,6 +491,10 @@ function ensureFile(
const prev = fs.readFileSync(path, {
encoding: 'utf8'
});
// Normalize line endings to match current content
if (prev.indexOf('\r') !== -1) {
contents = contents.replace(/\n/g, '\r\n');
}
if (prev !== contents) {
fs.writeFileSync(path, contents);
messages.push(`Updated ./${path}`);
Expand Down

0 comments on commit bef72f1

Please sign in to comment.