Skip to content

Upgrade styled-component + Unit test fixes + Publish packages workflows #617

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 41 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
54786b8
publish comps workflow
raheeliftikhar5 Dec 28, 2023
ae43e5f
upgrade styles-components dependency
raheeliftikhar5 Dec 29, 2023
1e03ad2
updates after styled-compoents upgrade + fixing unit tests
raheeliftikhar5 Jan 1, 2024
3381113
unit test fixes
raheeliftikhar5 Jan 4, 2024
ab73917
fixed unit tests
raheeliftikhar5 Jan 4, 2024
c4f898a
test workflow
raheeliftikhar5 Jan 4, 2024
796da3c
test workflow
raheeliftikhar5 Jan 4, 2024
52c9ceb
test workflow
raheeliftikhar5 Jan 4, 2024
5f060af
test workflow
raheeliftikhar5 Jan 4, 2024
26918a7
test workflow
raheeliftikhar5 Jan 4, 2024
b4c0c16
test workflow
raheeliftikhar5 Jan 4, 2024
86ece8e
test workflow
raheeliftikhar5 Jan 4, 2024
96751cd
test workflow
raheeliftikhar5 Jan 4, 2024
1814ff6
test workflow
raheeliftikhar5 Jan 4, 2024
763b6f1
test workflow
raheeliftikhar5 Jan 4, 2024
a987f29
test workflow
raheeliftikhar5 Jan 4, 2024
893d9fd
test workflow
raheeliftikhar5 Jan 4, 2024
7f73699
test workflow
raheeliftikhar5 Jan 4, 2024
b87c556
test workflow
raheeliftikhar5 Jan 5, 2024
7f8e816
test workflow
raheeliftikhar5 Jan 5, 2024
1e702b2
test workflow
raheeliftikhar5 Jan 5, 2024
79ae92d
test workflow
raheeliftikhar5 Jan 5, 2024
8252f7e
test workflow
raheeliftikhar5 Jan 5, 2024
85feb40
test workflow
raheeliftikhar5 Jan 5, 2024
45d7cce
publish lowcoder-comps workflow
raheeliftikhar5 Jan 5, 2024
61f6c23
test lowcoder-cli pipeline
raheeliftikhar5 Jan 5, 2024
a9abad1
test lowcoder-cli pipeline
raheeliftikhar5 Jan 5, 2024
1aa6c19
test lowcoder-cli pipeline
raheeliftikhar5 Jan 5, 2024
954497f
test lowcoder-cli pipeline
raheeliftikhar5 Jan 5, 2024
74d17a7
test lowcoder-cli pipeline
raheeliftikhar5 Jan 5, 2024
41470f0
test lowcoder-cli pipeline
raheeliftikhar5 Jan 5, 2024
a160f0b
test lowcoder-cli pipeline
raheeliftikhar5 Jan 5, 2024
e90e3b3
publish lowcoder-cli workflow
raheeliftikhar5 Jan 5, 2024
92b6de6
test lowcoder-core pipeline
raheeliftikhar5 Jan 5, 2024
3a444fa
test lowcoder-core pipeline
raheeliftikhar5 Jan 5, 2024
04b61f2
publish lowcoder-core workflow
raheeliftikhar5 Jan 5, 2024
c592c10
publish lowcoder-core workflow
raheeliftikhar5 Jan 5, 2024
4344485
test lowcoder-sdk pipeline
raheeliftikhar5 Jan 5, 2024
b988fe1
test lowcoder-sdk pipeline
raheeliftikhar5 Jan 5, 2024
520b626
publish lowcoder-sdk workflow
raheeliftikhar5 Jan 5, 2024
3fd234d
branch and access token update
raheeliftikhar5 Jan 5, 2024
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
47 changes: 47 additions & 0 deletions .github/workflows/publish-lowcoder-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Publish Lowcoder CLI

on:
push:
branches: [ "dev" ]

jobs:
publish-package:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Check version changes
uses: EndBug/version-check@v1
id: check
with:
diff-search: true
file-name: client/packages/lowcoder-cli/package.json

- name: Version update detected
if: steps.check.outputs.changed == 'true'
run: 'echo "Version change found! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"'

- name: Set up Node.js for NPM
if: steps.check.outputs.changed == 'true'
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/

- name: Install dependencies
if: steps.check.outputs.changed == 'true'
uses: borales/actions-yarn@v4.2.0
with:
cmd: install
dir: client/packages/lowcoder-cli

- name: Publish package to NPM
if: steps.check.outputs.changed == 'true'
run: npm publish
working-directory: client/packages/lowcoder-cli
env:
NODE_AUTH_TOKEN: ${{ secrets.LOWCODERNPMBOT }}
49 changes: 49 additions & 0 deletions .github/workflows/publish-lowcoder-comps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Publish Lowcoder Comps

on:
push:
branches: [ "dev" ]

jobs:
publish-package:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Check version changes
uses: EndBug/version-check@v1
id: check
with:
diff-search: true
file-name: client/packages/lowcoder-comps/package.json

- name: Version update detected
if: steps.check.outputs.changed == 'true'
run: 'echo "Version change found! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"'

- name: Set up Node.js for NPM
if: steps.check.outputs.changed == 'true'
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/

- name: Install dependencies
if: steps.check.outputs.changed == 'true'
uses: borales/actions-yarn@v4.2.0
with:
cmd: install
dir: client/packages/lowcoder-comps

- name: Publish
if: steps.check.outputs.changed == 'true'
uses: borales/actions-yarn@v4.2.0
with:
cmd: build_publish
dir: client/packages/lowcoder-comps
env:
NODE_AUTH_TOKEN: ${{ secrets.LOWCODERNPMBOT }}
47 changes: 47 additions & 0 deletions .github/workflows/publish-lowcoder-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Publish Lowcoder Core

on:
push:
branches: [ "dev" ]

jobs:
publish-package:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Check version changes
uses: EndBug/version-check@v1
id: check
with:
diff-search: true
file-name: client/packages/lowcoder-core/package.json

- name: Version update detected
if: steps.check.outputs.changed == 'true'
run: 'echo "Version change found! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"'

- name: Set up Node.js for NPM
if: steps.check.outputs.changed == 'true'
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/

- name: Install dependencies
if: steps.check.outputs.changed == 'true'
uses: borales/actions-yarn@v4.2.0
with:
cmd: install
dir: client/packages/lowcoder-core

- name: Publish package to NPM
if: steps.check.outputs.changed == 'true'
run: npm publish
working-directory: client/packages/lowcoder-core
env:
NODE_AUTH_TOKEN: ${{ secrets.LOWCODERNPMBOT }}
54 changes: 54 additions & 0 deletions .github/workflows/publish-lowcoder-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Publish Lowcoder SDK

on:
push:
branches: [ "dev" ]

jobs:
publish-package:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Check version changes
uses: EndBug/version-check@v1
id: check
with:
diff-search: true
file-name: client/packages/lowcoder-sdk/package.json

- name: Version update detected
if: steps.check.outputs.changed == 'true'
run: 'echo "Version change found! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"'

- name: Set up Node.js for NPM
if: steps.check.outputs.changed == 'true'
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/

- name: Install dependencies
if: steps.check.outputs.changed == 'true'
uses: borales/actions-yarn@v4.2.0
with:
cmd: install
dir: client/packages/lowcoder-sdk

- name: Build Package
if: steps.check.outputs.changed == 'true'
uses: borales/actions-yarn@v4.2.0
with:
cmd: build
dir: client/packages/lowcoder-sdk

- name: Publish package to NPM
if: steps.check.outputs.changed == 'true'
run: npm publish
working-directory: client/packages/lowcoder-sdk
env:
NODE_AUTH_TOKEN: ${{ secrets.LOWCODERNPMBOT }}
23 changes: 20 additions & 3 deletions client/config/test/jest.setup-after-env.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,25 @@ window.ResizeObserver = function () {
};
};

window.ImageData = {}
window.MediaStreamTrack = {}
window.URL.createObjectURL = () => {}
Object.defineProperty(window, 'ImageData', { value: 'yourValue' });
Object.defineProperty(window, 'MediaStreamTrack', { value: 'yourValue' });
Object.defineProperty(window, 'URL', {
writable: true,
value: {
createObjectURL: jest.fn(),
}
});
Object.defineProperty(window, "navigator", {
writable: true,
value: {
mediaDevices: {
enumerateDevices: jest.fn(),
},
userAgent: '',
language: '',
browserLanguage: '',
},
});

class Worker {
constructor(stringUrl) {
Expand All @@ -36,4 +52,5 @@ class Worker {
this.onmessage(msg);
}
}

window.Worker = Worker;
4 changes: 3 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"@types/react-resizable": "^3.0.5",
"@types/react-router-dom": "^5.3.2",
"@types/shelljs": "^0.8.11",
"@types/styled-components": "^5.1.19",
"@types/stylis": "^4.0.2",
"@types/tern": "0.23.4",
"@types/ua-parser-js": "^0.7.36",
Expand Down Expand Up @@ -71,6 +70,9 @@
},
"dependencies": {
"@lottiefiles/react-lottie-player": "^3.5.3",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.1",
"@types/styled-components": "^5.1.34",
"antd-mobile": "^5.28.0",
"chalk": "4",
"number-precision": "^1.6.0",
Expand Down
2 changes: 1 addition & 1 deletion client/packages/lowcoder-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lowcoder-cli",
"description": "CLI tool used to start build publish lowcoder components",
"version": "0.0.27",
"version": "0.0.28",
"license": "MIT",
"bin": "./index.js",
"type": "module",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import {
CalendarDeleteIcon,
Tooltip,
} from "lowcoder-sdk";
import { Input, Form } from "antd";
import { default as Form } from "antd/es/form";
import { default as Input } from "antd/es/input";
import { trans, getCalendarLocale } from "../../i18n/comps";
import { createRef, useContext, useRef, useState } from "react";
import FullCalendar from "@fullcalendar/react";
Expand Down Expand Up @@ -290,11 +291,11 @@ let CalendarBasicComp = (function () {
return (
<Wrapper
ref={ref}
editable={editable}
$editable={editable}
$style={style}
theme={theme?.theme}
$theme={theme?.theme}
onDoubleClick={handleDbClick}
left={left}
$left={left}
key={initialDate ? defaultView + initialDate : defaultView}
>
<FullCalendar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import {
SlotLabelContentArg,
ViewContentArg,
} from "@fullcalendar/core";
import { Form } from "antd";
import { default as Form } from "antd/es/form";

export const Wrapper = styled.div<{
editable: boolean;
$editable: boolean;
$style: CalendarStyleType;
theme?: ThemeDetail;
left?: number;
$theme?: ThemeDetail;
$left?: number;
}>`
position: relative;
height: 100%;
Expand Down Expand Up @@ -205,9 +205,9 @@ export const Wrapper = styled.div<{
flex-direction: inherit;
}
.fc-day-today .fc-daygrid-day-number {
background-color: ${(props) => props.theme.primary};
background-color: ${(props) => props.$theme.primary};
color: ${(props) =>
contrastText(props.theme.primary || "", props.theme.textDark, props.theme.textLight)};
contrastText(props.$theme.primary || "", props.$theme.textDark, props.$theme.textLight)};
}
.fc-daygrid-day-events {
padding: 1px 0 5px 0;
Expand Down Expand Up @@ -261,7 +261,7 @@ export const Wrapper = styled.div<{
border-radius: 4px;
box-shadow: 0 0px 10px 4px rgba(0, 0, 0, 0.25);
overflow: hidden;
left: ${(props) => `min(${props.left}px, calc(100% - 210px)) !important`};
left: ${(props) => `min(${props.$left}px, calc(100% - 210px)) !important`};
.fc-popover-body {
padding: 4px 0;
min-width: 200px;
Expand Down Expand Up @@ -368,7 +368,7 @@ export const Wrapper = styled.div<{
}
&:hover {
.event-remove {
opacity: ${(props) => props.editable && 1};
opacity: ${(props) => props.$editable ? 1 : undefined};
}
}
}
Expand Down Expand Up @@ -585,10 +585,10 @@ export const Wrapper = styled.div<{
}
.fc-day-today.fc-col-header-cell {
background-color: ${(props) =>
isDarkColor(props.$style.background) ? "#ffffff19" : toHex(props.theme.primary!) + "19"};
isDarkColor(props.$style.background) ? "#ffffff19" : toHex(props.$theme.primary!) + "19"};
a {
color: ${(props) =>
!isDarkColor(props.$style.background) && darkenColor(props.theme.primary!, 0.1)};
!isDarkColor(props.$style.background) && darkenColor(props.$theme.primary!, 0.1)};
}
}
.fc-col-header-cell-cushion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ const echartsUrlLocale = language === "zh" ? "zh" : "en";
export const optionUrl = `https://echarts.apache.org/${echartsUrlLocale}/option.html`;
export const examplesUrl = `https://echarts.apache.org/examples/${echartsUrlLocale}/index.html`;
export const xAxisTypeUrl = `${optionUrl}#xAxis.type`;
export const googleMapsApiUrl = `https://maps.googleapis.com/maps/api/js?v=3.exp`;
export const googleMapsApiUrl = `https://maps.googleapis.com/maps/api/js`;
export const mapOptionUrl = `https://github.com/plainheart/echarts-extension-gmap`;
export const mapExamplesUrl = `https://codepen.io/plainheart/pen/VweLGbR`;
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ export function getSelectedPoints(param: any, option: any) {
return [];
}

export function loadGoogleMapsScript(apiKey?: string) {
const mapsUrl = `${googleMapsApiUrl}&key=${apiKey}`;
export function loadGoogleMapsScript(apiKey: string) {
const mapsUrl = `${googleMapsApiUrl}?key=${apiKey}`;
const scripts = document.getElementsByTagName('script');
// is script already loaded
let scriptIndex = _.findIndex(scripts, (script) => script.src.endsWith(mapsUrl));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from "styled-components";
import { Button } from "antd";
import { default as Button } from "antd/es/button";
import { EventConfigType } from "lowcoder-sdk";
import { trans } from "i18n/comps";

Expand Down
2 changes: 1 addition & 1 deletion client/packages/lowcoder-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lowcoder-core",
"version": "0.0.9",
"version": "0.0.10",
"type": "module",
"scripts": {
"start": "rollup -c rollup.config.js --watch",
Expand Down
Loading