Maybe fix module imports

This commit is contained in:
Djkato 2023-05-25 18:51:01 +02:00
parent 47a28204ac
commit decce4a910
13 changed files with 303 additions and 45 deletions

View file

@ -0,0 +1,33 @@
{
"extends": [
"../../.eslintrc.json"
],
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"rules": {}
},
{
"files": [
"*.ts",
"*.tsx"
],
"rules": {}
},
{
"files": [
"*.js",
"*.jsx"
],
"rules": {}
}
]
}

View file

@ -0,0 +1,13 @@
# music-library
This library was generated with [Nx](https://nx.dev).
## Building
Run `nx build music-library` to build the library.

View file

@ -0,0 +1,5 @@
{
"name": "@euterpe-js/music-library",
"version": "0.0.1",
"type": "commonjs"
}

View file

@ -0,0 +1,40 @@
{
"name": "music-library",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/music-library/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": [
"{options.outputPath}"
],
"options": {
"outputPath": "dist/packages/music-library",
"main": "packages/music-library/src/index.ts",
"tsConfig": "packages/music-library/tsconfig.lib.json",
"assets": [
"packages/music-library/*.md"
]
}
},
"publish": {
"command": "node tools/scripts/publish.mjs music-library {args.ver} {args.tag}",
"dependsOn": [
"build"
]
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": [
"{options.outputFile}"
],
"options": {
"lintFilePatterns": [
"packages/music-library/**/*.ts"
]
}
}
},
"tags": []
}

View file

@ -0,0 +1,65 @@
import { writeFile, readFile } from "node:fs"
type ID = number
type URL = string
enum RefTo {
Artists,
Songs,
Collections
}
enum Platforms {
Youtube,
Linktree,
Bandcamp,
Spotify,
Portfolio,
BeatPort,
SoundCloud,
}
type Ref<T> = [T, ID]
type Song = {
id: ID,
name: string,
artists: Ref<RefTo.Artists>[],
url: URL,
publish_date?: Date,
remix_artists?: Ref<RefTo.Artists>[],
in_collection?: Ref<RefTo.Collections>,
cover?: URL,
duration: number,
bpm?: number,
key?: string,
fft_data?: number[]
}
type Artist = {
id: ID,
name: string,
pfp?: URL,
songs?: Ref<RefTo.Songs>[],
collections?: Ref<RefTo.Collections>[],
links: [Platforms, URL][],
}
type Collection = {
id: ID,
publish_date?: Date,
artists: Ref<RefTo.Artists>[],
songs: Ref<RefTo.Songs>[],
cover: URL,
duration: number,
}
type DB = {
artists?: Artist[],
songs?: Song[],
Collections?: Collection[],
}
const db: DB = {}
db.songs?.push(
{
id: 0,
artists: [RefTo.Artists, 0] as Ref<RefTo.Artists>,
duration: 13,
songs: [RefTo.Songs, 0] as Ref<RefTo.Songs>,
name: "Just the two of us",
url: "Huehue" as URL,
} as Song)

View file

@ -0,0 +1,3 @@
export function musicLibrary(): string {
return "music-library"
}

View file

@ -0,0 +1,53 @@
{
"artist": {
"id": 0,
"name": "",
"pfp?": "url('')",
"songs?": [
"ref(songs,0)",
"ref(songs,2)"
],
"collections?": [
"ref(collections,0)"
],
"links?": [
"(youtube, url(''))",
"(key, url(''))"
]
},
"song": {
"id": 0,
"publish-date?": "00-00-0000",
"name": "",
"artists": [
"ref(artists, 0)",
"ref(artists, 1)"
],
"remix_artists": [
"ref(artists,3)"
],
"in_collection?": "ref(collections,0)",
"url": "url('')",
"cover?": "either url or use collections cover",
"duration": 123,
"bpm?": 120,
"key": "A Minor",
"fft_data?": [
0,
1
]
},
"collection": {
"id": 0,
"publish-date?": "00-00-0000",
"artists": [
"ref(artists, 0)"
],
"songs": [
"ref(songs, 1)",
"ref(songs, 2)"
],
"cover": "url('')",
"duration": 123
}
}

View file

@ -0,0 +1,19 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}

View file

@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
}

View file

@ -1,9 +1,9 @@
{ {
"name": "@euterpe.js/player", "name": "@euterpe.js/player",
"version": "1.0.21", "version": "1.0.22",
"type": "commonjs", "type": "module",
"description": "A simple, safe AudioContext web music player", "description": "A simple, safe AudioContext web music player",
"main": "index.ts", "main": "./src/index.js",
"author": { "author": {
"name": "Djkáťo", "name": "Djkáťo",
"email": "djkatovfx@gmail.com" "email": "djkatovfx@gmail.com"
@ -21,5 +21,12 @@
"audio-visualizer", "audio-visualizer",
"webaudio", "webaudio",
"vizualizer" "vizualizer"
] ],
"exports": {
".": {
"types": "./src/index.d.ts",
"import": "./src/index.js",
"require": "./src/lib/player.js"
}
}
} }

View file

@ -1,9 +1,9 @@
{ {
"name": "@euterpe.js/visualizer", "name": "@euterpe.js/visualizer",
"version": "1.0.0", "version": "1.0.1",
"type": "commonjs", "type": "module",
"description": "Music visualizer based on SVG and AudioContext", "description": "Music visualizer based on SVG and AudioContext",
"main": "index.ts", "main": "./src/index.js",
"author": { "author": {
"name": "Djkáťo", "name": "Djkáťo",
"email": "djkatovfx@gmail.com" "email": "djkatovfx@gmail.com"
@ -19,5 +19,12 @@
"audio-visualizer", "audio-visualizer",
"webaudio", "webaudio",
"vizualizer" "vizualizer"
] ],
"exports": {
".": {
"types": "./src/index.d.ts",
"import": "./src/index.js",
"require": "./src/lib/visualizer.js"
}
}
} }

View file

@ -1,7 +1,7 @@
{ {
"extends": "../../tsconfig.base.json", "extends": "../../tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"module": "commonjs", "module": "ESNext",
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"strict": true, "strict": true,
"noImplicitOverride": true, "noImplicitOverride": true,

View file

@ -18,6 +18,9 @@
"skipDefaultLibCheck": true, "skipDefaultLibCheck": true,
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@euterpe-js/music-library": [
"packages/music-library/src/index.ts"
],
"@euterpe/player": [ "@euterpe/player": [
"packages/player/src/index.ts" "packages/player/src/index.ts"
], ],