Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Platform OSTIS 0.10.0 #61

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"files.exclude": {
"**/.DS_Store": false
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Rename all API classes, methods and objects according to API of the OSTIS Platform 0.10.0

## [v0.0.1-beta.1] - 04.07.2023

### Added
Expand Down
12 changes: 6 additions & 6 deletions docs/development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## css

In case of css modules (prefered) lets partly use BEM. In this case we do not need block, vut elements and modificators are quite usefull. We will use camelCase naming confection: `elemName_modName_modVal`. Also No-namespace style is ok to use.
In case of css modules (preferred) lets partly use BEM. In this case we do not need block, vut elements and modificators are quite useful. We will use camelCase naming confection: `elemName_modName_modVal`. Also No-namespace style is ok to use.
https://ru.bem.info/methodology/naming-convention/

For ordinary css it is not a big deal.
Expand All @@ -18,7 +18,7 @@ js variables, object properties should only be named in camelCase.

## assets

use dash separated words, like `my-icon.png`. All letters should be lovercased.
use dash separated words, like `my-icon.png`. All letters should be lowercased.

# css

Expand All @@ -34,7 +34,7 @@ const Comp = () => {
};
```

2. Create a `*.m.scss` file to use css-modules (prefered):
2. Create a `*.m.scss` file to use css-modules (preferred):

```tsx
import styles from './my-css.m.scss';
Expand Down Expand Up @@ -68,7 +68,7 @@ src
----hooks
```

Icons also placed in the component they are required in. If icon is requred by many components move it to assets folder
Icons also placed in the component they are required in. If icon is required by many components move it to assets folder

## Location of pictures, utilities, etc.

Expand All @@ -83,7 +83,7 @@ If the component is reusable, then put it in the root.

# imports

Do not use relative imports. Insted use absolute ones. The are listed in webpack/alias.js.
Do not use relative imports. Instead use absolute ones. The are listed in webpack/alias.js.

Bad:

Expand Down Expand Up @@ -131,7 +131,7 @@ Variables:

When a boolean value is passed, if the prop is not standard `isProp`, if the prop is standard `<Prop name>`.

Exemple: custom props - `isOpen`; standard props - `disabled`.
Example: custom props - `isOpen`; standard props - `disabled`.

Import images:

Expand Down
2 changes: 1 addition & 1 deletion docs/git-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Attach a link to the task to the description of the pull request.

`feature (or fix, release, hotfix)/<task number>-<task name>`: task number - number of task in trello; task name - appropriate task title;

Exemple: `feature/<387>-authorization`.
Example: `feature/<387>-authorization`.

### How to appoint reviewers:

Expand Down
12 changes: 6 additions & 6 deletions docs/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ When one is ready to make a release the following steps should be done:

## Prepare a changelog

The chandelog is located in docs/changelog.md. It has a common info on how to keep it and info for every version and changes for released version. Once you are ready, describe version to be released, what was done, etc.
The changelog is located in docs/changelog.md. It has a common info on how to keep it and info for every version and changes for released version. Once you are ready, describe version to be released, what was done, etc.

## Create a tag for version in main branch

### Manualy
### Manually

- Go to main branch `git checkout main`
- Set required version in package.json directly changing `version`. For example, `0.0.1-beta.1`
- Create a tag for given version. `git tag v0.0.1-beta.1`. Ensure to put `v` in the begining of a tag - this is very important.
- Create a tag for given version. `git tag v0.0.1-beta.1`. Ensure to put `v` in the beginning of a tag - this is very important.
- Push your tag `git push` and `git push --tags`
- Go to github actions, select `release` action, run forkflow, select created tag, run workflow
- Go to github actions, select `release` action, run workflow, select created tag, run workflow

### Using npm version

- Go to main branch `git checkout main`
- run `npm version`, according to what kind of release it is: patch, minor or major. This command creates a tag with new version in it
- To ensure that tag is created correctly one may run `git tag --list`
- Push your tag `git push` and `git push --tags`
- Go to github actions, select `release` action, run forkflow, select created tag, run workflow
- Go to github actions, select `release` action, run workflow, select created tag, run workflow

### Error handling

- `release` github workflow consists of two: `npm publish` and `github release`. If one of them breaks one will be able to run each of them manualy, selecting a target tag
- `release` github workflow consists of two: `npm publish` and `github release`. If one of them breaks one will be able to run each of them manually, selecting a target tag
19 changes: 10 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"react": ">=16",
"react-dom": ">=16",
"styled-components": "^5.1.0 || ^6.0.0-rc.1",
"ts-sc-client": ">=0.3.0"
"ts-sc-client": "0.5.0"
},
"devDependencies": {
"@babel/core": "^7.14.3",
Expand Down
24 changes: 12 additions & 12 deletions src/components/Language/ScLangText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ReactNode, useEffect, useState } from 'react';
import { useClient } from '@components/ClientProvider';
import { useScUtils } from '@components/ScUtils';
import { PseudoText } from '@components/Skeleton';
import { ScAddr, ScEventParams, ScEventType } from 'ts-sc-client';
import { ScAddr, ScEventSubscriptionParams, ScEventType } from 'ts-sc-client';

import { useLanguage } from './useLanguage';

Expand Down Expand Up @@ -56,9 +56,9 @@ export const ScLangText = ({
setText(String(newContent.data));
};

const eventParams = new ScEventParams(linkAddr, ScEventType.ChangeContent, onActionFinished);
const eventParams = new ScEventSubscriptionParams(linkAddr, ScEventType.BeforeChangeLinkContent, onActionFinished);

const [{ id }] = await client.eventsCreate(eventParams);
const [{ id }] = await client.createElementaryEventSubscriptions(eventParams);
setChangeContentEventId(id);
})();
}, [addrOrSystemId, addrOrSystemIdAddr, client, getMainIdLinkAddr, lang]);
Expand All @@ -74,23 +74,23 @@ export const ScLangText = ({
// const nodeAddr = await addrOrSystemIdAddr(addrOrSystemId);

// const onActionFinished = async (subscibedAddr: ScAddr, arc: ScAddr, anotherAddr: ScAddr) => {
// const { nrelMainIdtf, ...rest } = await findKeynodes('nrel_main_idtf', langToKeynode[lang]);
// const { nrelMainIdtf, ...rest } = await searchKeynodes('nrel_main_idtf', langToKeynode[lang]);
// const foundLang = rest[snakeToCamelCase(langToKeynode[lang])];

// const langAlias = '_lang';

// const template = new ScTemplate();

// template.tripleWithRelation(
// template.quintuple(
// subscibedAddr,
// ScType.EdgeDCommonVar,
// ScType.VarCommonArc,
// anotherAddr,
// ScType.EdgeAccessVarPosPerm,
// ScType.VarPermPosArc,
// nrelMainIdtf,
// );
// template.triple([ScType.NodeVarClass, langAlias], ScType.EdgeAccessVarPosPerm, anotherAddr);
// template.triple([ScType.VarNodeClass, langAlias], ScType.VarPermPosArc, anotherAddr);

// const res = await client.templateSearch(template);
// const res = await client.searchByTemplate(template);
// if (!res.length) return;

// const langAddr = res[0].get(langAlias);
Expand All @@ -103,16 +103,16 @@ export const ScLangText = ({

// const eventParams = new ScEventParams(new ScAddr(nodeAddr), ScEventType.AddOutgoingEdge, onActionFinished);

// const [{ id }] = await client.eventsCreate(eventParams);
// const [{ id }] = await client.createElementaryEventSubscriptions(eventParams);
// setAddNewLangEventId(id);
// })();
// }, [addrOrSystemId, addrOrSystemIdAddr, client, findKeynodes, getMainIdLinkAddr, lang]);
// }, [addrOrSystemId, addrOrSystemIdAddr, client, searchKeynodes, getMainIdLinkAddr, lang]);

useEffect(() => {
if (!changeContentEventId) return;

return () => {
client.eventsDestroy(changeContentEventId);
client.destroyElementaryEventSubscriptions(changeContentEventId);
};
}, [client, changeContentEventId]);

Expand Down
6 changes: 3 additions & 3 deletions src/components/ScUtils/ScUtils.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { createContext, ReactNode, useContext } from 'react';
import { useClient } from '@components/ClientProvider';
import { TFindKeynodes } from '@utils/findKeynodes';
import { TsearchKeynodes } from '@utils/searchKeynodes';

import { scUtilsBuilder } from './scUtilsBuilder';

type TScUtilsContext = Omit<ReturnType<typeof scUtilsBuilder>, 'findKeynodes'> & {
findKeynodes: TFindKeynodes;
type TScUtilsContext = Omit<ReturnType<typeof scUtilsBuilder>, 'searchKeynodes'> & {
searchKeynodes: TsearchKeynodes;
};

const ScUtilsContext = createContext<TScUtilsContext>({} as TScUtilsContext);
Expand Down
Loading