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

fix: packages #3092

Merged
merged 1 commit into from
Dec 10, 2024
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
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
source-iotsitewise,
source-iottwinmaker,
tools-iottwinmaker,
vite-config,
]
steps:
- name: Checkout
Expand Down Expand Up @@ -113,7 +114,7 @@ jobs:
${{ runner.os }}-test-lint-${{ matrix.package}}-

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

playwright:
needs: repo
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'],
},
},
},
};
12 changes: 7 additions & 5 deletions apps/dev-env/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"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 .turbo .cache test-results playwright-report",
"clean:nuke": "npm run clean && 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 +23,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 +37,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.

8 changes: 4 additions & 4 deletions apps/doc-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
"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 .turbo",
"clean:nuke": "npm run clean && 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 +27,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
14 changes: 7 additions & 7 deletions configuration/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "eslint-config-iot-app-kit",
"name": "@iot-app-kit/eslint-config",
"version": "12.2.1",
"main": "index.js",
"private": true,
"files": [
"index.js"
],
"exports": {
".": "./index.js"
},
"scripts": {
"clean:nuke": "rimraf node_modules"
"clean:nuke": "npx rimraf node_modules"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.60.0",
Expand All @@ -31,6 +32,5 @@
"@types/node": "^18.16.18",
"eslint-import-resolver-typescript": "^3.6.0",
"typescript": "^5.5.4"
},
"version": "12.2.1"
}
}
12 changes: 5 additions & 7 deletions configuration/ts-config/package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
{
"name": "@iot-app-kit/ts-config",
"type": "module",
"version": "12.2.1",
"private": true,
"type": "module",
"files": [
"tsconfig.base.json",
"tsconfig.cjs.json",
"tsconfig.esm.json"
"tsconfig.base.json"
],
"scripts": {
"clean:nuke": "rimraf node_modules"
"clean:nuke": "npx rimraf node_modules"
},
"devDependencies": {
"@types/node": "^18.16.18",
"rimraf": "^5.0.1",
"typescript": "^5.5.4"
},
"version": "12.2.1"
}
}
10 changes: 7 additions & 3 deletions configuration/ts-config/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"declaration": true,
"declarationDir": "dist",
"declarationMap": true,
"sourceMap": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
Expand All @@ -18,6 +20,8 @@
"module": "ESNext",
"moduleResolution": "bundler",
"target": "ESNEXT",
"jsx": "react-jsx"
"jsx": "react-jsx",
/* Flag used to import local package types directly from source during development. */
"customConditions": ["@iot-app-kit/development"]
}
}
10 changes: 0 additions & 10 deletions configuration/ts-config/tsconfig.build.json

This file was deleted.

8 changes: 0 additions & 8 deletions configuration/ts-config/tsconfig.cjs.json

This file was deleted.

7 changes: 0 additions & 7 deletions configuration/ts-config/tsconfig.esm.json

This file was deleted.

19 changes: 19 additions & 0 deletions configuration/vite-config/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const base = require('@iot-app-kit/eslint-config');

module.exports = {
...base,
root: true,
settings: {
...base.settings,
'import/resolver': {
...base.settings['import/resolver'],
typescript: {
...base.settings['import/resolver'].typescript,
project: ['configuration/vite-config/tsconfig.json'],
},
node: {
project: ['configuration/vite-config/tsconfig.json'],
},
},
},
};
37 changes: 37 additions & 0 deletions configuration/vite-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@iot-app-kit/vite-config",
"version": "12.2.1",
"private": true,
"type": "module",
"exports": {
"./definePackageConfig": "./src/definePackageConfig.ts"
},
"bin": {
"iot-prepack": "./src/scripts/prepack.ts",
"iot-postpack": "./src/scripts/postpack.ts"
},
"scripts": {
"clean": "npx rimraf .cache .turbo",
"clean:nuke": "npm run clean && npx rimraf node_modules",
"lint": "eslint . --max-warnings=0 --cache --cache-location .cache/eslint/ & tsc --noEmit",
"fix": "eslint --fix . --cache --cache-location ./cache/eslint/",
"test:typescript": "tsc --noEmit"
},
"devDependencies": {
"@iot-app-kit/eslint-config": "*",
"@iot-app-kit/ts-config": "*",
"@types/fs-extra": "^11.0.4",
"@types/node": "^18.16.18",
"rimraf": "^5.0.1"
},
"dependencies": {
"fs-extra": "^11.2.0",
"lodash-es": "^4.17.21",
"rollup-plugin-copy": "^3.5.0",
"tiny-invariant": "^1.3.1",
"type-fest": "^4.28.1",
"typescript": "^5.5.4",
"vite": "^5.4.11",
"vite-plugin-dts": "^4.3.0"
}
}
Loading
Loading