Skip to content

Commit e4493e5

Browse files
mheveryadamdbradleymanucorporat
authored
refactor: Change syntax to support closers capturing variables (#140)
* refactor: Change syntax to support closers capturing variables Change syntax from: ```typescript const Counter = qComponent<{}, {count: number}>({ onMount: qHook(() => {count: 0}), onRender: qHook((props, state) => ( <button on:click={qHook<typeof Counter>((props, state) => state.count++)}> {state.count} </button> ) }); ``` to: ```typescript const Counter = qComponent<>(() => { const state = useState(); return onRender(() => ( <button on:click={() => state.count++)}> {state.count} </button> ) }); ``` Co-authored-by: Adam Bradley <[email protected]> Co-authored-by: Manu MA <[email protected]> * fixup! refactor: Change syntax to support closers capturing variables * fixup! fixup! refactor: Change syntax to support closers capturing variables * fixup! refactor: Change syntax to support closers capturing variables * fixup! fixup! refactor: Change syntax to support closers capturing variables * fixup! fixup! fixup! refactor: Change syntax to support closers capturing variables * fixup! fixup! fixup! fixup! refactor: Change syntax to support closers capturing variables * fixup! fixup! fixup! fixup! fixup! refactor: Change syntax to support closers capturing variables Co-authored-by: Adam Bradley <[email protected]> Co-authored-by: Manu MA <[email protected]>
1 parent 0cfa168 commit e4493e5

File tree

108 files changed

+6954
-25484
lines changed

Some content is hidden

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

108 files changed

+6954
-25484
lines changed

.github/workflows/ci.yml

Lines changed: 110 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ jobs:
3838
uses: actions/cache@v2
3939
with:
4040
path: node_modules
41-
key: npm-cache-ubuntu-${{ hashFiles('yarn.lock') }}
42-
restore-keys: npm-cache-ubuntu-
41+
key: npm-cache-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
4342

4443
- name: Install NPM Dependencies
4544
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
@@ -84,23 +83,20 @@ jobs:
8483
uses: actions/cache@v2
8584
with:
8685
path: node_modules
87-
key: npm-cache-ubuntu-${{ hashFiles('yarn.lock') }}
88-
restore-keys: npm-cache-ubuntu-
86+
key: npm-cache-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
8987

9088
- name: Cache cargo dependencies
9189
uses: actions/cache@v2
9290
with:
9391
path: |
9492
~/.cargo
95-
key: cargo-deps-wasm-${{ hashFiles('Cargo.lock') }}
96-
restore-keys: cargo-deps-wasm-
93+
key: cargo-deps-wasm-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
9794

9895
- name: Cache cargo build
9996
uses: actions/cache@v2
10097
with:
10198
path: src/wasm/target
102-
key: cargo-build-wasm-${{ hashFiles('./src/wasm/Cargo.lock') }}
103-
restore-keys: cargo-build-wasm-
99+
key: cargo-build-wasm-${{ runner.os }}-${{ hashFiles('./src/wasm/Cargo.lock') }}
104100

105101
- name: Install wasm-pack
106102
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
@@ -171,7 +167,6 @@ jobs:
171167
with:
172168
path: node_modules
173169
key: npm-cache-${{ matrix.settings.target }}-${{ hashFiles('yarn.lock') }}
174-
restore-keys: npm-cache-${{ matrix.settings.target }}-
175170

176171
- name: Pull Latest Image
177172
if: ${{ matrix.settings.docker }}
@@ -187,14 +182,12 @@ jobs:
187182
path: |
188183
~/.cargo
189184
key: cargo-deps-${{ matrix.settings.target }}-${{ hashFiles('Cargo.lock') }}
190-
restore-keys: cargo-deps-${{ matrix.settings.target }}-
191185

192186
- name: Cache cargo build
193187
uses: actions/cache@v2
194188
with:
195189
path: target
196190
key: cargo-build-${{ matrix.settings.target }}-${{ hashFiles('Cargo.lock') }}
197-
restore-keys: cargo-deps-${{ matrix.settings.target }}-
198191

199192
- name: Setup Toolchain
200193
if: ${{ matrix.settings.setup }}
@@ -215,18 +208,17 @@ jobs:
215208
path: dist-dev/@builder.io-qwik/bindings/*.node
216209
if-no-files-found: error
217210

218-
############ RELEASE ############
219-
release:
220-
name: Release
211+
############ BUILD DISTRIBUTION ############
212+
build-distribution:
213+
name: Build Distribution
221214
if: "!contains(github.event.head_commit.message, 'skip ci')"
222215
runs-on: ubuntu-latest
223216
needs:
224217
- build-package
225218
- build-wasm
226219
- build-bindings
227-
- validate-rust
228220
- test-unit
229-
#- test-e2e
221+
- validate-rust
230222

231223
steps:
232224
- name: Setup Node.js
@@ -235,9 +227,6 @@ jobs:
235227
node-version: 16.x
236228
registry-url: https://registry.npmjs.org/
237229

238-
- name: Checkout
239-
uses: actions/checkout@v2
240-
241230
- name: Create dist-dev/@builder.io-qwik directory
242231
run: |
243232
mkdir dist-dev/
@@ -247,10 +236,10 @@ jobs:
247236
- name: Download Build Artifacts
248237
uses: actions/download-artifact@v2
249238

250-
- name: Print Package Artifacts
239+
- name: Print Distribution Artifacts
251240
run: ls -R dist-dev-builder-io-qwik/
252241

253-
- name: Move Package Artifacts
242+
- name: Move Distribution Artifacts
254243
run: mv dist-dev-builder-io-qwik/* dist-dev/@builder.io-qwik/
255244

256245
- name: Print Bindings Artifacts
@@ -262,12 +251,50 @@ jobs:
262251
- name: Print dist-dev
263252
run: ls -R dist-dev/
264253

254+
- name: Upload Qwik Distribution Artifact
255+
if: ${{ always() }}
256+
uses: actions/upload-artifact@master
257+
with:
258+
name: builderio-qwik-distribution
259+
path: dist-dev/@builder.io-qwik/*
260+
if-no-files-found: error
261+
262+
############ RELEASE ############
263+
release:
264+
name: Release
265+
if: "!contains(github.event.head_commit.message, 'skip ci')"
266+
runs-on: ubuntu-latest
267+
needs:
268+
- build-distribution
269+
- test-e2e
270+
271+
steps:
272+
- name: Setup Node.js
273+
uses: actions/setup-node@v1
274+
with:
275+
node-version: 16.x
276+
registry-url: https://registry.npmjs.org/
277+
278+
- name: Checkout
279+
uses: actions/checkout@v2
280+
281+
- name: Download Build Artifacts
282+
uses: actions/download-artifact@v2
283+
284+
- name: Print Distribution Artifacts
285+
run: ls -R builderio-qwik-distribution/
286+
287+
- name: Move Distribution Artifacts
288+
run: |
289+
mkdir dist-dev/
290+
mkdir dist-dev/@builder.io-qwik/
291+
mv builderio-qwik-distribution/* dist-dev/@builder.io-qwik/
292+
265293
- name: Cache NPM Dependencies
266294
uses: actions/cache@v2
267295
with:
268296
path: node_modules
269-
key: npm-cache-ubuntu-${{ hashFiles('yarn.lock') }}
270-
restore-keys: npm-cache-ubuntu-
297+
key: npm-cache-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
271298

272299
- name: Install NPM Dependencies
273300
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
@@ -286,13 +313,63 @@ jobs:
286313
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
287314
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
288315

289-
- name: Upload Qwik Package Artifact
290-
if: ${{ always() }}
291-
uses: actions/upload-artifact@master
316+
############ E2E TEST ############
317+
test-e2e:
318+
name: E2E Tests
319+
strategy:
320+
fail-fast: false
321+
matrix:
322+
settings:
323+
- host: ubuntu-latest
324+
browser: chromium
325+
- host: macos-latest
326+
browser: webkit
327+
- host: windows-latest
328+
browser: firefox
329+
330+
runs-on: ${{ matrix.settings.host }}
331+
needs:
332+
- build-distribution
333+
334+
steps:
335+
- name: Setup Node.js
336+
uses: actions/setup-node@v1
292337
with:
293-
name: BuilderIO-qwik
294-
path: dist-dev/*.tgz
295-
if-no-files-found: error
338+
node-version: 16.x
339+
registry-url: https://registry.npmjs.org/
340+
341+
- name: Checkout
342+
uses: actions/checkout@v2
343+
344+
- name: Download Build Artifacts
345+
uses: actions/download-artifact@v2
346+
347+
- name: Print Distribution Artifacts
348+
run: ls -R builderio-qwik-distribution/
349+
350+
- name: Move Distribution Artifacts
351+
run: |
352+
mkdir dist-dev/
353+
mkdir dist-dev/@builder.io-qwik/
354+
mv builderio-qwik-distribution/* dist-dev/@builder.io-qwik/
355+
356+
- name: Print Directory
357+
run: ls -R ./
358+
359+
- name: Cache NPM Dependencies
360+
uses: actions/cache@v2
361+
with:
362+
path: node_modules
363+
key: npm-cache-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
364+
365+
- name: Install NPM Dependencies
366+
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
367+
368+
- name: Install Playwright
369+
run: npx playwright install ${{ matrix.settings.browser }} && npx playwright install-deps ${{ matrix.settings.browser }}
370+
371+
- name: Playwright E2E Tests
372+
run: yarn test.e2e.${{ matrix.settings.browser }}
296373

297374
############ UNIT TEST ############
298375
test-unit:
@@ -313,54 +390,14 @@ jobs:
313390
uses: actions/cache@v2
314391
with:
315392
path: node_modules
316-
key: npm-cache-ubuntu-${{ hashFiles('yarn.lock') }}
317-
restore-keys: npm-cache-ubuntu-
393+
key: npm-cache-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
318394

319395
- name: Install NPM Dependencies
320396
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
321397

322398
- name: Jest Unit Tests
323399
run: yarn test.unit
324400

325-
############ E2E TEST ############
326-
# test-e2e:
327-
# name: E2E Tests
328-
# runs-on: ubuntu-latest
329-
330-
# steps:
331-
# - name: Setup Node.js
332-
# uses: actions/setup-node@v1
333-
# with:
334-
# node-version: 10.x
335-
# registry-url: https://registry.npmjs.org/
336-
337-
# - name: Checkout
338-
# uses: actions/checkout@v2
339-
340-
# - name: E2E Tests
341-
# uses: cypress-io/github-action@v2
342-
# with:
343-
# install-command: yarn --frozen-lockfile --ignore-engines
344-
# start: yarn integration.server.prod
345-
# wait-on: 'http://localhost:8081'
346-
# wait-on-timeout: 120
347-
# browser: chrome
348-
# record: true
349-
# group: 'Qwik E2E Test Group'
350-
# spec: cypress/integration/*
351-
# config-file: cypress/cypress.json
352-
# config: defaultCommandTimeout=10000
353-
# env:
354-
# CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
355-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
356-
357-
# - name: Upload Videos Artifacts
358-
# uses: actions/upload-artifact@v1
359-
# if: always()
360-
# with:
361-
# name: Cypress Videos
362-
# path: cypress/videos
363-
364401
########### VALIDATE RUST ############
365402
validate-rust:
366403
name: Validate Rust
@@ -383,15 +420,13 @@ jobs:
383420
with:
384421
path: |
385422
~/.cargo
386-
key: ${{ runner.os }}-cargo-deps-${{ hashFiles('Cargo.lock') }}
387-
restore-keys: ${{ runner.os }}-cargo-deps-
423+
key: cargo-deps-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
388424

389425
- name: Cache cargo build
390426
uses: actions/cache@v2
391427
with:
392428
path: target
393-
key: ${{ runner.os }}-cargo-build-${{ hashFiles('Cargo.lock') }}
394-
restore-keys: ${{ runner.os }}-cargo-build-
429+
key: cargo-build-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
395430

396431
- name: Format check
397432
uses: actions-rs/cargo@v1
@@ -430,8 +465,7 @@ jobs:
430465
uses: actions/cache@v2
431466
with:
432467
path: node_modules
433-
key: npm-cache-ubuntu-${{ hashFiles('yarn.lock') }}
434-
restore-keys: npm-cache-ubuntu-
468+
key: npm-cache-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
435469

436470
- name: Install NPM Dependencies
437471
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ integration/todo/output
1717
integration/*.js
1818
integration/*.cjs
1919
integration/*.map
20-
cypress/screenshots
21-
cypress/videos
22-
cypress/fixtures/
2320
src/napi/package-*
2421
target
2522
*.node

DEVELOPER.md

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,9 @@ Next the `start` command will:
1717
npm start
1818
```
1919

20-
## Running Dev Server Integration Tests
21-
22-
The `integration/` directory is for this local repo's end-to-end and integration testing (and not necessarily app demos). Its dev server is setup to always point to the local build and stay current with the watch process.
23-
24-
First start the integration dev server, which will also ensure a build was completed:
25-
26-
```
27-
npm run integration.server
28-
```
29-
30-
Then navigate to http://localhost:8080/
31-
32-
The `npm run integration.server` commands runs the server in `development` mode, where files are not minified, source maps are inlined, and there's additional logging. To run code minified with external source maps and without extra logs, run `npm run integration.server.prod`, which is what the end-to-end tests use.
33-
3420
## Running All Tests
3521

36-
To run all Unit tests ([Jest](https://jestjs.io/)) and E2E/Integration tests ([Cypress](https://www.cypress.io/)), run:
22+
To run all Unit tests ([Jest](https://jestjs.io/)) and E2E tests [Playwright](https://playwright.dev/), run:
3723

3824
```
3925
npm test
@@ -61,20 +47,14 @@ To debug and step through unit tests, within VSCode you can use the "Integration
6147

6248
### E2E Tests Only
6349

64-
E2E and Integration tests use [Cypress](https://www.cypress.io/).
50+
E2E tests use [Playwright](https://playwright.dev/).
6551

66-
To run the Cypress tests headless, from start to finish, run:
52+
To run the Playwright tests headless, from start to finish, run:
6753

6854
```
6955
npm run test.e2e
7056
```
7157

72-
To open Cypress in interactive mode and control through a browser, run:
73-
74-
```
75-
npm run test.e2e.open
76-
```
77-
7858
## Production Build
7959

8060
The `npm start` command will run development builds, type check, watch unit tests, and watch the files for changes.

0 commit comments

Comments
 (0)