Skip to content

Commit

Permalink
feat(sdk): rename sdk package to org namespace (#209)
Browse files Browse the repository at this point in the history
* rename everything to match @docmaps/sdk
  • Loading branch information
ships committed Dec 13, 2023
1 parent ba4e227 commit 73d490a
Show file tree
Hide file tree
Showing 72 changed files with 228 additions and 2,821 deletions.
9 changes: 6 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ title: "[PKG]: [BUG DESCRIPTION]"

Packages affected:

- [ ] sdk
- [ ] etl
- [ ] widget
- [ ] http-client
- [ ] http-server
- [ ] spa (explorer)
- [ ] OWL/SHACL definitions
- [ ] ts-sdk
- [ ] ts-etl
- [ ] spa

### Expected behavior

Expand Down
9 changes: 6 additions & 3 deletions .github/ISSUE_TEMPLATE/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ title: "[DOCS]: [DESCRIPTION]"

Packages related to documentation request:

- [ ] sdk
- [ ] etl
- [ ] widget
- [ ] http-client
- [ ] http-server
- [ ] spa (explorer)
- [ ] OWL/SHACL definitions
- [ ] ts-sdk
- [ ] ts-etl
- [ ] spa

### Description

Expand Down
9 changes: 6 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ title: "[PKG]: [FEATURE NAME]"

Packages to improve:

- [ ] sdk
- [ ] etl
- [ ] widget
- [ ] http-client
- [ ] http-server
- [ ] spa (explorer)
- [ ] OWL/SHACL definitions
- [ ] ts-sdk
- [ ] ts-etl
- [ ] spa

### Description

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test ts-etl
name: Test @docmaps/etl

on:
push:
Expand All @@ -7,7 +7,7 @@ on:
workflow_call:

env:
PKG_DIR: "packages/ts-etl"
PKG_DIR: "packages/etl"

jobs:
nodejs_test:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Generate docs
run: |
cd packages/ts-sdk ;
cd packages/sdk ;
pnpm docs:generate;
- name: Build SPA
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,21 @@ env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

jobs:
test-ts-sdk:
uses: ./.github/workflows/ts-sdk-tests.yaml
test-ts-http-server:
test-sdk:
uses: ./.github/workflows/sdk-tests.yaml
test-http-server:
uses: ./.github/workflows/http-server-tests.yaml
test-ts-etl:
uses: ./.github/workflows/ts-etl-tests.yaml
test-etl:
uses: ./.github/workflows/etl-tests.yaml
test-example:
uses: ./.github/workflows/example-tests.yaml
test-specification:
uses: ./.github/workflows/specification-tests.yaml
nodejs_release:
needs:
- test-ts-sdk
- test-ts-etl
- test-sdk
- test-etl
- test-http-server
- test-specification
- test-example

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test ts-sdk
name: Test @docmaps/sdk

on:
push:
Expand All @@ -7,7 +7,7 @@ on:
workflow_call:

env:
PKG_DIR: "packages/ts-sdk"
PKG_DIR: "packages/sdk"

jobs:
nodejs_test:
Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ More info: https://docmaps.knowledgefutures.org

## About This Repo

This repo contains JSONLD contexts and framing for Docmaps.
This repo contains the Typescript-based libraries for use with Node.js.

It also contains the Typescript-based libraries (initially, just `packages/ts-sdk`) for use with Node.js.
It also contains JSONLD contexts and RDF-native framing tools and SHACL shapes for Docmaps.

### Monorepo usage

Expand All @@ -21,7 +21,7 @@ cross-package behavior, such as release automation.
automatically generate semvers based on commit history for each package in the repository. Multiple tags
are generated for a single commit if it updates multiple packages.

**Cross-dependencies and typescript:** Several packages depend on `ts-sdk`, and will refer to
**Cross-dependencies and typescript:** Several packages depend on `@docmaps/sdk`, and will refer to
the `dist` directory within that package for their source code when making local changes.
For that reason, you may need to run `pnpm run build:deps` in a package, or `pnpm run -r build`
to build all packages, if you are making local changes to uptream dependencies within this
Expand All @@ -46,7 +46,11 @@ Latest @context: https://w3id.org/docmaps/context.jsonld

## Packages

### [ts-sdk](/packages/ts-sdk)
### [sdk](/packages/sdk)

> DEPRECATION NOTICE: the NPM package `docmaps-sdk` has been moved to `@docmaps/sdk`.
> (the source code still lives here.)
> Update your installs and imports accordingly.
This package contains a library of JSON-parsing and string-parsing codecs based on
`io-ts`, and associated Typescript types. These types can be used without `io-ts`, but
Expand All @@ -59,7 +63,7 @@ along with the types/interfaces in type namespace.
This package is a Node server that serves docmaps. It is the Typescript
reference implementation of Docmaps Project RFC#001 API Server Interoperability Protocol.

### [ts-etl](/packages/ts-etl)
### [etl](/packages/etl)

This package contains a CLI tool based on `commander.js` for generating docmaps. Currently,
it supports generating a docmap for a given DOI if that DOI is indexed on Crossref, and
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/ts-etl/README.md → packages/etl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pnpm docmaps-etl item --source crossref-api 10.5194/angeo-40-247-2022 # or npm d

## Implementation

This tool and library are written using the [`docmaps-sdk` package](/packages/ts-sdk)
This tool and library are written using the [`docmaps-sdk` package](/packages/sdk)
in this repository, as well as the [`crossref-openapi-client-ts`](https://github.com/Docmaps-Project/crossref-openapi-client-ts)
also maintained by Knowledge Futures, Inc. As seen in `src/crossref.ts`[src/crossref.ts],
Codecs from the SDK are processed using functional paradigms provided conveniently by
Expand Down
2 changes: 1 addition & 1 deletion packages/ts-etl/package.json → packages/etl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@commander-js/extra-typings": "^11.0.0",
"commander": "^11.0.0",
"crossref-openapi-client-ts": "^1.3.0",
"docmaps-sdk": "workspace:^0.0.0",
"@docmaps/sdk": "workspace:^0.0.0",
"fp-ts": "^2.14.0",
"tsx": "^4.0.0",
"typescript-collections": "^1.3.3"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { CrossrefClient } from 'crossref-openapi-client-ts'
import { Command, Option } from '@commander-js/extra-typings'
import { Publisher, PublisherT } from 'docmaps-sdk'
import { Publisher, PublisherT } from '@docmaps/sdk'
import { isLeft, right } from 'fp-ts/lib/Either'
import { process as proc } from './processor'

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as E from 'fp-ts/lib/Either'
import type { Plugin } from '../../types'
import { pipe } from 'fp-ts/lib/function'
import * as TE from 'fp-ts/lib/TaskEither'
import * as D from 'docmaps-sdk'
import * as D from '@docmaps/sdk'
import { relatedDoisForWork, decodeActionForWork } from './functions'
import { mapLeftToUnknownError } from '../../utils'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Work, DatemorphISOString } from 'crossref-openapi-client-ts'
import * as E from 'fp-ts/lib/Either'
import * as A from 'fp-ts/lib/Array'
import { pipe } from 'fp-ts/lib/function'
import * as D from 'docmaps-sdk'
import * as D from '@docmaps/sdk'
import { mapLeftToUnknownError, nameForAuthor } from '../../utils'
import { Eq } from 'fp-ts/lib/string'

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as D from 'docmaps-sdk'
import * as D from '@docmaps/sdk'
import type { Plugin, RecursiveStepDataChain } from './types'
import * as TE from 'fp-ts/lib/TaskEither'
import * as A from 'fp-ts/lib/Array'
Expand Down
2 changes: 1 addition & 1 deletion packages/ts-etl/src/types.ts → packages/etl/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type * as E from 'fp-ts/Either'
import type D from 'docmaps-sdk'
import type D from '@docmaps/sdk'
import type * as TE from 'fp-ts/lib/TaskEither'

export type ErrorOrDocmap = E.Either<Error, D.DocmapT[]>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as D from 'docmaps-sdk'
import * as D from '@docmaps/sdk'
import * as E from 'fp-ts/lib/Either'
import { pipe } from 'fp-ts/lib/function'
import type { ErrorOrDocmap } from '../types'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava'
import type { DocmapT } from 'docmaps-sdk'
import type { DocmapT } from '@docmaps/sdk'
import { MakeCli } from '../../src/command'

type cmdResult = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { InductiveStepResult, Plugin } from '../../../src/types'
import { mock, instance } from 'ts-mockito'

import type * as D from 'docmaps-sdk'
import type * as D from '@docmaps/sdk'
import * as TE from 'fp-ts/lib/TaskEither'
import { MANUSCRIPT_DOI } from './crossref'

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as cm from '../__fixtures__/crossref'
import * as E from 'fp-ts/lib/Either'
import { inspect } from 'util'
import * as F from '../../../src/plugins/crossref/functions'
import type { ActionT } from 'docmaps-sdk'
import type { ActionT } from '@docmaps/sdk'

function rightOrInspectError<T>(
t: ExecutionContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as TE from 'fp-ts/lib/TaskEither'
import { stepsForIdRecursive } from '../../src/processor'
import { whenThenRight } from './utils'
import * as am from './__fixtures__/abstract'
import type * as D from 'docmaps-sdk'
import type * as D from '@docmaps/sdk'
import { when } from 'ts-mockito'

const nothing = [] as D.ThingT[]
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"docmaps-sdk": "workspace:^0.0.0",
"@docmaps/sdk": "workspace:^0.0.0",
"fp-ts": "^2.16.0",
"io-ts": "^2.2.20",
"tsx": "^4.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/example/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as D from 'docmaps-sdk'
import * as D from '@docmaps/sdk'
import * as E from 'fp-ts/lib/Either'
import * as A from 'fp-ts/lib/Array'
import {pipe} from 'fp-ts/lib/function'
Expand Down Expand Up @@ -38,7 +38,7 @@ const program = pipe(
// note the use of `any` here, which is because the `actor` field
// currently doesn't have any obligatory fields. This leaks the
// type safety slightly by assuming there is a `name`. Improvements
// to the `docmaps-sdk` based on narrower specification or even more
// to the `@docmaps/sdk` based on narrower specification or even more
// involved parsing in the consumer library (like this script) can
// provide further safety.
A.map((p) => (p.actor as any).name)
Expand Down
2 changes: 1 addition & 1 deletion packages/http-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
],
"dependencies": {
"@ts-rest/core": "^3.30.2",
"docmaps-sdk": "workspace:^0.0.0"
"@docmaps/sdk": "workspace:^0.0.0"
},
"devDependencies": {
"@docmaps/build-configs": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/http-client/src/contract.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { initContract } from '@ts-rest/core'
import { DocmapT } from 'docmaps-sdk'
import { DocmapT } from '@docmaps/sdk'
import { ApiInfo, ErrorBody } from './types'

const c = initContract()
Expand Down
2 changes: 1 addition & 1 deletion packages/http-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ COPY --from=build /app/packages/http-server/dist /app/packages/http-server/dist

# Copy built sub-dependencies from this same package
COPY --from=build /app/packages/http-client/dist /app/packages/http-server/node_modules/@docmaps/http-client/dist
COPY --from=build /app/packages/ts-sdk/dist /app/packages/http-server/node_modules/docmaps-sdk/dist
COPY --from=build /app/packages/sdk/dist /app/packages/http-server/node_modules/@docmaps/sdk/dist
WORKDIR /app/packages/http-server

# Use production node environment by default.
Expand Down
2 changes: 1 addition & 1 deletion packages/http-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@zazuko/rdf-vocabularies": "^2023.1.19",
"commander": "^11.0.0",
"cors": "^2.8.5",
"docmaps-sdk": "workspace:^0.0.0",
"@docmaps/sdk": "workspace:^0.0.0",
"express": "^4.18.2",
"fetch-sparql-endpoint": "^4.0.0",
"fp-ts": "^2.14.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/http-server/src/adapter/sparql_adapter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type * as RDF from '@rdfjs/types'
import { CONSTRUCT, Construct, Describe } from '@tpluscode/sparql-builder'
import { VALUES } from '@tpluscode/sparql-builder/expressions'
import * as D from 'docmaps-sdk'
import * as D from '@docmaps/sdk'
import * as TE from 'fp-ts/lib/TaskEither'
import * as T from 'fp-ts/lib/Task'
import * as E from 'fp-ts/lib/Either'
Expand Down
2 changes: 1 addition & 1 deletion packages/http-server/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ApiInfo, BackendAdapter, ThingSpec } from './types'
import * as TE from 'fp-ts/TaskEither'
import * as D from 'docmaps-sdk'
import * as D from '@docmaps/sdk'

/** ApiInstance - a concrete class that handles sourcing data and composing answers
*
Expand Down
2 changes: 1 addition & 1 deletion packages/http-server/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as D from 'docmaps-sdk'
import * as D from '@docmaps/sdk'
import * as TE from 'fp-ts/TaskEither'

// TODO: use io-ts? this is only decodable by consumers...
Expand Down
2 changes: 1 addition & 1 deletion packages/http-server/test/integration/httpserver.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava'
import * as D from 'docmaps-sdk'
import * as D from '@docmaps/sdk'
import { inspect } from 'util'
import { API_VERSION } from '../../src'
import { MakeHttpClient } from '@docmaps/http-client'
Expand Down
6 changes: 3 additions & 3 deletions packages/http-server/test/unit/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import test from 'ava'
import { SparqlAdapter } from '../../src/adapter'
import { ApiInstance } from '../../src/api'
import * as TE from 'fp-ts/lib/TaskEither'
import * as D from 'docmaps-sdk'
import * as D from '@docmaps/sdk'

import { deepEqual, mock, instance, when } from 'ts-mockito'
import { ThingSpec } from '../../src/types'
Expand Down Expand Up @@ -72,7 +72,7 @@ test('docmap_by_id: consults the adapter', async (t) => {
).get_docmap_by_id(dm_content.id)()

// TODO awkward use of `await .. ()`, is there a more natural way?
// The alternative is all that `rightAnd` business in docmaps-sdk
// The alternative is all that `rightAnd` business in @docmaps/sdk
t.deepEqual(res, await TE.of(dm_content)())
})

Expand Down Expand Up @@ -101,6 +101,6 @@ test('docmap_for: consults the adapter', async (t) => {
).get_docmap_for_thing(spec)()

// TODO awkward use of `await .. ()`, is there a more natural way?
// The alternative is all that `rightAnd` business in docmaps-sdk
// The alternative is all that `rightAnd` business in @docmaps/sdk
t.deepEqual(res, await TE.of(dm_content)())
})
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing to docmaps ts-sdk
# Contributing to @docmaps/sdk

We welcome contributions from anyone interested in improving [Project Name]! Before you get started, please read through the guidelines below to ensure that your contributions are effective and useful.

Expand Down
Loading

0 comments on commit 73d490a

Please sign in to comment.