Skip to content

Commit 4a20c24

Browse files
authored
refactor: split into multiple packages + TS rewrite (#137)
Packages: - `@apify/consts` - `@apify/datastructures` - `@apify/git` - `@apify/hubspot_client` - `@apify/image_proxy_client` - `@apify/input_schema` - `@apify/log` - `@apify/markdown` - `@apify/salesforce_client` - `@apify/utilities` Other notable changes: - some of the typings are rather low effort (lots of `any` in some places, mainly salesforce and hubspot clients) - uses named exports except `log` where we keep the default export for logger instance - removes `underscore` from most of the packages (except salesforce/hubspot clients) - removed `startsWith` polyfill and `newPromise` and `requestPromised` methods - `truncate` method is duplicated so the `log` package does not depend on `utilities` (as those bring a lot of 3rd party deps) Closes #131 Closes #95 BREAKING CHANGE: - old `apify-shared` package is now gone in favour of new `@apify/*` packages - all exports are now done via named exports instead of default exports (with exception of logger instance) - removed `startsWith` polyfill and `newPromise` and `requestPromised` methods
1 parent 6ce262d commit 4a20c24

File tree

125 files changed

+31083
-3931
lines changed

Some content is hidden

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

125 files changed

+31083
-3931
lines changed

.babelrc

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

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"extends": "@apify"
2+
"extends": ["@apify/ts"]
33
}

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package-lock.json -diff -merge
2+
package-lock.json linguist-generated=true

.github/scripts/before-beta-release.js

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

.github/workflows/check.yml

Lines changed: 0 additions & 65 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Check PR title
2+
3+
on:
4+
pull_request_target:
5+
types: [ opened, edited, synchronize ]
6+
7+
jobs:
8+
check_pr_title:
9+
name: 'Check PR title'
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: amannn/action-semantic-pull-request@v1.2.0
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 0 additions & 114 deletions
This file was deleted.
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Check & Release
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
test:
11+
name: Test
12+
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
node-version: [ 12, 14, 15, 16 ]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v2
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
- name: Cache node_modules
27+
uses: actions/cache@v2
28+
with:
29+
path: '**/node_modules'
30+
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('**/package-lock.json') }}
31+
- name: Update NPM
32+
run: npm install --no-audit -g npm@latest
33+
- name: Install Dependencies
34+
run: npm ci --no-audit
35+
- name: Run Tests
36+
run: npm test
37+
38+
build:
39+
name: Build
40+
runs-on: ubuntu-latest
41+
42+
steps:
43+
- uses: actions/checkout@v2
44+
- name: Use Node.js 16
45+
uses: actions/setup-node@v2
46+
with:
47+
node-version: 16
48+
- name: Cache node_modules
49+
uses: actions/cache@v2
50+
with:
51+
path: '**/node_modules'
52+
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('**/package-lock.json') }}
53+
- name: Update NPM
54+
run: npm install --no-audit -g npm@latest
55+
- name: Install Dependencies
56+
run: npm ci --no-audit
57+
- run: npm run build
58+
59+
lint:
60+
name: Lint
61+
runs-on: ubuntu-latest
62+
63+
steps:
64+
- uses: actions/checkout@v2
65+
- name: Use Node.js 16
66+
uses: actions/setup-node@v2
67+
with:
68+
node-version: 16
69+
- name: Cache node_modules
70+
uses: actions/cache@v2
71+
with:
72+
path: '**/node_modules'
73+
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('**/package-lock.json') }}
74+
- name: Install Dependencies
75+
run: npm ci --no-audit
76+
- run: npm run lint
77+
78+
publish:
79+
name: Publish to NPM
80+
if: github.ref == 'refs/heads/master'
81+
needs: [ test, build, lint ]
82+
runs-on: ubuntu-latest
83+
steps:
84+
- uses: actions/checkout@v2
85+
with:
86+
token: ${{ secrets.GH_TOKEN }}
87+
fetch-depth: 0 # we need to pull everything to allow lerna to detect what packages changed
88+
ref: master
89+
- uses: actions/setup-node@v2
90+
with:
91+
node-version: 16
92+
- name: Cache node_modules
93+
uses: actions/cache@v2
94+
with:
95+
path: '**/node_modules'
96+
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('**/package-lock.json') }}
97+
- name: Check for changes
98+
id: changed_packages
99+
run: |
100+
echo "::set-output name=changed_packages::$(npx lerna changed -p | wc -l | xargs)"
101+
- name: Release
102+
if: steps.changed_packages.outputs.changed_packages != '0'
103+
run: |
104+
git config --global user.name 'Apify Release Bot'
105+
git config --global user.email 'noreply@apify.com'
106+
echo "access=public" >> .npmrc
107+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
108+
npm ci --no-audit
109+
npm run build
110+
git checkout -- .
111+
npx lerna publish --contents dist --yes --no-verify-access
112+
npm ci --no-audit # reinstall to have updated lock file
113+
npx lerna ls --json | npx ts-node -T scripts/sync-root-changelog.ts
114+
git commit -am 'chore: update root lock file and changelog [skip ci]'
115+
git push
116+
env:
117+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
118+
GIT_USER: "noreply@apify.com:${{ secrets.GH_TOKEN }}"
119+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
120+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
build
1+
dist
22
docs
33
node_modules
44
*.log
@@ -11,5 +11,4 @@ logs
1111
pids
1212
.idea
1313
yarn.lock
14-
package-lock.json
15-
types/
14+
.npmrc

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

0 commit comments

Comments
 (0)