TypeScript components + RSS improvements (#2780) · apify/pipedream@f639b58 · GitHub
Skip to content

Commit f639b58

Browse files
dylburgerjs07
andauthored
TypeScript components + RSS improvements (PipedreamHQ#2780)
Adding TypeScript components MVP. Co-authored-by: js07 <19861096+js07@users.noreply.github.com>
1 parent 77f374d commit f639b58

96 files changed

Lines changed: 46737 additions & 13909 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.eslintignore‎

Lines changed: 1 addition & 0 deletions

‎.eslintrc‎

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
{
22
"env": {
33
"commonjs": true,
4-
"es2021": true,
4+
"es2020": true,
55
"node": true
66
},
77
"extends": [
88
"eslint:recommended",
9-
"plugin:jsonc/recommended-with-jsonc"
9+
"plugin:jsonc/recommended-with-jsonc",
10+
"plugin:@typescript-eslint/recommended"
1011
],
12+
"ignorePatterns": ["scripts"],
1113
"overrides": [
1214
{
1315
"files": [
@@ -72,6 +74,39 @@
7274
"rules": {
7375
"no-unused-vars": "off"
7476
}
77+
},
78+
{
79+
"files": [
80+
"*.ts",
81+
"*.mts"
82+
],
83+
"parser": "@typescript-eslint/parser",
84+
"rules": {
85+
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
86+
"max-len": "off",
87+
// note you must disable the base rule as it can report incorrect errors
88+
"semi": "off",
89+
"@typescript-eslint/semi": ["error"],
90+
"@typescript-eslint/member-delimiter-style": ["error", {
91+
"multiline": {
92+
"delimiter": "semi",
93+
"requireLast": true
94+
},
95+
"singleline": {
96+
"delimiter": "semi",
97+
"requireLast": true
98+
},
99+
"multilineDetection": "brackets",
100+
"overrides": {
101+
"interface": {
102+
"multiline": {
103+
"delimiter": "semi",
104+
"requireLast": true
105+
}
106+
}
107+
}
108+
}]
109+
}
75110
}
76111
],
77112
"parserOptions": {
@@ -81,7 +116,8 @@
81116
"plugins": [
82117
"jsonc",
83118
"putout",
84-
"pipedream"
119+
"pipedream",
120+
"@typescript-eslint"
85121
],
86122
"root": true,
87123
"rules": {
@@ -97,12 +133,6 @@
97133
"error",
98134
"always"
99135
],
100-
"camelcase": [
101-
"error",
102-
{
103-
"properties": "never"
104-
}
105-
],
106136
"comma-dangle": [
107137
"error",
108138
"always-multiline"
@@ -184,14 +214,6 @@
184214
"allowAllPropertiesOnSameLine": false
185215
}
186216
],
187-
"putout/for-of-multiple-properties-destructuring": "error",
188-
"putout/multiple-properties-destructuring": [
189-
"error",
190-
{
191-
"minProperties": 2
192-
}
193-
],
194-
"putout/single-property-destructuring": "error",
195217
"quote-props": [
196218
"error",
197219
"consistent"

‎.github/workflows/npm.yaml‎

Lines changed: 0 additions & 28 deletions
This file was deleted.

‎.github/workflows/publish-components.yaml‎

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,32 @@ jobs:
1010
steps:
1111
- name: Checkout code
1212
uses: actions/checkout@v3.0.2
13+
- uses: pnpm/action-setup@v2.0.1
14+
with:
15+
version: 7.0.0
16+
- name: Get pnpm store directory
17+
id: pnpm-cache
18+
run: |
19+
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
20+
- uses: actions/cache@v3
21+
name: Setup pnpm cache
22+
with:
23+
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
24+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
25+
restore-keys: |
26+
${{ runner.os }}-pnpm-store-
27+
- name: Install dependencies
28+
run: pnpm install -r
29+
- name: Setup Node Env
30+
uses: actions/setup-node@v2.5.1
31+
with:
32+
node-version: 14
33+
registry-url: https://registry.npmjs.org/
34+
cache: 'pnpm'
35+
- name: Install Dependencies
36+
run: npm ci
37+
- name: Compile TypeScript
38+
run: npm run build
1339
- name: Install pd cli
1440
env:
1541
PD_API_KEY: ${{ secrets.PD_API_KEY }}
@@ -73,3 +99,103 @@ jobs:
7399
- name: Remove pd cli config
74100
run: |
75101
rm $HOME/.config/pipedream/config
102+
103+
publish-typescript-components:
104+
name: Publish TypeScript components
105+
runs-on: ubuntu-latest
106+
107+
steps:
108+
- name: Checkout code
109+
uses: actions/checkout@v2.4.0
110+
- uses: pnpm/action-setup@v2.0.1
111+
with:
112+
version: 7.0.0
113+
- name: Get pnpm store directory
114+
id: pnpm-cache
115+
run: |
116+
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
117+
- uses: actions/cache@v3
118+
name: Setup pnpm cache
119+
with:
120+
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
121+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
122+
restore-keys: |
123+
${{ runner.os }}-pnpm-store-
124+
- name: Setup Node Env
125+
uses: actions/setup-node@v2.5.1
126+
with:
127+
node-version: 14
128+
registry-url: https://registry.npmjs.org/
129+
cache: 'pnpm'
130+
- name: Install Dependencies
131+
run: npm ci
132+
- name: pnpm install
133+
run: pnpm install -r
134+
- name: Install pd cli
135+
env:
136+
PD_API_KEY: ${{ secrets.PD_API_KEY }}
137+
run: |
138+
curl -O https://cli.pipedream.com/linux/amd64/latest/pd.zip
139+
unzip pd.zip
140+
mkdir -p $HOME/.config/pipedream
141+
echo "api_key = $PD_API_KEY" > $HOME/.config/pipedream/config
142+
- name: Compile TypeScript
143+
id: compile
144+
run: npm run build > files.txt
145+
- name: Publish TypeScript components (dry run)
146+
env:
147+
PD_API_KEY: ${{ secrets.PD_API_KEY }}
148+
ENDPOINT: ${{ secrets.ENDPOINT }}
149+
shell: bash {0} # don't fast fail
150+
run: |
151+
IFS=$'\n'
152+
echo "The following files will be published on merge:"
153+
# Remove initial tsc output
154+
for f in $(cat files.txt | sed 1,3d)
155+
do
156+
echo "$f"
157+
done
158+
UNPUBLISHED=""
159+
PUBLISHED=""
160+
ERRORS=""
161+
SKIPPED=""
162+
# included in the components dir, ends with .*js (e.g. .js and .mjs) and not app.js,
163+
# doesn't end with /common*.*js, and doesn't follow */common/
164+
for f in $(cat files.txt | sed 1,3d); do
165+
echo "Checking if $f is publishable"
166+
if [[ $f == */components/* ]] && [[ $f == *.*js ]] && [[ $f != *.app.*js ]] \
167+
&& [[ $f != */common*.*js ]] && [[ $f != */common/* ]]
168+
then
169+
echo "attempting to publish ${f}"
170+
PD_OUTPUT=`./pd publish ${f} --json`
171+
if [ $? -eq 0 ]
172+
then
173+
KEY=`echo $PD_OUTPUT | jq -r ".key"`
174+
echo "published ${KEY}"
175+
echo "${KEY} will be added to the registry"
176+
curl "https://api.pipedream.com/graphql" -H "Content-Type: application/json" -H "Authorization: Bearer ${PD_API_KEY}" --data-binary $'{"query":"mutation($key: String!, $registry: Boolean!, $gitPath: String){\\n setComponentRegistry(key: $key, registry: $registry, gitPath: $gitPath){\\n savedComponent{\\n id\\n key\\n gitPath\\n }\\n }\\n}","variables":{"key":"'${KEY}'","registry":'true',"gitPath":"'${f}'"}}'
177+
PUBLISHED+="*${f}"
178+
else
179+
ERROR=`echo $PD_OUTPUT | jq -r ".error"`
180+
ERROR_MESSAGE="${ERROR} with ${f}"
181+
echo $ERROR_MESSAGE
182+
ERRORS+="*${ERROR_MESSAGE}"
183+
UNPUBLISHED+="*${f}"
184+
# add to array to spit out later
185+
fi
186+
else
187+
echo "${f} will not be added to the registry"
188+
SKIPPED+="*${f}"
189+
fi
190+
done
191+
# print out everything that didn't publish
192+
if [ ${#UNPUBLISHED[@]} -ne 0 ]; then
193+
echo "the following files were not published"
194+
printf '%s\n' "${UNPUBLISHED[@]}"
195+
fi
196+
# curl with form
197+
curl -X POST -d "skipped=${SKIPPED}" -d "errors=${ERRORS}" -d "unpublished=${UNPUBLISHED}" -d "published=${PUBLISHED}" $ENDPOINT
198+
unset IFS
199+
- name: Remove pd cli config
200+
run: |
201+
rm $HOME/.config/pipedream/config
Lines changed: 30 additions & 0 deletions

0 commit comments

Comments
 (0)