# FixtureJS

Tool for creating projects inside GoodData platform programmatically in node.js

## Usage

1. Add package to your project

    **Using npm**

    `npm install @gooddata/fixtures`

    **Using yarn**

    `yarn add @gooddata/fixtures`

2. Import the module inside your project

    ```javascript
    import { createFixture } from '@gooddata/fixtures';
    ```

3. Use the `createFixture function`

    ```javascript
    createFixture(basePath, username, password, hostname, authorizationToken, projectTitle)
    ```

4. Use TIGER function

    ```javascript
    createTigerWorkspace(workspaceTitle, token, host, backend)
    createTigerWorkspaceWithPrefix(workspacePrefix, token, host, backend)
    defaultScanPublishPDMForDatasource(dataSourceId, token, host, backend)
    setTigerWorkspaceLayout(workspaceId, token, host, backend, declarativeWorkspaceModel)
    setTigerWorkspaceLayoutFromFixtures(workspaceId, fixtureType, dataSource, token, host, backend)
    createMdObjects(configPath, workspaceId, token, host, backend)
    deleteTigerWorkspace(workspaceId, token, host, backend)
    cleanupExpiredTigerWorkspaces(workspacePrefix, timeExpired, includeWS, sizeWS, token, host, backend)
    ```

## Development

Install [Node.js](http://nodejs.org) (node 12.16.1, npm v6.13.4) and [Yarn](https://classic.yarnpkg.com) 1.22.4.

Install dependencies:
```
yarn install --frozen-lockfile
```

## Release

  1. Switch to master branch `git checkout master`
  2. Synchronize from upstream `git tag -l | xargs git tag -d; git fetch upstream; git reset --hard upstream/develop`
  3. Create new version `npm version [major|minor|patch] -m "Release v%s"`
  4. Create pull-request to the `develop` branch with the changes which previous command created (updated version in package.js)
  5. Release `npm publish --access=restricted`
