init repo
This commit is contained in:
4
.npmignore
Normal file
4
.npmignore
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
src
|
||||||
|
tests
|
||||||
|
rollup.config.js
|
||||||
|
tsconfig.json
|
||||||
16
dist/index.cjs.js
vendored
Normal file
16
dist/index.cjs.js
vendored
Normal 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
6
dist/index.d.ts
vendored
Normal 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
14
dist/index.es.js
vendored
Normal 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
36
package.json
Normal 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
23
rollup.config.js
Normal 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
14
src/index.ts
Normal 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
17
tsconfig.json
Normal 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"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user