Skip to content

Commit

Permalink
Merge pull request #369 from secretarium/chore/esm
Browse files Browse the repository at this point in the history
chore!: Migrate to Pure ESM
  • Loading branch information
fguitton authored Aug 5, 2024
2 parents 50b4454 + 0c9c230 commit 8140abb
Show file tree
Hide file tree
Showing 47 changed files with 70 additions and 89 deletions.
6 changes: 3 additions & 3 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { utils: { getProjects } } = require('@commitlint/config-nx-scopes');
import configNxScopes from '@commitlint/config-nx-scopes';

module.exports = {
export default {
extends: [
'@commitlint/config-conventional',
'@commitlint/config-nx-scopes'
Expand All @@ -10,7 +10,7 @@ module.exports = {
const projectFilter = ({ name }) =>
!name.includes('e2e');
const projectNames = new Set();
(await getProjects(ctx, projectFilter))
(await configNxScopes.utils.getProjects(ctx, projectFilter))
.forEach(element => {
projectNames.add(element);
});
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion apps/endoscope-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": [
"plugin:cypress/recommended",
"../../.eslintrc.js"
"../../.eslintrc.cjs"
],
"ignorePatterns": [
"!**/*"
Expand Down
13 changes: 13 additions & 0 deletions apps/endoscope-e2e/cypress.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const cypress = require('cypress')
const cypressPreset = require('@nx/cypress/plugins/cypress-preset');

const cypressJsonConfig = {
baseUrl: 'http://127.0.0.1:4210'
};

module.exports = cypress.defineConfig({
e2e: {
...cypressPreset.nxE2EPreset(__dirname),
...cypressJsonConfig
}
});
13 changes: 0 additions & 13 deletions apps/endoscope-e2e/cypress.config.ts

This file was deleted.

2 changes: 1 addition & 1 deletion apps/endoscope-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"e2e": {
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/endoscope-e2e/cypress.config.ts",
"cypressConfig": "apps/endoscope-e2e/cypress.config.cjs",
"devServerTarget": "endoscope:serve:development",
"testingType": "e2e"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/endoscope/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": [
"../../.eslintrc.js"
"../../.eslintrc.cjs"
],
"ignorePatterns": [
"!**/*"
Expand Down
2 changes: 1 addition & 1 deletion apps/endoscope/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'path';

export default {
displayName: 'endoscope',
preset: '../../jest.preset.js',
preset: '../../jest.preset.cjs',
transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': [
Expand Down
13 changes: 13 additions & 0 deletions apps/endoscope/postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { join } = require('path');

// Note: If you use library-specific PostCSS/Tailwind configuration then you should remove the `postcssConfig` build
// option from your application's configuration (i.e. project.json).
//
// See: https://nx.dev/guides/using-tailwind-css-in-react#step-4:-applying-configuration-to-libraries

module.exports = {
plugins: {
tailwindcss: { config: join(__dirname, 'tailwind.config.cjs') },
autoprefixer: {}
}
};
8 changes: 0 additions & 8 deletions apps/endoscope/postcss.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion apps/endoscope/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"apps/endoscope/src/styles.css"
],
"scripts": [],
"webpackConfig": "apps/endoscope/webpack.config"
"webpackConfig": "apps/endoscope/webpack.config.cjs"
},
"configurations": {
"production": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { join } = require('path');
const { createGlobPatternsForDependencies } = require('@nx/react/tailwind');

/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
...createGlobPatternsForDependencies(__dirname),
Expand Down
2 changes: 1 addition & 1 deletion apps/endoscope/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"module": "esnext",
"types": [
"jest",
"node",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion apps/pocket-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": [
"plugin:@nx/react",
"../../.eslintrc.js"
"../../.eslintrc.cjs"
],
"ignorePatterns": [
"!**/*"
Expand Down
2 changes: 1 addition & 1 deletion apps/pocket/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": [
"../../.eslintrc.js"
"../../.eslintrc.cjs"
],
"ignorePatterns": [
"!**/*",
Expand Down
1 change: 1 addition & 0 deletions apps/pocket/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@secretarium/pocket",
"version": "0.0.1",
"private": true,
"type": "module",
"dependencies": {
"@testing-library/jest-native": "*",
"@testing-library/react-native": "*",
Expand Down
2 changes: 1 addition & 1 deletion apps/pocket/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"module": "esnext",
"types": [
"jest",
"node"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion libs/connector/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": [
"../../.eslintrc.js"
"../../.eslintrc.cjs"
],
"ignorePatterns": [
"!**/*"
Expand Down
2 changes: 1 addition & 1 deletion libs/connector/.swcrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"jsc": {
"target": "es2017",
"target": "es2021",
"parser": {
"syntax": "typescript",
"decorators": true,
Expand Down
2 changes: 1 addition & 1 deletion libs/connector/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if (swcJestConfig.swcrc === undefined) {

export default {
displayName: 'connector',
preset: '../../jest.preset.js',
preset: '../../jest.preset.cjs',
transform: {
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig],
},
Expand Down
1 change: 1 addition & 0 deletions libs/connector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.17.0",
"license": "MIT",
"private": false,
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/secretarium/devsuite-typescript.git",
Expand Down
4 changes: 0 additions & 4 deletions libs/connector/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
],
"project": "libs/connector/package.json",
"compiler": "swc",
"format": [
"cjs",
"esm"
],
"external": "all",
"generateExportsField": true
}
Expand Down
8 changes: 4 additions & 4 deletions libs/connector/src/secretarium.connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class SCP {
return this._socket?.bufferedAmount || 0;
}

connect(url: string, userKey: Key, knownTrustedKey: Uint8Array | string | undefined = undefined, protocol: NNG.Protocol = NNG.Protocol.pair1): Promise<void> {
async connect(url: string, userKey: Key, knownTrustedKey: Uint8Array | string | undefined = undefined, protocol: NNG.Protocol = NNG.Protocol.pair1): Promise<void> {
// if (this._socket && this._socket.state < ConnectionState.closing) this._socket.close();

this._endpoint = {
Expand Down Expand Up @@ -245,7 +245,7 @@ export class SCP {
.send(ecdhPubKeyRaw);
});
})
.then((serverHello: Uint8Array): Promise<Uint8Array> => {
.then(async (serverHello: Uint8Array): Promise<Uint8Array> => {
const pow = this._computeProofOfWork(serverHello.subarray(0, 32));
const clientProofOfWork = Utils.concatBytesArrays([pow, trustedKey]);
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -403,7 +403,7 @@ export class SCP {
(cbs.onResult = cbs.onResult || []).push(x);
return query;
},
send: () => {
send: async () => {
this.send(app, command, rid, args);
return pm;
}
Expand Down Expand Up @@ -456,7 +456,7 @@ export class SCP {
(cbs.onResult = cbs.onResult || []).push(x);
return tx;
}, // for chained tx + query
send: () => {
send: async () => {
this.send(app, command, rid, args);
return pm;
}
Expand Down
2 changes: 1 addition & 1 deletion libs/connector/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"module": "esnext",
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"strict": true,
Expand Down
2 changes: 1 addition & 1 deletion libs/connector/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"module": "esnext",
"types": [
"jest",
"node"
Expand Down
2 changes: 1 addition & 1 deletion libs/crypto/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": [
"../../.eslintrc.js"
"../../.eslintrc.cjs"
],
"ignorePatterns": [
"!**/*",
Expand Down
2 changes: 1 addition & 1 deletion libs/crypto/.swcrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"jsc": {
"target": "es2017",
"target": "es2021",
"parser": {
"syntax": "typescript",
"decorators": true,
Expand Down
2 changes: 1 addition & 1 deletion libs/crypto/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if (swcJestConfig.swcrc === undefined) {

export default {
displayName: 'crypto',
preset: '../../jest.preset.js',
preset: '../../jest.preset.cjs',
transform: {
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig],
},
Expand Down
1 change: 1 addition & 0 deletions libs/crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.2.1",
"license": "MIT",
"private": false,
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/secretarium/devsuite-typescript.git",
Expand Down
4 changes: 0 additions & 4 deletions libs/crypto/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
],
"project": "libs/crypto/package.json",
"compiler": "swc",
"format": [
"cjs",
"esm"
],
"generateExportsField": true
}
},
Expand Down
2 changes: 1 addition & 1 deletion libs/crypto/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"module": "commonjs",
"module": "esnext",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
Expand Down
2 changes: 1 addition & 1 deletion libs/crypto/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"module": "esnext",
"types": [
"jest",
"node"
Expand Down
2 changes: 1 addition & 1 deletion libs/instrumentation/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": [
"../../.eslintrc.js"
"../../.eslintrc.cjs"
],
"ignorePatterns": [
"!**/*"
Expand Down
2 changes: 1 addition & 1 deletion libs/instrumentation/.swcrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"jsc": {
"target": "es2017",
"target": "es2021",
"parser": {
"syntax": "typescript",
"decorators": true,
Expand Down
2 changes: 1 addition & 1 deletion libs/instrumentation/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if (swcJestConfig.swcrc === undefined) {

export default {
displayName: 'instrumentation',
preset: '../../jest.preset.js',
preset: '../../jest.preset.cjs',
transform: {
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig],
},
Expand Down
2 changes: 1 addition & 1 deletion libs/instrumentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"version": "0.5.0",
"license": "MIT",
"private": false,
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/secretarium/devsuite-typescript.git",
"directory": "libs/instrumentation"
},
"type": "commonjs",
"peerDependencies": {
"@secretarium/connector": "0.17.0",
"@sentry/core": "7.118.0",
Expand Down
4 changes: 0 additions & 4 deletions libs/instrumentation/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
],
"project": "libs/instrumentation/package.json",
"compiler": "swc",
"format": [
"cjs",
"esm"
],
"bundle": true,
"generateExportsField": true
}
Expand Down
2 changes: 1 addition & 1 deletion libs/instrumentation/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"module": "esnext",
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
Expand Down
2 changes: 1 addition & 1 deletion libs/instrumentation/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"module": "esnext",
"types": [
"jest",
"node"
Expand Down
Loading

0 comments on commit 8140abb

Please sign in to comment.