Skip to content

Commit

Permalink
fix: internal packages
Browse files Browse the repository at this point in the history
  • Loading branch information
tracy-french committed Dec 9, 2024
1 parent 65c2024 commit 078ac95
Show file tree
Hide file tree
Showing 377 changed files with 3,579 additions and 16,748 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,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
11 changes: 0 additions & 11 deletions .stylelintignore

This file was deleted.

17 changes: 16 additions & 1 deletion apps/dev-env/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
const base = require('@iot-app-kit/eslint-config');

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'],
},
},
},
};
10 changes: 6 additions & 4 deletions apps/dev-env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"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",
"lint": "eslint . --max-warnings=0 --cache --cache-location .cache/eslint/ & tsc --noEmit",
"dev": "NODE_OPTIONS='--import tsx/esm' storybook dev -p 6006",
"lint": "eslint . --max-warnings=0 --cache --cache-location .cache/eslint/",
"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,8 +22,11 @@
"@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": "*",
"@iot-app-kit/vite-config": "*",
"@playwright/test": "^1.48.2",
"@storybook/addon-essentials": "^8.4.5",
"@storybook/addon-interactions": "^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: 3 additions & 2 deletions apps/dev-env/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { definePackageConfig } from '@iot-app-kit/vite-config/definePackageConfig';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';

// https://vitejs.dev/config/
export default defineConfig({
export default definePackageConfig({
iotAppKitPackage: { dirname: __dirname },
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.

4 changes: 2 additions & 2 deletions apps/doc-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"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
12 changes: 6 additions & 6 deletions configuration/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"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"
},
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"
}
}
28 changes: 28 additions & 0 deletions configuration/packaging/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@iot-app-kit/packaging",
"version": "12.2.1",
"private": true,
"files": [
"dist"
],
"type": "module",
"exports": {
".": "./src/prepack.cts"
},
"scripts": {
"clean": "rimraf .cache .turbo",
"clean:nuke": "npm run clean && rimraf node_modules"
},
"devDependencies": {
"@iot-app-kit/eslint-config": "*",
"@iot-app-kit/ts-config": "*",
"@types/node": "^18.16.18",
"fs-extra": "^11.2.0",
"lodash-es": "^4.17.21",
"rimraf": "^5.0.1",
"rollup-plugin-copy": "^3.5.0",
"typescript": "^5.5.4",
"vite": "^5.4.11",
"vite-plugin-dts": "^4.3.0"
}
}
21 changes: 21 additions & 0 deletions configuration/packaging/src/postpack.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env -S npx tsx
import * as fse from 'fs-extra';

function postpack() {
const sharedDependencies = process.argv.slice(2);

revertSharedPackageVersions(sharedDependencies);
}

function revertSharedPackageVersions(sharedDependencies: string[]) {
const packageJsonPath = './package.json';
const packageJson = fse.readJSONSync(packageJsonPath);

sharedDependencies.forEach((dep) => {
packageJson.dependencies[`@iot-app-kit/${dep}`] = '*';
});

fse.writeJSONSync(packageJsonPath, packageJson, { spaces: 2 });
}

postpack();
22 changes: 22 additions & 0 deletions configuration/packaging/src/prepack.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env -S npx tsx
import * as fse from 'fs-extra';

function prepack() {
const sharedDependencies = process.argv.slice(2);

setSharedPackageVersions(sharedDependencies);
}

function setSharedPackageVersions(sharedDependencies: string[]) {
const packageJsonPath = './package.json';
const packageJson = fse.readJSONSync(packageJsonPath);
console.log(packageJson);

sharedDependencies.forEach((dep) => {
packageJson.dependencies[`@iot-app-kit/${dep}`] = `file:./dist/${dep}`;
});

fse.writeJSONSync(packageJsonPath, packageJson, { spaces: 2 });
}

prepack();
5 changes: 5 additions & 0 deletions configuration/packaging/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@iot-app-kit/ts-config/tsconfig.base.json",
"include": ["src"]
}
10 changes: 4 additions & 6 deletions configuration/ts-config/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"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"
Expand All @@ -14,6 +13,5 @@
"@types/node": "^18.16.18",
"rimraf": "^5.0.1",
"typescript": "^5.5.4"
},
"version": "12.2.1"
}
}
9 changes: 6 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,7 @@
"module": "ESNext",
"moduleResolution": "bundler",
"target": "ESNEXT",
"jsx": "react-jsx"
"jsx": "react-jsx",
"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'],
},
},
},
};
30 changes: 30 additions & 0 deletions configuration/vite-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "@iot-app-kit/vite-config",
"private": true,
"type": "module",
"exports": {
"./definePackageConfig": "./src/definePackageConfig.ts"
},
"scripts": {
"clean": "rimraf .cache .turbo",
"clean:nuke": "npm run clean && rimraf node_modules",
"lint": "eslint . --max-warnings=0 --cache --cache-location .cache/eslint/",
"fix": "eslint --fix . --cache --cache-location ./cache/eslint/",
"test:typescript": "tsc --noEmit"
},
"devDependencies": {
"@iot-app-kit/eslint-config": "*",
"@iot-app-kit/ts-config": "*",
"@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",
"typescript": "^5.5.4",
"vite": "^5.4.11",
"vite-plugin-dts": "^4.3.0"
}
}
Loading

0 comments on commit 078ac95

Please sign in to comment.