Skip to content

Commit 2416789

Browse files
authored
Merge pull request #617 from raheeliftikhar5/publish-comps-workflow
Upgrade styled-component + Unit test fixes + Publish packages workflows
2 parents 57b6120 + 3fd234d commit 2416789

File tree

261 files changed

+2014
-1647
lines changed

Some content is hidden

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

261 files changed

+2014
-1647
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3+
4+
name: Publish Lowcoder CLI
5+
6+
on:
7+
push:
8+
branches: [ "dev" ]
9+
10+
jobs:
11+
publish-package:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v3
16+
17+
- name: Check version changes
18+
uses: EndBug/version-check@v1
19+
id: check
20+
with:
21+
diff-search: true
22+
file-name: client/packages/lowcoder-cli/package.json
23+
24+
- name: Version update detected
25+
if: steps.check.outputs.changed == 'true'
26+
run: 'echo "Version change found! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"'
27+
28+
- name: Set up Node.js for NPM
29+
if: steps.check.outputs.changed == 'true'
30+
uses: actions/setup-node@v3
31+
with:
32+
node-version: 16
33+
registry-url: https://registry.npmjs.org/
34+
35+
- name: Install dependencies
36+
if: steps.check.outputs.changed == 'true'
37+
uses: borales/actions-yarn@v4.2.0
38+
with:
39+
cmd: install
40+
dir: client/packages/lowcoder-cli
41+
42+
- name: Publish package to NPM
43+
if: steps.check.outputs.changed == 'true'
44+
run: npm publish
45+
working-directory: client/packages/lowcoder-cli
46+
env:
47+
NODE_AUTH_TOKEN: ${{ secrets.LOWCODERNPMBOT }}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3+
4+
name: Publish Lowcoder Comps
5+
6+
on:
7+
push:
8+
branches: [ "dev" ]
9+
10+
jobs:
11+
publish-package:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v3
16+
17+
- name: Check version changes
18+
uses: EndBug/version-check@v1
19+
id: check
20+
with:
21+
diff-search: true
22+
file-name: client/packages/lowcoder-comps/package.json
23+
24+
- name: Version update detected
25+
if: steps.check.outputs.changed == 'true'
26+
run: 'echo "Version change found! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"'
27+
28+
- name: Set up Node.js for NPM
29+
if: steps.check.outputs.changed == 'true'
30+
uses: actions/setup-node@v3
31+
with:
32+
node-version: 16
33+
registry-url: https://registry.npmjs.org/
34+
35+
- name: Install dependencies
36+
if: steps.check.outputs.changed == 'true'
37+
uses: borales/actions-yarn@v4.2.0
38+
with:
39+
cmd: install
40+
dir: client/packages/lowcoder-comps
41+
42+
- name: Publish
43+
if: steps.check.outputs.changed == 'true'
44+
uses: borales/actions-yarn@v4.2.0
45+
with:
46+
cmd: build_publish
47+
dir: client/packages/lowcoder-comps
48+
env:
49+
NODE_AUTH_TOKEN: ${{ secrets.LOWCODERNPMBOT }}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3+
4+
name: Publish Lowcoder Core
5+
6+
on:
7+
push:
8+
branches: [ "dev" ]
9+
10+
jobs:
11+
publish-package:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v3
16+
17+
- name: Check version changes
18+
uses: EndBug/version-check@v1
19+
id: check
20+
with:
21+
diff-search: true
22+
file-name: client/packages/lowcoder-core/package.json
23+
24+
- name: Version update detected
25+
if: steps.check.outputs.changed == 'true'
26+
run: 'echo "Version change found! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"'
27+
28+
- name: Set up Node.js for NPM
29+
if: steps.check.outputs.changed == 'true'
30+
uses: actions/setup-node@v3
31+
with:
32+
node-version: 16
33+
registry-url: https://registry.npmjs.org/
34+
35+
- name: Install dependencies
36+
if: steps.check.outputs.changed == 'true'
37+
uses: borales/actions-yarn@v4.2.0
38+
with:
39+
cmd: install
40+
dir: client/packages/lowcoder-core
41+
42+
- name: Publish package to NPM
43+
if: steps.check.outputs.changed == 'true'
44+
run: npm publish
45+
working-directory: client/packages/lowcoder-core
46+
env:
47+
NODE_AUTH_TOKEN: ${{ secrets.LOWCODERNPMBOT }}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3+
4+
name: Publish Lowcoder SDK
5+
6+
on:
7+
push:
8+
branches: [ "dev" ]
9+
10+
jobs:
11+
publish-package:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v3
16+
17+
- name: Check version changes
18+
uses: EndBug/version-check@v1
19+
id: check
20+
with:
21+
diff-search: true
22+
file-name: client/packages/lowcoder-sdk/package.json
23+
24+
- name: Version update detected
25+
if: steps.check.outputs.changed == 'true'
26+
run: 'echo "Version change found! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"'
27+
28+
- name: Set up Node.js for NPM
29+
if: steps.check.outputs.changed == 'true'
30+
uses: actions/setup-node@v3
31+
with:
32+
node-version: 16
33+
registry-url: https://registry.npmjs.org/
34+
35+
- name: Install dependencies
36+
if: steps.check.outputs.changed == 'true'
37+
uses: borales/actions-yarn@v4.2.0
38+
with:
39+
cmd: install
40+
dir: client/packages/lowcoder-sdk
41+
42+
- name: Build Package
43+
if: steps.check.outputs.changed == 'true'
44+
uses: borales/actions-yarn@v4.2.0
45+
with:
46+
cmd: build
47+
dir: client/packages/lowcoder-sdk
48+
49+
- name: Publish package to NPM
50+
if: steps.check.outputs.changed == 'true'
51+
run: npm publish
52+
working-directory: client/packages/lowcoder-sdk
53+
env:
54+
NODE_AUTH_TOKEN: ${{ secrets.LOWCODERNPMBOT }}

client/config/test/jest.setup-after-env.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,25 @@ window.ResizeObserver = function () {
2222
};
2323
};
2424

25-
window.ImageData = {}
26-
window.MediaStreamTrack = {}
27-
window.URL.createObjectURL = () => {}
25+
Object.defineProperty(window, 'ImageData', { value: 'yourValue' });
26+
Object.defineProperty(window, 'MediaStreamTrack', { value: 'yourValue' });
27+
Object.defineProperty(window, 'URL', {
28+
writable: true,
29+
value: {
30+
createObjectURL: jest.fn(),
31+
}
32+
});
33+
Object.defineProperty(window, "navigator", {
34+
writable: true,
35+
value: {
36+
mediaDevices: {
37+
enumerateDevices: jest.fn(),
38+
},
39+
userAgent: '',
40+
language: '',
41+
browserLanguage: '',
42+
},
43+
});
2844

2945
class Worker {
3046
constructor(stringUrl) {
@@ -36,4 +52,5 @@ class Worker {
3652
this.onmessage(msg);
3753
}
3854
}
55+
3956
window.Worker = Worker;

client/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"@types/react-resizable": "^3.0.5",
3535
"@types/react-router-dom": "^5.3.2",
3636
"@types/shelljs": "^0.8.11",
37-
"@types/styled-components": "^5.1.19",
3837
"@types/stylis": "^4.0.2",
3938
"@types/tern": "0.23.4",
4039
"@types/ua-parser-js": "^0.7.36",
@@ -71,6 +70,9 @@
7170
},
7271
"dependencies": {
7372
"@lottiefiles/react-lottie-player": "^3.5.3",
73+
"@testing-library/react": "^14.1.2",
74+
"@testing-library/user-event": "^14.5.1",
75+
"@types/styled-components": "^5.1.34",
7476
"antd-mobile": "^5.28.0",
7577
"chalk": "4",
7678
"number-precision": "^1.6.0",

client/packages/lowcoder-cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "lowcoder-cli",
33
"description": "CLI tool used to start build publish lowcoder components",
4-
"version": "0.0.27",
4+
"version": "0.0.28",
55
"license": "MIT",
66
"bin": "./index.js",
77
"type": "module",

client/packages/lowcoder-comps/src/comps/calendarComp/calendarComp.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ import {
2222
CalendarDeleteIcon,
2323
Tooltip,
2424
} from "lowcoder-sdk";
25-
import { Input, Form } from "antd";
25+
import { default as Form } from "antd/es/form";
26+
import { default as Input } from "antd/es/input";
2627
import { trans, getCalendarLocale } from "../../i18n/comps";
2728
import { createRef, useContext, useRef, useState } from "react";
2829
import FullCalendar from "@fullcalendar/react";
@@ -290,11 +291,11 @@ let CalendarBasicComp = (function () {
290291
return (
291292
<Wrapper
292293
ref={ref}
293-
editable={editable}
294+
$editable={editable}
294295
$style={style}
295-
theme={theme?.theme}
296+
$theme={theme?.theme}
296297
onDoubleClick={handleDbClick}
297-
left={left}
298+
$left={left}
298299
key={initialDate ? defaultView + initialDate : defaultView}
299300
>
300301
<FullCalendar

client/packages/lowcoder-comps/src/comps/calendarComp/calendarConstants.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ import {
2424
SlotLabelContentArg,
2525
ViewContentArg,
2626
} from "@fullcalendar/core";
27-
import { Form } from "antd";
27+
import { default as Form } from "antd/es/form";
2828

2929
export const Wrapper = styled.div<{
30-
editable: boolean;
30+
$editable: boolean;
3131
$style: CalendarStyleType;
32-
theme?: ThemeDetail;
33-
left?: number;
32+
$theme?: ThemeDetail;
33+
$left?: number;
3434
}>`
3535
position: relative;
3636
height: 100%;
@@ -205,9 +205,9 @@ export const Wrapper = styled.div<{
205205
flex-direction: inherit;
206206
}
207207
.fc-day-today .fc-daygrid-day-number {
208-
background-color: ${(props) => props.theme.primary};
208+
background-color: ${(props) => props.$theme.primary};
209209
color: ${(props) =>
210-
contrastText(props.theme.primary || "", props.theme.textDark, props.theme.textLight)};
210+
contrastText(props.$theme.primary || "", props.$theme.textDark, props.$theme.textLight)};
211211
}
212212
.fc-daygrid-day-events {
213213
padding: 1px 0 5px 0;
@@ -261,7 +261,7 @@ export const Wrapper = styled.div<{
261261
border-radius: 4px;
262262
box-shadow: 0 0px 10px 4px rgba(0, 0, 0, 0.25);
263263
overflow: hidden;
264-
left: ${(props) => `min(${props.left}px, calc(100% - 210px)) !important`};
264+
left: ${(props) => `min(${props.$left}px, calc(100% - 210px)) !important`};
265265
.fc-popover-body {
266266
padding: 4px 0;
267267
min-width: 200px;
@@ -368,7 +368,7 @@ export const Wrapper = styled.div<{
368368
}
369369
&:hover {
370370
.event-remove {
371-
opacity: ${(props) => props.editable && 1};
371+
opacity: ${(props) => props.$editable ? 1 : undefined};
372372
}
373373
}
374374
}
@@ -585,10 +585,10 @@ export const Wrapper = styled.div<{
585585
}
586586
.fc-day-today.fc-col-header-cell {
587587
background-color: ${(props) =>
588-
isDarkColor(props.$style.background) ? "#ffffff19" : toHex(props.theme.primary!) + "19"};
588+
isDarkColor(props.$style.background) ? "#ffffff19" : toHex(props.$theme.primary!) + "19"};
589589
a {
590590
color: ${(props) =>
591-
!isDarkColor(props.$style.background) && darkenColor(props.theme.primary!, 0.1)};
591+
!isDarkColor(props.$style.background) && darkenColor(props.$theme.primary!, 0.1)};
592592
}
593593
}
594594
.fc-col-header-cell-cushion {

client/packages/lowcoder-comps/src/comps/chartComp/chartConfigs/chartUrls.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ const echartsUrlLocale = language === "zh" ? "zh" : "en";
44
export const optionUrl = `https://echarts.apache.org/${echartsUrlLocale}/option.html`;
55
export const examplesUrl = `https://echarts.apache.org/examples/${echartsUrlLocale}/index.html`;
66
export const xAxisTypeUrl = `${optionUrl}#xAxis.type`;
7-
export const googleMapsApiUrl = `https://maps.googleapis.com/maps/api/js?v=3.exp`;
7+
export const googleMapsApiUrl = `https://maps.googleapis.com/maps/api/js`;
88
export const mapOptionUrl = `https://github.com/plainheart/echarts-extension-gmap`;
99
export const mapExamplesUrl = `https://codepen.io/plainheart/pen/VweLGbR`;

client/packages/lowcoder-comps/src/comps/chartComp/chartUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ export function getSelectedPoints(param: any, option: any) {
266266
return [];
267267
}
268268

269-
export function loadGoogleMapsScript(apiKey?: string) {
270-
const mapsUrl = `${googleMapsApiUrl}&key=${apiKey}`;
269+
export function loadGoogleMapsScript(apiKey: string) {
270+
const mapsUrl = `${googleMapsApiUrl}?key=${apiKey}`;
271271
const scripts = document.getElementsByTagName('script');
272272
// is script already loaded
273273
let scriptIndex = _.findIndex(scripts, (script) => script.src.endsWith(mapsUrl));

client/packages/lowcoder-comps/src/comps/imageEditorComp/imageEditorConstants.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import styled from "styled-components";
2-
import { Button } from "antd";
2+
import { default as Button } from "antd/es/button";
33
import { EventConfigType } from "lowcoder-sdk";
44
import { trans } from "i18n/comps";
55

client/packages/lowcoder-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder-core",
3-
"version": "0.0.9",
3+
"version": "0.0.10",
44
"type": "module",
55
"scripts": {
66
"start": "rollup -c rollup.config.js --watch",

0 commit comments

Comments
 (0)