-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Print github-specific deprecation notice on GH.
- Loading branch information
Showing
8 changed files
with
30 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
const { deprecationNotice } = require('../deprecation'); | ||
const { addDeprecationNotice } = require('../deprecation'); | ||
const { builder, handler } = require('../../cml/repo/prepare'); | ||
|
||
exports.command = 'ci'; | ||
exports.description = 'Prepare Git repository for CML operations'; | ||
exports.handler = handler; | ||
exports.builder = deprecationNotice({ | ||
exports.builder = addDeprecationNotice({ | ||
builder, | ||
notice: '"cml ci" is deprecated, please use "cml repo prepare"' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
const { deprecationNotice } = require('../deprecation'); | ||
const { addDeprecationNotice } = require('../deprecation'); | ||
const { builder, handler } = require('../../cml/asset/publish'); | ||
|
||
exports.command = 'publish <asset>'; | ||
exports.description = false; | ||
exports.handler = handler; | ||
exports.builder = deprecationNotice({ | ||
exports.builder = addDeprecationNotice({ | ||
builder, | ||
notice: '"cml publish" is deprecated, please use "cml asset publish"' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
const { deprecationNotice } = require('../deprecation'); | ||
const { addDeprecationNotice } = require('../deprecation'); | ||
const { builder, handler } = require('../../cml/workflow/rerun'); | ||
|
||
exports.command = 'rerun-workflow'; | ||
exports.description = false; | ||
exports.handler = handler; | ||
exports.builder = deprecationNotice({ | ||
exports.builder = addDeprecationNotice({ | ||
builder, | ||
notice: '"cml rerun-workflow" is deprecated, please use "cml workflow rerun"' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
const { deprecationNotice } = require('../deprecation'); | ||
const { addDeprecationNotice } = require('../deprecation'); | ||
const { builder, handler } = require('../../cml/comment/create'); | ||
|
||
exports.command = 'send-comment <markdown file>'; | ||
exports.description = false; | ||
exports.handler = handler; | ||
exports.builder = deprecationNotice({ | ||
exports.builder = addDeprecationNotice({ | ||
builder, | ||
notice: '"cml send-comment" is deprecated, please use "cml comment create"' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
const { deprecationNotice } = require('../deprecation'); | ||
const { addDeprecationNotice } = require('../deprecation'); | ||
const { builder, handler } = require('../../cml/check/create'); | ||
|
||
exports.command = 'send-github-check <markdown file>'; | ||
exports.description = false; | ||
exports.handler = handler; | ||
exports.builder = deprecationNotice({ | ||
exports.builder = addDeprecationNotice({ | ||
builder, | ||
notice: '"cml send-github-check" is deprecated, please use "cml check create"' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
const winston = require('winston'); | ||
|
||
// deprecationNotice adds middleware to the yargs chain to display a deprecation notice. | ||
const deprecationNotice = (opts = {}) => { | ||
// addDeprecationNotice adds middleware to the yargs chain to display a deprecation notice. | ||
const addDeprecationNotice = (opts = {}) => { | ||
const { builder, notice } = opts; | ||
return (yargs) => builder(yargs).middleware([(argv) => winston.warn(notice)]); | ||
return (yargs) => | ||
builder(yargs).middleware([(opts) => deprecationNotice(opts, notice)]); | ||
}; | ||
|
||
exports.deprecationNotice = deprecationNotice; | ||
const deprecationNotice = (opts, notice) => { | ||
const { cml } = opts; | ||
if (cml.driver.warn) { | ||
cml.driver.warn(notice); | ||
} else { | ||
winston.warn(notice); | ||
} | ||
}; | ||
|
||
exports.addDeprecationNotice = addDeprecationNotice; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
082595c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test Comment
082595c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test Comment