switch to a proper typescript compilation
This commit is contained in:
parent
68346c0a47
commit
5383eb5d7f
8 changed files with 47 additions and 25 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
*.js
|
||||
dist
|
||||
node_modules
|
||||
|
|
3
bootstrap.js
vendored
3
bootstrap.js
vendored
|
@ -1,3 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
require('tsx/cjs')
|
||||
require('./index.ts')
|
|
@ -9,8 +9,8 @@ import {
|
|||
DeleteObjectsCommandOutput,
|
||||
} from "@aws-sdk/client-s3";
|
||||
import { Upload } from "@aws-sdk/lib-storage";
|
||||
import { openApiConf } from "./auth";
|
||||
import Pool from "@supercharge/promise-pool";
|
||||
import { PromisePool } from "@supercharge/promise-pool";
|
||||
import { openApiConf } from "./auth.js";
|
||||
|
||||
// Walks through the local directory at path `dir`, and for each file it contains, returns :
|
||||
// - `localPath`: its path on the local filesystem (includes `dir`). On windows, this path
|
||||
|
@ -145,7 +145,7 @@ export async function deploy(vhost: string, localFolder: string) {
|
|||
}
|
||||
|
||||
// Control concurrence while uploading
|
||||
await Pool
|
||||
await PromisePool
|
||||
.for(localFiles)
|
||||
.withConcurrency(6)
|
||||
.process(({ localPath, s3Path }) => uploadFile(s3client, Bucket, s3Path,fs.createReadStream(localPath)));
|
||||
|
|
7
index.ts
7
index.ts
|
@ -1,7 +1,8 @@
|
|||
#!/usr/bin/env node
|
||||
import { program } from "commander";
|
||||
import { login } from "./auth";
|
||||
import { deploy } from "./deploy";
|
||||
import { vhostsList } from "./vhosts";
|
||||
import { login } from "./auth.js";
|
||||
import { deploy } from "./deploy.js";
|
||||
import { vhostsList } from "./vhosts.js";
|
||||
|
||||
program
|
||||
.name('dxfl')
|
||||
|
|
22
package-lock.json
generated
22
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "dxfl",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "dxfl",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"license": "EUPL-1.2",
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.750.0",
|
||||
|
@ -17,10 +17,11 @@
|
|||
"guichet-sdk-ts": "git+https://git.deuxfleurs.fr/Deuxfleurs/guichet-sdk-ts",
|
||||
"mime": "^4.0.6",
|
||||
"read": "^4.1.0",
|
||||
"tsx": "^4.19.3"
|
||||
"tsx": "^4.19.3",
|
||||
"typescript": "^5.7.3"
|
||||
},
|
||||
"bin": {
|
||||
"dfl": "bootstrap.js"
|
||||
"dxfl": "dist/index.js"
|
||||
}
|
||||
},
|
||||
"node_modules/@aws-crypto/crc32": {
|
||||
|
@ -1938,6 +1939,19 @@
|
|||
"fsevents": "~2.3.3"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.7.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz",
|
||||
"integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==",
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz",
|
||||
|
|
11
package.json
11
package.json
|
@ -4,12 +4,14 @@
|
|||
"description": "",
|
||||
"license": "EUPL-1.2",
|
||||
"author": "Deuxfleurs Team <coucou@deuxfleurs.fr>",
|
||||
"type": "commonjs",
|
||||
"main": "bootstrap.js",
|
||||
"type": "module",
|
||||
"main": "dist/main.js",
|
||||
"bin": {
|
||||
"dxfl": "./bootstrap.js"
|
||||
"dxfl": "./dist/index.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"prepare": "npm run-script build",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -21,6 +23,7 @@
|
|||
"guichet-sdk-ts": "git+https://git.deuxfleurs.fr/Deuxfleurs/guichet-sdk-ts",
|
||||
"mime": "^4.0.6",
|
||||
"read": "^4.1.0",
|
||||
"tsx": "^4.19.3"
|
||||
"tsx": "^4.19.3",
|
||||
"typescript": "^5.7.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
/* Language and Environment */
|
||||
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||
"lib": [ "es6" ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
||||
|
@ -25,13 +25,15 @@
|
|||
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
||||
|
||||
/* Modules */
|
||||
"module": "commonjs", /* Specify what module code is generated. */
|
||||
"module": "nodenext", /* Specify what module code is generated. */
|
||||
// "rootDir": "./", /* Specify the root folder within your source files. */
|
||||
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||
//"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
|
@ -51,14 +53,14 @@
|
|||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
||||
|
||||
/* Emit */
|
||||
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
||||
"outDir": "dist", /* Specify an output folder for all emitted files. */
|
||||
// "removeComments": true, /* Disable emitting comments. */
|
||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||
|
@ -107,5 +109,9 @@
|
|||
/* Completeness */
|
||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||
}
|
||||
},
|
||||
"exclude": [
|
||||
"dist",
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Configuration, WebsiteApi } from "guichet-sdk-ts";
|
||||
import { openApiConf } from "./auth";
|
||||
import { openApiConf } from "./auth.js";
|
||||
|
||||
export async function vhostsList() {
|
||||
const conf = await openApiConf();
|
||||
|
|
Loading…
Add table
Reference in a new issue