ActionableAgile / jira-to-analytics

This code extracts data from Jira based on a yaml config file, and outputs a properly formatted CSV that can be read by the ActionableAgile Analytics tool.
https://www.actionableagile.com
GNU General Public License v2.0
57 stars 36 forks source link

Use tool as npm module #30

Closed haynzz closed 7 years ago

haynzz commented 7 years ago

Hi, I am trying to build a wrapper around the tool so that I can use it in an automated environment. I don't want to fork the source and manipulate it. I have managed to include the latest beta release as npm module into my project. When I try to build it, it throws errors. I basically try to run the same code that the cli.ts runs without the whole lean-kit stuff.

$ tsc
index.ts(94,2): error TS2346: Supplied parameters do not match any signature of call target.
node_modules/actionableagileimporttool/dist/lib/core/work-item.d.ts(1,35): error TS2304: Cannot find name 'IWorkItem'.
node_modules/actionableagileimporttool/dist/lib/extractors/jira/extractor.d.ts(2,13): error TS2304: Cannot find name 'IJiraSettings'.
node_modules/actionableagileimporttool/dist/lib/extractors/jira/extractor.d.ts(4,26): error TS2304: Cannot find name 'IJiraSettings'.
node_modules/actionableagileimporttool/dist/lib/extractors/jira/extractor.d.ts(5,18): error TS2304: Cannot find name 'IJiraSettings'.
node_modules/actionableagileimporttool/dist/lib/extractors/jira/extractor.d.ts(8,47): error TS2304: Cannot find name 'IWorkItem'.
node_modules/actionableagileimporttool/dist/lib/extractors/jira/extractor.d.ts(9,69): error TS2304: Cannot find name 'IWorkItem'.
node_modules/actionableagileimporttool/dist/lib/extractors/leankit/extractor.d.ts(1,1): error TS6053: File '/Users/fcheraghi/Repos/mse_kpi_w_submodules/node_modules/actionableagileimporttool/src/lib/extractors/leankit/leankit-mock-typings.d.ts' not found.
node_modules/actionableagileimporttool/dist/lib/extractors/leankit/extractor.d.ts(5,13): error TS2304: Cannot find name 'ILeanKitSettings'.
node_modules/actionableagileimporttool/dist/lib/extractors/leankit/extractor.d.ts(6,26): error TS2304: Cannot find name 'ILeanKitSettings'.
node_modules/actionableagileimporttool/dist/lib/extractors/leankit/extractor.d.ts(9,19): error TS2304: Cannot find name 'ILeanKitSettings'.

This is the code from line 94 (see first error):

(async function(args: any): Promise<void> {
  try {
    await run(args);
  } catch (e) {
    log(`Error running ActionableAgile Command Line Tool`);
    log(e);
  }
}());

Is there a way to get this running? I have to admit I have 0 experience with Typescript.

johnrjj commented 7 years ago

Hey! Thanks for opening this issue. I went ahead and refactored the code to support consuming this tool outside of the repository.

Try to install the updated version of the actionableagileimporttool by npm install-ing again:

npm install actionableagileimporttool@0.6.0 --save

You should now be able to import the JiraExtractor (and compile!)

// inside typescript file
import { JiraExtractor } from 'actionableagileimporttool';

Note: If you'd rather not use TypeScript, you don't have to, as this library also works in plain javascript. (But having types is always nice since they're already provided)!

haynzz commented 7 years ago

@johnrjj Thanks for the really quick and valuable reaction! It really just worked. I don't completely get why I have to run tsc index.ts and not just tsc. And why I keep getting so many errors/warning. But as long as it works, I am happy!

Just FYI, I get these logs when building:

$ tsc index.ts 
node_modules/@types/isomorphic-fetch/index.d.ts(57,20): error TS2304: Cannot find name 'Promise'.
node_modules/@types/isomorphic-fetch/index.d.ts(58,13): error TS2304: Cannot find name 'Promise'.
node_modules/@types/isomorphic-fetch/index.d.ts(59,17): error TS2304: Cannot find name 'Promise'.
node_modules/@types/isomorphic-fetch/index.d.ts(60,13): error TS2304: Cannot find name 'Promise'.
node_modules/@types/isomorphic-fetch/index.d.ts(61,16): error TS2304: Cannot find name 'Promise'.
node_modules/@types/isomorphic-fetch/index.d.ts(62,13): error TS2304: Cannot find name 'Promise'.
node_modules/@types/isomorphic-fetch/index.d.ts(67,20): error TS2304: Cannot find name 'Promise'.
node_modules/@types/isomorphic-fetch/index.d.ts(68,13): error TS2304: Cannot find name 'Promise'.
node_modules/@types/isomorphic-fetch/index.d.ts(69,17): error TS2304: Cannot find name 'Promise'.
node_modules/@types/isomorphic-fetch/index.d.ts(70,13): error TS2304: Cannot find name 'Promise'.
node_modules/@types/isomorphic-fetch/index.d.ts(71,16): error TS2304: Cannot find name 'Promise'.
node_modules/@types/isomorphic-fetch/index.d.ts(72,13): error TS2304: Cannot find name 'Promise'.
node_modules/@types/isomorphic-fetch/index.d.ts(143,14): error TS2304: Cannot find name 'Promise'.
node_modules/@types/isomorphic-fetch/index.d.ts(171,14): error TS2304: Cannot find name 'Promise'.
node_modules/@types/isomorphic-fetch/index.d.ts(177,50): error TS2304: Cannot find name 'Promise'.
node_modules/actionableagileimporttool/dist/lib/extractors/jira/extractor.d.ts(10,39): error TS2304: Cannot find name 'Promise'.
node_modules/actionableagileimporttool/dist/lib/extractors/jira/extractor.d.ts(11,61): error TS2304: Cannot find name 'Promise'.
node_modules/actionableagileimporttool/dist/lib/extractors/leankit/extractor.d.ts(8,22): error TS2304: Cannot find name 'Promise'.
node_modules/actionableagileimporttool/dist/lib/extractors/leankit/extractor.d.ts(9,44): error TS2304: Cannot find name 'Promise'.
node_modules/actionableagileimporttool/dist/lib/extractors/leankit/extractor.d.ts(10,40): error TS2304: Cannot find name 'Promise'.
node_modules/actionableagileimporttool/dist/lib/extractors/leankit/extractor.d.ts(14,19): error TS2304: Cannot find name 'Promise'.
index.ts(21,7): error TS2304: Cannot find name 'Promise'.
index.ts(31,13): error TS1311: Async functions are only available when targeting ECMAScript 2015 or higher.
index.ts(31,43): error TS2304: Cannot find name 'Promise'.
index.ts(94,2): error TS1311: Async functions are only available when targeting ECMAScript 2015 or higher.
index.ts(94,29): error TS2304: Cannot find name 'Promise'.
jessicakryan commented 6 years ago

Hi, are there any instructions on how to use this as a imported module? Also is extraction as JSON supported? Cheers