diff --git a/packages/grafana-ui/package.json b/packages/grafana-ui/package.json index e3c407b500a..73eff40d3d7 100644 --- a/packages/grafana-ui/package.json +++ b/packages/grafana-ui/package.json @@ -1,11 +1,15 @@ { - "name": "grafana-ui", + "name": "@grafana/ui", "version": "1.0.0", "description": "", - "main": "index.ts", + "main": "dist/index.js", + "types": "dist/types", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "tsc --noEmit" }, "author": "", - "license": "ISC" + "license": "ISC", + "devDependencies": { + "typescript": "^3.2.2" + } } diff --git a/packages/grafana-ui/index.ts b/packages/grafana-ui/src/index.ts similarity index 63% rename from packages/grafana-ui/index.ts rename to packages/grafana-ui/src/index.ts index 4beb45d6fb3..015fff3bca8 100644 --- a/packages/grafana-ui/index.ts +++ b/packages/grafana-ui/src/index.ts @@ -1,11 +1,16 @@ +export { Other } from './other'; +import { TimeSeries } from '../types'; + export class Google { + data: TimeSeries; + hello() { return 'hello'; } } class Singleton { - constructor(private state) {} + constructor(private state: string) {} hello() { return this.state; diff --git a/packages/grafana-ui/src/other.ts b/packages/grafana-ui/src/other.ts new file mode 100644 index 00000000000..cbc1390dd05 --- /dev/null +++ b/packages/grafana-ui/src/other.ts @@ -0,0 +1,5 @@ +export class Other { + static hello() { + return "hello from other"; + } +} diff --git a/packages/grafana-ui/tsconfig.json b/packages/grafana-ui/tsconfig.json new file mode 100644 index 00000000000..f9e577c23d0 --- /dev/null +++ b/packages/grafana-ui/tsconfig.json @@ -0,0 +1,36 @@ +{ + "include": [ + "src/**/*.ts", + "src/**/*.tsx" + ], + "exclude": [ + "dist" + ], + "scripts": { + "build": "tsc" + }, + "compilerOptions": { + "moduleResolution": "node", + "target": "es5", + "lib": ["es6", "dom"], + "jsx": "react", + "module": "esnext", + "outDir": "dist", + "declaration": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "importHelpers": true, + "noEmitHelpers": true, + "removeComments": false, + "inlineSourceMap": false, + "sourceMap": true, + "noEmitOnError": false, + "emitDecoratorMetadata": false, + "experimentalDecorators": true, + "declaration": true, + "declarationDir": "./dist/types", + "noImplicitAny": true, + "strictNullChecks": true + } +} diff --git a/packages/grafana-ui/types/index.ts b/packages/grafana-ui/types/index.ts new file mode 100644 index 00000000000..ed86915b4cf --- /dev/null +++ b/packages/grafana-ui/types/index.ts @@ -0,0 +1,4 @@ + +export interface TimeSeries { + name: string; +} diff --git a/public/app/features/dashboard/dashgrid/VisualizationTab.tsx b/public/app/features/dashboard/dashgrid/VisualizationTab.tsx index 42d9bf6a6eb..53364502383 100644 --- a/public/app/features/dashboard/dashgrid/VisualizationTab.tsx +++ b/public/app/features/dashboard/dashgrid/VisualizationTab.tsx @@ -15,6 +15,7 @@ import { PanelOptionSection } from './PanelOptionSection'; import { PanelModel } from '../panel_model'; import { DashboardModel } from '../dashboard_model'; import { PanelPlugin } from 'app/types/plugins'; +import { TimeSeries } from '@grafana/ui/types'; interface Props { panel: PanelModel; diff --git a/public/app/features/plugins/plugin_loader.ts b/public/app/features/plugins/plugin_loader.ts index 97e35ab5631..2c394cb77e7 100644 --- a/public/app/features/plugins/plugin_loader.ts +++ b/public/app/features/plugins/plugin_loader.ts @@ -26,7 +26,7 @@ import * as ticks from 'app/core/utils/ticks'; import impressionSrv from 'app/core/services/impression_srv'; import builtInPlugins from './built_in_plugins'; import * as d3 from 'd3'; -import * as grafanaUI from 'grafana-ui'; +import * as grafanaUI from '@grafana/ui'; // rxjs import { Observable } from 'rxjs/Observable'; diff --git a/yarn.lock b/yarn.lock index 9bc6c7dcd63..ecdc347c4f5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14544,6 +14544,11 @@ typescript@^3.0.3: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.1.1.tgz#3362ba9dd1e482ebb2355b02dfe8bcd19a2c7c96" integrity sha512-Veu0w4dTc/9wlWNf2jeRInNodKlcdLgemvPsrNpfu5Pq39sgfFjvIIgTsvUHCoLBnMhPoUA+tFxsXjU6VexVRQ== +typescript@^3.2.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.2.tgz#fe8101c46aa123f8353523ebdcf5730c2ae493e5" + integrity sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg== + ua-parser-js@^0.7.18: version "0.7.19" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.19.tgz#94151be4c0a7fb1d001af7022fdaca4642659e4b"