Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
"release:alpha": "node scripts/release.js --preId alpha",
"release:beta": "node scripts/release.js --preId beta",
"prepare": "npx husky install",
"publish-npm": "node scripts/publish.js "
"publish-npm": "node scripts/publish.js"
},
"dependencies": {
"tslib": "^2.3.1"
},
"devDependencies": {
"@commitlint/cli": "^16.0.1",
Expand All @@ -43,7 +46,7 @@
"@typescript-eslint/eslint-plugin": "^5.6.0",
"@typescript-eslint/eslint-plugin-tslint": "^5.6.0",
"@typescript-eslint/parser": "^5.6.0",
"chalk": "^4.1.2",
"colors": "1.4.0",
"conventional-changelog-cli": "^2.2.2",
"enquirer": "^2.3.6",
"eslint": "^8.6.0",
Expand All @@ -67,8 +70,5 @@
},
"resolutions": {
"**/**/axios": ">=0.21.1"
},
"dependencies": {
"tslib": "^2.3.1"
}
}
6 changes: 3 additions & 3 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

const chalk = require('chalk');
const colors = require('colors/safe');
const fs = require('fs/promises');
const fsEx = require('fs-extra');
const path = require('path');
Expand Down Expand Up @@ -37,7 +37,7 @@ async function buildTarget(target) {
})
.map(f => fs.copyFile(f.src, f.dest));
await Promise.all(copyTasks);
console.log(`${chalk.blue(target.name)} ${chalk.green('success')} 🚀`);
console.log(`${colors.blue(target.name)} ${colors.green('success')} 🚀`);

await fs.rm(`${path.resolve('./node_modules/' + target.name)}`, {
force: true,
Expand All @@ -49,7 +49,7 @@ async function buildTarget(target) {
);
} else {
console.log(
`${chalk.blue(target.name)} ${chalk.cyan('skip')} for private module`
`${colors.blue(target.name)} ${colors.cyan('skip')} for private module`
);
}
}
Expand Down
18 changes: 9 additions & 9 deletions scripts/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

const chalk = require('chalk');
const colors = require('colors/safe');
const shelljs = require('shelljs');
const path = require('path');

Expand All @@ -16,33 +16,33 @@ function publishNpm(target) {
try {
if (target.private === true) {
console.log(
`${chalk.red(target.name)} is ${chalk.cyan('private')}, ${chalk.green(
'skip'
)}`
`${colors.red(target.name)} is ${colors.cyan(
'private'
)}, ${colors.green('skip')}`
);
} else {
doPublishNpm(target);
}
} catch (err) {
console.log(
`failed to puslish ${chalk.red(target.name)}@${chalk.yellowBright(
`failed to puslish ${colors.red(target.name)}@${colors.brightYellow(
target.version
)}, error: ${chalk.blue(err.message)}`
)}, error: ${colors.blue(err.message)}`
);
}
}

function doPublishNpm(target) {
console.log(
`build ${chalk.red(target.name)}@${chalk.yellow(target.version)}`
`build ${colors.red(target.name)}@${colors.yellow(target.version)}`
);
const packagePath = path.join(__dirname, '..', 'dist', target.folderName);
console.log(packagePath);
shelljs.cd(packagePath).exec('npm publish');
console.log(
`puslish ${chalk.red(target.name)}@${chalk.yellowBright(
`puslish ${colors.red(target.name)}@${colors.brightYellow(
target.version
)} ${chalk.green('successfully')}`
)} ${colors.green('successfully')}`
);
}

Expand Down
18 changes: 9 additions & 9 deletions scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

const args = require('minimist')(process.argv.slice(2));
const chalk = require('chalk');
const colors = require('colors/safe');
const semver = require('semver');
const { exec, set } = require('shelljs');
const { exec } = require('shelljs');
const currentVersion = require('../package.json').version;
const { prompt } = require('enquirer');
const path = require('path');
Expand All @@ -34,11 +34,11 @@ const versionIncrements = [
const inc = i => semver.inc(currentVersion, i, preId);

const realRun = command => exec(command);
const dryRun = command => console.log(chalk.blue(`[dry run]: ${command}`));
const dryRun = command => console.log(colors.blue(`[dry run]: ${command}`));

const run = isDryRun ? dryRun : realRun;

const step = msg => console.log(chalk.cyan(msg));
const step = msg => console.log(colors.cyan(msg));

const fetchTargetVersion = async () => {
let targetVersion = args._[0];
Expand Down Expand Up @@ -74,9 +74,9 @@ const fetchTargetVersion = async () => {
const confirmUpdateTargetVersion = async (targetVersion, targets) => {
targets.forEach(target => {
console.log(
`${chalk.blue(target.name)}@${chalk.cyan(target.version)} => ${chalk.red(
'v' + targetVersion
)}`
`${colors.blue(target.name)}@${colors.cyan(
target.version
)} => ${colors.red('v' + targetVersion)}`
);
});
const { yes } = await prompt({
Expand All @@ -92,7 +92,7 @@ const updatePackageVersion = (pkgPath, version) => {
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
pkg.version = version;
if (isDryRun) {
console.log(`${chalk.bgCyan(pkg.name + '@' + pkg.version)}`);
console.log(`${colors.bgCyan(pkg.name + '@' + pkg.version)}`);
} else {
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
}
Expand All @@ -107,7 +107,7 @@ const updatePackageDeps = (pkgPath, version) => {
dependencies[dependency] = version;
});
if (isDryRun) {
console.log(`${chalk.bgCyan(pkg.name + '@' + pkg.version)}`);
console.log(`${colors.bgCyan(pkg.name + '@' + pkg.version)}`);
console.log(pkg);
} else {
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2071,7 +2071,7 @@ chalk@2.4.2, chalk@^2.0.0, chalk@^2.3.0:
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"

chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.2:
chalk@^4.0.0, chalk@^4.1.0:
version "4.1.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
Expand Down Expand Up @@ -2243,7 +2243,7 @@ colorette@^2.0.16:
resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.16.tgz#713b9af84fdb000139f04546bd4a93f62a5085da"
integrity sha512-hUewv7oMjCp+wkBv5Rm0v87eJhq4woh5rSR+42YSQJKecCqgIqNkZ6lAlQms/BwHPJA5NKMRlpxPRv0n8HQW6g==

colors@^1.2.1:
colors@1.4.0, colors@^1.2.1:
version "1.4.0"
resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78"
integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==
Expand Down