Visitar URL original
Fix paths in generated theme file for windows (#42) · dojo/cli-create-theme@465cdc0 · GitHub
Skip to content

Commit 465cdc0

Browse files
authored
Fix paths in generated theme file for windows (#42)
* Fix package not found test for windows * Fix paths in generated theme file for windows The join function in path detects the platform and if it is windows, it changes to using backslash \ instead of forward slash /. Typescript expects forward slashes / regardless of platform.
1 parent 7b805ca commit 465cdc0

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎src/createThemeFile.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ function createThemeFile({
3030
}
3131

3232
const CSSModulesData = themedWidgets.map(({ themeKey, fileName }) => {
33+
themeKey = themeKey.split(/[\\]+/).join('/');
3334
const CSSModulePath = `${themeKey}/${fileName}${CSSModuleExtension}`;
3435
const themeKeyVariable = camelcase(fileName);
3536

‎tests/unit/main.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as mockery from 'mockery';
22
import * as sinon from 'sinon';
3+
import { join } from 'path';
34

45
const { describe, it, beforeEach, afterEach } = intern.getInterface('bdd');
56
const { assert } = intern.getPlugin('chai');
@@ -46,7 +47,10 @@ describe('The main runner', () => {
4647
errorMessage = err;
4748
}
4849

49-
assert.equal(errorMessage, 'Error: This package path does not exist: node_modules/some-package/theme');
50+
assert.equal(
51+
errorMessage,
52+
'Error: This package path does not exist: ' + join('node_modules', 'some-package', 'theme')
53+
);
5054
});
5155

5256
it('errors if no widgets selections are made', async () => {

0 commit comments

Comments
 (0)