Skip to content

Commit 1d4d4f7

Browse files
committed
we now have a built in ci/cd for updating the files to the most recent stack
1 parent 1f68bce commit 1d4d4f7

File tree

8 files changed

+139
-4
lines changed

8 files changed

+139
-4
lines changed

core/cli.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import Template from '../io/temp/temp.ts'
22
import App from '../io/app/index.ts'
33
import Engine from '../io/engine/index.ts'
4+
import Update from '../io/update/index.ts'
5+
46

57
let isAppCreated: Boolean | undefined;
68

@@ -167,6 +169,9 @@ if (import.meta.main) {
167169
Engine();
168170
// expected output: "Mangoes and papayas are $2.79 a pound."
169171
break;
172+
case 'update':
173+
Update()
174+
break;
170175
default:
171176
console.log(`Sorry, you need to select and option checkout --help to find out what is availbile`);
172177
}
File renamed without changes.

io/app/resources/pages/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as Component from 'components';
1+
import * as Component from 'engine/components';
22

33

44
export default function Index() {

io/engine/components/head.js

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
import Head from 'next/head'
3+
4+
5+
export default function Header(props) {
6+
7+
8+
return (
9+
10+
<Head>
11+
<title>{props.title || "Sauveur"}</title>
12+
<link rel="shortcut icon" type="image/jpg" href="/images/favicon.jpg" />
13+
<meta name="description" content={props.desc || "Digital Transformation for small business"} />
14+
<meta name="author" content="Rawk" />
15+
<meta name='viewport' content='width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no' />
16+
17+
<meta property="og:type" content="website" />
18+
<meta property="og:title" content={props.title || "Sauveur"} />
19+
<meta property="og:description" content={props.desc || "Digital Transformation for small business"} />
20+
<meta
21+
property="og:image"
22+
content={props.image|| "https://devuniversity.github.io/dot/card.jpg"}
23+
/>
24+
<meta property="og:url" content="https://sauveur.xyz" />
25+
26+
<link rel="apple-touch-icon" href="/images/icon_alt.png"></link>
27+
<meta name="theme-color" content="#317EFB"/>
28+
29+
30+
<meta name="mobile-web-app-capable" content="yes"/>
31+
<meta name="apple-mobile-web-app-capable" content="yes"/>
32+
<meta name="apple-mobile-web-app-status-bar-style" content="default"/>
33+
<meta name="apple-mobile-web-app-title" content={props.title}/>
34+
35+
{/* Global site tag (gtag.js) - Google Analytics */}
36+
<script async src={`https://www.googletagmanager.com/gtag/js?id=${props.tag || "" }`}></script>
37+
<script async src="/scripts/ga.js">
38+
gtag('config', `${props.tag || "" }`);
39+
</script>
40+
<link href="/manifest.json" rel="manifest"></link>
41+
{/* <script src="https://cdn.jsdelivr.net/npm/@shopify/[email protected]/lib/sortable.js"></script> */}
42+
43+
{props.children}
44+
</Head>
45+
46+
)
47+
}

io/engine/components/index.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { useEffect, useState,React } from 'react';
2+
import { useRouter } from 'next/router';
3+
import Link from 'next/link'
4+
5+
export {Link,useRouter,useEffect,useState,React}
6+
7+
import Head from './head'
8+
export{Head}
9+
10+
import {CreateToken, ReadToken} from '../pages/api/token/init'
11+
export {CreateToken, ReadToken}
12+
13+
// custom imports below
14+
15+

io/engine/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ const engine = async () => {
2121
await sdk.CraeteFolder(`${url}/${main}`)
2222
}
2323

24-
await sdk.copyDirectory(`${directory}/${type}/${main}`, `./${url}/${main}/`)
24+
await sdk.copyDirectory(`${directory}/${type}/${main}`, `.engine/${url}/${main}/`)
2525

2626
if (type == "components") {
2727

28-
let _import = `import ${capitalize(main)} from './${main}/component' \n`
28+
let _import = `import ${capitalize(main)} from './${main}/engine/component' \n`
2929
let _export = `export {${capitalize(main)}} \n`
3030

31-
const write = await Deno.writeTextFile("components/index.js", `${_import}${_export}`, { append: true });
31+
const write = await Deno.writeTextFile("/engine/components/index.js", `${_import}${_export}`, { append: true });
3232

3333
}
3434

io/update/index.ts

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// import { assert } from "https://deno.land/std/testing/asserts.ts";
2+
const directory = `./${sdk.env.get('tool')}/io/engine`
3+
import * as sdk from "../../imports/index.ts";
4+
5+
const update = () => {
6+
7+
8+
9+
const checkFile = async () => {
10+
11+
const watcher = Deno.watchFs("engine");
12+
console.log('watching the files to update')
13+
for await (const event of watcher) {
14+
15+
16+
17+
if (event.kind == "modify") {
18+
await sdk.copyDirectory(`./engine/`, `${directory}/`)
19+
20+
console.log(">>>> updated");
21+
}
22+
23+
if (event.kind == "remove") {
24+
25+
let path = event.paths[0].split('\\');
26+
27+
if (path.length == 0) {
28+
path = event.paths[0].split('/')
29+
}
30+
console.log(path)
31+
let deleteFile = ''
32+
let key: number
33+
path.map((path, k) => {
34+
35+
if (path == "engine") {
36+
key = k
37+
}
38+
39+
if (k > key) {
40+
deleteFile += `/${path}`
41+
}
42+
})
43+
44+
// const fileInfo = Deno.statSync(`${directory}${deleteFile}`);
45+
46+
await Deno.remove(`${directory}${deleteFile}`,{ recursive: true });
47+
// if (fileInfo.isFile) {
48+
// await Deno.remove(`${directory}${deleteFile}`,{ recursive: true });
49+
// } else {
50+
// await Deno.remove(`${directory}${deleteFile}/`);
51+
// }
52+
53+
54+
55+
}
56+
57+
58+
}
59+
60+
61+
}
62+
63+
64+
checkFile()
65+
}
66+
67+
68+
export default update

0 commit comments

Comments
 (0)