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

ui-trackoccupancydiagram: setup sub-repo #714

Merged
merged 1 commit into from
Nov 20, 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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"ui-warped-map",
"ui-manchette",
"ui-manchette-with-spacetimechart",
"ui-trackoccupancydiagram",
"storybook"
],
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions storybook/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { mergeConfig } from 'vite';
/** @type { import('@storybook/html-vite').StorybookConfig } */
const config: StorybookConfig = {
stories: [
'../stories/**/stories.ts',
'../../**/src/**/*.mdx',
// TODO: remove this when every stories are migrated to `@osrd-project/stroybook/stories/`
'../../**/src/**/*.stories.@(js|jsx|mjs|ts|tsx)',
'../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)',
],
addons: [
getAbsolutePath('@storybook/addon-links'),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from 'react';

import type { Meta, StoryObj } from '@storybook/react';

import {
TrackOccupancyManchette,
TrackOccupancyCanvas,
} from '../../../ui-trackoccupancydiagram/src/index';

const TrackOccupancyDiagram = () => (
<div>
<TrackOccupancyManchette />
<TrackOccupancyCanvas />
</div>
);

const meta: Meta<typeof TrackOccupancyDiagram> = {
title: 'TrackOccupancyDiagram/Rendering',
component: TrackOccupancyDiagram,
decorators: [(Story) => <Story />],
parameters: {
layout: 'centered',
backgrounds: {
default: 'dark',
},
},
args: {},

render: () => <TrackOccupancyDiagram />,
tags: ['autodocs'],
};

export default meta;

type Story = StoryObj<typeof TrackOccupancyDiagram>;

export const TrackOccupancyDiagramStoryDefault: Story = {
args: {},
};
3 changes: 0 additions & 3 deletions storybook/stories/just-a-test.mdx

This file was deleted.

4 changes: 2 additions & 2 deletions storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"extends": "../tsconfig.base.json",
"include": [".storybook/*.tsx", "./stories/**/*"],
"include": [".storybook/*.tsx", "stories/**/*"],
"compilerOptions": {
"rootDir": "./src",
"rootDir": "../",
"outDir": "./dist",
"declarationDir": "./dist"
}
Expand Down
Empty file.
58 changes: 58 additions & 0 deletions ui-trackoccupancydiagram/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "@osrd-project/ui-trackoccupancydiagram",
"version": "0.0.1-dev",
"license": "LGPL-3.0-or-later",
"bugs": "https://github.com/osrd-project/osrd-ui/issues",
"repository": {
"type": "git",
"url": "https://github.com/osrd-project/osrd-ui.git",
"directory": "ui-trackoccupancydiagram"
},
"publishConfig": {
"access": "public"
},
"type": "module",
"module": "./dist/index.esm.js",
"types": "./dist/index.d.ts",
"main": "./dist/index.esm.js",
"style": "dist/theme.css",
"files": [
"/dist"
],
"exports": {
"./dist/theme.css": "./dist/theme.css",
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.esm.js"
}
},
"scripts": {
"rollup": "rollup -c",
"clean": "rimraf dist",
"build": "npm run rollup",
"watch": "NODE_ENV=development rollup -c -w",
"test": "vitest run --dir src/__tests__",
"prepublishOnly": "npm run clean && npm run build",
"lint": "eslint src --max-warnings 0",
"lint:fix": "eslint src --fix"
},
"dependencies": {
"@types/chroma-js": "^2.4.4",
"chroma-js": "^3.1.1",
"classnames": "^2.5.1",
"tailwindcss": "^3.4.1"
},
"peerDependencies": {
"react": ">=18.0"
},
"devDependencies": {
"autoprefixer": "^10.4.17",
"postcss": "^8.4.37",
"postcss-assets": "^6.0.0",
"postcss-import": "^16.0.0",
"postcss-preset-env": "^10.0.5",
"rollup-plugin-livereload": "^2.0.5",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-serve": "^1.1.1"
}
}
3 changes: 3 additions & 0 deletions ui-trackoccupancydiagram/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import generateBaseRollupConfig from '../rollup-base.config.js';

export default generateBaseRollupConfig('osrdTrackOccupancyDiagram', ['react']);
7 changes: 7 additions & 0 deletions ui-trackoccupancydiagram/src/__tests__/utils.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { describe, expect, it } from 'vitest';

describe('test to remove', () => {
it('should return the good value', () => {
expect(1 + 1).toEqual(2);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';

const TrackOccupancyCanvas = () => <div>TrackOccupancyCanvas</div>;

export default TrackOccupancyCanvas;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';

const TrackOccupancyManchette = () => <div>TrackOccupancyManchette</div>;

export default TrackOccupancyManchette;
5 changes: 5 additions & 0 deletions ui-trackoccupancydiagram/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import '@osrd-project/ui-core/dist/theme.css';
import './styles/main.css';

export { default as TrackOccupancyCanvas } from './components/TrackOccupancyCanvas';
export { default as TrackOccupancyManchette } from './components/TrackOccupancyManchette';
3 changes: 3 additions & 0 deletions ui-trackoccupancydiagram/src/styles/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
6 changes: 6 additions & 0 deletions ui-trackoccupancydiagram/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import osrdUiPreset from '../tailwind-preset.js';
/** @type {import('tailwindcss').Config} */
export default {
presets: [osrdUiPreset],
content: ['./src/**/*.{js,jsx,ts,tsx}'],
};
10 changes: 10 additions & 0 deletions ui-trackoccupancydiagram/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../tsconfig.base.json",
"include": ["./src/**/*"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
"declarationDir": "./dist",
"typeRoots": ["./node_modules/@types", "../raw.d.ts"]
}
}
Loading