init repo

This commit is contained in:
2025-10-21 22:18:18 +01:00
parent 09affd5191
commit fb8ff229c9
8 changed files with 130 additions and 0 deletions

4
.npmignore Normal file
View File

@@ -0,0 +1,4 @@
src
tests
rollup.config.js
tsconfig.json

16
dist/index.cjs.js vendored Normal file
View File

@@ -0,0 +1,16 @@
'use strict';
class Updater {
archiveURL;
feedType;
constructor(archiveURL = "/", feedType = "rss") {
this.archiveURL = archiveURL;
this.feedType = feedType;
}
async getArchive() {
const res = await fetch(`${this.archiveURL}.${this.feedType}`);
console.log(res);
}
}
module.exports = Updater;

6
dist/index.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
export default class Updater {
archiveURL: string;
feedType: string;
constructor(archiveURL?: string, feedType?: string);
getArchive(): Promise<void>;
}

14
dist/index.es.js vendored Normal file
View File

@@ -0,0 +1,14 @@
class Updater {
archiveURL;
feedType;
constructor(archiveURL = "/", feedType = "rss") {
this.archiveURL = archiveURL;
this.feedType = feedType;
}
async getArchive() {
const res = await fetch(`${this.archiveURL}.${this.feedType}`);
console.log(res);
}
}
export { Updater as default };

36
package.json Normal file
View File

@@ -0,0 +1,36 @@
{
"name": "updaterweblibrary",
"version": "1.0.0",
"description": "OTA Updater App frontend library",
"repository": {
"type": "git",
"url": "git@git.emaker.limited:MicrocontrollerCD/UpdaterWebLibrary.git"
},
"license": "MIT",
"author": "chopster44",
"type": "commonjs",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"exports": {
".": {
"require": "./dist/cjs/index.js",
"import": "./dist/esm/index.js"
}
},
"files": [
"dist"
],
"scripts": {
"build:types": "tsc -p tsconfig.json --emitDeclarationOnly",
"build": "rm -rf ./dist && npm run build:types && rollup -c",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"@rollup/plugin-typescript": "^12.1.4",
"rollup": "^4.52.5",
"tslib": "^2.8.1",
"typescript": "^5.9.3",
"vitest": "^3.2.4"
}
}

23
rollup.config.js Normal file
View File

@@ -0,0 +1,23 @@
const typescript = require("@rollup/plugin-typescript");
const typescriptOptions = {
exclude: ["tests/**/*"],
compilerOptions: { declaration: false },
};
const data = [
{
external: ["typeorm", "sinon"],
input: "src/index.ts",
output: { file: "dist/index.es.js", format: "esm" },
plugins: [typescript(typescriptOptions)],
},
{
external: ["typeorm", "sinon"],
input: "src/index.ts",
output: { file: "dist/index.cjs.js", format: "cjs" },
plugins: [typescript(typescriptOptions)],
},
];
module.exports = data;

14
src/index.ts Normal file
View File

@@ -0,0 +1,14 @@
export default class Updater {
public archiveURL: string;
public feedType: string;
constructor(archiveURL: string = "/", feedType: string = "rss") {
this.archiveURL = archiveURL;
this.feedType = feedType;
}
async getArchive(): Promise<void> {
const res = await fetch(`${this.archiveURL}.${this.feedType}`);
console.log(res);
}
}

17
tsconfig.json Normal file
View File

@@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "Node",
"esModuleInterop": true,
"outDir": "./dist",
"strict": false,
"declaration": true,
"declarationDir": "./dist",
"paths": {
"rollup/parseAst": ["./node_modules/rollup/dist/parseAst"]
}
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}