From 40e490536ff817d0e13cec2efb700fd240bcbaa7 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 24 Jun 2020 17:38:36 +0300 Subject: [PATCH 1/6] @joystream/types: build in root folder to avoid need for /lib/ in import path --- types/.gitignore | 5 ++++- types/.npmignore | 2 ++ types/package.json | 12 +++++------- types/tsconfig.json | 17 +++++++++++------ 4 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 types/.npmignore diff --git a/types/.gitignore b/types/.gitignore index 12c18d4ede..7079ea4f50 100644 --- a/types/.gitignore +++ b/types/.gitignore @@ -1 +1,4 @@ -/lib/ +# Don't track build artifacts +**/*.js +**/*.d.ts +hiring/schemas \ No newline at end of file diff --git a/types/.npmignore b/types/.npmignore new file mode 100644 index 0000000000..d19907294d --- /dev/null +++ b/types/.npmignore @@ -0,0 +1,2 @@ +# No need to include src in published package +src/ \ No newline at end of file diff --git a/types/package.json b/types/package.json index 279d3b74c2..304573be99 100644 --- a/types/package.json +++ b/types/package.json @@ -2,7 +2,8 @@ "name": "@joystream/types", "version": "0.11.0", "description": "Types for Joystream Substrate Runtime - nicaea release", - "main": "lib/index.js", + "main": "index.js", + "types": "index.d.ts", "scripts": { "prepublish": "npm run build", "build": "tsc --build tsconfig.json" @@ -15,9 +16,6 @@ "ajv": "^6.11.0", "lodash": "^4.17.15" }, - "directories": { - "lib": "lib" - }, "devDependencies": { "typescript": "^3.6.4" }, @@ -30,7 +28,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/Joystream/apps.git" + "url": "git+https://github.com/Joystream/joystream.git" }, "keywords": [ "substrate", @@ -39,7 +37,7 @@ ], "license": "Apache-2.0", "bugs": { - "url": "https://github.com/Joystream/apps/issues" + "url": "https://github.com/Joystream/joystream/issues" }, - "homepage": "https://github.com/Joystream/packages/joy-types/README.md" + "homepage": "https://github.com/Joystream/joystream" } diff --git a/types/tsconfig.json b/types/tsconfig.json index 614dd66505..568023db6d 100644 --- a/types/tsconfig.json +++ b/types/tsconfig.json @@ -11,14 +11,19 @@ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ "declaration": true, - "outDir": "lib", - "resolveJsonModule": true, - "types" : [ - "node" - ] - + "outDir": "./", + "resolveJsonModule": true, + "types" : [ + "node" + ], + "forceConsistentCasingInFileNames": true }, "include": [ "src/**/*.ts" ], + "exclude": [ + "node_modules", + "**/*.spec.ts", + "**/*.d.ts" + ] } From 81450c64629dfbc7929657630b3cefc7dd881dd7 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 24 Jun 2020 17:46:40 +0300 Subject: [PATCH 2/6] update import path for @joystream/types in apps --- cli/src/Api.ts | 8 ++++---- cli/src/Types.ts | 6 +++--- cli/src/commands/council/info.ts | 2 +- .../src/constantinople/tests/impl/electingCouncil.ts | 2 +- .../proposals/impl/storageRoleParametersProposal.ts | 2 +- .../src/constantinople/utils/apiWrapper.ts | 10 +++++----- tests/network-tests/src/constantinople/utils/utils.ts | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cli/src/Api.ts b/cli/src/Api.ts index f33a134026..44d04bca2f 100644 --- a/cli/src/Api.ts +++ b/cli/src/Api.ts @@ -18,10 +18,10 @@ import { import { DerivedFees, DerivedBalances } from '@polkadot/api-derive/types'; import { CLIError } from '@oclif/errors'; import ExitCodes from './ExitCodes'; -import { Worker, Lead as WorkerLead, WorkerId, WorkerRoleStakeProfile } from '@joystream/types/lib/working-group'; -import { MemberId, Profile } from '@joystream/types/lib/members'; -import { RewardRelationship, RewardRelationshipId } from '@joystream/types/lib/recurring-rewards'; -import { Stake, StakeId } from '@joystream/types/lib/stake'; +import { Worker, Lead as WorkerLead, WorkerId, WorkerRoleStakeProfile } from '@joystream/types/working-group'; +import { MemberId, Profile } from '@joystream/types/members'; +import { RewardRelationship, RewardRelationshipId } from '@joystream/types/recurring-rewards'; +import { Stake, StakeId } from '@joystream/types/stake'; import { LinkageResult } from '@polkadot/types/codec/Linkage'; export const DEFAULT_API_URI = 'wss://rome-rpc-endpoint.joystream.org:9944/'; diff --git a/cli/src/Types.ts b/cli/src/Types.ts index f40688004e..82abee239b 100644 --- a/cli/src/Types.ts +++ b/cli/src/Types.ts @@ -1,11 +1,11 @@ import BN from 'bn.js'; -import { ElectionStage, Seat } from '@joystream/types/lib/council'; +import { ElectionStage, Seat } from '@joystream/types/council'; import { Option } from '@polkadot/types'; import { BlockNumber, Balance, AccountId } from '@polkadot/types/interfaces'; import { DerivedBalances } from '@polkadot/api-derive/types'; import { KeyringPair } from '@polkadot/keyring/types'; -import { WorkerId, Lead } from '@joystream/types/lib/working-group'; -import { Profile, MemberId } from '@joystream/types/lib/members'; +import { WorkerId, Lead } from '@joystream/types/working-group'; +import { Profile, MemberId } from '@joystream/types/members'; // KeyringPair type extended with mandatory "meta.name" // It's used for accounts/keys management within CLI. diff --git a/cli/src/commands/council/info.ts b/cli/src/commands/council/info.ts index ad7da08ec0..7a7b5c762e 100644 --- a/cli/src/commands/council/info.ts +++ b/cli/src/commands/council/info.ts @@ -1,4 +1,4 @@ -import { ElectionStage } from '@joystream/types/lib/council'; +import { ElectionStage } from '@joystream/types/council'; import { formatNumber, formatBalance } from '@polkadot/util'; import { BlockNumber } from '@polkadot/types/interfaces'; import { CouncilInfoObj, NameValueObj } from '../../Types'; diff --git a/tests/network-tests/src/constantinople/tests/impl/electingCouncil.ts b/tests/network-tests/src/constantinople/tests/impl/electingCouncil.ts index 8b56ebf71c..266bfb1977 100644 --- a/tests/network-tests/src/constantinople/tests/impl/electingCouncil.ts +++ b/tests/network-tests/src/constantinople/tests/impl/electingCouncil.ts @@ -2,7 +2,7 @@ import { KeyringPair } from '@polkadot/keyring/types'; import { ApiWrapper } from '../../utils/apiWrapper'; import { Keyring } from '@polkadot/api'; import BN from 'bn.js'; -import { Seat } from '@constantinople/types/lib/council'; +import { Seat } from '@constantinople/types/council'; import { assert } from 'chai'; import { v4 as uuid } from 'uuid'; import { Utils } from '../../utils/utils'; diff --git a/tests/network-tests/src/constantinople/tests/proposals/impl/storageRoleParametersProposal.ts b/tests/network-tests/src/constantinople/tests/proposals/impl/storageRoleParametersProposal.ts index 24f816e900..1d654764bd 100644 --- a/tests/network-tests/src/constantinople/tests/proposals/impl/storageRoleParametersProposal.ts +++ b/tests/network-tests/src/constantinople/tests/proposals/impl/storageRoleParametersProposal.ts @@ -4,7 +4,7 @@ import { ApiWrapper } from '../../../utils/apiWrapper'; import { v4 as uuid } from 'uuid'; import BN from 'bn.js'; import { assert } from 'chai'; -import { RoleParameters } from '@constantinople/types/lib/roles'; +import { RoleParameters } from '@constantinople/types/roles'; import tap from 'tap'; export function storageRoleParametersProposalTest( diff --git a/tests/network-tests/src/constantinople/utils/apiWrapper.ts b/tests/network-tests/src/constantinople/utils/apiWrapper.ts index c581b8fe34..48214dd77c 100644 --- a/tests/network-tests/src/constantinople/utils/apiWrapper.ts +++ b/tests/network-tests/src/constantinople/utils/apiWrapper.ts @@ -2,11 +2,11 @@ import { ApiPromise, WsProvider } from '@polkadot/api'; import { Option, Vec, Bytes, u32 } from '@polkadot/types'; import { Codec } from '@polkadot/types/types'; import { KeyringPair } from '@polkadot/keyring/types'; -import { UserInfo, PaidMembershipTerms, MemberId } from '@constantinople/types/lib/members'; -import { Mint, MintId } from '@constantinople/types/lib/mint'; -import { Lead, LeadId } from '@constantinople/types/lib/content-working-group'; -import { RoleParameters } from '@constantinople/types/lib/roles'; -import { Seat } from '@constantinople/types/lib/council'; +import { UserInfo, PaidMembershipTerms, MemberId } from '@constantinople/types/members'; +import { Mint, MintId } from '@constantinople/types/mint'; +import { Lead, LeadId } from '@constantinople/types/content-working-group'; +import { RoleParameters } from '@constantinople/types/roles'; +import { Seat } from '@constantinople/types/council'; import { Balance, EventRecord, AccountId, BlockNumber, BalanceOf } from '@polkadot/types/interfaces'; import BN from 'bn.js'; import { SubmittableExtrinsic } from '@polkadot/api/types'; diff --git a/tests/network-tests/src/constantinople/utils/utils.ts b/tests/network-tests/src/constantinople/utils/utils.ts index b740bd8d99..50fcdf02f3 100644 --- a/tests/network-tests/src/constantinople/utils/utils.ts +++ b/tests/network-tests/src/constantinople/utils/utils.ts @@ -4,7 +4,7 @@ import { blake2AsHex } from '@polkadot/util-crypto'; import BN from 'bn.js'; import fs from 'fs'; import { decodeAddress } from '@polkadot/keyring'; -import { Seat } from '@constantinople/types/lib/council'; +import { Seat } from '@constantinople/types/council'; export class Utils { private static LENGTH_ADDRESS = 32 + 1; // publicKey + prefix From 9f353fe8eaedc535d8ab626ecf6f1e7b0ae8d659 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 24 Jun 2020 18:08:01 +0300 Subject: [PATCH 3/6] types: update .gitignore and .npmignore --- types/.gitignore | 8 +++++++- types/.npmignore | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/types/.gitignore b/types/.gitignore index 7079ea4f50..8757ac767a 100644 --- a/types/.gitignore +++ b/types/.gitignore @@ -1,4 +1,10 @@ # Don't track build artifacts **/*.js **/*.d.ts -hiring/schemas \ No newline at end of file +hiring/schemas + +# from prior versions +lib/ + +# artifact of webpack when building pioneer? +build/ \ No newline at end of file diff --git a/types/.npmignore b/types/.npmignore index d19907294d..39d00699c4 100644 --- a/types/.npmignore +++ b/types/.npmignore @@ -1,2 +1,6 @@ # No need to include src in published package -src/ \ No newline at end of file +src/ + +# old build artifacts +lib/ +build/ \ No newline at end of file From 639a9475cbe0b5867e7f8ec1306aea5e7da3fa0b Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 24 Jun 2020 18:55:22 +0300 Subject: [PATCH 4/6] @joystream/types: keep src/ in published npm packages, it gets built on install --- types/.npmignore | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/.npmignore b/types/.npmignore index 39d00699c4..acdb6a9a94 100644 --- a/types/.npmignore +++ b/types/.npmignore @@ -1,6 +1,6 @@ -# No need to include src in published package -src/ +# keep src/ files, packages is compiled when installed +# src/ # old build artifacts lib/ -build/ \ No newline at end of file +build/ From 26c008f7c5c31cb02c230a46cb7387ee7014bb86 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 24 Jun 2020 19:06:26 +0300 Subject: [PATCH 5/6] @joystream/types: add missing dependencies --- types/package.json | 4 +++- yarn.lock | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/types/package.json b/types/package.json index 304573be99..f5f822782c 100644 --- a/types/package.json +++ b/types/package.json @@ -12,12 +12,14 @@ "maintainers": [], "dependencies": { "@polkadot/types": "^0.96.1", + "@polkadot/keyring": "^1.7.0-beta.5", + "@types/lodash": "^4.14.157", "@types/vfile": "^4.0.0", "ajv": "^6.11.0", "lodash": "^4.17.15" }, "devDependencies": { - "typescript": "^3.6.4" + "typescript": "^3.7.2" }, "engines": { "node": ">=10.0" diff --git a/yarn.lock b/yarn.lock index 5896b874ea..64ca53dd31 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1359,6 +1359,7 @@ version "0.11.0" dependencies: "@polkadot/types" "^0.96.1" + "@types/lodash" "^4.14.157" "@types/vfile" "^4.0.0" ajv "^6.11.0" lodash "^4.17.15" @@ -3816,6 +3817,11 @@ resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.149.tgz#1342d63d948c6062838fbf961012f74d4e638440" integrity sha512-ijGqzZt/b7BfzcK9vTrS6MFljQRPn5BFWOx8oE0GYxribu6uV+aA9zZuXI1zc/etK9E8nrgdoF2+LgUw7+9tJQ== +"@types/lodash@^4.14.157": + version "4.14.157" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.157.tgz#fdac1c52448861dfde1a2e1515dbc46e54926dc8" + integrity sha512-Ft5BNFmv2pHDgxV5JDsndOWTRJ+56zte0ZpYLowp03tW+K+t8u8YMOzAnpuqPgzX6WO1XpDIUm7u04M8vdDiVQ== + "@types/marked@^0.7.0": version "0.7.2" resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.7.2.tgz#1393f076773b55cc7078c0fbeb86a497c69db97e" From 7d2cf90f9c53448f8b96e64aa6995c169b5dec9f Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 25 Jun 2020 17:16:47 +0300 Subject: [PATCH 6/6] types: explicit .gitignore of role.schema.json --- types/.gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/.gitignore b/types/.gitignore index 8757ac767a..9606bf2927 100644 --- a/types/.gitignore +++ b/types/.gitignore @@ -1,7 +1,9 @@ # Don't track build artifacts **/*.js **/*.d.ts -hiring/schemas + +# JSON files imported by hiring types +hiring/schemas/role.schema.json # from prior versions lib/