Skip to content

Commit

Permalink
wip: convert shared packages to esm (doesn't build, needs doing to ap…
Browse files Browse the repository at this point in the history
…ps too)
  • Loading branch information
Julusian committed Oct 10, 2024
1 parent 90535f8 commit 6514a86
Show file tree
Hide file tree
Showing 70 changed files with 419 additions and 330 deletions.
10 changes: 5 additions & 5 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ module.exports = {
ignorePatterns: ['**/dist/**/*', '**/__tests__/**/*'],
rules: {
'no-console': 'warn',
'node/no-unpublished-import': [
'n/no-unpublished-import': [
'error',
{
allowModules: ['electron', 'typed-emitter', 'electron-devtools-installer'],
},
],
'node/no-unpublished-require': [
'n/no-unpublished-require': [
'error',
{
allowModules: ['html-webpack-plugin', 'electron-notarize'],
},
],
'node/no-extraneous-import': [
'n/no-extraneous-import': [
'error',
{
allowModules: [
Expand Down Expand Up @@ -59,8 +59,8 @@ module.exports = {
rules: {
...commonRules,
...tsRules,
// "node/no-extraneous-import": "off", // because there are a lot of them as dev-dependencies
'node/no-missing-import': 'off', // erroring on every single import
// "n/no-extraneous-import": "off", // because there are a lot of them as dev-dependencies
'n/no-missing-import': 'off', // erroring on every single import
'react/prop-types': 'off', // we don't use this
// "@typescript-eslint/no-empty-interface": "off", // many prop/state types are {}
'@typescript-eslint/promise-function-async': 'off', // event handlers can't be async
Expand Down
2 changes: 1 addition & 1 deletion apps/app/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// eslint-disable-next-line node/no-unpublished-require
// eslint-disable-next-line n/no-unpublished-require
const base = require('../../jest.config.base')
const packageJson = require('./package')

Expand Down
2 changes: 1 addition & 1 deletion apps/app/src/react/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const ENABLE_WHY_DID_YOU_RENDER = false
if (process.env.NODE_ENV === 'development' && ENABLE_WHY_DID_YOU_RENDER) {
// eslint-disable-next-line no-console
console.log('Why-did-you-render-enabled')
// eslint-disable-next-line @typescript-eslint/no-require-imports, node/no-unpublished-require
// eslint-disable-next-line @typescript-eslint/no-require-imports, n/no-unpublished-require
const whyDidYouRender = require('@welldone-software/why-did-you-render')
whyDidYouRender(React, {
trackAllPureComponents: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GDDSchema } from 'graphics-data-definition'
import { TSRTimelineContent, TSRTimelineObj } from 'timeline-state-resolver-types'
// eslint-disable-next-line node/no-missing-import
// eslint-disable-next-line n/no-missing-import
import { OnSave } from '../timelineObjs/lib'

export function getBasicType(schemaType: string | string[]): string {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
},
"devDependencies": {
"@sofie-automation/eslint-plugin": "^0.1.1",
"@tsconfig/node20": "^20.1.4",
"@types/jest": "^29.5.13",
"@types/node": "^20.16.11",
"@types/shelljs": "^0",
Expand All @@ -52,7 +53,7 @@
"eslint": "^8.57.1",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-jest": "^28.8.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-n": "^17.11.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.37.1",
"eslint-plugin-react-hooks": "^4.6.2",
Expand Down
2 changes: 1 addition & 1 deletion scripts/license-check.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable no-process-exit, node/no-unpublished-require, node/no-extraneous-require */
/* eslint-disable no-process-exit, n/no-unpublished-require, n/no-extraneous-require */
'use strict'
const fs = require('fs')
const path = require('path')
Expand Down
5 changes: 3 additions & 2 deletions shared/packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
"homepage": "https://github.com/SuperFlyTV/SuperConductor#readme",
"license": "AGPL-3.0-or-later",
"private": true,
"type": "module",
"engines": {
"node": "20"
},
"main": "dist/index",
"types": "dist/index",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
Expand Down
6 changes: 3 additions & 3 deletions shared/packages/api/src/bridgeAPI.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { MetadataAny, ResourceAny, TSRDeviceId, SerializedProtectedMap } from '@shared/models'
import { AnalogValue, KnownPeripheral, PeripheralId, PeripheralSettingsAny } from './peripherals'
import { AnalogValue, KnownPeripheral, PeripheralId, PeripheralSettingsAny } from './peripherals.js'
import { DeviceOptionsAny, Mappings, TSRTimeline } from 'timeline-state-resolver-types'
import { KeyDisplay, KeyDisplayTimeline, PeripheralInfo } from './peripherals'
import { BridgeId } from './bridge'
import { KeyDisplay, KeyDisplayTimeline, PeripheralInfo } from './peripherals.js'
import { BridgeId } from './bridge.js'

export namespace BridgeAPI {
export namespace FromBridge {
Expand Down
8 changes: 4 additions & 4 deletions shared/packages/api/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './bridge'
export * from './bridgeAPI'
export * from './peripherals'
export * from './logging'
export * from './bridge.js'
export * from './bridgeAPI.js'
export * from './peripherals.js'
export * from './logging.js'
10 changes: 3 additions & 7 deletions shared/packages/api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
"extends": "../../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"lib": [
"es6"
]
"outDir": "dist"
},
"exclude": [
"src/**/__tests__/**/*"
]
"include": ["src/**/*.ts"],
"exclude": ["src/**/__tests__/**/*"]
}
5 changes: 3 additions & 2 deletions shared/packages/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
"homepage": "https://github.com/SuperFlyTV/SuperConductor#readme",
"license": "AGPL-3.0-or-later",
"private": true,
"type": "module",
"engines": {
"node": "20"
},
"main": "dist/index",
"types": "dist/index",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
Expand Down
2 changes: 1 addition & 1 deletion shared/packages/lib/src/Resources.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { protectString, ResourceAny, ResourceType, ResourceId } from '@shared/models'
import { assertNever } from './lib'
import { assertNever } from './lib.js'
import {
TSRTimelineObj,
TSRTimelineContent,
Expand Down
2 changes: 1 addition & 1 deletion shared/packages/lib/src/TimelineTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
TimelineObjectInstance,
} from 'superfly-timeline'
import _ from 'lodash'
import { deepClone } from './lib'
import { deepClone } from './lib.js'

export class TimelineTracker {
private timeline: TimelineObject[]
Expand Down
12 changes: 6 additions & 6 deletions shared/packages/lib/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from './bytesToSize'
export * from './color'
export * from './lib'
export * from './peripheral'
export * from './Resources'
export * from './TimelineTracker'
export * from './bytesToSize.js'
export * from './color.js'
export * from './lib.js'
export * from './peripheral.js'
export * from './Resources.js'
export * from './TimelineTracker.js'
6 changes: 2 additions & 4 deletions shared/packages/lib/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
"extends": "../../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"lib": [
"es6"
]
"outDir": "dist"
},
"include": ["src/**/*.ts"]
}
5 changes: 3 additions & 2 deletions shared/packages/models/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
"homepage": "https://github.com/SuperFlyTV/SuperConductor#readme",
"license": "AGPL-3.0-or-later",
"private": true,
"type": "module",
"engines": {
"node": "20"
},
"main": "dist/index",
"types": "dist/index",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
Expand Down
8 changes: 4 additions & 4 deletions shared/packages/models/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './resource'
export * from './metadata'
export * from './protectedString'
export * from './tsrDevice'
export * from './resource/index.js'
export * from './metadata/index.js'
export * from './protectedString.js'
export * from './tsrDevice.js'
4 changes: 2 additions & 2 deletions shared/packages/models/src/metadata/Atem.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InputState } from 'atem-connection'
import { MetadataBase, MetadataType } from './metadata'
import type { InputState } from 'atem-connection'
import { MetadataBase, MetadataType } from './metadata.js'

export interface AtemMetadata extends MetadataBase {
metadataType: MetadataType.ATEM
Expand Down
2 changes: 1 addition & 1 deletion shared/packages/models/src/metadata/CasparCG.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MetadataBase, MetadataType } from './metadata'
import { MetadataBase, MetadataType } from './metadata.js'

export interface CasparCGMetadata extends MetadataBase {
metadataType: MetadataType.CASPARCG
Expand Down
2 changes: 1 addition & 1 deletion shared/packages/models/src/metadata/HTTPSend.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MetadataBase, MetadataType } from './metadata'
import { MetadataBase, MetadataType } from './metadata.js'

export interface HTTPSendMetadata extends MetadataBase {
metadataType: MetadataType.HTTP_SEND
Expand Down
2 changes: 1 addition & 1 deletion shared/packages/models/src/metadata/Hyperdeck.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MetadataBase, MetadataType } from './metadata'
import { MetadataBase, MetadataType } from './metadata.js'

export interface HyperdeckMetadata extends MetadataBase {
metadataType: MetadataType.HYPERDECK
Expand Down
2 changes: 1 addition & 1 deletion shared/packages/models/src/metadata/OBS.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MetadataBase, MetadataType } from './metadata'
import { MetadataBase, MetadataType } from './metadata.js'

export interface OBSMetadata extends MetadataBase {
metadataType: MetadataType.OBS
Expand Down
2 changes: 1 addition & 1 deletion shared/packages/models/src/metadata/OSC.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MetadataBase, MetadataType } from './metadata'
import { MetadataBase, MetadataType } from './metadata.js'

export interface OSCMetadata extends MetadataBase {
metadataType: MetadataType.OSC
Expand Down
2 changes: 1 addition & 1 deletion shared/packages/models/src/metadata/TCPSend.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MetadataBase, MetadataType } from './metadata'
import { MetadataBase, MetadataType } from './metadata.js'

export interface TCPSendMetadata extends MetadataBase {
metadataType: MetadataType.TCP_SEND
Expand Down
2 changes: 1 addition & 1 deletion shared/packages/models/src/metadata/TriCaster.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MetadataBase, MetadataType } from './metadata'
import { MetadataBase, MetadataType } from './metadata.js'

export interface TriCasterMetadata extends MetadataBase {
metadataType: MetadataType.TRICASTER
Expand Down
2 changes: 1 addition & 1 deletion shared/packages/models/src/metadata/VMix.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MetadataBase, MetadataType } from './metadata'
import { MetadataBase, MetadataType } from './metadata.js'

export interface VMixMetadata extends MetadataBase {
metadataType: MetadataType.VMIX
Expand Down
20 changes: 10 additions & 10 deletions shared/packages/models/src/metadata/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export * from './metadata'
export * from './Atem'
export * from './CasparCG'
export * from './HTTPSend'
export * from './OBS'
export * from './OSC'
export * from './VMix'
export * from './Hyperdeck'
export * from './TCPSend'
export * from './TriCaster'
export * from './metadata.js'
export * from './Atem.js'
export * from './CasparCG.js'
export * from './HTTPSend.js'
export * from './OBS.js'
export * from './OSC.js'
export * from './VMix.js'
export * from './Hyperdeck.js'
export * from './TCPSend.js'
export * from './TriCaster.js'
18 changes: 9 additions & 9 deletions shared/packages/models/src/metadata/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { AtemMetadata } from './Atem'
import { CasparCGMetadata } from './CasparCG'
import { HTTPSendMetadata } from './HTTPSend'
import { HyperdeckMetadata } from './Hyperdeck'
import { OBSMetadata } from './OBS'
import { OSCMetadata } from './OSC'
import { TCPSendMetadata } from './TCPSend'
import { TriCasterMetadata } from './TriCaster'
import { VMixMetadata } from './VMix'
import { AtemMetadata } from './Atem.js'
import { CasparCGMetadata } from './CasparCG.js'
import { HTTPSendMetadata } from './HTTPSend.js'
import { HyperdeckMetadata } from './Hyperdeck.js'
import { OBSMetadata } from './OBS.js'
import { OSCMetadata } from './OSC.js'
import { TCPSendMetadata } from './TCPSend.js'
import { TriCasterMetadata } from './TriCaster.js'
import { VMixMetadata } from './VMix.js'

export type MetadataAny =
| AtemMetadata
Expand Down
2 changes: 1 addition & 1 deletion shared/packages/models/src/resource/Atem.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ResourceBase, ResourceType } from './resource'
import { ResourceBase, ResourceType } from './resource.js'

export type AtemAny =
| AtemMe
Expand Down
2 changes: 1 addition & 1 deletion shared/packages/models/src/resource/CasparCG.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ResourceBase, ResourceType } from './resource'
import { ResourceBase, ResourceType } from './resource.js'
import type { GDDSchema } from 'graphics-data-definition'

export type CasparCGAny = CasparCGServer | CasparCGMedia | CasparCGTemplate
Expand Down
2 changes: 1 addition & 1 deletion shared/packages/models/src/resource/HTTPSend.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ResourceBase, ResourceType } from './resource'
import { ResourceBase, ResourceType } from './resource.js'

export type HTTPSendAny = HTTPRequest

Expand Down
2 changes: 1 addition & 1 deletion shared/packages/models/src/resource/Hyperdeck.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ResourceBase, ResourceType } from './resource'
import { ResourceBase, ResourceType } from './resource.js'

export type HyperdeckAny = HyperdeckPlay | HyperdeckRecord | HyperdeckPreview | HyperdeckClip

Expand Down
2 changes: 1 addition & 1 deletion shared/packages/models/src/resource/OBS.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ResourceBase, ResourceType } from './resource'
import { ResourceBase, ResourceType } from './resource.js'

export type OBSAny = OBSScene | OBSTransition | OBSRecording | OBSStreaming | OBSSourceSettings | OBSMute | OBSRender

Expand Down
2 changes: 1 addition & 1 deletion shared/packages/models/src/resource/OSC.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ResourceBase, ResourceType } from './resource'
import { ResourceBase, ResourceType } from './resource.js'

export type OSCAny = OSCMessage

Expand Down
2 changes: 1 addition & 1 deletion shared/packages/models/src/resource/TCPSend.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ResourceBase, ResourceType } from './resource'
import { ResourceBase, ResourceType } from './resource.js'

export type TCPSendAny = TCPRequest

Expand Down
2 changes: 1 addition & 1 deletion shared/packages/models/src/resource/TriCaster.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ResourceBase, ResourceType } from './resource'
import { ResourceBase, ResourceType } from './resource.js'

export type TriCasterAny =
| TriCasterMe
Expand Down
2 changes: 1 addition & 1 deletion shared/packages/models/src/resource/VMix.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ResourceBase, ResourceType } from './resource'
import { ResourceBase, ResourceType } from './resource.js'

export type VMixAny =
| VMixInput
Expand Down
20 changes: 10 additions & 10 deletions shared/packages/models/src/resource/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export * from './Atem'
export * from './CasparCG'
export * from './OBS'
export * from './VMix'
export * from './OSC'
export * from './HTTPSend'
export * from './Hyperdeck'
export * from './resource'
export * from './TCPSend'
export * from './TriCaster'
export * from './Atem.js'
export * from './CasparCG.js'
export * from './OBS.js'
export * from './VMix.js'
export * from './OSC.js'
export * from './HTTPSend.js'
export * from './Hyperdeck.js'
export * from './resource.js'
export * from './TCPSend.js'
export * from './TriCaster.js'
Loading

0 comments on commit 6514a86

Please sign in to comment.