Skip to content

Commit 7c18bbb

Browse files
authored
Add flags to support automation in edge cases (#707)
* feat: ✨ add --allow-star-activation Closes: #700 * feat: ✨ add --allow-missing-repository Closes: #706
1 parent 8b22207 commit 7c18bbb

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/main.ts

+12
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ module.exports = function (argv: string[]): void {
103103
.option('--no-gitLabIssueLinking', 'Disable automatic expansion of GitLab-style issue syntax into links')
104104
.option('--no-dependencies', 'Disable dependency detection via npm or yarn')
105105
.option('--pre-release', 'Mark this package as a pre-release')
106+
.option('--allow-star-activation', 'Allow using * in activation events')
107+
.option('--allow-missing-repository', 'Allow missing a repository URL in package.json')
106108
.action(
107109
(
108110
version,
@@ -123,6 +125,8 @@ module.exports = function (argv: string[]): void {
123125
gitLabIssueLinking,
124126
dependencies,
125127
preRelease,
128+
allowStarActivation,
129+
allowMissingRepository,
126130
}
127131
) =>
128132
main(
@@ -144,6 +148,8 @@ module.exports = function (argv: string[]): void {
144148
gitLabIssueLinking,
145149
dependencies,
146150
preRelease,
151+
allowStarActivation,
152+
allowMissingRepository,
147153
})
148154
)
149155
);
@@ -180,6 +186,8 @@ module.exports = function (argv: string[]): void {
180186
.option('--ignoreFile <path>', 'Indicate alternative .vscodeignore')
181187
.option('--no-dependencies', 'Disable dependency detection via npm or yarn')
182188
.option('--pre-release', 'Mark this package as a pre-release')
189+
.option('--allow-star-activation', 'Allow using * in activation events')
190+
.option('--allow-missing-repository', 'Allow missing a repository URL in package.json')
183191
.action(
184192
(
185193
version,
@@ -199,6 +207,8 @@ module.exports = function (argv: string[]): void {
199207
ignoreFile,
200208
dependencies,
201209
preRelease,
210+
allowStarActivation,
211+
allowMissingRepository,
202212
}
203213
) =>
204214
main(
@@ -219,6 +229,8 @@ module.exports = function (argv: string[]): void {
219229
ignoreFile,
220230
dependencies,
221231
preRelease,
232+
allowStarActivation,
233+
allowMissingRepository,
222234
})
223235
)
224236
);

src/package.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ export interface IPackageOptions {
8686
readonly gitLabIssueLinking?: boolean;
8787
readonly dependencies?: boolean;
8888
readonly preRelease?: boolean;
89+
readonly allowStarActivation?: boolean;
90+
readonly allowMissingRepository?: boolean;
8991
}
9092

9193
export interface IProcessor {
@@ -490,15 +492,15 @@ export class ManifestProcessor extends BaseProcessor {
490492
);
491493
}
492494

493-
if (!this.manifest.repository) {
495+
if (!this.options.allowMissingRepository && !this.manifest.repository) {
494496
util.log.warn(`A 'repository' field is missing from the 'package.json' manifest file.`);
495497

496498
if (!/^y$/i.test(await util.read('Do you want to continue? [y/N] '))) {
497499
throw new Error('Aborted');
498500
}
499501
}
500502

501-
if (this.manifest.activationEvents?.some(e => e === '*')) {
503+
if (!this.options.allowStarActivation && this.manifest.activationEvents?.some(e => e === '*')) {
502504
util.log.warn(
503505
`Using '*' activation is usually a bad idea as it impacts performance.\nMore info: https://code.visualstudio.com/api/references/activation-events#Start-up`
504506
);

src/publish.ts

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ export interface IPublishOptions {
3131
readonly noVerify?: boolean;
3232
readonly dependencies?: boolean;
3333
readonly preRelease?: boolean;
34+
readonly allowStarActivation?: boolean;
35+
readonly allowMissingRepository?: boolean;
3436
}
3537

3638
export async function publish(options: IPublishOptions = {}): Promise<any> {

0 commit comments

Comments
 (0)