@remvst/asset-catalog 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/utils.js CHANGED
@@ -38,7 +38,7 @@ function categoryPath(assetDir, png) {
38
38
  const dir = (0, path_1.dirname)(png);
39
39
  const trimmedDir = (0, path_1.relative)(assetDir, dir);
40
40
  return trimmedDir
41
- .split('/')
41
+ .split(/[\/\\]/g)
42
42
  .map(component => lowerCamelize(component))
43
43
  .filter(component => component.length > 0);
44
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remvst/asset-catalog",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "generate-image-catalog": "./lib/generate-image-catalog.js",
@@ -70,16 +70,16 @@ async function generatedCreateCatalogFunction(assetDir: string, tree: Tree): Pro
70
70
  async function main() {
71
71
  const argv = await yargs(hideBin(process.argv))
72
72
  .options({
73
- 'outFile': {
74
- type: 'string',
75
- default: '.',
76
- alias: 'o',
73
+ 'outFile': {
74
+ type: 'string',
75
+ default: '.',
76
+ alias: 'o',
77
77
  describe: 'Directory to generate the files into',
78
78
  },
79
- 'assetDir': {
80
- type: 'string',
81
- default: './package.json',
82
- alias: 'a',
79
+ 'assetDir': {
80
+ type: 'string',
81
+ default: './package.json',
82
+ alias: 'a',
83
83
  describe: 'package.json file to use for the version',
84
84
  }
85
85
  })
package/src/utils.ts CHANGED
@@ -38,7 +38,7 @@ export function categoryPath(assetDir: string, png: string): string[] {
38
38
  const dir = dirname(png);
39
39
  const trimmedDir = relative(assetDir, dir);
40
40
  return trimmedDir
41
- .split('/')
41
+ .split(/[\/\\]/g)
42
42
  .map(component => lowerCamelize(component))
43
43
  .filter(component => component.length > 0);
44
44
  }
package/testOut/images.ts DELETED
@@ -1,38 +0,0 @@
1
- import _directions_left_png from './../testData/directions/left.png';
2
- import _directions_up_png from './../testData/directions/up.png';
3
- import _fire_png from './../testData/fire.png';
4
-
5
- export type TextureCatalog<T> = {
6
- directions: {
7
- left: T,
8
- up: T,
9
- }
10
- fire: T,
11
- }
12
-
13
-
14
-
15
- export function createTextureCatalog<T>(createItem: (opts: {path: string, width: number, height: number, size: number}) => T): TextureCatalog<T> {
16
- return {
17
- directions: {
18
- left: createItem({
19
- path: _directions_left_png,
20
- width: 100,
21
- height: 100,
22
- size: 4424,
23
- }),
24
- up: createItem({
25
- path: _directions_up_png,
26
- width: 100,
27
- height: 100,
28
- size: 601,
29
- }),
30
- },
31
- fire: createItem({
32
- path: _fire_png,
33
- width: 384,
34
- height: 384,
35
- size: 10908,
36
- }),
37
- };
38
- }
package/testOut/sounds.ts DELETED
@@ -1,45 +0,0 @@
1
- import __testData_sounds_click_UI_Click_Metallic_mono_ogg from '../testData/sounds/click/UI_Click_Metallic_mono.ogg';
2
- import __testData_sounds_click_UI_Click_Metallic_mono_mp3 from '../testData/sounds/click/UI_Click_Metallic_mono.mp3';
3
- import __testData_sounds_jump_jump2_ogg from '../testData/sounds/jump/jump2.ogg';
4
- import __testData_sounds_jump_xhGkA9Px_mp3 from '../testData/sounds/jump/xhGkA9Px.mp3';
5
-
6
- export class SoundDefinition {
7
- constructor(
8
- readonly basename: string,
9
- readonly files: string[],
10
- readonly averageFileSize: number,
11
- ) {}
12
- }
13
-
14
-
15
- export function sound_click(): SoundDefinition[] {
16
- return [
17
- new SoundDefinition(
18
- 'UI_Click_Metallic_mono',
19
- [
20
- __testData_sounds_click_UI_Click_Metallic_mono_ogg,
21
- __testData_sounds_click_UI_Click_Metallic_mono_mp3,
22
- ],
23
- 2836,
24
- ),
25
- ];
26
- }
27
-
28
- export function sound_jump(): SoundDefinition[] {
29
- return [
30
- new SoundDefinition(
31
- 'jump2',
32
- [
33
- __testData_sounds_jump_jump2_ogg,
34
- ],
35
- 5631,
36
- ),
37
- new SoundDefinition(
38
- 'xhGkA9Px',
39
- [
40
- __testData_sounds_jump_xhGkA9Px_mp3,
41
- ],
42
- 2106,
43
- ),
44
- ];
45
- }