Skip to content

Commit 7f3e9eb

Browse files
authored
Merge pull request #328 from IQSS/release/1.0.0
Update develop branch with release branch changes
2 parents cebb64c + 8a9fd46 commit 7f3e9eb

File tree

12 files changed

+237
-139
lines changed

12 files changed

+237
-139
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## What did you expect to happen?
88

9-
## Which version of js-dataverse are you using?
9+
## Which version of dataverse-client-javascript are you using?
1010

1111
## Any related open or closed issues to this bug report?
1212

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
## What existing behavior do you want changed?
66

7-
## Any brand new behavior do you want to add to js-dataverse?
7+
## Any brand new behavior do you want to add to dataverse-client-javascript?
88

99
## Any open or closed issues related to this feature request?

.npmrc.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# NPM Package Registry
2+
//registry.npmjs.org/:_authToken=<YOUR_NPM_AUTH_TOKEN>
3+
@iqss:registry=https://registry.npmjs.org/

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contributing to js-dataverse
1+
# Contributing to dataverse-client-javascript
22

33
First of all thank you very much for your interest in contributing to this project!
44

README.md

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,49 @@
1-
# js-dataverse
1+
## Dataverse JavaScript Client
22

3-
[![npm](https://img.shields.io/npm/v/js-dataverse.svg)](https://www.npmjs.com/package/js-dataverse)
3+
![NPM Version](https://img.shields.io/npm/v/%40iqss%2Fdataverse-client-javascript)
44

5-
A JavaScript/TypeScript API wrapper for [Dataverse](http://guides.dataverse.org/en/latest/api/).
5+
The Dataverse JavaScript Client is an open-source package that provides a set of use-case-driven functions to interact with the [Dataverse API](http://guides.dataverse.org/en/latest/api/). Designed around Domain-Driven Design (DDD) principles, this package offers a structured, high-level interface to perform actions like retrieving datasets, managing collections, uploading files, and more.
66

7-
- [Installation](./docs/installation.md)
8-
- [Use Cases](./docs/useCases.md)
9-
- [Local Development](./docs/localDevelopment.md)
10-
- [Contributing](./CONTRIBUTING.md)
11-
- [License](./LICENSE)
7+
This package is part of the Dataverse Frontend ecosystem and is intended to be used by applications or services that integrate with the Dataverse platform.
8+
9+
## Features
10+
11+
- **Use case-centric API functions** – Organized around domain-specific actions like `getDataset`, `createCollection`, or `restrictFile`.
12+
- **TypeScript-first** – All use cases include strong typings for inputs and outputs, improving developer experience.
13+
14+
## Installation
15+
16+
Install the package via npm:
17+
18+
```bash
19+
npm install @iqss/dataverse-client-javascript
20+
```
21+
22+
## Usage
23+
24+
```typescript
25+
import { getDataset } from '@iqss/dataverse-client-javascript'
26+
27+
/* ... */
28+
29+
const datasetIdentifier = 'doi:10.77777/FK2/AAAAAA'
30+
const datasetVersion = '1.0'
31+
32+
getDataset.execute(datasetIdentifier, datasetVersion).then((dataset: Dataset) => {
33+
/* ... */
34+
})
35+
36+
/* ... */
37+
```
38+
39+
For detailed information about available use cases see [Use Cases Docs](https://github.com/IQSS/dataverse-client-javascript/blob/main/docs/useCases.md).
40+
41+
For detailed information about usage see [Usage Docs](https://github.com/IQSS/dataverse-client-javascript/blob/main/docs/usage.md).
42+
43+
## Contributing
44+
45+
Want to add a new use case or improve an existing one? Please check the [Contributing](https://github.com/IQSS/dataverse-client-javascript/blob/main/CONTRIBUTING.md) section.
46+
47+
## License
48+
49+
This project is open source and available under the [MIT License](https://github.com/IQSS/dataverse-client-javascript/blob/main/LICENSE).

docs/installation.md

Lines changed: 0 additions & 124 deletions
This file was deleted.

docs/localDevelopment.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,21 @@ Fix linting checks on the code:
117117
```bash
118118
npm run lint:fix
119119
```
120+
121+
## Development Versions of this package
122+
123+
Two different versions are being pushed to the GitHub Packages registry:
124+
125+
1. **PR-Generated Versions**:
126+
127+
- These versions are generated from pull request commits.
128+
- They follow the structure `<current_package_version>-pr<pr_number>.<commit_hash>`, where `pr_number` is the number of the pull request, and `commit_hash` is the specific commit hash from the PR branch.
129+
- These versions are unstable and correspond to the state of the package during the pull request.
130+
131+
2. **Develop Alpha Versions**:
132+
- These versions are generated on every commit made to the `develop` branch, ideally after each pull request is merged.
133+
- They follow the structure `<current_package_version>-alpha.<number>`, where `number` is an incremental value that starts at 1 and increases with each build.
134+
- These versions are also unstable and represent the latest work in progress on the `develop` branch.
135+
136+
These versions are great for developing a new SPA frontend feature integration.
137+
For instance, if you create a new use case in this repository and want to integrate the UI in the [dataverse-frontend repository](https://github.com/IQSS/dataverse-frontend), you can use the PR-Generated Version. If the changes have already been merged, the Alpha Version will contain the new use case.

docs/making-releases.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Making Releases
2+
3+
- [Introduction](#introduction)
4+
- [Regular or Hotfix?](#regular-or-hotfix)
5+
- [Create Github Issue and Release Branch](#create-github-issue-and-release-branch)
6+
- [Update the version](#update-the-version)
7+
- [Merge "release branch" into "main"](#merge-release-branch-into-main)
8+
- [Publish the Dataverse Client Javascript package](#publish-the-dataverse-client-javascript-package)
9+
- [Create a Draft Release on GitHub and Tag the Version](#create-a-draft-release-on-github-and-tag-the-version)
10+
- [Merge "release branch" into "develop"](#merge-release-branch-into-develop)
11+
- [Delete "release branch"](#delete-release-branch)
12+
13+
## Introduction
14+
15+
This document is about releasing a new version of dataverse-client-javascript.
16+
17+
## Regular or Hotfix?
18+
19+
Early on, make sure it’s clear what type of release this is. The steps below describe making both regular releases and hotfix releases. Suppose the current version is 1.0.0.
20+
21+
- Regular
22+
- e.g. 1.1.0 (minor)
23+
- e.g. 2.0.0 (major)
24+
- Hotfix
25+
- e.g. 1.1.1 (patch)
26+
27+
## Create Github Issue and Release Branch
28+
29+
First of all create an issue on Github to prepare the release, name it Release vX.X.X .
30+
31+
On your local, create the release branch from the latest from develop and name it release/X.X.X .
32+
33+
## Update the version
34+
35+
To update the version run the command `npm version <X.X.X> --no-git-tag-version`. So if we are releasing version `3.5.0` the command will be:
36+
37+
```shell
38+
npm version 3.5.0 --no-git-tag-version
39+
```
40+
41+
This command will update the version in the `package.json` and `package-lock.json`.
42+
43+
If everything looks good, you can push the changes to the repository.
44+
45+
## Merge "release branch" into "main"
46+
47+
Create a pull request to merge the `release` branch into the `main` branch.
48+
Once important tests have passed (unit, functional, integration), merge the pull request (skipping code review is ok).
49+
50+
## Publish the Dataverse Client Javascript package
51+
52+
Once the release branch has been merged, switch to the `main` branch on your local machine and update it to ensure you have the latest changes.
53+
54+
Dataverse Client Javascript is [published](https://www.npmjs.com/package/@iqss/dataverse-client-javascript) to the npm Package Registry. Below are the steps for publishing a new version.
55+
56+
1. **Build the package**
57+
58+
Now we need to build the package by running `npm run build`, after that you will see a `dist` folder in the root of the project. If you are not sure that folder was there already you can delete it and run the build command again.
59+
60+
2. **Publish the package**
61+
62+
As the version number is already updated and we build the package, now we can publish the package running the next command:
63+
64+
```shell
65+
npm publish --access public
66+
```
67+
68+
This command will publish the package to the npm registry.
69+
70+
Remember that you need a valid npm token to publish the package and be part of the @iqss organization on npm.
71+
72+
Get a new token from the npm website and update the `.npmrc` file with the new token. If you don't have yet an `.npmrc` file, go to the project directory root, duplicate `.npmrc.example`, saving the copy as `.npmrc`.
73+
74+
Open the `.npmrc` file and replace `YOUR_NPM_TOKEN ` with your actual npm token.
75+
76+
```plaintext
77+
//registry.npmjs.org/:\_authToken=<YOUR_NPM_AUTH_TOKEN>
78+
@iqss:registry=https://registry.npmjs.org/
79+
```
80+
81+
3. **Review the new version in the npm registry**
82+
83+
After publishing the package, you can review the new version in the [npm registry](https://www.npmjs.com/package/@iqss/dataverse-client-javascript?activeTab=versions).
84+
85+
The new version should be available in the npm registry.
86+
87+
## Create a Draft Release on GitHub and Tag the Version
88+
89+
After merging the `release` branch into the `main` branch, you should create a release on GitHub and tag the version.
90+
91+
Go to https://github.com/IQSS/dataverse-client-javascript/releases/new to start creating a draft release.
92+
93+
- Under "Choose a tag" you will be creating a new tag. Have it start with a "v" such as v3.5.0. Click "Create new tag on publish".
94+
95+
- Under "Target", choose "main".
96+
97+
- Under "Release title" use the same name as the tag such as v3.5.0.
98+
99+
- Add a description of the changes included in this release. You should include a link to the recently published npm version and summarize the key updates, fixes, or features.
100+
101+
- Click "Save draft" because we do not want to publish the release yet.
102+
103+
At this point you can send around the draft release for any final feedback. Make corrections to the draft, if necessary. Publish once everything is ok.
104+
105+
## Merge "release branch" into "develop"
106+
107+
After merging the release branch into `main`, ensure the develop branch is updated with the latest changes.
108+
109+
Create a pull request to merge the `release` branch into `develop` branch also.
110+
111+
## Delete "release branch"
112+
113+
Once the release process is complete and the `release` branch has been merged into both `main` and `develop`, you can safely delete the `release` branch to keep the repository clean.
114+
115+
- Delete the branch locally from your repository.
116+
- Delete the branch remotely from the remote repository.
117+
118+
This ensures that the `release` branch is no longer present in either your local or remote repositories.

docs/usage.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## Initialization
2+
3+
In order for the package to connect to the Dataverse API, there is an `APIConfig` object that should be initialized to set the preferred authentication mechanism with the associated credentials for connecting to the Dataverse API.
4+
5+
Currently, the supported authentication mechanisms are:
6+
7+
- **API Key**: The recommended authentication mechanism. The API Key should correspond to a particular Dataverse user account.
8+
9+
- **Bearer Token**: This mechanism is currently under development and testing. We've selected it for the upcoming Dataverse SPA and will provide more information in a future release once it becomes a standard.
10+
11+
- **Session Cookie**: This is an experimental feature primarily designed for Dataverse SPA development. To use this mechanism, you must enable the corresponding feature flag in the Dataverse installation (See https://guides.dataverse.org/en/latest/installation/config.html?#feature-flags). It is recommended not to use this mechanism and instead use API Key authentication.
12+
13+
It is recommended to globally initialize the `ApiConfig` object from the consuming application, as the configuration will be read on every API call made by the package's use cases.
14+
15+
For example, in a React application, we can globally initialize the `ApiConfig` object in the `App` file, like this:
16+
17+
```typescript
18+
ApiConfig.init(<DATAVERSE_API_BASE_URL>, DataverseApiAuthMechanism.API_KEY, <DATAVERSE_API_KEY>)
19+
20+
function App() {
21+
/* Yor App code */
22+
}
23+
24+
export default App
25+
```
26+
27+
The same example but with example values set:
28+
29+
```typescript
30+
ApiConfig.init(
31+
'http://localhost:8000/api/v1',
32+
DataverseApiAuthMechanism.API_KEY,
33+
'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
34+
)
35+
36+
function App() {
37+
/* Yor App code */
38+
}
39+
40+
export default App
41+
```
42+
43+
We can initialize the `ApiConfig` object as an unauthenticated user, by setting `undefined` as the API Key value.
44+
45+
This will allow use cases that do not require authentication to be successfully executed, but those that do require authentication will fail.

0 commit comments

Comments
 (0)