Skip to content

Shared scripts: @lg-tools/slackbot #1819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 69 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
c47e502
lerna exec. extend build.tsconfig
TheSonOfThomp Jun 15, 2023
26fa036
updates internal tsconfig
TheSonOfThomp Jun 15, 2023
7c2ff27
updates paths
TheSonOfThomp Jun 15, 2023
49d185d
Create update-package-json.ts
TheSonOfThomp Jun 13, 2023
43c33c6
adds turbo
TheSonOfThomp Jun 14, 2023
bbde2ee
Create turbo.yml
TheSonOfThomp Jun 14, 2023
cc0a444
update ci
TheSonOfThomp Jun 14, 2023
7ab7dc8
updates CI
TheSonOfThomp Jun 15, 2023
b125914
Setup nx vs turbo benchmark job
TheSonOfThomp Jun 15, 2023
ddf17f7
Update benchmark.yml
TheSonOfThomp Jun 15, 2023
b49d37d
rename lint script
TheSonOfThomp Jun 15, 2023
39b0da0
rm yarn cache
TheSonOfThomp Jun 15, 2023
ab911cd
update build dependencies
TheSonOfThomp Jun 16, 2023
1e4b4c0
Adds baseline job
TheSonOfThomp Jun 16, 2023
b9b99fe
Updates configs & ci
TheSonOfThomp Jun 16, 2023
fac8bb8
removes nx.json
TheSonOfThomp Jun 20, 2023
4a954e8
lerna exec. extend build.tsconfig
TheSonOfThomp Jun 15, 2023
902d564
rm old tsconfigs
TheSonOfThomp Jun 15, 2023
a9061f1
fixes dependencies
TheSonOfThomp Jun 16, 2023
dd90259
rm readdir from rollup
TheSonOfThomp Jun 16, 2023
82c75fe
rollup 2.79
TheSonOfThomp Jun 16, 2023
aece2e4
mv rollup.js => mjs
TheSonOfThomp Jun 16, 2023
69f5c4a
fixes for rollup 2.79
TheSonOfThomp Jun 16, 2023
be5cb37
use global rollup
TheSonOfThomp Jun 16, 2023
bf43cbb
use old svgr in icon
TheSonOfThomp Jun 16, 2023
f038dd9
update rollup plugins
TheSonOfThomp Jun 16, 2023
6186a33
update svgr dependencies
TheSonOfThomp Jun 16, 2023
71c56ae
adds rollup-plugin-node-externals
TheSonOfThomp Jun 16, 2023
b42e269
mv rollup config
TheSonOfThomp Jun 16, 2023
4470a99
Updates rollup script
TheSonOfThomp Jun 16, 2023
da1cbad
legacy scripts
TheSonOfThomp Jun 16, 2023
306e536
Only parse icons if we have to
TheSonOfThomp Jun 16, 2023
38cb1ee
Update update-package-json.ts
TheSonOfThomp Jun 16, 2023
f57039c
mv rollup.js => mjs
TheSonOfThomp Jun 16, 2023
c954dad
fixes for rollup 2.79
TheSonOfThomp Jun 16, 2023
eebdc4e
adds rollup-plugin-node-externals
TheSonOfThomp Jun 16, 2023
358b40b
mv rollup config
TheSonOfThomp Jun 16, 2023
fd7c934
Only parse icons if we have to
TheSonOfThomp Jun 16, 2023
8b74e45
lint
TheSonOfThomp Jun 20, 2023
057dda5
temporarily restore root level babel config
TheSonOfThomp Jun 20, 2023
093b30a
Restores compat mode
TheSonOfThomp Jun 21, 2023
73a6276
breaks out icon specific config
TheSonOfThomp Jun 21, 2023
8dc5e78
Creates lg-tools/rollup
TheSonOfThomp Jun 21, 2023
5265e06
separate tools/babel tools/tsconfig
TheSonOfThomp Jun 21, 2023
2645d7f
moves dependencies
TheSonOfThomp Jun 21, 2023
3db8acd
mv config to one package
TheSonOfThomp Jun 22, 2023
7ad8308
lint
TheSonOfThomp Jun 22, 2023
93d1c9a
Update babel.config.js
TheSonOfThomp Jun 22, 2023
c1b87fc
restores svgr webpack (for SB)
TheSonOfThomp Jun 22, 2023
fb50150
upgrade to @rollup/plugin-terser
TheSonOfThomp Jun 23, 2023
4101e4f
silence peer dependency warnings
TheSonOfThomp Jun 23, 2023
c4048b5
Cleanup Prebuild script (#1818)
TheSonOfThomp Jun 26, 2023
519da8c
updates icon build config
TheSonOfThomp Jun 26, 2023
ab7098f
renames default config
TheSonOfThomp Jun 26, 2023
c9ebf80
lint
TheSonOfThomp Jun 26, 2023
97d54cb
mv svgrc.js
TheSonOfThomp Jun 26, 2023
54ca48b
Update package.json
TheSonOfThomp Jun 27, 2023
5ecf0e5
mv config
TheSonOfThomp Jun 27, 2023
81625d7
Adds color control to icon story
TheSonOfThomp Jun 27, 2023
6c302b4
fixes icon build
TheSonOfThomp Jun 27, 2023
c0fe308
rm explicit build tool
TheSonOfThomp Jun 27, 2023
7a7ae3b
fix missing imports
TheSonOfThomp Jun 27, 2023
8faf34b
lint
TheSonOfThomp Jun 28, 2023
0c5c489
mv slackbot
TheSonOfThomp Jun 27, 2023
af67797
lint
TheSonOfThomp Jun 27, 2023
eef5a4a
update config paths
TheSonOfThomp Jun 27, 2023
eb8fd97
Create poor-cheetahs-pretend.md
TheSonOfThomp Jun 28, 2023
16a459d
Merge branch 'integration-shared-config' into tools/slackbot
TheSonOfThomp Jun 28, 2023
bf97b01
Merge branch 'integration-shared-config' into tools/slackbot
TheSonOfThomp Jun 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/poor-cheetahs-pretend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lg-tools/slackbot': minor
---

First pre-release of LeafyGreen slackbot
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"prepublish:ts-downlevel": "rm -rf packages/*/dist/ts3.4 && echo packages/*/dist | NODE_NO_WARNINGS=1 xargs -I{} -n1 -P8 downlevel-dts {} {}/ts3.4",
"publish": "npm-run-all --serial publish:*",
"publish:packages": "yarn changeset publish --public",
"slackbot": "npx ts-node ./scripts/slackbot",
"slackbot": "slackbot",
"start": "storybook dev -p 9001 --no-version-updates",
"test": "lg-test",
"test:ssr": "lg-test --ssr",
Expand All @@ -46,9 +46,9 @@
"@leafygreen-ui/testing-lib": "*",
"@lg-tools/build": "^0.0.1",
"@lg-tools/lint": "^0.0.1",
"@lg-tools/slackbot": "^0.0.1",
"@lg-tools/storybook": "^0.0.1",
"@lg-tools/storybook-decorators": "^0.0.1",
"@slack/web-api": "^6.4.0",
"@tanstack/react-table": "^8.7.3",
"@types/facepaint": "^1.2.1",
"@types/highlight.js": "^10.1.0",
Expand Down
2 changes: 2 additions & 0 deletions tools/slackbot/bin/slackbot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env node
require('../dist/index.js');
21 changes: 21 additions & 0 deletions tools/slackbot/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "@lg-tools/slackbot",
"version": "0.0.1",
"description": "Slackbot for LeafyGreen",
"bin": {
"slackbot": "./bin/slackbot.js"
},
"scripts": {
"build": "rollup -c rollup.config.mjs",
"tsc": "tsc --build tsconfig.json"
},
"license": "MIT",
"dependencies": {
"@lg-tools/build": "^0.0.1",
"@slack/web-api": "^6.4.0",
"chalk": "^4.1.2",
"commander": "^11.0.0",
"lodash": "^4.17.21",
"node-fetch": "^2.6.1"
}
}
7 changes: 7 additions & 0 deletions tools/slackbot/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { umdConfig } from '@lg-tools/build/config/rollup.config.mjs';

const config = {
...umdConfig,
};

export default config;
File renamed without changes.
13 changes: 9 additions & 4 deletions scripts/slackbot/slackbot.ts → tools/slackbot/src/slackbot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
constructBasicUpdateText,
constructShortUpdateText,
constructUpdateTextWithChangelog,
} from './utils/construcUpdateText';
} from './utils/constructUpdateText';
import { generateGreeting } from './utils/generateGreeting';
import { getSortedUpdates } from './utils/getSortedUpdates';
import {
Expand All @@ -20,14 +20,15 @@ import {
} from './slackbot.types';

const cli = new Command('slackbot')
.arguments('<updates>')
.arguments('[updates]')
.option(
'-c, --channel <channel>',
'Channel to post to.',
'leafygreen-ui-releases',
)
.option('--test', 'Post to `design-system-testing`', false)
.option('--dry', 'Dry run. Does not post', false)
.option('--verbose', 'Verbose mode', false)
.parse(process.argv);

cli.addHelpText(
Expand All @@ -47,7 +48,7 @@ cli.addHelpText(
`,
);

const { channel, test, dry }: Opts = cli.opts();
const { channel, test, dry, verbose }: Opts = cli.opts();

try {
/**
Expand Down Expand Up @@ -86,7 +87,9 @@ async function slackbot(
channel: string,
updates: Array<ComponentUpdateObject>,
) {
verbose && console.log({ updates, channel });
const sortedUpdates = await getSortedUpdates(updates);
verbose && console.log({ sortedUpdates });

const updateStrings = {
major:
Expand Down Expand Up @@ -115,6 +118,8 @@ async function slackbot(
: '',
};

verbose && console.log({ updateStrings });

const web = new WebClient(botToken);

/** Post to the channel */
Expand Down Expand Up @@ -146,7 +151,7 @@ async function slackbot(
});
}
} else {
console.warn('Missing message text. Did not send message.');
console.warn('No updates to post.');
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface Opts {
channel: keyof typeof Channels;
test: boolean;
dry: boolean;
verbose: boolean;
}

export interface ComponentUpdateObject {
Expand Down
1 change: 1 addition & 0 deletions tools/slackbot/src/utils/test.data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const TEST_DATA = [{ name: '@leafygreen-ui/example', version: '0.0.0' }];
12 changes: 12 additions & 0 deletions tools/slackbot/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "@lg-tools/build/config/package.tsconfig.json",
"compilerOptions": {
"declarationDir": "dist",
"outDir": "dist",
"rootDir": "src",
"baseUrl": "."
},
"include": [
"src/**/*"
]
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7048,6 +7048,11 @@ combined-stream@^1.0.6, combined-stream@^1.0.8:
dependencies:
delayed-stream "~1.0.0"

commander@^11.0.0:
version "11.0.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-11.0.0.tgz#43e19c25dbedc8256203538e8d7e9346877a6f67"
integrity sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==

commander@^2.18.0, commander@^2.19.0, commander@^2.20.0:
version "2.20.3"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
Expand Down