@shohojdhara/atomix 0.4.7 → 0.4.9
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/atomix.config.ts +58 -1
- package/dist/atomix.css +172 -157
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +4 -4
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.d.ts +33 -0
- package/dist/charts.js +1274 -164
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +33 -10
- package/dist/core.js +1099 -83
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +33 -0
- package/dist/forms.js +2106 -1050
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +42 -1
- package/dist/heavy.js +1663 -638
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +442 -270
- package/dist/index.esm.js +1947 -680
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1982 -712
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +6 -3
- package/scripts/atomix-cli.js +136 -1827
- package/scripts/cli/__tests__/basic.test.js +3 -2
- package/scripts/cli/__tests__/clean.test.js +278 -0
- package/scripts/cli/__tests__/component-validator.test.js +433 -0
- package/scripts/cli/__tests__/generator.test.js +613 -0
- package/scripts/cli/__tests__/glass-motion.test.js +256 -0
- package/scripts/cli/__tests__/integration.test.js +719 -108
- package/scripts/cli/__tests__/migrate.test.js +74 -0
- package/scripts/cli/__tests__/security.test.js +206 -0
- package/scripts/cli/__tests__/test-setup.js +3 -1
- package/scripts/cli/__tests__/theme-bridge.test.js +507 -0
- package/scripts/cli/__tests__/token-provider.test.js +361 -0
- package/scripts/cli/__tests__/utils.test.js +5 -5
- package/scripts/cli/commands/benchmark.js +105 -0
- package/scripts/cli/commands/build-theme.js +115 -0
- package/scripts/cli/commands/clean.js +109 -0
- package/scripts/cli/commands/doctor.js +88 -0
- package/scripts/cli/commands/generate.js +218 -0
- package/scripts/cli/commands/init.js +73 -0
- package/scripts/cli/commands/migrate.js +106 -0
- package/scripts/cli/commands/sync-tokens.js +206 -0
- package/scripts/cli/commands/theme-bridge.js +248 -0
- package/scripts/cli/commands/tokens.js +157 -0
- package/scripts/cli/commands/validate.js +194 -0
- package/scripts/cli/internal/ai-engine.js +156 -0
- package/scripts/cli/internal/compiler.js +114 -0
- package/scripts/cli/internal/component-validator.js +443 -0
- package/scripts/cli/internal/config-loader.js +162 -0
- package/scripts/cli/internal/filesystem.js +158 -0
- package/scripts/cli/internal/generator.js +430 -0
- package/scripts/cli/internal/glass-generator.js +398 -0
- package/scripts/cli/internal/hook-generator.js +369 -0
- package/scripts/cli/internal/hooks.js +61 -0
- package/scripts/cli/internal/itcss-generator.js +565 -0
- package/scripts/cli/internal/motion-generator.js +679 -0
- package/scripts/cli/internal/template-engine.js +301 -0
- package/scripts/cli/internal/theme-bridge.js +664 -0
- package/scripts/cli/internal/tokens/engine.js +122 -0
- package/scripts/cli/internal/tokens/provider.js +34 -0
- package/scripts/cli/internal/tokens/providers/figma.js +50 -0
- package/scripts/cli/internal/tokens/providers/style-dictionary.js +48 -0
- package/scripts/cli/internal/tokens/providers/w3c.js +48 -0
- package/scripts/cli/internal/tokens/token-provider.js +443 -0
- package/scripts/cli/internal/tokens/token-validator.js +513 -0
- package/scripts/cli/internal/validator.js +276 -0
- package/scripts/cli/internal/wizard.js +115 -0
- package/scripts/cli/mappings.js +23 -0
- package/scripts/cli/migration-tools.js +164 -94
- package/scripts/cli/plugins/style-dictionary.js +46 -0
- package/scripts/cli/templates/README.md +525 -95
- package/scripts/cli/templates/common-templates.js +40 -14
- package/scripts/cli/templates/components/react-component.ts +282 -0
- package/scripts/cli/templates/config/project-config.ts +112 -0
- package/scripts/cli/templates/hooks/use-component.ts +477 -0
- package/scripts/cli/templates/index.js +19 -4
- package/scripts/cli/templates/index.ts +171 -0
- package/scripts/cli/templates/next-templates.js +72 -0
- package/scripts/cli/templates/react-templates.js +70 -126
- package/scripts/cli/templates/scss-templates.js +35 -35
- package/scripts/cli/templates/stories/storybook-story.ts +241 -0
- package/scripts/cli/templates/styles/scss-component.ts +255 -0
- package/scripts/cli/templates/tests/vitest-test.ts +229 -0
- package/scripts/cli/templates/token-templates.js +337 -1
- package/scripts/cli/templates/tokens/token-generators.ts +1088 -0
- package/scripts/cli/templates/types/component-types.ts +145 -0
- package/scripts/cli/templates/utils/testing-utils.ts +144 -0
- package/scripts/cli/templates/vanilla-templates.js +39 -0
- package/scripts/cli/token-manager.js +8 -2
- package/scripts/cli/utils/cache-manager.js +240 -0
- package/scripts/cli/utils/detector.js +46 -0
- package/scripts/cli/utils/diagnostics.js +289 -0
- package/scripts/cli/utils/error.js +89 -0
- package/scripts/cli/utils/helpers.js +67 -0
- package/scripts/cli/utils/logger.js +75 -0
- package/scripts/cli/utils/security.js +302 -0
- package/scripts/cli/utils/telemetry.js +115 -0
- package/scripts/cli/utils/validation.js +37 -0
- package/scripts/cli/utils.js +28 -341
- package/src/components/Accordion/Accordion.stories.tsx +0 -18
- package/src/components/Accordion/Accordion.test.tsx +0 -17
- package/src/components/Accordion/Accordion.tsx +0 -4
- package/src/components/AtomixGlass/AtomixGlass.test.tsx +37 -3
- package/src/components/AtomixGlass/AtomixGlass.tsx +143 -31
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +129 -31
- package/src/components/AtomixGlass/PerformanceDashboard.tsx +219 -0
- package/src/components/AtomixGlass/README.md +25 -10
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +216 -0
- package/src/components/AtomixGlass/animation-system.ts +578 -0
- package/src/components/AtomixGlass/shader-utils.ts +4 -1
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +157 -6
- package/src/components/AtomixGlass/stories/Phase1-Animation.stories.tsx +653 -0
- package/src/components/AtomixGlass/stories/Phase1-Test.stories.tsx +95 -0
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +51 -51
- package/src/components/AtomixGlass/stories/shared-components.tsx +6 -0
- package/src/components/Avatar/Avatar.tsx +1 -1
- package/src/components/Button/Button.stories.disabled-link.tsx +10 -0
- package/src/components/Button/Button.stories.tsx +10 -0
- package/src/components/Button/Button.test.tsx +16 -11
- package/src/components/Button/Button.tsx +4 -4
- package/src/components/Card/Card.tsx +1 -1
- package/src/components/Dropdown/Dropdown.tsx +12 -12
- package/src/components/Form/Select.tsx +62 -3
- package/src/components/Modal/Modal.tsx +14 -3
- package/src/components/Navigation/Navbar/Navbar.tsx +44 -0
- package/src/components/Slider/Slider.stories.tsx +3 -3
- package/src/components/Slider/Slider.tsx +38 -0
- package/src/components/Steps/Steps.tsx +3 -3
- package/src/components/Tabs/Tabs.tsx +77 -8
- package/src/components/Testimonial/Testimonial.tsx +1 -1
- package/src/components/TypedButton/TypedButton.stories.tsx +59 -0
- package/src/components/TypedButton/TypedButton.tsx +39 -0
- package/src/components/TypedButton/index.ts +2 -0
- package/src/components/VideoPlayer/VideoPlayer.tsx +11 -4
- package/src/lib/composables/index.ts +4 -7
- package/src/lib/composables/types.ts +45 -0
- package/src/lib/composables/useAccordion.ts +0 -7
- package/src/lib/composables/useAtomixGlass.ts +148 -6
- package/src/lib/composables/useAtomixGlassStyles.ts +9 -7
- package/src/lib/composables/useChartExport.ts +3 -13
- package/src/lib/composables/useDropdown.ts +66 -0
- package/src/lib/composables/useFocusTrap.ts +80 -0
- package/src/lib/composables/usePerformanceMonitor.ts +448 -0
- package/src/lib/composables/useResponsiveGlass.presets.ts +192 -0
- package/src/lib/composables/useResponsiveGlass.ts +441 -0
- package/src/lib/composables/useTooltip.ts +16 -0
- package/src/lib/composables/useTypedButton.ts +66 -0
- package/src/lib/config/index.ts +62 -5
- package/src/lib/constants/components.ts +62 -7
- package/src/lib/theme/devtools/__tests__/useHistory.test.tsx +150 -0
- package/src/lib/theme/tokens/centralized-tokens.ts +120 -0
- package/src/lib/theme/utils/__tests__/domUtils.test.ts +101 -0
- package/src/lib/types/components.ts +37 -11
- package/src/lib/types/glass.ts +35 -0
- package/src/lib/types/index.ts +1 -0
- package/src/lib/utils/displacement-generator.ts +1 -1
- package/src/styles/01-settings/_settings.testtypecheck.scss +53 -0
- package/src/styles/01-settings/_settings.typedbutton.scss +53 -0
- package/src/styles/06-components/_components.atomix-glass.scss +17 -21
- package/src/styles/06-components/_components.edge-panel.scss +1 -5
- package/src/styles/06-components/_components.modal.scss +1 -4
- package/src/styles/06-components/_components.navbar.scss +1 -1
- package/src/styles/06-components/_components.testbutton.scss +212 -0
- package/src/styles/06-components/_components.testtypecheck.scss +212 -0
- package/src/styles/06-components/_components.tooltip.scss +9 -5
- package/src/styles/06-components/_components.typedbutton.scss +212 -0
- package/src/styles/99-utilities/_index.scss +1 -0
- package/src/styles/99-utilities/_utilities.text.scss +1 -1
- package/src/styles/99-utilities/_utilities.touch-target.scss +36 -0
- package/scripts/cli/component-generator.js +0 -564
- package/scripts/cli/interactive-init.js +0 -357
- package/src/styles/06-components/old.chart.styles.scss +0 -2788
|
@@ -21,7 +21,8 @@ describe('CLI Core Utils', () => {
|
|
|
21
21
|
it('should reject paths outside project directory', () => {
|
|
22
22
|
const result = validatePath('../../etc/passwd', '/project');
|
|
23
23
|
expect(result.isValid).toBe(false);
|
|
24
|
-
expect(result.error).
|
|
24
|
+
expect(result.error).toBeTruthy();
|
|
25
|
+
expect(result.error).toMatch(/outside|traversal/);
|
|
25
26
|
});
|
|
26
27
|
|
|
27
28
|
it('should reject sensitive files', () => {
|
|
@@ -42,7 +43,7 @@ describe('CLI Core Utils', () => {
|
|
|
42
43
|
});
|
|
43
44
|
|
|
44
45
|
it('should reject invalid names', () => {
|
|
45
|
-
const invalidNames = ['
|
|
46
|
+
const invalidNames = ['123Button', '', '1', 'a'];
|
|
46
47
|
|
|
47
48
|
invalidNames.forEach(name => {
|
|
48
49
|
const result = validateComponentName(name);
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for Atomix CLI Clean Command
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
import { mkdtemp, writeFile, mkdir, rm } from 'fs/promises';
|
|
8
|
+
import { tmpdir } from 'os';
|
|
9
|
+
import { cacheManager } from '../utils/cache-manager.js';
|
|
10
|
+
|
|
11
|
+
describe('cacheManager', () => {
|
|
12
|
+
let testDir;
|
|
13
|
+
|
|
14
|
+
beforeEach(async () => {
|
|
15
|
+
// Create isolated temp directory for each test
|
|
16
|
+
testDir = await mkdtemp(join(tmpdir(), 'atomix-clean-test-'));
|
|
17
|
+
process.chdir(testDir);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
afterEach(async () => {
|
|
21
|
+
// Cleanup temp directory
|
|
22
|
+
await rm(testDir, { recursive: true, force: true });
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe('identifyTargets', () => {
|
|
26
|
+
it('should return empty array when no clean targets exist', async () => {
|
|
27
|
+
const targets = await cacheManager.identifyTargets();
|
|
28
|
+
expect(targets).toEqual([]);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should identify dist directory', async () => {
|
|
32
|
+
await mkdir(join(testDir, 'dist'), { recursive: true });
|
|
33
|
+
const targets = await cacheManager.identifyTargets();
|
|
34
|
+
|
|
35
|
+
expect(targets.some(t => t.relativePath === 'dist')).toBe(true);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('should identify .atomix directory', async () => {
|
|
39
|
+
await mkdir(join(testDir, '.atomix'), { recursive: true });
|
|
40
|
+
const targets = await cacheManager.identifyTargets();
|
|
41
|
+
|
|
42
|
+
expect(targets.some(t => t.relativePath === '.atomix')).toBe(true);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('should identify node_modules/.cache with --all flag', async () => {
|
|
46
|
+
await mkdir(join(testDir, 'node_modules', '.cache'), { recursive: true });
|
|
47
|
+
|
|
48
|
+
// Without --all flag, node_modules should not be included
|
|
49
|
+
const targetsDefault = await cacheManager.identifyTargets();
|
|
50
|
+
// Default targets don't include node_modules at all
|
|
51
|
+
expect(targetsDefault.some(t => t.relativePath === 'node_modules')).toBe(false);
|
|
52
|
+
|
|
53
|
+
// With --all flag, node_modules should be included
|
|
54
|
+
const targetsAll = await cacheManager.identifyTargets({ all: true });
|
|
55
|
+
expect(targetsAll.some(t => t.relativePath === 'node_modules')).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should only identify cache directories with --cache flag', async () => {
|
|
59
|
+
await mkdir(join(testDir, 'dist'), { recursive: true });
|
|
60
|
+
await mkdir(join(testDir, '.atomix'), { recursive: true });
|
|
61
|
+
await mkdir(join(testDir, 'node_modules', '.cache'), { recursive: true });
|
|
62
|
+
|
|
63
|
+
const targets = await cacheManager.identifyTargets({ cache: true });
|
|
64
|
+
|
|
65
|
+
// Should include .atomix and node_modules/.cache but not log files
|
|
66
|
+
expect(targets.some(t => t.relativePath === '.atomix')).toBe(true);
|
|
67
|
+
expect(targets.some(t => t.relativePath.includes('node_modules'))).toBe(true);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe('getPathType', () => {
|
|
72
|
+
it('should identify directory type', async () => {
|
|
73
|
+
await mkdir(join(testDir, 'test-dir'), { recursive: true });
|
|
74
|
+
const type = await cacheManager.getPathType(join(testDir, 'test-dir'));
|
|
75
|
+
expect(type).toBe('directory');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('should identify file type', async () => {
|
|
79
|
+
await writeFile(join(testDir, 'test.txt'), 'content');
|
|
80
|
+
const type = await cacheManager.getPathType(join(testDir, 'test.txt'));
|
|
81
|
+
expect(type).toBe('file');
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('should return unknown for non-existent path', async () => {
|
|
85
|
+
const type = await cacheManager.getPathType(join(testDir, 'nonexistent'));
|
|
86
|
+
expect(type).toBe('unknown');
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
describe('isProtected', () => {
|
|
91
|
+
it('should protect JavaScript files', () => {
|
|
92
|
+
expect(cacheManager.isProtected('file.js')).toBe(true);
|
|
93
|
+
expect(cacheManager.isProtected('file.jsx')).toBe(true);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('should protect TypeScript files', () => {
|
|
97
|
+
expect(cacheManager.isProtected('file.ts')).toBe(true);
|
|
98
|
+
expect(cacheManager.isProtected('file.tsx')).toBe(true);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('should protect style files', () => {
|
|
102
|
+
expect(cacheManager.isProtected('file.scss')).toBe(true);
|
|
103
|
+
expect(cacheManager.isProtected('file.css')).toBe(true);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('should allow deleting build artifacts', () => {
|
|
107
|
+
expect(cacheManager.isProtected('file.map')).toBe(false);
|
|
108
|
+
expect(cacheManager.isProtected('file.bundle')).toBe(false);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
describe('formatBytes', () => {
|
|
113
|
+
it('should format zero bytes', () => {
|
|
114
|
+
expect(cacheManager.formatBytes(0)).toBe('0 Bytes');
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('should format bytes to KB', () => {
|
|
118
|
+
expect(cacheManager.formatBytes(1024)).toBe('1 KB');
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('should format bytes to MB', () => {
|
|
122
|
+
expect(cacheManager.formatBytes(1048576)).toBe('1 MB');
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('should format large sizes', () => {
|
|
126
|
+
expect(cacheManager.formatBytes(1073741824)).toBe('1 GB');
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
describe('calculateSize', () => {
|
|
131
|
+
it('should calculate total size of files', async () => {
|
|
132
|
+
// Create test files
|
|
133
|
+
await mkdir(join(testDir, 'dist'), { recursive: true });
|
|
134
|
+
await writeFile(join(testDir, 'dist', 'file1.txt'), 'a'.repeat(100));
|
|
135
|
+
await writeFile(join(testDir, 'dist', 'file2.txt'), 'b'.repeat(200));
|
|
136
|
+
|
|
137
|
+
const targets = await cacheManager.identifyTargets();
|
|
138
|
+
const size = await cacheManager.calculateSize(targets);
|
|
139
|
+
|
|
140
|
+
expect(size).toBeGreaterThan(0);
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
describe('deletePath', () => {
|
|
145
|
+
it('should delete a directory in dry-run mode without actually deleting', async () => {
|
|
146
|
+
process.env.ATOMIX_DRY_RUN = 'true';
|
|
147
|
+
|
|
148
|
+
await mkdir(join(testDir, 'dist'), { recursive: true });
|
|
149
|
+
await writeFile(join(testDir, 'dist', 'test.txt'), 'content');
|
|
150
|
+
|
|
151
|
+
// Use base path as testDir since filesystem validates against cwd
|
|
152
|
+
const result = await cacheManager.deletePath(join(testDir, 'dist'), { skipValidation: true });
|
|
153
|
+
|
|
154
|
+
expect(result).toBe(true);
|
|
155
|
+
|
|
156
|
+
// Verify directory still exists
|
|
157
|
+
const exists = await cacheManager.getPathType(join(testDir, 'dist'));
|
|
158
|
+
expect(exists).toBe('directory');
|
|
159
|
+
|
|
160
|
+
delete process.env.ATOMIX_DRY_RUN;
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('should actually delete a directory when not in dry-run mode', async () => {
|
|
164
|
+
await mkdir(join(testDir, 'dist'), { recursive: true });
|
|
165
|
+
await writeFile(join(testDir, 'dist', 'test.txt'), 'content');
|
|
166
|
+
|
|
167
|
+
const result = await cacheManager.deletePath(join(testDir, 'dist'), { skipValidation: true });
|
|
168
|
+
|
|
169
|
+
expect(result).toBe(true);
|
|
170
|
+
|
|
171
|
+
// Verify directory is deleted
|
|
172
|
+
const exists = await cacheManager.getPathType(join(testDir, 'dist'));
|
|
173
|
+
expect(exists).toBe('unknown');
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it('should refuse to delete protected files', async () => {
|
|
177
|
+
await writeFile(join(testDir, 'source.js'), 'console.log("hi")');
|
|
178
|
+
|
|
179
|
+
await expect(
|
|
180
|
+
cacheManager.deletePath(join(testDir, 'source.js'), { skipValidation: true })
|
|
181
|
+
).rejects.toThrow('Cannot delete protected source file');
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
describe('displayDryRun', () => {
|
|
186
|
+
it('should show message when nothing to clean', () => {
|
|
187
|
+
// This is mainly a visual test, we just ensure it doesn't throw
|
|
188
|
+
expect(() => {
|
|
189
|
+
cacheManager.displayDryRun([]);
|
|
190
|
+
}).not.toThrow();
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it('should display list of files to be deleted', () => {
|
|
194
|
+
const targets = [
|
|
195
|
+
{ relativePath: 'dist', type: 'directory' },
|
|
196
|
+
{ relativePath: '.atomix', type: 'directory' }
|
|
197
|
+
];
|
|
198
|
+
|
|
199
|
+
expect(() => {
|
|
200
|
+
cacheManager.displayDryRun(targets);
|
|
201
|
+
}).not.toThrow();
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
describe('cleanAction', () => {
|
|
207
|
+
let testDir;
|
|
208
|
+
|
|
209
|
+
beforeEach(async () => {
|
|
210
|
+
testDir = await mkdtemp(join(tmpdir(), 'atomix-action-test-'));
|
|
211
|
+
process.chdir(testDir);
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
afterEach(async () => {
|
|
215
|
+
await rm(testDir, { recursive: true, force: true });
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
it('should handle empty state gracefully', async () => {
|
|
219
|
+
const { cleanAction } = await import('../commands/clean.js');
|
|
220
|
+
|
|
221
|
+
// Should not throw when nothing to clean
|
|
222
|
+
await expect(cleanAction({})).resolves.not.toThrow();
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('should respect dry-run mode', async () => {
|
|
226
|
+
const { cleanAction } = await import('../commands/clean.js');
|
|
227
|
+
|
|
228
|
+
// Create test directory
|
|
229
|
+
await mkdir(join(testDir, 'dist'), { recursive: true });
|
|
230
|
+
|
|
231
|
+
// Run in dry-run mode
|
|
232
|
+
process.env.ATOMIX_DRY_RUN = 'true';
|
|
233
|
+
await cleanAction({ dryRun: true });
|
|
234
|
+
|
|
235
|
+
// Verify dist still exists
|
|
236
|
+
const exists = await cacheManager.getPathType(join(testDir, 'dist'));
|
|
237
|
+
expect(exists).toBe('directory');
|
|
238
|
+
|
|
239
|
+
delete process.env.ATOMIX_DRY_RUN;
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
it('should clean created directories', async () => {
|
|
243
|
+
const { cleanAction } = await import('../commands/clean.js');
|
|
244
|
+
|
|
245
|
+
// Create test directories
|
|
246
|
+
await mkdir(join(testDir, 'dist'), { recursive: true });
|
|
247
|
+
await mkdir(join(testDir, '.atomix'), { recursive: true });
|
|
248
|
+
|
|
249
|
+
// Run clean
|
|
250
|
+
await cleanAction({});
|
|
251
|
+
|
|
252
|
+
// Verify directories are deleted
|
|
253
|
+
const distExists = await cacheManager.getPathType(join(testDir, 'dist'));
|
|
254
|
+
const atomixExists = await cacheManager.getPathType(join(testDir, '.atomix'));
|
|
255
|
+
|
|
256
|
+
expect(distExists).toBe('unknown');
|
|
257
|
+
expect(atomixExists).toBe('unknown');
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
it('should preserve source files', async () => {
|
|
261
|
+
const { cleanAction } = await import('../commands/clean.js');
|
|
262
|
+
|
|
263
|
+
// Create mix of source and build files
|
|
264
|
+
await mkdir(join(testDir, 'dist'), { recursive: true });
|
|
265
|
+
await writeFile(join(testDir, 'src.js'), 'console.log("source")');
|
|
266
|
+
|
|
267
|
+
// Run clean
|
|
268
|
+
await cleanAction({});
|
|
269
|
+
|
|
270
|
+
// Verify source file preserved
|
|
271
|
+
const srcExists = await cacheManager.getPathType(join(testDir, 'src.js'));
|
|
272
|
+
expect(srcExists).toBe('file');
|
|
273
|
+
|
|
274
|
+
// Verify build deleted
|
|
275
|
+
const distExists = await cacheManager.getPathType(join(testDir, 'dist'));
|
|
276
|
+
expect(distExists).toBe('unknown');
|
|
277
|
+
});
|
|
278
|
+
});
|