@mschauer5/spfx-toolkit 1.0.27 → 1.0.28
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/.vscode/settings.json +22 -22
- package/LICENSE +21 -21
- package/README.md +72 -72
- package/lib/common/util.js +2 -1
- package/lib/common/util.js.map +1 -1
- package/package.json +3 -2
- package/src/commands/env.commands.ts +63 -63
- package/src/commands/index.ts +12 -12
- package/src/commands/installer.command.ts +134 -134
- package/src/commands/nvmrc.command.ts +76 -76
- package/src/commands/projects.command.ts +37 -37
- package/src/commands/repo.command.ts +206 -206
- package/src/commands/scripts.command.ts +139 -139
- package/src/common/index.ts +5 -5
- package/src/common/util.ts +114 -113
- package/src/index.ts +261 -261
- package/lib/commands/install.command.js +0 -28
- package/lib/commands/install.command.js.map +0 -1
- package/lib/commands/open-solution.command.js +0 -30
- package/lib/commands/open-solution.command.js.map +0 -1
- package/lib/commands/serve.command.js +0 -27
- package/lib/commands/serve.command.js.map +0 -1
- package/lib/commands/settings.js +0 -68
- package/lib/commands/settings.js.map +0 -1
- package/lib/package.json +0 -45
- package/lib/src/commands/alias.command.js +0 -104
- package/lib/src/commands/alias.command.js.map +0 -1
- package/lib/src/commands/build.command.js +0 -61
- package/lib/src/commands/build.command.js.map +0 -1
- package/lib/src/commands/bundle.command.js +0 -70
- package/lib/src/commands/bundle.command.js.map +0 -1
- package/lib/src/commands/eslint.command.js +0 -34
- package/lib/src/commands/eslint.command.js.map +0 -1
- package/lib/src/commands/index.js +0 -49
- package/lib/src/commands/index.js.map +0 -1
- package/lib/src/commands/serve.command.js +0 -27
- package/lib/src/commands/serve.command.js.map +0 -1
- package/lib/src/commands/version.command.js +0 -98
- package/lib/src/commands/version.command.js.map +0 -1
- package/lib/src/common/constants.js +0 -10
- package/lib/src/common/constants.js.map +0 -1
- package/lib/src/common/index.js +0 -43
- package/lib/src/common/index.js.map +0 -1
- package/lib/src/common/logger.js +0 -42
- package/lib/src/common/logger.js.map +0 -1
- package/lib/src/common/util.js +0 -80
- package/lib/src/common/util.js.map +0 -1
- package/lib/src/index.js +0 -146
- package/lib/src/index.js.map +0 -1
- package/lib/test/index.test.js +0 -17
- package/lib/test/index.test.js.map +0 -1
- package/mschauer5-spfx-toolkit-1.0.25.tgz +0 -0
package/src/index.ts
CHANGED
|
@@ -1,261 +1,261 @@
|
|
|
1
|
-
#! /usr/bin/env node
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import * as commander from 'commander';
|
|
4
|
-
import { Command } from 'commander';
|
|
5
|
-
import * as commands from './commands';
|
|
6
|
-
import { logger, util } from './common';
|
|
7
|
-
const program = new Command();
|
|
8
|
-
|
|
9
|
-
const defaultToolkitName = 'spfx-toolkit';
|
|
10
|
-
|
|
11
|
-
program
|
|
12
|
-
.name('Matt Schauer SPFx Toolkit')
|
|
13
|
-
.description('CLI to help with SPFx development')
|
|
14
|
-
.addHelpText('beforeAll', chalk.blueBright('Developed by Matt Schauer'))
|
|
15
|
-
.version('1.0.27');
|
|
16
|
-
|
|
17
|
-
program
|
|
18
|
-
.command('add-alias')
|
|
19
|
-
.description('add alias')
|
|
20
|
-
.addArgument(new commander.Argument('<name>', 'alias name to use for this program'))
|
|
21
|
-
.action((name) => {
|
|
22
|
-
commands.alias.addAlias(name, defaultToolkitName);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
program
|
|
26
|
-
.command('add-project')
|
|
27
|
-
.description('add project shortcut')
|
|
28
|
-
.addArgument(new commander.Argument('[name]', 'give the project a name or default to folder name'))
|
|
29
|
-
.action((name) => {
|
|
30
|
-
commands.projects.addProject(name);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
program
|
|
34
|
-
.command('open-project')
|
|
35
|
-
.alias('op')
|
|
36
|
-
.description('open project')
|
|
37
|
-
.addArgument(new commander.Argument('[name]', 'project name to open'))
|
|
38
|
-
.action((name) => {
|
|
39
|
-
if (!name) {
|
|
40
|
-
logger.error('Project name is required.');
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
commands.projects.openProject(name);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
program
|
|
47
|
-
.command('clear-alias')
|
|
48
|
-
.description('remove any alias for spfx-toolkit')
|
|
49
|
-
.action(() => {
|
|
50
|
-
commands.alias.clearAlias(defaultToolkitName);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
program
|
|
54
|
-
.command('set-repo')
|
|
55
|
-
.description('Set current folder as the default repo location')
|
|
56
|
-
.action(() => {
|
|
57
|
-
commands.repo.SetRepo();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
program
|
|
61
|
-
.command('repo [args...]')
|
|
62
|
-
.description('Go to repository location')
|
|
63
|
-
.action((args) => {
|
|
64
|
-
commands.repo.goToRepo(Array.isArray(args) ? args : []);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
program
|
|
68
|
-
.command('serve')
|
|
69
|
-
.alias('s')
|
|
70
|
-
.description('Serve / Start the SPFx Project')
|
|
71
|
-
.action(() => {
|
|
72
|
-
commands.scripts.run('serve');
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
program
|
|
76
|
-
.command('build')
|
|
77
|
-
.alias('bl')
|
|
78
|
-
.description('Build Project')
|
|
79
|
-
.action(() => {
|
|
80
|
-
commands.scripts.run('build');
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
program
|
|
84
|
-
.command('bundle')
|
|
85
|
-
.alias('bn')
|
|
86
|
-
.description('Bundle Project')
|
|
87
|
-
.option('-i, --increment <part>', 'Increment package version (major, minor, patch)', (value: string) => {
|
|
88
|
-
if (!['major', 'minor', 'patch'].includes(value)) {
|
|
89
|
-
throw new Error(`Invalid increment part: ${value}. Must be one of major, minor, or patch.`);
|
|
90
|
-
}
|
|
91
|
-
return value; // Return the validated value
|
|
92
|
-
})
|
|
93
|
-
.action((options) => {
|
|
94
|
-
commands.scripts.run('bundle', options.increment);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
program
|
|
98
|
-
.command('run')
|
|
99
|
-
.alias('r')
|
|
100
|
-
.description('Run a script from package.json by name')
|
|
101
|
-
.addArgument(new commander.Argument('<name>', 'script name to run from package.json'))
|
|
102
|
-
.action((name) => {
|
|
103
|
-
commands.scripts.run(name);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
program
|
|
107
|
-
.command('install')
|
|
108
|
-
.alias('i')
|
|
109
|
-
.description('Run an install')
|
|
110
|
-
.addArgument(new commander.Argument('[packages]', 'script name in global config or local OR package(s) to install'))
|
|
111
|
-
.action((packages) => {
|
|
112
|
-
commands.installer.install(packages, false);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
program
|
|
116
|
-
.command('install-packages')
|
|
117
|
-
.alias('ips')
|
|
118
|
-
.description('Run an installer package from global package.json by name')
|
|
119
|
-
.addArgument(new commander.Argument('<name>', 'package name in global config to install'))
|
|
120
|
-
.action((name) => {
|
|
121
|
-
commands.installer.install(name, true);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
program
|
|
125
|
-
.command('add-nvmrc')
|
|
126
|
-
.description('Add .nvmrc file with current specified Node version')
|
|
127
|
-
.action(() => {
|
|
128
|
-
commands.nvmrc.addNvmrc();
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
program
|
|
132
|
-
.command('use-nvmrc')
|
|
133
|
-
.description('Use Node version specified in .nvmrc file')
|
|
134
|
-
.action(() => {
|
|
135
|
-
commands.nvmrc.useNvmrc();
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
program
|
|
139
|
-
.command('uninstall')
|
|
140
|
-
.alias('un')
|
|
141
|
-
.description('Run an uninstall')
|
|
142
|
-
.addArgument(new commander.Argument('<packages>', 'script name in global config or local OR package(s) to uninstall'))
|
|
143
|
-
.action((packages) => {
|
|
144
|
-
commands.installer.uninstall(packages, false);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
program
|
|
148
|
-
.command('uninstall-script')
|
|
149
|
-
.alias('uns')
|
|
150
|
-
.description('Run an uninstall script from package.json by name')
|
|
151
|
-
.addArgument(new commander.Argument('<name>', 'script name in global config or local to uninstall'))
|
|
152
|
-
|
|
153
|
-
.action((name) => {
|
|
154
|
-
commands.installer.uninstall(name, true);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
program
|
|
158
|
-
.command('open-global-config')
|
|
159
|
-
.alias('ogc')
|
|
160
|
-
.description('Open global package.json for spfx-toolkit')
|
|
161
|
-
.action(() => {
|
|
162
|
-
util.openGlobalPackageJsonInEditor();
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
program
|
|
166
|
-
.command('global-config-init')
|
|
167
|
-
.alias('ogci')
|
|
168
|
-
.description('Set default scripts in global package.json for spfx-toolkit')
|
|
169
|
-
.option('-f, --force', 'If set will overwrite existing scripts names in global package.json')
|
|
170
|
-
.action((options) => {
|
|
171
|
-
util.initGlobalPackageJsonWithDefaults(options.force);
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
program
|
|
175
|
-
.command('sync-script')
|
|
176
|
-
.description('Sync a script name from global or local package.json')
|
|
177
|
-
.addArgument(new commander.Argument('<name>', 'script name in package.json'))
|
|
178
|
-
.addArgument(new commander.Argument('<to>', 'global | local'))
|
|
179
|
-
.action((name, to) => {
|
|
180
|
-
if (to !== 'global' && to !== 'local') {
|
|
181
|
-
logger.error("Source must be either 'global' or 'local'.");
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
commands.scripts.sync(name, to);
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
program
|
|
188
|
-
.command('open-solution')
|
|
189
|
-
.alias('os')
|
|
190
|
-
.description('Open solution folder')
|
|
191
|
-
.action(() => {
|
|
192
|
-
commands.open.solution();
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
program
|
|
196
|
-
.command('open-directory')
|
|
197
|
-
.alias('od')
|
|
198
|
-
.description('Open directory folder')
|
|
199
|
-
.action(() => {
|
|
200
|
-
commands.open.directory();
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
program
|
|
204
|
-
.command('open-vs')
|
|
205
|
-
.alias('vs')
|
|
206
|
-
.description('Open current directory in VS Code')
|
|
207
|
-
.action(() => {
|
|
208
|
-
commands.open.vs();
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
program
|
|
212
|
-
.command('eslint')
|
|
213
|
-
.description('Backup and restore eslint file')
|
|
214
|
-
.option('-b, --backup', 'Backup the eslint file')
|
|
215
|
-
.option('-r, --restore', 'Restore from backup eslint file')
|
|
216
|
-
.action((options) => {
|
|
217
|
-
if (options.backup) {
|
|
218
|
-
commands.env.backupEslint();
|
|
219
|
-
} else if (options.restore) {
|
|
220
|
-
commands.env.restoreEslint();
|
|
221
|
-
} else {
|
|
222
|
-
logger.error('No action specified. Use --backup | -b <OR> --restore | -r');
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
program
|
|
227
|
-
.command('set-env')
|
|
228
|
-
.description('Set tenantDomain environment variables')
|
|
229
|
-
.addArgument(new commander.Argument('[tenantDomain]', 'Tenant domain to set'))
|
|
230
|
-
.option('-t, --tenant <tenantDomain>', 'Specify the tenant domain')
|
|
231
|
-
.action((tenantDomain, options) => {
|
|
232
|
-
// Prefer positional argument, fallback to option
|
|
233
|
-
const domain = tenantDomain || options.tenant;
|
|
234
|
-
|
|
235
|
-
commands.envCommands.setEnv(domain);
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
program
|
|
239
|
-
.command('version')
|
|
240
|
-
.option('-l, --list', 'List SPFx project versions')
|
|
241
|
-
.option('-s, --sync', 'Sync package.json version with package-solution.json version')
|
|
242
|
-
.option('-i, --increment <part>', 'Increment package version (major, minor, patch)', (value: string) => {
|
|
243
|
-
if (!['major', 'minor', 'patch'].includes(value)) {
|
|
244
|
-
throw new Error(`Invalid increment part: ${value}. Must be one of major, minor, or patch.`);
|
|
245
|
-
}
|
|
246
|
-
return value; // Return the validated value
|
|
247
|
-
})
|
|
248
|
-
.action((options) => {
|
|
249
|
-
const { list, sync } = options;
|
|
250
|
-
if (list) {
|
|
251
|
-
commands.version.listVersions();
|
|
252
|
-
} else if (sync) {
|
|
253
|
-
commands.version.syncVersion();
|
|
254
|
-
} else if (options.increment) {
|
|
255
|
-
commands.version.incrementVersion(options.increment);
|
|
256
|
-
} else {
|
|
257
|
-
logger.error('No action specified. Use --list | -l OR --sync | -s OR --increment | -i');
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
program.parse();
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import * as commander from 'commander';
|
|
4
|
+
import { Command } from 'commander';
|
|
5
|
+
import * as commands from './commands';
|
|
6
|
+
import { logger, util } from './common';
|
|
7
|
+
const program = new Command();
|
|
8
|
+
|
|
9
|
+
const defaultToolkitName = 'spfx-toolkit';
|
|
10
|
+
|
|
11
|
+
program
|
|
12
|
+
.name('Matt Schauer SPFx Toolkit')
|
|
13
|
+
.description('CLI to help with SPFx development')
|
|
14
|
+
.addHelpText('beforeAll', chalk.blueBright('Developed by Matt Schauer'))
|
|
15
|
+
.version('1.0.27');
|
|
16
|
+
|
|
17
|
+
program
|
|
18
|
+
.command('add-alias')
|
|
19
|
+
.description('add alias')
|
|
20
|
+
.addArgument(new commander.Argument('<name>', 'alias name to use for this program'))
|
|
21
|
+
.action((name) => {
|
|
22
|
+
commands.alias.addAlias(name, defaultToolkitName);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
program
|
|
26
|
+
.command('add-project')
|
|
27
|
+
.description('add project shortcut')
|
|
28
|
+
.addArgument(new commander.Argument('[name]', 'give the project a name or default to folder name'))
|
|
29
|
+
.action((name) => {
|
|
30
|
+
commands.projects.addProject(name);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
program
|
|
34
|
+
.command('open-project')
|
|
35
|
+
.alias('op')
|
|
36
|
+
.description('open project')
|
|
37
|
+
.addArgument(new commander.Argument('[name]', 'project name to open'))
|
|
38
|
+
.action((name) => {
|
|
39
|
+
if (!name) {
|
|
40
|
+
logger.error('Project name is required.');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
commands.projects.openProject(name);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
program
|
|
47
|
+
.command('clear-alias')
|
|
48
|
+
.description('remove any alias for spfx-toolkit')
|
|
49
|
+
.action(() => {
|
|
50
|
+
commands.alias.clearAlias(defaultToolkitName);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
program
|
|
54
|
+
.command('set-repo')
|
|
55
|
+
.description('Set current folder as the default repo location')
|
|
56
|
+
.action(() => {
|
|
57
|
+
commands.repo.SetRepo();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
program
|
|
61
|
+
.command('repo [args...]')
|
|
62
|
+
.description('Go to repository location')
|
|
63
|
+
.action((args) => {
|
|
64
|
+
commands.repo.goToRepo(Array.isArray(args) ? args : []);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
program
|
|
68
|
+
.command('serve')
|
|
69
|
+
.alias('s')
|
|
70
|
+
.description('Serve / Start the SPFx Project')
|
|
71
|
+
.action(() => {
|
|
72
|
+
commands.scripts.run('serve');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
program
|
|
76
|
+
.command('build')
|
|
77
|
+
.alias('bl')
|
|
78
|
+
.description('Build Project')
|
|
79
|
+
.action(() => {
|
|
80
|
+
commands.scripts.run('build');
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
program
|
|
84
|
+
.command('bundle')
|
|
85
|
+
.alias('bn')
|
|
86
|
+
.description('Bundle Project')
|
|
87
|
+
.option('-i, --increment <part>', 'Increment package version (major, minor, patch)', (value: string) => {
|
|
88
|
+
if (!['major', 'minor', 'patch'].includes(value)) {
|
|
89
|
+
throw new Error(`Invalid increment part: ${value}. Must be one of major, minor, or patch.`);
|
|
90
|
+
}
|
|
91
|
+
return value; // Return the validated value
|
|
92
|
+
})
|
|
93
|
+
.action((options) => {
|
|
94
|
+
commands.scripts.run('bundle', options.increment);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
program
|
|
98
|
+
.command('run')
|
|
99
|
+
.alias('r')
|
|
100
|
+
.description('Run a script from package.json by name')
|
|
101
|
+
.addArgument(new commander.Argument('<name>', 'script name to run from package.json'))
|
|
102
|
+
.action((name) => {
|
|
103
|
+
commands.scripts.run(name);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
program
|
|
107
|
+
.command('install')
|
|
108
|
+
.alias('i')
|
|
109
|
+
.description('Run an install')
|
|
110
|
+
.addArgument(new commander.Argument('[packages]', 'script name in global config or local OR package(s) to install'))
|
|
111
|
+
.action((packages) => {
|
|
112
|
+
commands.installer.install(packages, false);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
program
|
|
116
|
+
.command('install-packages')
|
|
117
|
+
.alias('ips')
|
|
118
|
+
.description('Run an installer package from global package.json by name')
|
|
119
|
+
.addArgument(new commander.Argument('<name>', 'package name in global config to install'))
|
|
120
|
+
.action((name) => {
|
|
121
|
+
commands.installer.install(name, true);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
program
|
|
125
|
+
.command('add-nvmrc')
|
|
126
|
+
.description('Add .nvmrc file with current specified Node version')
|
|
127
|
+
.action(() => {
|
|
128
|
+
commands.nvmrc.addNvmrc();
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
program
|
|
132
|
+
.command('use-nvmrc')
|
|
133
|
+
.description('Use Node version specified in .nvmrc file')
|
|
134
|
+
.action(() => {
|
|
135
|
+
commands.nvmrc.useNvmrc();
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
program
|
|
139
|
+
.command('uninstall')
|
|
140
|
+
.alias('un')
|
|
141
|
+
.description('Run an uninstall')
|
|
142
|
+
.addArgument(new commander.Argument('<packages>', 'script name in global config or local OR package(s) to uninstall'))
|
|
143
|
+
.action((packages) => {
|
|
144
|
+
commands.installer.uninstall(packages, false);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
program
|
|
148
|
+
.command('uninstall-script')
|
|
149
|
+
.alias('uns')
|
|
150
|
+
.description('Run an uninstall script from package.json by name')
|
|
151
|
+
.addArgument(new commander.Argument('<name>', 'script name in global config or local to uninstall'))
|
|
152
|
+
|
|
153
|
+
.action((name) => {
|
|
154
|
+
commands.installer.uninstall(name, true);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
program
|
|
158
|
+
.command('open-global-config')
|
|
159
|
+
.alias('ogc')
|
|
160
|
+
.description('Open global package.json for spfx-toolkit')
|
|
161
|
+
.action(() => {
|
|
162
|
+
util.openGlobalPackageJsonInEditor();
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
program
|
|
166
|
+
.command('global-config-init')
|
|
167
|
+
.alias('ogci')
|
|
168
|
+
.description('Set default scripts in global package.json for spfx-toolkit')
|
|
169
|
+
.option('-f, --force', 'If set will overwrite existing scripts names in global package.json')
|
|
170
|
+
.action((options) => {
|
|
171
|
+
util.initGlobalPackageJsonWithDefaults(options.force);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
program
|
|
175
|
+
.command('sync-script')
|
|
176
|
+
.description('Sync a script name from global or local package.json')
|
|
177
|
+
.addArgument(new commander.Argument('<name>', 'script name in package.json'))
|
|
178
|
+
.addArgument(new commander.Argument('<to>', 'global | local'))
|
|
179
|
+
.action((name, to) => {
|
|
180
|
+
if (to !== 'global' && to !== 'local') {
|
|
181
|
+
logger.error("Source must be either 'global' or 'local'.");
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
commands.scripts.sync(name, to);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
program
|
|
188
|
+
.command('open-solution')
|
|
189
|
+
.alias('os')
|
|
190
|
+
.description('Open solution folder')
|
|
191
|
+
.action(() => {
|
|
192
|
+
commands.open.solution();
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
program
|
|
196
|
+
.command('open-directory')
|
|
197
|
+
.alias('od')
|
|
198
|
+
.description('Open directory folder')
|
|
199
|
+
.action(() => {
|
|
200
|
+
commands.open.directory();
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
program
|
|
204
|
+
.command('open-vs')
|
|
205
|
+
.alias('vs')
|
|
206
|
+
.description('Open current directory in VS Code')
|
|
207
|
+
.action(() => {
|
|
208
|
+
commands.open.vs();
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
program
|
|
212
|
+
.command('eslint')
|
|
213
|
+
.description('Backup and restore eslint file')
|
|
214
|
+
.option('-b, --backup', 'Backup the eslint file')
|
|
215
|
+
.option('-r, --restore', 'Restore from backup eslint file')
|
|
216
|
+
.action((options) => {
|
|
217
|
+
if (options.backup) {
|
|
218
|
+
commands.env.backupEslint();
|
|
219
|
+
} else if (options.restore) {
|
|
220
|
+
commands.env.restoreEslint();
|
|
221
|
+
} else {
|
|
222
|
+
logger.error('No action specified. Use --backup | -b <OR> --restore | -r');
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
program
|
|
227
|
+
.command('set-env')
|
|
228
|
+
.description('Set tenantDomain environment variables')
|
|
229
|
+
.addArgument(new commander.Argument('[tenantDomain]', 'Tenant domain to set'))
|
|
230
|
+
.option('-t, --tenant <tenantDomain>', 'Specify the tenant domain')
|
|
231
|
+
.action((tenantDomain, options) => {
|
|
232
|
+
// Prefer positional argument, fallback to option
|
|
233
|
+
const domain = tenantDomain || options.tenant;
|
|
234
|
+
|
|
235
|
+
commands.envCommands.setEnv(domain);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
program
|
|
239
|
+
.command('version')
|
|
240
|
+
.option('-l, --list', 'List SPFx project versions')
|
|
241
|
+
.option('-s, --sync', 'Sync package.json version with package-solution.json version')
|
|
242
|
+
.option('-i, --increment <part>', 'Increment package version (major, minor, patch)', (value: string) => {
|
|
243
|
+
if (!['major', 'minor', 'patch'].includes(value)) {
|
|
244
|
+
throw new Error(`Invalid increment part: ${value}. Must be one of major, minor, or patch.`);
|
|
245
|
+
}
|
|
246
|
+
return value; // Return the validated value
|
|
247
|
+
})
|
|
248
|
+
.action((options) => {
|
|
249
|
+
const { list, sync } = options;
|
|
250
|
+
if (list) {
|
|
251
|
+
commands.version.listVersions();
|
|
252
|
+
} else if (sync) {
|
|
253
|
+
commands.version.syncVersion();
|
|
254
|
+
} else if (options.increment) {
|
|
255
|
+
commands.version.incrementVersion(options.increment);
|
|
256
|
+
} else {
|
|
257
|
+
logger.error('No action specified. Use --list | -l OR --sync | -s OR --increment | -i');
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
program.parse();
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.run = void 0;
|
|
13
|
-
const detect_package_manager_1 = require("detect-package-manager");
|
|
14
|
-
const scripts_command_1 = require("./scripts.command");
|
|
15
|
-
const run = (name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
const usercommand = yield (0, detect_package_manager_1.detect)();
|
|
17
|
-
const getScriptByNameValue = yield (0, scripts_command_1.getScriptByName)(`install:${name}`);
|
|
18
|
-
if (getScriptByNameValue !== undefined) {
|
|
19
|
-
const args = getScriptByNameValue.split(' ');
|
|
20
|
-
// add install to the command
|
|
21
|
-
args.unshift('install');
|
|
22
|
-
const spawn = require('cross-spawn');
|
|
23
|
-
spawn.sync(usercommand, args, { stdio: 'inherit' });
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
exports.run = run;
|
|
28
|
-
//# sourceMappingURL=install.command.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"install.command.js","sourceRoot":"","sources":["../../src/commands/install.command.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAAgD;AAChD,uDAAoD;AAE7C,MAAM,GAAG,GAAG,CAAO,IAAY,EAAE,EAAE;IACxC,MAAM,WAAW,GAAG,MAAM,IAAA,+BAAM,GAAE,CAAC;IAEnC,MAAM,oBAAoB,GAAG,MAAM,IAAA,iCAAe,EAAC,WAAW,IAAI,EAAE,CAAC,CAAC;IACtE,IAAI,oBAAoB,KAAK,SAAS,EAAE,CAAC;QACvC,MAAM,IAAI,GAAG,oBAAoB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7C,6BAA6B;QAC7B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAExB,MAAM,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;QACrC,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QACpD,OAAO;IACT,CAAC;AACH,CAAC,CAAA,CAAC;AAbW,QAAA,GAAG,OAad"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.openSolution = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const child_process_1 = __importDefault(require("child_process"));
|
|
9
|
-
const common_1 = require("../common");
|
|
10
|
-
const openSolution = () => {
|
|
11
|
-
let solutionPath = path_1.default.resolve(common_1.constants.WORKING_DIRECTORY, 'sharepoint', 'solution');
|
|
12
|
-
var cmd = ``;
|
|
13
|
-
switch (require(`os`).platform().toLowerCase().replace(/[0-9]/g, ``).replace(`darwin`, `macos`)) {
|
|
14
|
-
case `win`:
|
|
15
|
-
solutionPath = solutionPath || '=';
|
|
16
|
-
cmd = `explorer`;
|
|
17
|
-
break;
|
|
18
|
-
case `linux`:
|
|
19
|
-
solutionPath = solutionPath || '/';
|
|
20
|
-
cmd = `xdg-open`;
|
|
21
|
-
break;
|
|
22
|
-
case `macos`:
|
|
23
|
-
solutionPath = solutionPath || '/';
|
|
24
|
-
cmd = `open`;
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
child_process_1.default.spawn(cmd, [solutionPath]);
|
|
28
|
-
};
|
|
29
|
-
exports.openSolution = openSolution;
|
|
30
|
-
//# sourceMappingURL=open-solution.command.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"open-solution.command.js","sourceRoot":"","sources":["../../src/commands/open-solution.command.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,kEAAuC;AACvC,sCAAsC;AAE/B,MAAM,YAAY,GAAG,GAAG,EAAE;IAC/B,IAAI,YAAY,GAAG,cAAI,CAAC,OAAO,CAAC,kBAAS,CAAC,iBAAiB,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;IAEvF,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,QAAQ,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC;QAChG,KAAK,KAAK;YACR,YAAY,GAAG,YAAY,IAAI,GAAG,CAAC;YACnC,GAAG,GAAG,UAAU,CAAC;YACjB,MAAM;QACR,KAAK,OAAO;YACV,YAAY,GAAG,YAAY,IAAI,GAAG,CAAC;YACnC,GAAG,GAAG,UAAU,CAAC;YACjB,MAAM;QACR,KAAK,OAAO;YACV,YAAY,GAAG,YAAY,IAAI,GAAG,CAAC;YACnC,GAAG,GAAG,MAAM,CAAC;YACb,MAAM;IACV,CAAC;IAED,uBAAU,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;AACxC,CAAC,CAAC;AApBW,QAAA,YAAY,gBAoBvB"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.run = void 0;
|
|
13
|
-
const common_1 = require("../common");
|
|
14
|
-
const run = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
-
common_1.logger.info('Starting the SPFx development server...');
|
|
16
|
-
common_1.util.isUsingGulp().then((usingGulp) => {
|
|
17
|
-
if (usingGulp) {
|
|
18
|
-
common_1.logger.info('Gulp detected. Running gulp serve...');
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
common_1.logger.error('Gulp not detected. Please ensure you have gulp installed and configured.');
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
// Implementation of the serve command goes here
|
|
25
|
-
});
|
|
26
|
-
exports.run = run;
|
|
27
|
-
//# sourceMappingURL=serve.command.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serve.command.js","sourceRoot":"","sources":["../../src/commands/serve.command.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAyC;AAElC,MAAM,GAAG,GAAG,GAAwB,EAAE;IAC3C,eAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;IACvD,aAAI,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;QACpC,IAAI,SAAS,EAAE,CAAC;YACd,eAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QACtD,CAAC;aAAM,CAAC;YACN,eAAM,CAAC,KAAK,CAAC,0EAA0E,CAAC,CAAC;QAC3F,CAAC;IACH,CAAC,CAAC,CAAC;IACH,gDAAgD;AAClD,CAAC,CAAA,CAAC;AAVW,QAAA,GAAG,OAUd"}
|