npm config; ci/cd flow changes
This commit is contained in:
5
.github/workflows/main.yml
vendored
5
.github/workflows/main.yml
vendored
@@ -1,5 +1,10 @@
|
|||||||
name: build check (mikayla dot dev)
|
name: build check (mikayla dot dev)
|
||||||
|
|
||||||
|
env:
|
||||||
|
POSTGRES_URL: ${{ secrets.POSTGRES_URL }}
|
||||||
|
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
|
||||||
|
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
|||||||
5
.github/workflows/staging.yml
vendored
5
.github/workflows/staging.yml
vendored
@@ -1,5 +1,10 @@
|
|||||||
name: build check (mikayla dot dev)
|
name: build check (mikayla dot dev)
|
||||||
|
|
||||||
|
env:
|
||||||
|
POSTGRES_URL: ${{ secrets.POSTGRES_URL }}
|
||||||
|
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
|
||||||
|
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
|||||||
20
pkg/.eslintrc.json
Normal file
20
pkg/.eslintrc.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es2021": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended"
|
||||||
|
],
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": "latest",
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"@typescript-eslint"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
}
|
||||||
|
}
|
||||||
1
pkg/.gitignore
vendored
Normal file
1
pkg/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
lib
|
||||||
2
pkg/.npmignore
Normal file
2
pkg/.npmignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
src
|
||||||
|
eslintrc.json
|
||||||
2
pkg/README.md
Normal file
2
pkg/README.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Helpers for mikayla.dev
|
||||||
|
|
||||||
29
pkg/package.json
Normal file
29
pkg/package.json
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "@mkladotdev/utils",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "Utilities for mikayla.dev",
|
||||||
|
"main": "./lib/index.js",
|
||||||
|
"types": "./lib/index.d.ts",
|
||||||
|
"files": [
|
||||||
|
"./lib/**/*"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc",
|
||||||
|
"lint": "eslint . --ext .ts",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "Mikayla Dobson",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^20.5.9",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^6.6.0",
|
||||||
|
"@typescript-eslint/parser": "^6.6.0",
|
||||||
|
"eslint": "^8.49.0",
|
||||||
|
"typescript": "^5.2.2"
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"registry": "http://localhost:4873"
|
||||||
|
}
|
||||||
|
}
|
||||||
12
pkg/src/entities/audiocollection.ts
Normal file
12
pkg/src/entities/audiocollection.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
export type Track = {
|
||||||
|
name: string;
|
||||||
|
date: Date;
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AudioCollection = {
|
||||||
|
name: string;
|
||||||
|
date: Date;
|
||||||
|
tracklist: Track[];
|
||||||
|
directory: string;
|
||||||
|
}
|
||||||
9
pkg/src/entities/post.ts
Normal file
9
pkg/src/entities/post.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
export type Post = {
|
||||||
|
name: string;
|
||||||
|
date: Date;
|
||||||
|
author: string;
|
||||||
|
description: string;
|
||||||
|
body: string;
|
||||||
|
tagIDs: string[];
|
||||||
|
media?: string[]; // array of URLs
|
||||||
|
}
|
||||||
49
pkg/src/entities/project.ts
Normal file
49
pkg/src/entities/project.ts
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
|
export type Project = {
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
created: Date;
|
||||||
|
updated?: Date;
|
||||||
|
tagIDs?: string[];
|
||||||
|
media?: string[]; // array of URLs
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ProjectCreationError extends Error {
|
||||||
|
constructor(message: string) {
|
||||||
|
super(message);
|
||||||
|
this.name = "ProjectCreationError";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZProject = z.object({
|
||||||
|
name: z.string(),
|
||||||
|
description: z.string(),
|
||||||
|
created: z.date(),
|
||||||
|
updated: z.date().optional(),
|
||||||
|
tagIDs: z.array(z.string()).optional(),
|
||||||
|
media: z.array(z.string()).optional(),
|
||||||
|
})
|
||||||
|
|
||||||
|
export function createProject(data: Partial<Project>) {
|
||||||
|
if (!data.name) throw new ProjectCreationError("Project name is required");
|
||||||
|
if (!data.description) throw new ProjectCreationError("Project description is required");
|
||||||
|
|
||||||
|
const today = new Date();
|
||||||
|
|
||||||
|
const completeInput = {
|
||||||
|
name: data.name,
|
||||||
|
description: data.description,
|
||||||
|
created: data.created || today,
|
||||||
|
updated: today,
|
||||||
|
} satisfies Partial<Project>;
|
||||||
|
|
||||||
|
const parsedProject = ZProject.safeParse(completeInput);
|
||||||
|
|
||||||
|
if (!parsedProject.success) throw new ProjectCreationError("Invalid project data");
|
||||||
|
return parsedProject.data satisfies Project;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isProject(data: unknown): data is Project {
|
||||||
|
return ZProject.safeParse(data).success;
|
||||||
|
}
|
||||||
28
pkg/tsconfig.json
Normal file
28
pkg/tsconfig.json
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
/* Projects */
|
||||||
|
"incremental": true,
|
||||||
|
|
||||||
|
/* Language and Environment */
|
||||||
|
"target": "es2016",
|
||||||
|
|
||||||
|
/* Modules */
|
||||||
|
"module": "commonjs",
|
||||||
|
"rootDir": "./src",
|
||||||
|
|
||||||
|
/* Emit */
|
||||||
|
"declaration": true,
|
||||||
|
"declarationMap": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"outDir": "./lib",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
|
||||||
|
/* Type Checking */
|
||||||
|
"strict": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"skipLibCheck": true
|
||||||
|
},
|
||||||
|
"include": ["src"],
|
||||||
|
"exclude": ["lib", "node_modules"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user