Skip to content

Commit

Permalink
Update build process (#43)
Browse files Browse the repository at this point in the history
* Remove site package

* Update changelog

* Update build

* Fix lint issues

* Update build

* Update changelog

* clear npmignore and use package.json files instead

* Update lint rules

---------

Co-authored-by: lukachi <[email protected]>
  • Loading branch information
ardier16 and lukachi authored Mar 19, 2024
1 parent 0f53539 commit b0eba8d
Show file tree
Hide file tree
Showing 58 changed files with 8,807 additions and 12,099 deletions.
19 changes: 16 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
root: true,

parserOptions: {
sourceType: 'module',
},
Expand All @@ -8,21 +9,30 @@ module.exports = {

overrides: [
{
files: ['**/*.js'],
files: ['*.js'],
extends: ['@metamask/eslint-config-nodejs'],
},

{
files: ['**/*.{ts,tsx}'],
files: ['*.ts', '*.tsx'],
extends: ['@metamask/eslint-config-typescript'],
rules: {
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/no-non-null-assertion': 0,
'no-restricted-globals': 0,
'@typescript-eslint/naming-convention': 0,
'@typescript-eslint/prefer-nullish-coalescing': 0,
'id-length': 0,
'id-denylist': 0,
'@typescript-eslint/restrict-template-expressions': 0,
'@typescript-eslint/unbound-method': 0,
'@typescript-eslint/no-unnecessary-type-assertion': 0,
'@typescript-eslint/restrict-plus-operands': 0,
},
},

{
files: ['**/*.test.ts', '**/*.test.js'],
files: ['*.test.ts', '*.test.js'],
extends: ['@metamask/eslint-config-jest'],
rules: {
'@typescript-eslint/no-shadow': [
Expand All @@ -37,6 +47,9 @@ module.exports = {
'!.prettierrc.js',
'**/!.eslintrc.js',
'**/dist*/',
'**/scripts/**/*.js',
'jest.config.base.js',
'jest.config.js',
'**/*__GENERATED__*',
'**/build',
'**/public',
Expand Down
28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.0.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.1.1.cjs

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
afterInstall: yarn postinstall

changesetBaseRefs:
- main
- origin/main
- upstream/main

compressionLevel: mixed

enableGlobalCache: false

enableTelemetry: false

nodeLinker: node-modules
Expand All @@ -16,11 +22,7 @@ packageExtensions:
optional: true

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-after-install.cjs
spec: "https://raw.githubusercontent.com/mhassan1/yarn-plugin-after-install/v0.6.0/bundles/@yarnpkg/plugin-after-install.js"

yarnPath: .yarn/releases/yarn-3.6.0.cjs

afterInstall: yarn postinstall
yarnPath: .yarn/releases/yarn-4.1.1.cjs
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- `@rarimo/rarime`:
- `CreateIdentity` - accept `privateKeyHex` optional param for identity creation
- Bump Yarn version to 4.1.1
- Use SWC instead of TSC for the build process
- Update Jest config for testing
- Use latest MetaMask snap libraries
- Use `workspace` version inside packages

### Removed
- `packages/site` package

### Removed
- `packages/site` package
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
<img src="https://github.com/rarimo/rarime/blob/6efa918aeb21d7c5e154e20b048754f417ce0f16/packages/snap/images/icon.svg" alt="RariMe logo" width="240"/>
</p>





# RariMe

[![npm](https://img.shields.io/npm/v/%40rarimo%2Frarime)](https://www.npmjs.com/package/@rarimo/rarime)
[![npm](https://img.shields.io/npm/dm/%40rarimo%2Frarime)](https://npm-stat.com/charts.html?package=%40rarimo%2Frarime)

Expand Down Expand Up @@ -49,6 +46,7 @@ yarn apply-version 0.1.0
Run `yarn test` to run the tests once.

Run `yarn lint` to run the linter, or run `yarn lint:fix` to run the linter and fix any automatically fixable issues.

## Notes

- Babel is used for transpiling TypeScript to JavaScript, so when building with the CLI,
Expand Down
13 changes: 13 additions & 0 deletions jest.config.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const baseConfig = require('./jest.config.base');

module.exports = {
...baseConfig,
roots: ['<rootDir>/src'],
testMatch: [
'**/__tests__/**/*.+(ts|tsx|js)',
'**/?(*.)+(spec|tests|test).+(ts|tsx|js)',
],
moduleNameMapper: {
'^@/(.*)': '<rootDir>/src/$1',
},
};
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
projects: ['<rootDir>/packages/*/jest.config.js'],
};
40 changes: 23 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,46 +16,52 @@
"packages/*"
],
"scripts": {
"build": "yarn workspaces foreach --parallel --topological --verbose run build",
"apply-version": "node scripts/versions.js $0 && yarn build:connector && yarn workspace @rarimo/rarime preversion",
"build": "yarn workspaces foreach -pv --topological-dev --verbose --all run build",
"build:connector": "yarn workspace @rarimo/rarime-connector build",
"postinstall": "patch-package",
"lint": "yarn lint:eslint && yarn lint:misc --check",
"lint:eslint": "eslint . --cache --ext js,ts",
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
"lint:misc": "prettier '**/*.json' '**/*.md' '!**/CHANGELOG.md' '**/*.yml' --ignore-path .gitignore",
"start": "yarn build:connector && yarn workspaces foreach --parallel --interlaced --verbose run start",
"test": "echo \"TODO\"",
"postinstall": "patch-package",
"publish": "yarn workspaces foreach --no-private exec yarn npm publish",
"rsc": "node scripts/release-sanity-check.js",
"apply-version": "node scripts/versions.js $0 && yarn build:connector && yarn workspace @rarimo/rarime preversion",
"publish": "yarn workspaces foreach --no-private exec yarn npm publish"
"start": "yarn build:connector && yarn workspaces foreach --parallel --interlaced --verbose --all run start",
"test": "yarn workspaces foreach -pv --no-private --all run test"
},
"devDependencies": {
"@metamask/eslint-config": "10.0.0",
"@metamask/eslint-config-jest": "10.0.0",
"@metamask/eslint-config-nodejs": "10.0.0",
"@metamask/eslint-config-typescript": "10.0.0",
"@metamask/eslint-config": "^12.0.0",
"@metamask/eslint-config-jest": "^12.1.0",
"@metamask/eslint-config-nodejs": "^12.0.0",
"@metamask/eslint-config-typescript": "^12.1.0",
"@types/jest": "^29.5.10",
"@typescript-eslint/eslint-plugin": "5.33.0",
"@typescript-eslint/parser": "5.33.0",
"chalk": "4.1.2",
"dotenv": "^16.4.1",
"eslint": "8.21.0",
"eslint-config-prettier": "8.1.0",
"eslint-plugin-import": "2.26.0",
"eslint": "^8.27.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "26.8.2",
"eslint-plugin-jsdoc": "39.2.9",
"eslint-plugin-jsdoc": "^41.1.2",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"jest": "^29.7.0",
"patch-package": "6.5.1",
"prettier": "2.2.1",
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "2.2.18",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "4.7.4"
},
"packageManager": "yarn@3.2.1",
"packageManager": "yarn@4.1.1",
"engines": {
"node": ">=16.0.0"
},
"gitHooks": {
"pre-commit": "yarn lint",
"pre-push": "yarn test && yarn rsc"
}
}
14 changes: 14 additions & 0 deletions packages/connector/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
extends: ['../../.eslintrc.js'],

ignorePatterns: [
'!.eslintrc.js',
'dist/',
'**/*.js',
'**/scripts/**/*.js',
'**/jest.config.ts',
'**/*.test.ts',
'**/src/**/types/**/contracts/**/*.ts',
'**/src/**/types/**/graphql/**/*.ts',
],
};
7 changes: 7 additions & 0 deletions packages/connector/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
src/**/*.test.ts
jest.config.ts
jest.config.js
tsconfig.json
tsconfig.build.json
postbuild.js
.swcrc
31 changes: 31 additions & 0 deletions packages/connector/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"jsc": {
"parser": {
"syntax": "typescript",
"jsx": false,
"dynamicImport": false,
"privateMethod": true,
"functionBind": false,
"exportDefaultFrom": false,
"exportNamespaceFrom": false,
"decorators": false,
"decoratorsBeforeExport": false,
"topLevelAwait": false,
"importMeta": false
},
"baseUrl": ".",
"transform": null,
"target": "es2016",
"loose": false,
"externalHelpers": false,
"keepClassNames": true,
"preserveAllComments": true,
"paths": {
"@/*": ["src/*"]
}
},
"exclude": ["src/tests", ".test.ts"],
"minify": false,
"sourceMaps": true
}
Loading

0 comments on commit b0eba8d

Please sign in to comment.