Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Commit

Permalink
Marketing+App template
Browse files Browse the repository at this point in the history
  • Loading branch information
dyakovri committed Feb 1, 2023
1 parent 8586215 commit 51557d1
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
52 changes: 52 additions & 0 deletions bin/create-profcomff-webapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,25 @@ const env = yeoman.createEnv();
env.registerStub(require("generator-single-spa"), "single-spa");

console.info(`Using directory ${process.cwd()} for project files`)

try {
fetch(`https://marketing.api.profcomff.com/action`, {
method: "POST",
cache: "no-cache",
redirect: "follow",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
user_id: -3,
action: "webapp init",
path_from: "https://github.com/profcomff/create-profcomff-webapp",
path_to: "https://github.com/profcomff/create-profcomff-webapp",
additional_data: `{"folder": "${process.cwd()}"}`,
}),
});
} catch {
//Failed, skips
}

env.run("single-spa . --framework vue --moduleType app-parcel" + argv._.join(" "), argv).then(() => {
content = `module.exports = {
runtimeCompiler: true,
Expand Down Expand Up @@ -52,6 +71,39 @@ VUE_APP_API_MARKETING=https://marketing.api.test.profcomff.com
VUE_APP_FEEDBACK_FORM=https://forms.yandex.ru/u/635d013b068ff0587320bfc9/
`;
fs.writeFile(process.cwd() + '/.env.development', content, err => {if (err) { console.error(err); throw err; }});
}).then(() => {
content = `
<template>
<img alt="Vue logo" :src="url">
<HelloWorld msg="Ура! Вы создали приложение для Твой ФФ!"/>
</template>
<script>
import HelloWorld from './components/HelloWorld.vue'
export default {
name: 'App',
components: {
HelloWorld
},
data: () => ({
url: \`$\{process.env.VUE_APP_CDN\}/app/logo/logo_ff.svg\`
})
}
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
`;
fs.writeFile(process.cwd() + '/src/App.vue', content, err => {if (err) { console.error(err); throw err; }});
}).then(() => {
// exec(
// `git add ${process.cwd()} && git commit -m 'profcomff preparation' --author='PKFF CI <[email protected]>'`,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-profcomff-webapp",
"version": "1.0.4",
"version": "1.0.5",
"description": "скрипт для автоматической генерации проекта приложения Твой ФФ!",
"bin": {
"create-profcomff-webapp": "bin/create-profcomff-webapp.js"
Expand Down

0 comments on commit 51557d1

Please sign in to comment.