parent
4992da2997
commit
eda1e16325
|
@ -43,6 +43,19 @@ const srcPath = path.join(packagePath, "./src");
|
||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
async function typescriptCopy({ from, to }) {
|
||||||
|
if (!(await fse.exists(to))) {
|
||||||
|
console.warn(`path ${to} does not exists`);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const files = glob.sync("**/*.d.ts", { cwd: from });
|
||||||
|
const cmds = files.map(file =>
|
||||||
|
fse.copy(path.resolve(from, file), path.resolve(to, file))
|
||||||
|
);
|
||||||
|
return Promise.all(cmds);
|
||||||
|
}
|
||||||
|
|
||||||
async function createPackageFile() {
|
async function createPackageFile() {
|
||||||
const packageData = await fse.readFile(
|
const packageData = await fse.readFile(
|
||||||
path.resolve(packagePath, "./package.json"),
|
path.resolve(packagePath, "./package.json"),
|
||||||
|
@ -54,7 +67,9 @@ async function createPackageFile() {
|
||||||
const newPackageData = {
|
const newPackageData = {
|
||||||
...packageDataOther,
|
...packageDataOther,
|
||||||
private: false,
|
private: false,
|
||||||
main: "./index.js"
|
main: "./index.js",
|
||||||
|
//module: "./esm/index.js",
|
||||||
|
typings: "./index.d.ts"
|
||||||
};
|
};
|
||||||
const targetPath = path.resolve(buildPath, "./package.json");
|
const targetPath = path.resolve(buildPath, "./package.json");
|
||||||
|
|
||||||
|
@ -77,6 +92,9 @@ async function run() {
|
||||||
try {
|
try {
|
||||||
await createPackageFile();
|
await createPackageFile();
|
||||||
|
|
||||||
|
// TypeScript
|
||||||
|
await typescriptCopy({ from: srcPath, to: buildPath });
|
||||||
|
|
||||||
//await createModulePackages({ from: srcPath, to: buildPath });
|
//await createModulePackages({ from: srcPath, to: buildPath });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
import * as typeValidator from "./data/typeValidator";
|
||||||
|
import * as localStorage from "./storage/localStorage";
|
||||||
|
|
||||||
|
export { typeValidator, localStorage };
|
Loading…
Reference in New Issue