mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 10:21:55 +00:00
chore: Update some things to make a single export?
This commit is contained in:
10
Makefile
10
Makefile
@@ -13,8 +13,16 @@ buildOutput: lib/test/output.ts fmt
|
||||
echo 'done'
|
||||
|
||||
|
||||
bundle: clean $(TS_FILES) package.json .FORCE node_modules test fmt
|
||||
bundle: $(TS_FILES) package.json .FORCE node_modules test fmt
|
||||
npx tsc
|
||||
npx tsc --project tsconfig-cjs.json
|
||||
cp package.json dist/package.json
|
||||
cp README.md dist/README.md
|
||||
cp LICENSE dist/LICENSE
|
||||
|
||||
full-bundle:
|
||||
make clean
|
||||
make bundle
|
||||
cp package.json dist/package.json
|
||||
cp README.md dist/README.md
|
||||
cp LICENSE dist/LICENSE
|
||||
|
||||
36
lib/index.ts
36
lib/index.ts
@@ -1,20 +1,22 @@
|
||||
import "./backup"
|
||||
import "./config"
|
||||
import "./config/builder"
|
||||
import "./config/configTypes"
|
||||
import "./health"
|
||||
import "./health/checkFns"
|
||||
import "./mainFn"
|
||||
import "ts-matches"
|
||||
import "./types"
|
||||
import "@iarna/toml"
|
||||
import "./types"
|
||||
import "./util"
|
||||
import "yaml"
|
||||
import "./dependencyConfig"
|
||||
import "./actions"
|
||||
import "./manifest"
|
||||
import "./inits"
|
||||
export { Daemons } from "./mainFn/Daemons"
|
||||
export { EmVer } from "./emverLite/mod"
|
||||
export { Overlay } from "./util/Overlay"
|
||||
export { Utils } from "./util/utils"
|
||||
export * as actions from "./actions"
|
||||
export * as backup from "./backup"
|
||||
export * as config from "./config"
|
||||
export * as configBuilder from "./config/builder"
|
||||
export * as configTypes from "./config/configTypes"
|
||||
export * as dependencyConfig from "./dependencyConfig"
|
||||
export * as health from "./health"
|
||||
export * as healthFns from "./health/checkFns"
|
||||
export * as inits from "./inits"
|
||||
export * as mainFn from "./mainFn"
|
||||
export * as manifest from "./manifest"
|
||||
export * as toml from "@iarna/toml"
|
||||
export * as types from "./types"
|
||||
export * as util from "./util"
|
||||
export * as yaml from "yaml"
|
||||
|
||||
export * as matches from "ts-matches"
|
||||
export * as YAML from "yaml"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import fs from "fs/promises"
|
||||
import * as fs from "fs/promises"
|
||||
import * as T from "../types"
|
||||
import cp from "child_process"
|
||||
import * as cp from "child_process"
|
||||
import { promisify } from "util"
|
||||
import { Buffer } from "node:buffer"
|
||||
export const execFile = promisify(cp.execFile)
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as matches from "ts-matches"
|
||||
import * as YAML from "yaml"
|
||||
import * as TOML from "@iarna/toml"
|
||||
import * as T from "../types"
|
||||
import fs from "fs"
|
||||
import * as fs from "fs"
|
||||
|
||||
const previousPath = /(.+?)\/([^/]*)$/
|
||||
|
||||
@@ -60,12 +60,12 @@ export class FileHelper<A> {
|
||||
async write(data: A, effects: T.Effects) {
|
||||
if (previousPath.exec(this.path)) {
|
||||
await new Promise((resolve, reject) =>
|
||||
fs.mkdir(this.path, (err) => (!err ? resolve(null) : reject(err))),
|
||||
fs.mkdir(this.path, (err: any) => (!err ? resolve(null) : reject(err))),
|
||||
)
|
||||
}
|
||||
|
||||
await new Promise((resolve, reject) =>
|
||||
fs.writeFile(this.path, this.writeData(data), (err) =>
|
||||
fs.writeFile(this.path, this.writeData(data), (err: any) =>
|
||||
!err ? resolve(null) : reject(err),
|
||||
),
|
||||
)
|
||||
@@ -76,7 +76,7 @@ export class FileHelper<A> {
|
||||
}
|
||||
return this.readData(
|
||||
await new Promise((resolve, reject) =>
|
||||
fs.readFile(this.path, (err, data) =>
|
||||
fs.readFile(this.path, (err: any, data: any) =>
|
||||
!err ? resolve(data.toString("utf-8")) : reject(err),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// a,g,h,A-Z,,,,-
|
||||
|
||||
import crypto from "crypto"
|
||||
import * as crypto from "crypto"
|
||||
export function getRandomCharInSet(charset: string): string {
|
||||
const set = stringToCharSet(charset)
|
||||
let charIdx = crypto.randomInt(0, set.len)
|
||||
|
||||
@@ -235,14 +235,14 @@ export const createUtils = <
|
||||
env: options.env,
|
||||
})
|
||||
const answer = new Promise<null>((resolve, reject) => {
|
||||
childProcess.stdout.on("data", (data) => {
|
||||
childProcess.stdout.on("data", (data: any) => {
|
||||
console.log(data.toString())
|
||||
})
|
||||
childProcess.stderr.on("data", (data) => {
|
||||
childProcess.stderr.on("data", (data: any) => {
|
||||
console.error(data.toString())
|
||||
})
|
||||
|
||||
childProcess.on("close", (code) => {
|
||||
childProcess.on("close", (code: any) => {
|
||||
if (code === 0) {
|
||||
return resolve(null)
|
||||
}
|
||||
|
||||
23
package.json
23
package.json
@@ -2,8 +2,24 @@
|
||||
"name": "@start9labs/start-sdk",
|
||||
"version": "0.4.0-rev0.lib0.rc8.beta7",
|
||||
"description": "Software development kit to facilitate packaging services for StartOS",
|
||||
"main": "./lib/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"main": "./cjs/lib/index.js",
|
||||
"types": "./cjs/lib/index.d.ts",
|
||||
"module": "./mjs/lib/index.js",
|
||||
"sideEffects": true,
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./mjs/lib/index.js",
|
||||
"require": "./cjs/lib/index.js",
|
||||
"types": "./cjs/lib/index.d.ts"
|
||||
}
|
||||
},
|
||||
"typesVersion": {
|
||||
">=3.1": {
|
||||
"*": [
|
||||
"cjs/lib/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest -c ./jest.config.js --coverage",
|
||||
"buildOutput": "ts-node ./lib/test/makeOutput.ts && npx prettier --write '**/*.ts'",
|
||||
@@ -40,6 +56,5 @@
|
||||
"tsconfig-paths": "^3.14.2",
|
||||
"typescript": "^5.0.4",
|
||||
"vitest": "^0.29.2"
|
||||
},
|
||||
"declaration": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"targets": [
|
||||
{
|
||||
"extname": ".cjs",
|
||||
"module": "commonjs"
|
||||
},
|
||||
{
|
||||
"extname": ".mjs",
|
||||
"module": "esnext"
|
||||
}
|
||||
],
|
||||
"projects": [
|
||||
"./tsconfig.json"
|
||||
]
|
||||
}
|
||||
19
tsconfig-base.json
Normal file
19
tsconfig-base.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"strict": true,
|
||||
"outDir": "dist",
|
||||
"preserveConstEnums": true,
|
||||
"sourceMap": true,
|
||||
"target": "es2017",
|
||||
"pretty": true,
|
||||
"declaration": true,
|
||||
"noImplicitAny": true,
|
||||
"esModuleInterop": true,
|
||||
"types": ["node", "jest"],
|
||||
"moduleResolution": "node",
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["lib/**/*"],
|
||||
"exclude": ["lib/**/*.spec.ts", "lib/**/*.gen.ts", "list", "node_modules"]
|
||||
}
|
||||
8
tsconfig-cjs.json
Normal file
8
tsconfig-cjs.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./tsconfig-base.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"outDir": "dist/cjs",
|
||||
"target": "es2018"
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,8 @@
|
||||
{
|
||||
"include": ["./lib/**/*.ts", "scripts/oldSpecToBuilder.ts"],
|
||||
"inputs": ["./lib/index.ts"],
|
||||
"extends": "./tsconfig-base.json",
|
||||
"compilerOptions": {
|
||||
"target": "es2022",
|
||||
"module": "Node16",
|
||||
"moduleResolution": "Node16",
|
||||
"declaration": true,
|
||||
"outDir": "./dist/",
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"ts-node": {
|
||||
"compilerOptions": {
|
||||
"module": "commonjs"
|
||||
}
|
||||
"module": "esnext",
|
||||
"outDir": "dist/mjs",
|
||||
"target": "esnext"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user