Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function conventionalChangelog(done) {
clog({
preset: 'angular',
// repository: 'https://github.com/router5/router5',
// append: false
})
.pipe(source('CHANGELOG.md'))
.pipe(fs.dest(path.join(__dirname, '..')));
}
console.log(
chalk.bold.cyan("Omi-Cli") +
(!isCn
? " will creating a new omi app in "
: " 即将创建一个新的应用在 ") +
dest
);
vfs
.src(["**/*", "!node_modules/**/*"], {
cwd: tpl,
cwdbase: true,
dot: true
})
.pipe(template(dest, tpl))
.pipe(vfs.dest(dest))
.on("end", function() {
try {
info("Rename", "gitignore -> .gitignore");
renameSync(join(dest, "gitignore"), join(dest, ".gitignore"));
if (customPrjName) {
try {
var appPackage = require(join(dest,"package.json"));
appPackage.name = projectName;
fs.writeFile(join(dest,"package.json"), JSON.stringify(appPackage, null, 2), (err) => {
if (err) return console.log(err);
})
process.chdir(customPrjName);
} catch (err) {
console.log(error(err));
}
}
console.log(
chalk.bold.cyan("Omi-Cli") +
(!isCn
? " will creating a new omi app in "
: " 即将创建一个新的应用在 ") +
dest
);
vfs
.src(["**/*", "!node_modules/**/*"], {
cwd: tpl,
cwdbase: true,
dot: true
})
.pipe(template(dest, tpl))
.pipe(vfs.dest(dest))
.on("end", function() {
try {
info("Rename", "gitignore -> .gitignore");
renameSync(join(dest, "gitignore"), join(dest, ".gitignore"));
if (customPrjName) {
try {
var appPackage = require(join(dest,"package.json"));
appPackage.name = projectName;
fs.writeFile(join(dest,"package.json"), JSON.stringify(appPackage, null, 2), (err) => {
if (err) return console.log(err);
})
process.chdir(customPrjName);
} catch (err) {
console.log(error(err));
}
}
function createApp() {
console.log();
console.log(chalk.bold.cyan("Omi-Cli") + (!isCn ? ' will creating a new omi app in ' : ' 即将创建一个新的应用在 ') + dest);
vfs.src(['**/*', '!mode_modules/**/*'], {cwd: tpl, cwdbase: true, dot: true})
.pipe(template(dest, tpl))
.pipe(vfs.dest(dest))
.on('end', function(){
try{
info('Rename', 'gitignore -> .gitignore');
renameSync(join(dest, 'gitignore'), join(dest, '.gitignore'));
if(customPrjName) {
try{
process.chdir(customPrjName);
}
catch (err) {
console.log(error(err));
}
}
info('Install', 'npm will install dependencies');
console.log();
require('./install')(mirror, done)
} catch(e){
module.exports = (files) => () =>
vfs
.src(files)
.pipe(prettier())
.pipe(vfs.dest((file) => file.base))
.then(output => {
const dist = file.replace(/^\.\/src/, './docs/html').replace(/\/[^\/]+$/, '');
streamArray(output).pipe(vfs.dest(dist));
});
});
setTimeout(function () {
try {
vinyl.src(`templates/*.yml`)
.pipe(replace(patterns))
.pipe(vinyl.dest(`dist`))
} catch (e) {
err(e)
} finally {
cb(null, 5)
}
}, 1000)
}
function copyHtmls() {
var vfs = require('vinyl-fs');
var through = require('through2');
vfs.src(['./**/*.html', '!./_site/**/*.html', '!./spm_modules/**/*.html', '!./node_modules/**/*.html'])
.pipe(through.obj(function(f, enc, cb) {
f.contents = new Buffer(require('./utils/deps').replaceDeps(f.contents, f.relative));
this.push(f);
cb();
}))
.pipe(vfs.dest('./_site/'));
}
vfs.src('css/site.css', { ...opts, sourcemaps }).pipe(postcss(postcssPlugins)),
vfs.src('font/*.{ttf,woff*(2)}', opts),
vfs
.src('img/**/*.{jpg,ico,png,svg}', opts)
.pipe(
imagemin([
imagemin.gifsicle(),
imagemin.jpegtran(),
imagemin.optipng(),
imagemin.svgo({ plugins: [{ removeViewBox: false }] }),
])
),
vfs.src('helpers/*.js', opts),
vfs.src('layouts/*.hbs', opts),
vfs.src('partials/*.hbs', opts)
).pipe(vfs.dest(dest, { sourcemaps: sourcemaps && '.' }))
}