@mrdemonwolf/iconwolf 0.1.1

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.
Files changed (83) hide show
  1. package/LICENSE +21 -0
  2. package/dist/generator.d.ts +3 -0
  3. package/dist/generator.d.ts.map +1 -0
  4. package/dist/generator.js +122 -0
  5. package/dist/generator.js.map +1 -0
  6. package/dist/index.d.ts +3 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +48 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/lib.d.ts +10 -0
  11. package/dist/lib.d.ts.map +1 -0
  12. package/dist/lib.js +9 -0
  13. package/dist/lib.js.map +1 -0
  14. package/dist/types.d.ts +21 -0
  15. package/dist/types.d.ts.map +1 -0
  16. package/dist/types.js +2 -0
  17. package/dist/types.js.map +1 -0
  18. package/dist/utils/icon-composer.d.ts +14 -0
  19. package/dist/utils/icon-composer.d.ts.map +1 -0
  20. package/dist/utils/icon-composer.js +200 -0
  21. package/dist/utils/icon-composer.js.map +1 -0
  22. package/dist/utils/image.d.ts +22 -0
  23. package/dist/utils/image.d.ts.map +1 -0
  24. package/dist/utils/image.js +145 -0
  25. package/dist/utils/image.js.map +1 -0
  26. package/dist/utils/logger.d.ts +10 -0
  27. package/dist/utils/logger.d.ts.map +1 -0
  28. package/dist/utils/logger.js +38 -0
  29. package/dist/utils/logger.js.map +1 -0
  30. package/dist/utils/paths.d.ts +17 -0
  31. package/dist/utils/paths.d.ts.map +1 -0
  32. package/dist/utils/paths.js +27 -0
  33. package/dist/utils/paths.js.map +1 -0
  34. package/dist/utils/update-notifier.d.ts +9 -0
  35. package/dist/utils/update-notifier.d.ts.map +1 -0
  36. package/dist/utils/update-notifier.js +80 -0
  37. package/dist/utils/update-notifier.js.map +1 -0
  38. package/dist/variants/android.d.ts +5 -0
  39. package/dist/variants/android.d.ts.map +1 -0
  40. package/dist/variants/android.js +18 -0
  41. package/dist/variants/android.js.map +1 -0
  42. package/dist/variants/favicon.d.ts +3 -0
  43. package/dist/variants/favicon.d.ts.map +1 -0
  44. package/dist/variants/favicon.js +23 -0
  45. package/dist/variants/favicon.js.map +1 -0
  46. package/dist/variants/splash.d.ts +3 -0
  47. package/dist/variants/splash.d.ts.map +1 -0
  48. package/dist/variants/splash.js +7 -0
  49. package/dist/variants/splash.js.map +1 -0
  50. package/dist/variants/standard.d.ts +3 -0
  51. package/dist/variants/standard.d.ts.map +1 -0
  52. package/dist/variants/standard.js +7 -0
  53. package/dist/variants/standard.js.map +1 -0
  54. package/eslint.config.js +10 -0
  55. package/package.json +57 -0
  56. package/scripts/build-release.sh +63 -0
  57. package/src/generator.ts +163 -0
  58. package/src/index.ts +73 -0
  59. package/src/lib.ts +16 -0
  60. package/src/types.ts +22 -0
  61. package/src/utils/icon-composer.ts +283 -0
  62. package/src/utils/image.ts +207 -0
  63. package/src/utils/logger.ts +61 -0
  64. package/src/utils/paths.ts +30 -0
  65. package/src/utils/update-notifier.ts +99 -0
  66. package/src/variants/android.ts +45 -0
  67. package/src/variants/favicon.ts +32 -0
  68. package/src/variants/splash.ts +11 -0
  69. package/src/variants/standard.ts +11 -0
  70. package/tests/cli.test.ts +84 -0
  71. package/tests/generator.test.ts +368 -0
  72. package/tests/helpers.ts +36 -0
  73. package/tests/utils/icon-composer.test.ts +208 -0
  74. package/tests/utils/image.test.ts +207 -0
  75. package/tests/utils/logger.test.ts +128 -0
  76. package/tests/utils/paths.test.ts +51 -0
  77. package/tests/utils/update-notifier.test.ts +184 -0
  78. package/tests/variants/android.test.ts +77 -0
  79. package/tests/variants/favicon.test.ts +36 -0
  80. package/tests/variants/splash.test.ts +35 -0
  81. package/tests/variants/standard.test.ts +35 -0
  82. package/tsconfig.json +19 -0
  83. package/vitest.config.ts +8 -0
@@ -0,0 +1,35 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import sharp from 'sharp';
4
+ import { describe, it, expect, beforeAll, afterAll } from 'vitest';
5
+ import { generateSplashIcon } from '../../src/variants/splash.js';
6
+ import { createTestPng, createTmpDir, cleanDir } from '../helpers.js';
7
+
8
+ let tmpDir: string;
9
+ let outDir: string;
10
+ let testPng: string;
11
+
12
+ beforeAll(async () => {
13
+ tmpDir = createTmpDir();
14
+ outDir = path.join(tmpDir, 'output');
15
+ fs.mkdirSync(outDir);
16
+ testPng = await createTestPng(1024, 1024, tmpDir);
17
+ });
18
+
19
+ afterAll(() => {
20
+ cleanDir(tmpDir);
21
+ });
22
+
23
+ describe('generateSplashIcon', () => {
24
+ it('generates splash-icon.png at 1024x1024', async () => {
25
+ const result = await generateSplashIcon(testPng, outDir);
26
+
27
+ expect(result.width).toBe(1024);
28
+ expect(result.height).toBe(1024);
29
+ expect(result.filePath).toContain('splash-icon.png');
30
+ expect(fs.existsSync(result.filePath)).toBe(true);
31
+
32
+ const meta = await sharp(result.filePath).metadata();
33
+ expect(meta.format).toBe('png');
34
+ });
35
+ });
@@ -0,0 +1,35 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import sharp from 'sharp';
4
+ import { describe, it, expect, beforeAll, afterAll } from 'vitest';
5
+ import { generateStandardIcon } from '../../src/variants/standard.js';
6
+ import { createTestPng, createTmpDir, cleanDir } from '../helpers.js';
7
+
8
+ let tmpDir: string;
9
+ let outDir: string;
10
+ let testPng: string;
11
+
12
+ beforeAll(async () => {
13
+ tmpDir = createTmpDir();
14
+ outDir = path.join(tmpDir, 'output');
15
+ fs.mkdirSync(outDir);
16
+ testPng = await createTestPng(1024, 1024, tmpDir);
17
+ });
18
+
19
+ afterAll(() => {
20
+ cleanDir(tmpDir);
21
+ });
22
+
23
+ describe('generateStandardIcon', () => {
24
+ it('generates icon.png at 1024x1024', async () => {
25
+ const result = await generateStandardIcon(testPng, outDir);
26
+
27
+ expect(result.width).toBe(1024);
28
+ expect(result.height).toBe(1024);
29
+ expect(result.filePath).toContain('icon.png');
30
+ expect(fs.existsSync(result.filePath)).toBe(true);
31
+
32
+ const meta = await sharp(result.filePath).metadata();
33
+ expect(meta.format).toBe('png');
34
+ });
35
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "outDir": "./dist",
7
+ "rootDir": "./src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "resolveJsonModule": true,
13
+ "declaration": true,
14
+ "declarationMap": true,
15
+ "sourceMap": true
16
+ },
17
+ "include": ["src/**/*"],
18
+ "exclude": ["node_modules", "dist", "tests"]
19
+ }
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ testTimeout: 15000,
7
+ },
8
+ });