Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log(' Usefull for cross-pacakge refactors.')
console.log('')
console.log(' Examples:')
console.log('')
console.log(
' $ sui-mono commit-all --type=fix -m "bump dependency to major version"'
)
console.log(' $ sui-mono --help')
console.log(' $ sui-mono -h')
console.log('')
})
.parse(process.argv)
// Check mandatory parameters
const {message, type} = program
!message && showError('Commit message is mandatory')
!type && showError('Commit type is mandatory')
const packagesDir = path.join(process.cwd(), config.getPackagesFolder())
/**
* Checks if given path has changes
* @param {String} path Folder to check
* @return {Promise}
*/
const hasChangedFiles = path => {
return new Promise((resolve, reject) => {
exec(`git add . && git status ${path}`, {cwd: path}, (err, output) => {
err ? reject(err) : resolve(!output.includes('nothing to commit'))
})
})
}
console.log('')
console.log(' Examples:')
console.log('')
console.log(
' $ sui-mono commit-all --type=fix -m "bump dependency to major version"'
)
console.log(' $ sui-mono --help')
console.log(' $ sui-mono -h')
console.log('')
})
.parse(process.argv)
// Check mandatory parameters
const {message, type} = program
!message && showError('Commit message is mandatory')
!type && showError('Commit type is mandatory')
const packagesDir = path.join(process.cwd(), config.getPackagesFolder())
/**
* Checks if given path has changes
* @param {String} path Folder to check
* @return {Promise}
*/
const hasChangedFiles = path => {
return new Promise((resolve, reject) => {
exec(`git add . && git status ${path}`, {cwd: path}, (err, output) => {
err ? reject(err) : resolve(!output.includes('nothing to commit'))
})
})
}
console.log(' $ sui-studio generate searchs re-beta -P mt')
console.log(' $ sui-studio generate searchs re-beta -R -C')
console.log(' $ custom-help --help')
console.log(' $ custom-help -h')
console.log('')
})
.parse(process.argv)
const BASE_DIR = process.cwd()
const [category, component] = program.args
if (!component) {
showError('component must be defined')
}
if (!category) {
showError('category must be defined')
}
const wordsOnlyRegex = /^[\w]+$/
if (!wordsOnlyRegex.test(component)) {
showError('component name must contain letters or underscore only')
}
if (!wordsOnlyRegex.test(category)) {
showError('category name must contain letters or underscore only')
}
const componentInPascal = pascalCase(
`${category.replace(/s$/, '')} ${component}`
)
const COMPONENT_DIR = `/components/${category}/${component}/`
console.log('')
console.log(' $ sui-studio generate ')
console.log(' $ sui-studio generate cards alfa')
console.log(' $ sui-studio generate searchs re-beta -P mt')
console.log(' $ sui-studio generate searchs re-beta -R -C')
console.log(' $ custom-help --help')
console.log(' $ custom-help -h')
console.log('')
})
.parse(process.argv)
const BASE_DIR = process.cwd()
const [category, component] = program.args
if (!component) {
showError('component must be defined')
}
if (!category) {
showError('category must be defined')
}
const wordsOnlyRegex = /^[\w]+$/
if (!wordsOnlyRegex.test(component)) {
showError('component name must contain letters or underscore only')
}
if (!wordsOnlyRegex.test(category)) {
showError('category name must contain letters or underscore only')
}
const componentInPascal = pascalCase(
`${category.replace(/s$/, '')} ${component}`
.parse(process.argv)
const BASE_DIR = process.cwd()
const [category, component] = program.args
if (!component) {
showError('component must be defined')
}
if (!category) {
showError('category must be defined')
}
const wordsOnlyRegex = /^[\w]+$/
if (!wordsOnlyRegex.test(component)) {
showError('component name must contain letters or underscore only')
}
if (!wordsOnlyRegex.test(category)) {
showError('category name must contain letters or underscore only')
}
const componentInPascal = pascalCase(
`${category.replace(/s$/, '')} ${component}`
)
const COMPONENT_DIR = `/components/${category}/${component}/`
const COMPONENT_PATH = `${BASE_DIR}${COMPONENT_DIR}`
const COMPONENT_ENTRY_JS_POINT_FILE = `${COMPONENT_PATH}src/index.js`
const COMPONENT_PACKAGE_JSON_FILE = `${COMPONENT_PATH}package.json`
const COMPONENT_PACKAGE_GITIGNORE_FILE = `${COMPONENT_PATH}.gitignore`
const COMPONENT_PACKAGE_NPMIGNORE_FILE = `${COMPONENT_PATH}.npmignore`
const COMPONENT_ENTRY_SCSS_POINT_FILE = `${COMPONENT_PATH}src/index.scss`
const [category, component] = program.args
if (!component) {
showError('component must be defined')
}
if (!category) {
showError('category must be defined')
}
const wordsOnlyRegex = /^[\w]+$/
if (!wordsOnlyRegex.test(component)) {
showError('component name must contain letters or underscore only')
}
if (!wordsOnlyRegex.test(category)) {
showError('category name must contain letters or underscore only')
}
const componentInPascal = pascalCase(
`${category.replace(/s$/, '')} ${component}`
)
const COMPONENT_DIR = `/components/${category}/${component}/`
const COMPONENT_PATH = `${BASE_DIR}${COMPONENT_DIR}`
const COMPONENT_ENTRY_JS_POINT_FILE = `${COMPONENT_PATH}src/index.js`
const COMPONENT_PACKAGE_JSON_FILE = `${COMPONENT_PATH}package.json`
const COMPONENT_PACKAGE_GITIGNORE_FILE = `${COMPONENT_PATH}.gitignore`
const COMPONENT_PACKAGE_NPMIGNORE_FILE = `${COMPONENT_PATH}.npmignore`
const COMPONENT_ENTRY_SCSS_POINT_FILE = `${COMPONENT_PATH}src/index.scss`
const COMPONENT_README_FILE = `${COMPONENT_PATH}README.md`
const DEMO_DIR = `${BASE_DIR}/demo/${category}/${component}/`
$ sui-bundler lib src/index.js -o umd/my-lib -p http://my-cdn.com/my-lib -C'
$ sui-bundler lib --help'
`)
)
.parse(process.argv)
const {
clean = false,
output,
path: publicPath,
args: [entry],
root = false
} = program
if (!output) {
showError(new Error('--output is mandatory.'), program)
}
if (!entry) {
showError(new Error('Please provide an entry file path.'), program)
}
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
const version = getPackageJson(process.cwd()).version
const outputFolder = path.join(
process.cwd(),
output,
path.sep,
root ? '' : version
)
const webpackConfig = Object.assign({}, config, {
const getDeployClientFromProgram = async program => {
const deployName = await getDeployNameFromProgram(program)
if (!program.now) {
const {showError} = require('@s-ui/helpers/cli')
showError('ERR: --now is the only hosting service available', program)
} else {
return getNowDeployClient({
authToken: process.env.NOW_TOKEN,
deployName
})
}
}
const checkIsMasterBranchActive = async ({status, cwd}) => {
try {
const output = await exec(`git rev-parse --abbrev-ref HEAD`, {
cwd
})
if (output.stdout.trim() === 'master') {
return Promise.resolve(status)
} else {
throw new Error(
'Active branch is not master, please make releases only in master branch'
)
}
} catch (error) {
showError(error)
return Promise.reject(error)
}
}
getSpawnPromise(DEPLOY_PATH, ['spa', program.name, BUILD_FOLDER]).catch(err => {
showError(err.message)
})