Skip to content

Commit

Permalink
fix: meaningful changes
Browse files Browse the repository at this point in the history
  • Loading branch information
luthfimasruri committed Mar 29, 2021
1 parent 640dd3d commit 8b0ea09
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 49 deletions.
2 changes: 1 addition & 1 deletion packages/vue-quill/src/assets/snow.styl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ backgroundColor = #fff
inactiveColor = #4B5563
shadowColor = #D1D5DB
textColor = #4B5563
// Additional colors
// Additional color
backgroundHoverColor = #F3F4F6
backgroundActiveColor = #DBEAFE

Expand Down
7 changes: 5 additions & 2 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ npm run build -- vue-quill --formats cjs
}

async function build(target: string) {
const rollupConfig = path.resolve(__dirname, '../rollup.config.js')
const pkgDir = path.resolve(__dirname, `../packages/${target}`)
const pkg = require(path.resolve(pkgDir, 'package.json'))
let assets: any = {}
Expand All @@ -77,9 +78,11 @@ npm run build -- vue-quill --formats cjs
(pkg.buildOptions && pkg.buildOptions.env) ||
(devOnly ? 'development' : 'production')
await execa(
'rollup',
'npx',
[
'-c',
'rollup',
'--config',
rollupConfig,
'--environment',
[
`COMMIT:${commit}`,
Expand Down
2 changes: 1 addition & 1 deletion scripts/buildAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ npm run assets:build -- vue-quill

// only build published packages for release
if (isRelease && assets.private) return
if (!assets.css) return
if (!assets.css.length) return

assets.css.forEach(async (css: any) => {
const input = path.resolve(pkgDir, css.input)
Expand Down
91 changes: 49 additions & 42 deletions scripts/release.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(async () => {
const chalk = require('chalk')
const execa = require('execa')
// const chalk = require('chalk')
// const execa = require('execa')
const path = require('path')
const semanticRelease = require('semantic-release')
// const { WritableStreamBuffer } = require('stream-buffers');
Expand All @@ -21,6 +21,13 @@
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
[
"@semantic-release/exec",
{
prepareCmd: "npx ts-node scripts/build.ts --nextVersion ${nextRelease.version}",
publishCmd: `zip ${target}-dist.zip -r dist`,
}
],
'@semantic-release/npm',
[
'@semantic-release/github',
Expand All @@ -40,23 +47,23 @@
await run()

async function run() {
const nextVersion = await getNextVersion()
console.log(nextVersion)
await prepare(target)
// const nextVersion = await getNextVersion()
// console.log(nextVersion)
// await prepare(target)
await release()
}

async function prepare(target: string/*, nextVersion: string*/) {
try {
// const buildScript = path.resolve(__dirname, 'build.ts')
// console.log(chalk.bgCyan("Build package"))
// execa.sync('npx', ['ts-node', buildScript, '--nextVersion', nextVersion])
console.log(chalk.bgCyan("Zipping distribution file"))
execa.sync('zip', ['-r', `${target}-dist.zip`, '.', '-i', 'dist'])
} catch (err) {
console.log(`>>>>>>>>>>>>> ${err}`)
}
}
// async function prepare(target: string/*, nextVersion: string*/) {
// try {
// // const buildScript = path.resolve(__dirname, 'build.ts')
// // console.log(chalk.bgCyan("Build package"))
// // execa.sync('npx', ['ts-node', buildScript, '--nextVersion', nextVersion])
// console.log(chalk.bgCyan("Zipping distribution file"))
// execa.sync('zip', ['-r', `${target}-dist.zip`, '.', '-i', 'dist'])
// } catch (err) {
// console.log(`>>>>>>>>>>>>> ${err}`)
// }
// }

async function release() {
// const pkgDir = path.resolve(__dirname, '..')
Expand Down Expand Up @@ -104,30 +111,30 @@
}
}

async function getNextVersion(): Promise<string> {
const rootDir = path.resolve(__dirname, '..')
try {
const { nextRelease } = await semanticRelease({
branches: releaserc.branches,
repositoryUrl: pkg.repository.url,
plugins: [
'@semantic-release/commit-analyzer',
[
"@semantic-release/exec",
{
prepareCmd: "npx ts-node scripts/build.ts --nextVersion ${nextRelease.version}"
}
]
]
}, {
cwd: rootDir,
env: { ...process.env }
})
if (nextRelease) return nextRelease.version
else console.log('No release will bepublished')
} catch (err) {
console.error('Failed to retrieve next version with %O', err)
}
return pkg.version
}
// async function getNextVersion(): Promise<string> {
// const rootDir = path.resolve(__dirname, '..')
// try {
// const { nextRelease } = await semanticRelease({
// branches: releaserc.branches,
// repositoryUrl: pkg.repository.url,
// plugins: [
// '@semantic-release/commit-analyzer',
// [
// "@semantic-release/exec",
// {
// prepareCmd: "npx ts-node scripts/build.ts --nextVersion ${nextRelease.version}"
// }
// ]
// ]
// }, {
// cwd: rootDir,
// env: { ...process.env }
// })
// if (nextRelease) return nextRelease.version
// else console.log('No release will bepublished')
// } catch (err) {
// console.error('Failed to retrieve next version with %O', err)
// }
// return pkg.version
// }
})()
6 changes: 3 additions & 3 deletions scripts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ async function runParallel(maxConcurrency: number, source: string[], iteratorFn:
}

function checkBuildSize(target: string) {
const pkgDir = path.resolve(`packages/${target}`)
const pkgDir = path.resolve(__dirname, `../packages/${target}`)
checkFileSize(`${pkgDir}/dist/${target}.global.prod.js`)
}

function checkAssetsSize(target: string, ext = '.css') {
const pkgDir = path.resolve(`packages/${target}`)
const pkgDir = path.resolve(__dirname, `../packages/${target}`)
const distDir = path.resolve(pkgDir, 'dist')
fs.readdir(distDir, function (err: string, files: string[]) {
fs.readdir(distDir, (err: string, files: string[]) => {
if (err) console.log(chalk.redBright('Unable to scan directory: ' + err))
files.forEach((file: string) => {
if (file.includes(`prod${ext}`))
Expand Down

0 comments on commit 8b0ea09

Please sign in to comment.