@sfdc-webapps/cli 1.0.2 → 1.0.4
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/README.md +8 -8
- package/dist/commands/apply-patches.d.ts +2 -2
- package/dist/commands/apply-patches.d.ts.map +1 -1
- package/dist/commands/apply-patches.js +99 -19
- package/dist/commands/apply-patches.js.map +1 -1
- package/dist/commands/new-app-feature.d.ts.map +1 -1
- package/dist/commands/new-app-feature.js +5 -12
- package/dist/commands/new-app-feature.js.map +1 -1
- package/dist/commands/watch-patches.d.ts +1 -3
- package/dist/commands/watch-patches.d.ts.map +1 -1
- package/dist/commands/watch-patches.js +9 -47
- package/dist/commands/watch-patches.js.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/src/commands/apply-patches.ts +109 -21
- package/src/commands/new-app-feature.ts +5 -12
- package/src/commands/watch-patches.ts +9 -52
- package/src/index.ts +7 -7
- package/test/e2e/watch-patches.spec.ts +49 -59
- package/test/helpers/cli-runner.ts +5 -9
- package/test/unit/index.spec.ts +11 -14
- package/vitest.config.ts +10 -0
package/test/unit/index.spec.ts
CHANGED
|
@@ -40,7 +40,7 @@ describe('CLI index', () => {
|
|
|
40
40
|
.argument('<app-path>', 'Path to the app')
|
|
41
41
|
.argument('<target-dir>', 'Target directory')
|
|
42
42
|
.option('--skip-dependency-changes', 'Skip installing dependencies')
|
|
43
|
-
.option('--
|
|
43
|
+
.option('--reset', 'Reset target directory to base app state before applying patches (preserves node_modules)');
|
|
44
44
|
|
|
45
45
|
const applyPatchesCmd = program.commands.find(cmd => cmd.name() === 'apply-patches');
|
|
46
46
|
expect(applyPatchesCmd).toBeDefined();
|
|
@@ -59,8 +59,7 @@ describe('CLI index', () => {
|
|
|
59
59
|
.description('Watch feature template directory and auto-apply patches on changes')
|
|
60
60
|
.argument('<feature-path>', 'Path to the feature')
|
|
61
61
|
.argument('<app-path>', 'Path to the app')
|
|
62
|
-
.argument('<target-dir>', 'Target directory')
|
|
63
|
-
.option('--clean', 'Remove target directory if it exists');
|
|
62
|
+
.argument('<target-dir>', 'Target directory');
|
|
64
63
|
|
|
65
64
|
const watchPatchesCmd = program.commands.find(cmd => cmd.name() === 'watch-patches');
|
|
66
65
|
expect(watchPatchesCmd).toBeDefined();
|
|
@@ -76,13 +75,13 @@ describe('CLI index', () => {
|
|
|
76
75
|
.argument('<app-path>', 'Path to the app')
|
|
77
76
|
.argument('<target-dir>', 'Target directory')
|
|
78
77
|
.option('--skip-dependency-changes', 'Skip installing dependencies')
|
|
79
|
-
.option('--
|
|
78
|
+
.option('--reset', 'Reset target directory to base app state before applying patches (preserves node_modules)')
|
|
80
79
|
.action((featurePath, appPath, targetDir, options) => {
|
|
81
80
|
expect(featurePath).toBe('packages/feature-test');
|
|
82
81
|
expect(appPath).toBe('packages/base-app');
|
|
83
82
|
expect(targetDir).toBe('my-app');
|
|
84
83
|
expect(options.skipDependencyChanges).toBe(true);
|
|
85
|
-
expect(options.
|
|
84
|
+
expect(options.reset).toBeUndefined(); // Not provided, so undefined
|
|
86
85
|
});
|
|
87
86
|
|
|
88
87
|
program.parse(['node', 'cli', 'apply-patches', 'packages/feature-test', 'packages/base-app', 'my-app', '--skip-dependency-changes']);
|
|
@@ -96,15 +95,13 @@ describe('CLI index', () => {
|
|
|
96
95
|
.argument('<feature-path>', 'Path to the feature')
|
|
97
96
|
.argument('<app-path>', 'Path to the app')
|
|
98
97
|
.argument('<target-dir>', 'Target directory')
|
|
99
|
-
.
|
|
100
|
-
.action((featurePath, appPath, targetDir, options) => {
|
|
98
|
+
.action((featurePath, appPath, targetDir) => {
|
|
101
99
|
expect(featurePath).toBe('packages/feature-test');
|
|
102
100
|
expect(appPath).toBe('packages/base-app');
|
|
103
101
|
expect(targetDir).toBe('watch-target');
|
|
104
|
-
expect(options.clean).toBe(true);
|
|
105
102
|
});
|
|
106
103
|
|
|
107
|
-
program.parse(['node', 'cli', 'watch-patches', 'packages/feature-test', 'packages/base-app', 'watch-target'
|
|
104
|
+
program.parse(['node', 'cli', 'watch-patches', 'packages/feature-test', 'packages/base-app', 'watch-target']);
|
|
108
105
|
});
|
|
109
106
|
|
|
110
107
|
it('should handle missing required arguments', () => {
|
|
@@ -131,13 +128,13 @@ describe('CLI index', () => {
|
|
|
131
128
|
.argument('<app-path>', 'Path to the app')
|
|
132
129
|
.argument('<target-dir>', 'Target directory')
|
|
133
130
|
.option('--skip-dependency-changes', 'Skip installing dependencies from package.json')
|
|
134
|
-
.option('--
|
|
131
|
+
.option('--reset', 'Reset target directory to base app state before applying patches (preserves node_modules)');
|
|
135
132
|
|
|
136
133
|
const cmd = program.commands[0];
|
|
137
134
|
const options = cmd.options;
|
|
138
135
|
|
|
139
136
|
expect(options.find(opt => opt.long === '--skip-dependency-changes')).toBeDefined();
|
|
140
|
-
expect(options.find(opt => opt.long === '--
|
|
137
|
+
expect(options.find(opt => opt.long === '--reset')).toBeDefined();
|
|
141
138
|
});
|
|
142
139
|
|
|
143
140
|
it('should have correct option flags for watch-patches', () => {
|
|
@@ -147,12 +144,12 @@ describe('CLI index', () => {
|
|
|
147
144
|
.command('watch-patches')
|
|
148
145
|
.argument('<feature-path>', 'Path to the feature')
|
|
149
146
|
.argument('<app-path>', 'Path to the app')
|
|
150
|
-
.argument('<target-dir>', 'Target directory')
|
|
151
|
-
.option('--clean', 'Remove target directory if it exists before applying patches');
|
|
147
|
+
.argument('<target-dir>', 'Target directory');
|
|
152
148
|
|
|
153
149
|
const cmd = program.commands[0];
|
|
154
150
|
const options = cmd.options;
|
|
155
151
|
|
|
156
|
-
|
|
152
|
+
// watch-patches has no options - it always resets
|
|
153
|
+
expect(options.length).toBe(0);
|
|
157
154
|
});
|
|
158
155
|
});
|
package/vitest.config.ts
CHANGED
|
@@ -9,6 +9,16 @@ export default defineConfig({
|
|
|
9
9
|
exclude: ['**/node_modules/**', '**/dist/**', '**/gold/**'],
|
|
10
10
|
setupFiles: ['./test/setup.ts'],
|
|
11
11
|
testTimeout: 30000, // E2E tests may take longer
|
|
12
|
+
coverage: {
|
|
13
|
+
provider: 'v8',
|
|
14
|
+
exclude: [
|
|
15
|
+
'**/node_modules/**',
|
|
16
|
+
'**/dist/**',
|
|
17
|
+
'**/*.config.ts',
|
|
18
|
+
'**/*.config.js',
|
|
19
|
+
'src/index.ts',
|
|
20
|
+
],
|
|
21
|
+
},
|
|
12
22
|
},
|
|
13
23
|
resolve: {
|
|
14
24
|
alias: {
|