@artsy/cli
Advanced tools
Comparing version 0.12.0 to 0.13.0
@@ -0,1 +1,25 @@ | ||
# v0.13.0 (Sat Mar 06 2021) | ||
#### 🚀 Enhancement | ||
- chore: bump mocha timeout [#71](https://github.com/artsy/cli/pull/71) ([@dblandin](https://github.com/dblandin)) | ||
- feat: promote most recent blog posts in scheduled:recently-published command. [#71](https://github.com/artsy/cli/pull/71) ([@pepopowitz](https://github.com/pepopowitz) [@dblandin](https://github.com/dblandin)) | ||
#### ⚠️ Pushed to `master` | ||
- chore: temporarily downgrade engine requirement to v10 ([@dblandin](https://github.com/dblandin)) | ||
- Revert "chore: use auto/publish-canary" ([@dblandin](https://github.com/dblandin)) | ||
#### 🏠 Internal | ||
- chore: use auto/publish-canary [#73](https://github.com/artsy/cli/pull/73) ([@dblandin](https://github.com/dblandin)) | ||
- chore: configure node orb [#72](https://github.com/artsy/cli/pull/72) ([@dblandin](https://github.com/dblandin)) | ||
#### Authors: 2 | ||
- Devon Blandin ([@dblandin](https://github.com/dblandin)) | ||
- Steven Hicks ([@pepopowitz](https://github.com/pepopowitz)) | ||
--- | ||
# v0.12.0 (Mon Mar 01 2021) | ||
@@ -2,0 +26,0 @@ |
@@ -24,3 +24,5 @@ "use strict"; | ||
]; | ||
Acronym.flags = Object.assign({}, base_1.default.flags); | ||
Acronym.flags = { | ||
...base_1.default.flags, | ||
}; | ||
Acronym.args = [{ name: "acronym", required: true }]; |
@@ -17,2 +17,4 @@ "use strict"; | ||
]; | ||
Random.flags = Object.assign({}, base_1.default.flags); | ||
Random.flags = { | ||
...base_1.default.flags, | ||
}; |
@@ -22,7 +22,9 @@ "use strict"; | ||
]; | ||
Hello.flags = Object.assign(Object.assign({}, base_1.default.flags), { | ||
Hello.flags = { | ||
...base_1.default.flags, | ||
// flag with a value (-n, --name=VALUE) | ||
name: command_1.flags.string({ char: "n", description: "name to print" }), | ||
name: command_1.flags.string({ char: "n", description: "name to print" }), | ||
// flag with no value (-f, --force) | ||
force: command_1.flags.boolean({ char: "f" }) }); | ||
force: command_1.flags.boolean({ char: "f" }), | ||
}; | ||
Hello.args = [{ name: "file" }]; |
@@ -32,3 +32,5 @@ "use strict"; | ||
Identify.description = "Identify a Gravity resource by its BSON ID"; | ||
Identify.flags = Object.assign({}, base_1.default.flags); | ||
Identify.flags = { | ||
...base_1.default.flags, | ||
}; | ||
Identify.args = [{ name: "id" }]; | ||
@@ -35,0 +37,0 @@ Identify.collectionsToCheck = [ |
@@ -46,2 +46,4 @@ "use strict"; | ||
Login.description = "Log into the Artsy API. This is a prerequisite for many other commands."; | ||
Login.flags = Object.assign({}, base_1.default.flags); | ||
Login.flags = { | ||
...base_1.default.flags, | ||
}; |
@@ -28,2 +28,4 @@ "use strict"; | ||
Logout.description = "Expire your local auth token."; | ||
Logout.flags = Object.assign({}, command_1.Command.flags); | ||
Logout.flags = { | ||
...command_1.Command.flags, | ||
}; |
@@ -55,13 +55,18 @@ "use strict"; | ||
List.description = "List users via OpsGenie"; | ||
List.flags = Object.assign(Object.assign({}, base_1.default.flags), { randomize: command_1.flags.boolean({ | ||
List.flags = { | ||
...base_1.default.flags, | ||
randomize: command_1.flags.boolean({ | ||
char: "r", | ||
default: false, | ||
description: "Trigger randomization", | ||
}), split: command_1.flags.integer({ | ||
}), | ||
split: command_1.flags.integer({ | ||
char: "s", | ||
default: 1, | ||
description: "Split members into [N] groups", | ||
}), team: command_1.flags.string({ | ||
}), | ||
team: command_1.flags.string({ | ||
char: "t", | ||
description: "Name of team to limit results to", | ||
}) }); | ||
}), | ||
}; |
@@ -27,5 +27,9 @@ "use strict"; | ||
Next.description = "List is on call next"; | ||
Next.flags = Object.assign(Object.assign({}, base_1.default.flags), { date: command_1.flags.string({ description: "target date in ISO format" }), schedule: command_1.flags.string({ | ||
Next.flags = { | ||
...base_1.default.flags, | ||
date: command_1.flags.string({ description: "target date in ISO format" }), | ||
schedule: command_1.flags.string({ | ||
description: "schedule name", | ||
default: "Engineering On Call", | ||
}) }); | ||
}), | ||
}; |
@@ -27,5 +27,9 @@ "use strict"; | ||
Who.description = "List who is on call now"; | ||
Who.flags = Object.assign(Object.assign({}, base_1.default.flags), { date: command_1.flags.string({ description: "target date in ISO format" }), schedule: command_1.flags.string({ | ||
Who.flags = { | ||
...base_1.default.flags, | ||
date: command_1.flags.string({ description: "target date in ISO format" }), | ||
schedule: command_1.flags.string({ | ||
description: "schedule name", | ||
default: "Engineering On Call", | ||
}) }); | ||
}), | ||
}; |
@@ -36,2 +36,4 @@ "use strict"; | ||
NextOnCall.description = "Remind members with upcoming on-call shifts."; | ||
NextOnCall.flags = Object.assign({}, base_1.default.flags); | ||
NextOnCall.flags = { | ||
...base_1.default.flags, | ||
}; |
import { Command } from "@oclif/command"; | ||
import Parser = require("rss-parser"); | ||
export default class ScheduledRecentlyPublished extends Command { | ||
static description: string; | ||
run(): Promise<void>; | ||
buildBlogSummary(): Promise<({ | ||
type: string; | ||
elements: { | ||
type: string; | ||
text: string; | ||
}[]; | ||
text?: undefined; | ||
} | { | ||
type: string; | ||
text?: undefined; | ||
elements?: undefined; | ||
} | { | ||
type: string; | ||
text: { | ||
type: string; | ||
text: string; | ||
}; | ||
})[]>; | ||
buildBlogArticleBlocks(post: Parser.Item): ({ | ||
type: string; | ||
text: { | ||
type: string; | ||
text: string; | ||
}; | ||
elements?: undefined; | ||
} | { | ||
type: string; | ||
elements: { | ||
type: string; | ||
text: string; | ||
}[]; | ||
text?: undefined; | ||
} | { | ||
type: string; | ||
text?: undefined; | ||
elements?: undefined; | ||
})[]; | ||
buildPodcastSummary(): Promise<({ | ||
@@ -6,0 +44,0 @@ type: string; |
@@ -7,9 +7,59 @@ "use strict"; | ||
async run() { | ||
const blog = await this.buildBlogSummary(); | ||
const podcast = await this.buildPodcastSummary(); | ||
const callToAction = this.buildCallToAction(); | ||
const response = { | ||
blocks: [...podcast, ...callToAction], | ||
blocks: [...blog, ...podcast, ...callToAction], | ||
}; | ||
this.log(JSON.stringify(response)); | ||
} | ||
async buildBlogSummary() { | ||
const BLOG_FEED_URL = "https://artsy.github.io/feed.xml"; | ||
const parser = new Parser(); | ||
const feed = await parser.parseURL(BLOG_FEED_URL); | ||
const mostRecentPost = feed.items[0]; | ||
const { pubDate } = mostRecentPost; | ||
const daysAgo = computeDaysAgo(pubDate); | ||
const threeMostRecentPosts = feed.items.slice(0, 3); | ||
const threeMostRecentPostBlocks = threeMostRecentPosts | ||
.map(this.buildBlogArticleBlocks) | ||
.flat(); | ||
const blocks = [ | ||
{ | ||
type: "section", | ||
text: { | ||
type: "mrkdwn", | ||
text: `*${daysAgo} days ago* we published our most recent article on the *Artsy Engineering Blog*. Here are our most recent posts -- read and share them!`, | ||
}, | ||
}, | ||
...threeMostRecentPostBlocks, | ||
]; | ||
return blocks; | ||
} | ||
buildBlogArticleBlocks(post) { | ||
const { link, pubDate, title } = post; | ||
const formattedDate = formatDate(pubDate); | ||
const blocks = [ | ||
{ | ||
type: "section", | ||
text: { | ||
type: "mrkdwn", | ||
text: `<${link}|${title}>`, | ||
}, | ||
}, | ||
{ | ||
type: "context", | ||
elements: [ | ||
{ | ||
type: "mrkdwn", | ||
text: formattedDate, | ||
}, | ||
], | ||
}, | ||
{ | ||
type: "divider", | ||
}, | ||
]; | ||
return blocks; | ||
} | ||
async buildPodcastSummary() { | ||
@@ -21,7 +71,3 @@ const PODCAST_FEED_URL = "https://artsy.github.io/podcast.xml"; | ||
const { title, content, pubDate, itunes: { author }, } = lastEpisode; | ||
const formattedDate = new Date(pubDate).toLocaleDateString("en-US", { | ||
year: "numeric", | ||
month: "short", | ||
day: "numeric", | ||
}); | ||
const formattedDate = formatDate(pubDate); | ||
const blocks = [ | ||
@@ -87,1 +133,21 @@ { | ||
ScheduledRecentlyPublished.description = "Describe our most recently published articles and podcast episodes"; | ||
function computeDaysAgo(dateString) { | ||
if (dateString === undefined) { | ||
return "??"; | ||
} | ||
const parsed = Date.parse(dateString); | ||
const now = Date.now(); | ||
const diff = now - parsed; | ||
const diffInDays = diff / (1000 * 3600 * 24); | ||
return Math.floor(diffInDays); | ||
} | ||
function formatDate(dateString) { | ||
if (dateString === undefined) { | ||
return "??"; | ||
} | ||
return new Date(dateString).toLocaleDateString("en-US", { | ||
year: "numeric", | ||
month: "short", | ||
day: "numeric", | ||
}); | ||
} |
@@ -90,3 +90,5 @@ "use strict"; | ||
RFCs.description = "lists open RFCs"; | ||
RFCs.flags = Object.assign({}, base_1.default.flags); | ||
RFCs.flags = { | ||
...base_1.default.flags, | ||
}; | ||
RFCs.SearchURL = "https://github.com/search?q=org:Artsy+label:RFC+state:open"; |
@@ -38,2 +38,4 @@ "use strict"; | ||
StandupReminder.description = "Remind facilitators and participants of upcoming standup."; | ||
StandupReminder.flags = Object.assign({}, base_1.default.flags); | ||
StandupReminder.flags = { | ||
...base_1.default.flags, | ||
}; |
@@ -29,3 +29,6 @@ "use strict"; | ||
timezone_code: {}, | ||
}, Object.assign({ printLine: this.log }, flags)); | ||
}, { | ||
printLine: this.log, | ||
...flags, | ||
}); | ||
} | ||
@@ -35,2 +38,5 @@ } | ||
WhoAmI.description = "Who are you?"; | ||
WhoAmI.flags = Object.assign(Object.assign({}, command_1.Command.flags), cli_ux_1.default.table.flags()); | ||
WhoAmI.flags = { | ||
...command_1.Command.flags, | ||
...cli_ux_1.default.table.flags(), | ||
}; |
@@ -11,3 +11,8 @@ "use strict"; | ||
const gravityUrl = Gravity.urls.access_token; | ||
const body = Object.assign({ client_id: process.env.CLIENT_ID, client_secret: process.env.CLIENT_SECRET, grant_type: "credentials" }, credentials); | ||
const body = { | ||
client_id: process.env.CLIENT_ID, | ||
client_secret: process.env.CLIENT_SECRET, | ||
grant_type: "credentials", | ||
...credentials, | ||
}; | ||
const response = await node_fetch_1.default(gravityUrl, { | ||
@@ -14,0 +19,0 @@ method: "post", |
@@ -1,1 +0,1 @@ | ||
{"version":"0.12.0","commands":{"hello":{"id":"hello","description":"describe the command here","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"examples":["$ artsy hello\nhello world from ./src/hello.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"name":{"name":"name","type":"option","char":"n","description":"name to print"},"force":{"name":"force","type":"boolean","char":"f","allowNo":false}},"args":[{"name":"file"}]},"identify":{"id":"identify","description":"Identify a Gravity resource by its BSON ID","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"id"}]},"login":{"id":"login","description":"Log into the Artsy API. This is a prerequisite for many other commands.","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"logout":{"id":"logout","description":"Expire your local auth token.","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"whoami":{"id":"whoami","description":"Who are you?","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"columns":{"name":"columns","type":"option","description":"only show provided columns (comma-separated)"},"sort":{"name":"sort","type":"option","description":"property to sort by (prepend '-' for descending)"},"filter":{"name":"filter","type":"option","description":"filter property by partial string matching, ex: name=foo"},"csv":{"name":"csv","type":"boolean","description":"output is csv format [alias: --output=csv]","allowNo":false},"output":{"name":"output","type":"option","description":"output in a more machine friendly format","options":["csv","json","yaml"]},"extended":{"name":"extended","type":"boolean","char":"x","description":"show extra columns","allowNo":false},"no-truncate":{"name":"no-truncate","type":"boolean","description":"do not truncate output to fit screen","allowNo":false},"no-header":{"name":"no-header","type":"boolean","description":"hide table header from output","allowNo":false}},"args":[]},"acronym":{"id":"acronym","description":"Explain an acronym heard at Artsy","pluginName":"@artsy/cli","pluginType":"core","aliases":["tla","wtf"],"examples":["$ artsy acronym aov\nAOV: Average Order Value"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"acronym","required":true}]},"acronym:random":{"id":"acronym:random","description":"Return a random acronym heard at Artsy","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"examples":["$ artsy acronym:random\nTAT: Turn around time"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"on-call:list":{"id":"on-call:list","description":"List users via OpsGenie","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"randomize":{"name":"randomize","type":"boolean","char":"r","description":"Trigger randomization","allowNo":false},"split":{"name":"split","type":"option","char":"s","description":"Split members into [N] groups","default":1},"team":{"name":"team","type":"option","char":"t","description":"Name of team to limit results to"}},"args":[]},"on-call:next":{"id":"on-call:next","description":"List is on call next","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"date":{"name":"date","type":"option","description":"target date in ISO format"},"schedule":{"name":"schedule","type":"option","description":"schedule name","default":"Engineering On Call"}},"args":[]},"on-call:who":{"id":"on-call:who","description":"List who is on call now","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"date":{"name":"date","type":"option","description":"target date in ISO format"},"schedule":{"name":"schedule","type":"option","description":"schedule name","default":"Engineering On Call"}},"args":[]},"scheduled:next-on-call":{"id":"scheduled:next-on-call","description":"Remind members with upcoming on-call shifts.","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"scheduled:recently-published":{"id":"scheduled:recently-published","description":"Describe our most recently published articles and podcast episodes","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"scheduled:rfcs":{"id":"scheduled:rfcs","description":"lists open RFCs","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"scheduled:standup-reminder":{"id":"scheduled:standup-reminder","description":"Remind facilitators and participants of upcoming standup.","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]}}} | ||
{"version":"0.13.0","commands":{"hello":{"id":"hello","description":"describe the command here","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"examples":["$ artsy hello\nhello world from ./src/hello.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"name":{"name":"name","type":"option","char":"n","description":"name to print"},"force":{"name":"force","type":"boolean","char":"f","allowNo":false}},"args":[{"name":"file"}]},"identify":{"id":"identify","description":"Identify a Gravity resource by its BSON ID","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"id"}]},"login":{"id":"login","description":"Log into the Artsy API. This is a prerequisite for many other commands.","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"logout":{"id":"logout","description":"Expire your local auth token.","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"whoami":{"id":"whoami","description":"Who are you?","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"columns":{"name":"columns","type":"option","description":"only show provided columns (comma-separated)"},"sort":{"name":"sort","type":"option","description":"property to sort by (prepend '-' for descending)"},"filter":{"name":"filter","type":"option","description":"filter property by partial string matching, ex: name=foo"},"csv":{"name":"csv","type":"boolean","description":"output is csv format [alias: --output=csv]","allowNo":false},"output":{"name":"output","type":"option","description":"output in a more machine friendly format","options":["csv","json","yaml"]},"extended":{"name":"extended","type":"boolean","char":"x","description":"show extra columns","allowNo":false},"no-truncate":{"name":"no-truncate","type":"boolean","description":"do not truncate output to fit screen","allowNo":false},"no-header":{"name":"no-header","type":"boolean","description":"hide table header from output","allowNo":false}},"args":[]},"acronym":{"id":"acronym","description":"Explain an acronym heard at Artsy","pluginName":"@artsy/cli","pluginType":"core","aliases":["tla","wtf"],"examples":["$ artsy acronym aov\nAOV: Average Order Value"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"acronym","required":true}]},"acronym:random":{"id":"acronym:random","description":"Return a random acronym heard at Artsy","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"examples":["$ artsy acronym:random\nTAT: Turn around time"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"on-call:list":{"id":"on-call:list","description":"List users via OpsGenie","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"randomize":{"name":"randomize","type":"boolean","char":"r","description":"Trigger randomization","allowNo":false},"split":{"name":"split","type":"option","char":"s","description":"Split members into [N] groups","default":1},"team":{"name":"team","type":"option","char":"t","description":"Name of team to limit results to"}},"args":[]},"on-call:next":{"id":"on-call:next","description":"List is on call next","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"date":{"name":"date","type":"option","description":"target date in ISO format"},"schedule":{"name":"schedule","type":"option","description":"schedule name","default":"Engineering On Call"}},"args":[]},"on-call:who":{"id":"on-call:who","description":"List who is on call now","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"date":{"name":"date","type":"option","description":"target date in ISO format"},"schedule":{"name":"schedule","type":"option","description":"schedule name","default":"Engineering On Call"}},"args":[]},"scheduled:next-on-call":{"id":"scheduled:next-on-call","description":"Remind members with upcoming on-call shifts.","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"scheduled:recently-published":{"id":"scheduled:recently-published","description":"Describe our most recently published articles and podcast episodes","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"scheduled:rfcs":{"id":"scheduled:rfcs","description":"lists open RFCs","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"scheduled:standup-reminder":{"id":"scheduled:standup-reminder","description":"Remind facilitators and participants of upcoming standup.","pluginName":"@artsy/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]}}} |
{ | ||
"name": "@artsy/cli", | ||
"description": "The artsy command line tool", | ||
"version": "0.12.0", | ||
"version": "0.13.0", | ||
"author": "Jon Allured @jonallured", | ||
@@ -61,3 +61,3 @@ "bin": { | ||
"engines": { | ||
"node": ">=8.0.0" | ||
"node": ">=10.0.0" | ||
}, | ||
@@ -64,0 +64,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1838035
30571