nextui/packages/react/scripts/pre-publish.js
2022-01-01 18:56:14 -03:00

31 lines
862 B
JavaScript

const setupPackage = require('./setup-package');
const path = require('path');
const fse = require('fs-extra');
const shell = require('./utils').shell;
const step = require('./utils').step;
const error = require('./utils').error;
const libRoot = path.join(__dirname, '../lib');
const rootDir = path.join(__dirname, '../');
const buildPkg = step('build pkg...', () => shell(`yarn build`));
const printPkg = step('print pkg...', () => {
const genPkgJson = fse
.readFileSync(`${libRoot}/package.json`)
.toString('utf-8');
console.log(JSON.parse(genPkgJson));
});
const copyFromRoot = (file) =>
fse.copySync(`${rootDir}/${file}`, `${libRoot}/${file}`, { overwrite: true });
Promise.resolve(true)
.then(buildPkg)
.then(() => {
setupPackage();
printPkg();
copyFromRoot('README.md');
copyFromRoot('LICENSE');
})
.catch(error);