Skip to content
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

chore: merge rc into main #3101

Merged
merged 9 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
138 changes: 126 additions & 12 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,73 @@ jobs:
- name: Git
run: npm run test:git

unit:
needs: repo
build-pack:
runs-on: ubuntu-latest
timeout-minutes: 30
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
package:
[
atoms,
core,
core-util,
dashboard,
doc-site,
helpers,
react-components,
scene-composer,
source-iotsitewise,
source-iottwinmaker,
tools-iottwinmaker,
]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: node_modules cache
id: npm-cache
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-node_modules-${{hashFiles('**/package-lock.json')}}
restore-keys: |
${{ runner.os }}-node_modules-

- name: Install
if: steps.npm-cache.outputs.cache-hit != 'true'
shell: bash
env:
NODE_OPTIONS: '--max_old_space_size=8192'
run: npm ci --prefer-offline --no-audit --progress=false --workspaces --include-workspace-root

- name: Turbo cache
uses: actions/cache@v4
with:
path: '.turbo'
key: ${{ runner.os }}-turbo-build-pack-${{ matrix.package}}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-build-pack-${{ matrix.package}}-

- name: Validate
run: npx turbo build pack -F @iot-app-kit/${{ matrix.package }}

lint:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
package:
[
atoms,
core,
core-util,
dashboard,
Expand All @@ -67,7 +125,9 @@ jobs:
scene-composer,
source-iotsitewise,
source-iottwinmaker,
testing-util,
tools-iottwinmaker,
vite-config,
]
steps:
- name: Checkout
Expand Down Expand Up @@ -100,25 +160,79 @@ jobs:
uses: actions/cache@v4
with:
path: '.turbo'
key: ${{ runner.os }}-turbo-unit-${{ matrix.package}}-${{ github.sha }}
key: ${{ runner.os }}-turbo-lint-${{ matrix.package}}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-unit-${{ matrix.package}}-
${{ runner.os }}-turbo-lint-${{ matrix.package}}-

- name: Test and lint cache
- name: Lint cache
uses: actions/cache@v4
with:
path: '**/.cache'
key: ${{ runner.os }}-test-lint-${{ matrix.package}}-${{ github.sha }}
key: ${{ runner.os }}-lint-${{ matrix.package}}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-test-lint-${{ matrix.package}}-
${{ runner.os }}-lint-${{ matrix.package}}-

- name: Validate
run: npx turbo build:cjs build:es lint test --filter=@iot-app-kit/${{ matrix.package }}
run: npx turbo lint -F @iot-app-kit/${{ matrix.package }}

unit:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
package:
[
core,
core-util,
dashboard,
react-components,
scene-composer,
source-iotsitewise,
source-iottwinmaker,
tools-iottwinmaker,
]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: node_modules cache
id: npm-cache
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-node_modules-${{hashFiles('**/package-lock.json')}}
restore-keys: |
${{ runner.os }}-node_modules-

- name: Install
if: steps.npm-cache.outputs.cache-hit != 'true'
shell: bash
env:
NODE_OPTIONS: '--max_old_space_size=8192'
run: npm ci --prefer-offline --no-audit --progress=false --workspaces --include-workspace-root

- name: Turbo cache
uses: actions/cache@v4
with:
path: '.turbo'
key: ${{ runner.os }}-turbo-unit-${{ matrix.package}}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-unit-${{ matrix.package}}-

- name: Validate
run: npx turbo test -F @iot-app-kit/${{ matrix.package }}

playwright:
needs: repo
runs-on: ubuntu-latest
timeout-minutes: 30
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -189,7 +303,7 @@ jobs:

- name: Playwright
run: |
npx turbo test:ui:ci --filter=@iot-app-kit/${{ matrix.package.name }} -- --shard=${{ matrix.package.shardIndex }}/${{ matrix.package.totalShards }}
npx turbo test:ui:ci -F @iot-app-kit/${{ matrix.package.name }} -- --shard=${{ matrix.package.shardIndex }}/${{ matrix.package.totalShards }}

- name: Test report
id: upload-test-report
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ npm-debug.log
*.sublime-project
*.sublime-workspace
*.docx
*.tgz

.idea/
.vscode/
Expand Down
11 changes: 0 additions & 11 deletions .stylelintignore

This file was deleted.

2 changes: 2 additions & 0 deletions apps/dev-env/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
storybook-static
.turbo
.cache
24 changes: 23 additions & 1 deletion apps/dev-env/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
const base = require('@iot-app-kit/eslint-config');

// The pattern of manual merging is repeated in the .eslintrc.cjs files across
// the repo. Since we are using lodash-es, merge cannot be imported in this CJS
// file.

// TODO: Replace manual merging in ESLint config files. Consider migration to
// the latest ESLint which uses ESM.

module.exports = {
...base,
root: true,
extends: ['iot-app-kit'],
settings: {
...base.settings,
'import/resolver': {
...base.settings['import/resolver'],
typescript: {
...base.settings['import/resolver'].typescript,
project: ['apps/dev-env/tsconfig.json'],
},
node: {
project: ['apps/dev-env/tsconfig.json'],
},
},
},
};
13 changes: 8 additions & 5 deletions apps/dev-env/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{
"name": "@iot-app-kit/dev-env",
"version": "12.2.1",
"private": true,
"type": "module",
"scripts": {
"start": "npm run dev",
"clean": "rimraf storybook-static .turbo .cache test-results playwright-report",
"clean:nuke": "npm run clean && rimraf node_modules",
"dev": "storybook dev -p 6006",
"clean": "npx rimraf storybook-static .cache test-results playwright-report",
"clean:turbo": "npx rimraf .turbo",
"clean:nuke": "npm run clean && npm run clean:turbo && npx rimraf node_modules",
"dev": "NODE_OPTIONS='--import tsx/esm' storybook dev -p 6006",
"lint": "eslint . --max-warnings=0 --cache --cache-location .cache/eslint/ & tsc --noEmit",
"fix": "eslint --fix . --cache --cache-location ./cache/eslint/",
"test:ui": "npx playwright test",
"test:ui:ci": "npx playwright test",
"test:ui:ci": "NODE_OPTIONS='-C @iot-app-kit/development' npx playwright test",
"test:ui:watch": "npx playwright test --ui"
},
"dependencies": {
Expand All @@ -22,7 +24,9 @@
"@iot-app-kit/core-util": "*",
"@iot-app-kit/dashboard": "*",
"@iot-app-kit/data-mocked": "*",
"@iot-app-kit/eslint-config": "*",
"@iot-app-kit/helpers": "*",
"@iot-app-kit/react-components": "*",
"@iot-app-kit/ts-config": "*",
"@playwright/test": "^1.48.2",
"@storybook/addon-essentials": "^8.4.5",
Expand All @@ -34,7 +38,6 @@
"@types/lodash-es": "^4.17.12",
"@types/node": "^18.16.18",
"@vitejs/plugin-react": "^4.3.3",
"eslint-config-iot-app-kit": "*",
"lodash-es": "^4.17.21",
"msw-storybook-addon": "^2.0.4",
"react": "^18.2.0",
Expand Down
5 changes: 1 addition & 4 deletions apps/dev-env/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
MINUTE_IN_MS,
SECOND_IN_MS,
} from '@iot-app-kit/helpers/constants/time';
import { MINUTE_IN_MS, SECOND_IN_MS } from '@iot-app-kit/helpers';
import { defineConfig, devices } from '@playwright/test';

/**
Expand Down
2 changes: 0 additions & 2 deletions apps/dev-env/stories/dashboard/sitewise-dashboard.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,12 @@ type Story = StoryObj<typeof Dashboard>;

export const Main: Story = {
render: (_story, { args }) => {
// eslint-disable-next-line react-hooks/rules-of-hooks
const [initialViewMode, setInitialViewMode] = useState<'preview' | 'edit'>(
'edit'
);

// on save not only updates local storage but forces the dashboard to reload given the updated config
// this is done to more realistically match the dashboard implementation in iot-application
// eslint-disable-next-line react-hooks/rules-of-hooks
const onSave = useCallback(
async (
dashboard: DashboardConfiguration,
Expand Down
2 changes: 1 addition & 1 deletion apps/dev-env/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@iot-app-kit/ts-config/tsconfig.base.json",
"include": [".storybook", "stories", "msw"],
"include": [".storybook", "stories", "msw", "e2e"],
"compilerOptions": {
"types": ["vite/client"]
}
Expand Down
5 changes: 4 additions & 1 deletion apps/dev-env/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
resolve: {
conditions: ['@iot-app-kit/development'],
},
plugins: [react()],
});
6 changes: 6 additions & 0 deletions apps/doc-site/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const base = require('@iot-app-kit/eslint-config');

module.exports = {
...base,
root: true,
};
4 changes: 0 additions & 4 deletions apps/doc-site/.eslintrc.js

This file was deleted.

9 changes: 5 additions & 4 deletions apps/doc-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@
"scripts": {
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"clean": "rimraf storybook-static .turbo",
"clean:nuke": "npm run clean && rimraf node_modules",
"clean": "npx rimraf storybook-static",
"clean:turbo": "npx rimraf .turbo",
"clean:nuke": "npm run clean && npm run clean:turbo && npx rimraf node_modules",
"start": "storybook dev -p 6006",
"dev": "npm start",
"build": "storybook build",
"lint": "eslint --max-warnings=0 --cache --cache-location .cache/eslint/",
"fix": "eslint --fix . --cache --cache-location .cache/eslint/"
},
"devDependencies": {
"@iot-app-kit/testing-util": "12.2.1",
"@iot-app-kit/eslint-config": "*",
"@iot-app-kit/testing-util": "*",
"@storybook/addon-essentials": "^8.4.5",
"@storybook/addon-interactions": "^8.4.5",
"@storybook/addon-links": "^8.4.5",
Expand All @@ -26,7 +28,6 @@
"@storybook/theming": "^8.4.5",
"@types/node": "^18.16.18",
"@vitejs/plugin-react": "^4.3.3",
"eslint-config-iot-app-kit": "12.2.1",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
4 changes: 3 additions & 1 deletion configuration/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ module.exports = {
pragma: 'h',
},
'import/resolver': {
typescript: true,
typescript: {
conditionNames: ['@iot-app-kit/development'],
},
node: true,
},
},
Expand Down
Loading
Loading