Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeEach(() => {
// create test files
shell.touch(testFileName1);
shell.ShellString(testContents1).to(testFileName1);
shell.mkdir('-p', path.dirname(testFileName2));
shell.touch(testFileName2);
shell.ShellString(testContents2).to(testFileName2);
shell.touch(testFileName3);
shell.ShellString(testContents3).to(testFileName3);
shell.touch(testFileName4);
shell.ShellString(testContents4).to(testFileName4);
});
module.exports = ( blockName, blockDir, isCanary ) => {
shell.cd( blockDir );
shell.touch( 'package.json' );
// Build a package.json file since npm install needs it.
const appPackage = {
name: `${ blockName }-cgb-guten-block`,
version: '1.0.0',
private: true,
scripts: {
start: 'cgb-scripts start',
build: 'cgb-scripts build',
eject: 'cgb-scripts eject',
},
};
// Write the package.json file.
fs.writeFileSync( path.join( process.cwd(), 'package.json' ), JSON.stringify( appPackage, null, 2 ) + '\n' );
function reset() {
burninate();
$.mkdir('mvtemp');
$.touch('mv-a');
$.touch('mv-b');
$.touch('mv-c');
}
if (typeof pkg.repository === "object") {
if (!pkg.repository.hasOwnProperty("url")) {
throw new Error("URL does not exist in repository section");
}
repoUrl = pkg.repository.url;
} else {
repoUrl = pkg.repository;
}
let parsedUrl = url.parse(repoUrl);
let repository = (parsedUrl.host || "") + (parsedUrl.path || "");
let ghToken = process.env.GH_TOKEN;
echo("Deploying docs!!!");
cd("dist/docs");
touch(".nojekyll");
exec("git init");
exec("git add .");
exec('git config user.name "Yingyu Cheng"');
exec('git config user.email "github@winguse.com"');
exec('git commit -m "docs(docs): update gh-pages"');
exec(
`git push --force --quiet "https://${ghToken}@${repository}" master:gh-pages`
);
echo("Docs deployed!!");
if (typeof pkg.repository === "object") {
if (!pkg.repository.hasOwnProperty("url")) {
throw new Error("URL does not exist in repository section")
}
repoUrl = pkg.repository.url
} else {
repoUrl = pkg.repository
}
let parsedUrl = url.parse(repoUrl)
let repository = (parsedUrl.host || "") + (parsedUrl.path || "")
let ghToken = process.env.GH_TOKEN
echo("Deploying docs!!!")
cd("dist/docs")
touch(".nojekyll")
exec("git init")
exec("git add .")
exec('git config user.name "Orie Steele"')
exec('git config user.email "orie@ohs.io"')
exec('git commit -m "docs(docs): update gh-pages"')
exec(
`git push --force --quiet "https://${ghToken}@${repository}" master:gh-pages`
)
echo("Docs deployed!!")
if (typeof pkg.repository === 'object') {
if (!pkg.repository.hasOwnProperty('url')) {
throw new Error('URL does not exist in repository section')
}
repoUrl = pkg.repository.url
} else {
repoUrl = pkg.repository
}
const parsedUrl = url.parse(repoUrl)
const repository = (parsedUrl.host || '') + (parsedUrl.path || '')
const ghToken = process.env.GH_TOKEN
echo('Deploying docs!!!')
cd('dist/docs')
touch('.nojekyll')
exec('git init')
exec('git add .')
exec('git config user.name "Michael Wittwer"')
exec('git config user.email "michael.wittwer@shiftcode.ch"')
exec('git commit -m "docs(docs): update gh-pages"')
exec(
`git push --force --quiet "https://${ghToken}@${repository}" master:gh-pages`
)
echo('Docs deployed!!')
} else {
echo('Not running on master -> skipping docs deployment')
}
if (typeof pkg.repository === "object") {
if (!pkg.repository.hasOwnProperty("url")) {
throw new Error("URL does not exist in repository section")
}
repoUrl = pkg.repository.url
} else {
repoUrl = pkg.repository
}
let parsedUrl = url.parse(repoUrl)
let repository = (parsedUrl.host || "") + (parsedUrl.path || "")
let ghToken = process.env.GH_TOKEN
echo("Deploying docs!!!")
cd("docs")
touch(".nojekyll")
exec("git init")
exec("git add .")
exec('git config user.name "Tristan Fitzgerald"')
exec('git config user.email "tristan@simplyspoke.com"')
exec('git commit -m "docs(docs): update gh-pages"')
exec(
`git push --force --quiet "https://${ghToken}@${repository}" master:gh-pages`
)
echo("Docs deployed!!")
if (typeof pkg.repository === "object") {
if (!pkg.repository.hasOwnProperty("url")) {
throw new Error("URL does not exist in repository section")
}
repoUrl = pkg.repository.url
} else {
repoUrl = pkg.repository
}
let parsedUrl = url.parse(repoUrl)
let repository = (parsedUrl.host || "") + (parsedUrl.path || "")
let ghToken = process.env.GH_TOKEN
echo("Deploying docs!!!")
cd("docs")
touch(".nojekyll")
exec("git init")
exec("git add .")
exec('git config user.name "sanye"')
exec('git config user.email "liubingjian@hzyushi.cn"')
exec('git commit -m "docs(docs): update gh-pages"')
exec(
`git push --force --quiet "https://github.com/liuSyen/ys-tool.git" master:gh-pages`
)
echo("Docs deployed!!")
globby.sync(fileGlob).forEach(file => {
const fileName = path.basename(file);
const tmpFile = path.join(targetDir, fileName);
const transpiled = babel.transformFileSync(file);
shell.touch(tmpFile);
shell.ShellString(transpiled.code).to(tmpFile);
shell.echo(chalk.dim(` -> transpiled ${fileName}`));
});
}
if (typeof pkg.repository === "object") {
if (!pkg.repository.hasOwnProperty("url")) {
throw new Error("URL does not exist in repository section")
}
repoUrl = pkg.repository.url
} else {
repoUrl = pkg.repository
}
let parsedUrl = url.parse(repoUrl)
let repository = (parsedUrl.host || "") + (parsedUrl.path || "")
let ghToken = process.env.GH_TOKEN
echo("Deploying docs!!!")
cd("dist/docs")
touch(".nojekyll")
exec("git init")
exec("git add .")
exec('git config user.name "Kevin Kipp"')
exec('git config user.email "kevin.kipp@gmail.com"')
exec('git commit -m "docs(docs): update gh-pages"')
exec(`git push --force --quiet "https://${ghToken}@${repository}" master:gh-pages`)
echo("Docs deployed!!")