@batijs/cli 0.0.139 → 0.0.141
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/boilerplates/@batijs/google-analytics/files/$.env.js +16 -0
- package/dist/boilerplates/@batijs/prettier/files/.prettierignore +29 -7
- package/dist/boilerplates/@batijs/prisma/files/$.env.js +12 -17
- package/dist/boilerplates/@batijs/react/files/layouts/HeadDefault.tsx +19 -0
- package/dist/boilerplates/@batijs/solid/files/layouts/HeadDefault.tsx +19 -0
- package/dist/boilerplates/@batijs/vue/files/$package.json.js +14 -2
- package/dist/boilerplates/@batijs/vue/files/layouts/HeadDefault.vue +4 -9
- package/dist/boilerplates/@batijs/vue/files/pages/+onCreateApp.ts +14 -0
- package/dist/boilerplates/@batijs/vue/types/pages/+config.h.d.ts +24 -0
- package/dist/boilerplates/@batijs/vue/types/pages/+onCreateApp.d.ts +2 -0
- package/dist/boilerplates/boilerplates.json +11 -0
- package/dist/index.js +22 -14
- package/package.json +5 -5
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// files/$.env.ts
|
|
2
|
+
import { appendToEnv } from "@batijs/core";
|
|
3
|
+
async function getEnv(props) {
|
|
4
|
+
const envContent = await props.readfile?.();
|
|
5
|
+
return appendToEnv(
|
|
6
|
+
envContent,
|
|
7
|
+
"PUBLIC_ENV__GOOGLE_ANALYTICS",
|
|
8
|
+
"G-XXXXXXXXXX",
|
|
9
|
+
`Google Analytics
|
|
10
|
+
|
|
11
|
+
See the documentation https://support.google.com/analytics/answer/9304153?hl=en#zippy=%2Cweb`
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
getEnv as default
|
|
16
|
+
};
|
|
@@ -5,6 +5,7 @@ npm-debug.log*
|
|
|
5
5
|
yarn-debug.log*
|
|
6
6
|
yarn-error.log*
|
|
7
7
|
lerna-debug.log*
|
|
8
|
+
.pnpm-debug.log*
|
|
8
9
|
|
|
9
10
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
10
11
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
@@ -41,8 +42,8 @@ build/Release
|
|
|
41
42
|
node_modules/
|
|
42
43
|
jspm_packages/
|
|
43
44
|
|
|
44
|
-
#
|
|
45
|
-
|
|
45
|
+
# Snowpack dependency directory (https://snowpack.dev/)
|
|
46
|
+
web_modules/
|
|
46
47
|
|
|
47
48
|
# TypeScript cache
|
|
48
49
|
*.tsbuildinfo
|
|
@@ -53,6 +54,9 @@ typings/
|
|
|
53
54
|
# Optional eslint cache
|
|
54
55
|
.eslintcache
|
|
55
56
|
|
|
57
|
+
# Optional stylelint cache
|
|
58
|
+
.stylelintcache
|
|
59
|
+
|
|
56
60
|
# Microbundle cache
|
|
57
61
|
.rpt2_cache/
|
|
58
62
|
.rts2_cache_cjs/
|
|
@@ -68,15 +72,20 @@ typings/
|
|
|
68
72
|
# Yarn Integrity file
|
|
69
73
|
.yarn-integrity
|
|
70
74
|
|
|
71
|
-
# dotenv environment
|
|
75
|
+
# dotenv environment variable files
|
|
72
76
|
.env
|
|
73
|
-
.env.
|
|
77
|
+
.env.development.local
|
|
78
|
+
.env.test.local
|
|
79
|
+
.env.production.local
|
|
80
|
+
.env.local
|
|
74
81
|
|
|
75
82
|
# parcel-bundler cache (https://parceljs.org/)
|
|
76
83
|
.cache
|
|
84
|
+
.parcel-cache
|
|
77
85
|
|
|
78
86
|
# Next.js build output
|
|
79
87
|
.next
|
|
88
|
+
out
|
|
80
89
|
|
|
81
90
|
# Nuxt.js build / generate output
|
|
82
91
|
.nuxt
|
|
@@ -84,13 +93,19 @@ dist
|
|
|
84
93
|
|
|
85
94
|
# Gatsby files
|
|
86
95
|
.cache/
|
|
87
|
-
# Comment in the public line in if your project uses Gatsby and
|
|
96
|
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
88
97
|
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
89
98
|
# public
|
|
90
99
|
|
|
91
100
|
# vuepress build output
|
|
92
101
|
.vuepress/dist
|
|
93
102
|
|
|
103
|
+
# vuepress v2.x temp and cache directory
|
|
104
|
+
.temp
|
|
105
|
+
|
|
106
|
+
# Docusaurus cache and generated files
|
|
107
|
+
.docusaurus
|
|
108
|
+
|
|
94
109
|
# Serverless directories
|
|
95
110
|
.serverless/
|
|
96
111
|
|
|
@@ -103,5 +118,12 @@ dist
|
|
|
103
118
|
# TernJS port file
|
|
104
119
|
.tern-port
|
|
105
120
|
|
|
106
|
-
#
|
|
107
|
-
.
|
|
121
|
+
# Stores VSCode versions used for testing VSCode extensions
|
|
122
|
+
.vscode-test
|
|
123
|
+
|
|
124
|
+
# yarn v2
|
|
125
|
+
.yarn/cache
|
|
126
|
+
.yarn/unplugged
|
|
127
|
+
.yarn/build-state.yml
|
|
128
|
+
.yarn/install-state.gz
|
|
129
|
+
.pnp.*
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
// files/$.env.ts
|
|
2
|
-
import "@batijs/core";
|
|
2
|
+
import { appendToEnv } from "@batijs/core";
|
|
3
3
|
async function getEnv(props) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
const prismaContent = `# Prisma
|
|
4
|
+
const envContent = await props.readfile?.();
|
|
5
|
+
return appendToEnv(
|
|
6
|
+
envContent,
|
|
7
|
+
"DATABASE_URL",
|
|
8
|
+
"postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public",
|
|
9
|
+
`Prisma
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
Environment variables declared in this file are automatically made available to Prisma.
|
|
12
|
+
See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"
|
|
20
|
-
`;
|
|
21
|
-
return envContent + prismaContent;
|
|
14
|
+
Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
|
|
15
|
+
See the documentation for all the connection string options: https://pris.ly/d/connection-strings`
|
|
16
|
+
);
|
|
22
17
|
}
|
|
23
18
|
export {
|
|
24
19
|
getEnv as default
|
|
@@ -12,6 +12,25 @@ export default function HeadDefault() {
|
|
|
12
12
|
<script defer data-domain="yourdomain.com" src="https://plausible.io/js/script.js"></script>
|
|
13
13
|
</>
|
|
14
14
|
);
|
|
15
|
+
} else if (BATI.has("google-analytics")) {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
19
|
+
<script
|
|
20
|
+
async
|
|
21
|
+
src={`https://www.googletagmanager.com/gtag/js?id=${import.meta.env.PUBLIC_ENV__GOOGLE_ANALYTICS}`}
|
|
22
|
+
></script>
|
|
23
|
+
<script
|
|
24
|
+
dangerouslySetInnerHTML={{
|
|
25
|
+
__html: `window.dataLayer = window.dataLayer || [];
|
|
26
|
+
function gtag(){dataLayer.push(arguments);}
|
|
27
|
+
gtag('js', new Date());
|
|
28
|
+
|
|
29
|
+
gtag('config', '${import.meta.env.PUBLIC_ENV__GOOGLE_ANALYTICS}');`,
|
|
30
|
+
}}
|
|
31
|
+
></script>
|
|
32
|
+
</>
|
|
33
|
+
);
|
|
15
34
|
} else {
|
|
16
35
|
return (
|
|
17
36
|
<>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable solid/no-innerhtml */
|
|
2
|
+
|
|
1
3
|
// Default <head> (can be overridden by pages)
|
|
2
4
|
|
|
3
5
|
import logoUrl from "../assets/logo.svg";
|
|
@@ -12,6 +14,23 @@ export default function HeadDefault() {
|
|
|
12
14
|
<script defer data-domain="yourdomain.com" src="https://plausible.io/js/script.js" />
|
|
13
15
|
</>
|
|
14
16
|
);
|
|
17
|
+
} else if (BATI.has("google-analytics")) {
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
21
|
+
<script
|
|
22
|
+
async
|
|
23
|
+
src={`https://www.googletagmanager.com/gtag/js?id=${import.meta.env.PUBLIC_ENV__GOOGLE_ANALYTICS}`}
|
|
24
|
+
/>
|
|
25
|
+
<script
|
|
26
|
+
innerHTML={`window.dataLayer = window.dataLayer || [];
|
|
27
|
+
function gtag(){dataLayer.push(arguments);}
|
|
28
|
+
gtag('js', new Date());
|
|
29
|
+
|
|
30
|
+
gtag('config', '${import.meta.env.PUBLIC_ENV__GOOGLE_ANALYTICS}');`}
|
|
31
|
+
/>
|
|
32
|
+
</>
|
|
33
|
+
);
|
|
15
34
|
} else {
|
|
16
35
|
return (
|
|
17
36
|
<>
|
|
@@ -52,9 +52,10 @@ var require_package = __commonJS({
|
|
|
52
52
|
typescript: "^5.3.3",
|
|
53
53
|
"unplugin-vue-markdown": "^0.25.2",
|
|
54
54
|
vike: "^0.4.156",
|
|
55
|
-
"vike-vue": "^0.5.
|
|
55
|
+
"vike-vue": "^0.5.4",
|
|
56
56
|
vite: "^5.0.11",
|
|
57
|
-
vue: "^3.4.13"
|
|
57
|
+
vue: "^3.4.13",
|
|
58
|
+
"vue-gtag": "^2.0.1"
|
|
58
59
|
},
|
|
59
60
|
dependencies: {
|
|
60
61
|
"@batijs/core": "workspace:*"
|
|
@@ -71,6 +72,9 @@ var require_package = __commonJS({
|
|
|
71
72
|
"./pages/+config.h": {
|
|
72
73
|
types: "./dist/types/pages/+config.h.d.ts"
|
|
73
74
|
},
|
|
75
|
+
"./pages/+onCreateApp": {
|
|
76
|
+
types: "./dist/types/pages/+onCreateApp.d.ts"
|
|
77
|
+
},
|
|
74
78
|
"./pages/+onPageTransitionEnd": {
|
|
75
79
|
types: "./dist/types/pages/+onPageTransitionEnd.d.ts"
|
|
76
80
|
},
|
|
@@ -95,6 +99,9 @@ var require_package = __commonJS({
|
|
|
95
99
|
"pages/+config.h": [
|
|
96
100
|
"./dist/types/pages/+config.h.d.ts"
|
|
97
101
|
],
|
|
102
|
+
"pages/+onCreateApp": [
|
|
103
|
+
"./dist/types/pages/+onCreateApp.d.ts"
|
|
104
|
+
],
|
|
98
105
|
"pages/+onPageTransitionEnd": [
|
|
99
106
|
"./dist/types/pages/+onPageTransitionEnd.d.ts"
|
|
100
107
|
],
|
|
@@ -134,6 +141,11 @@ async function getPackageJson(props) {
|
|
|
134
141
|
devDependencies: ["eslint-plugin-vue"]
|
|
135
142
|
});
|
|
136
143
|
}
|
|
144
|
+
if (props.meta.BATI.has("google-analytics")) {
|
|
145
|
+
addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)), {
|
|
146
|
+
dependencies: ["vue-gtag"]
|
|
147
|
+
});
|
|
148
|
+
}
|
|
137
149
|
return addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)), {
|
|
138
150
|
devDependencies: ["vite"],
|
|
139
151
|
dependencies: [
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
<!-- Default <head> (can be overridden by pages) -->
|
|
2
2
|
|
|
3
3
|
<template>
|
|
4
|
-
<meta
|
|
5
|
-
name="viewport"
|
|
6
|
-
content="width=device-width, initial-scale=1"
|
|
7
|
-
>
|
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
8
5
|
|
|
9
6
|
<!-- BATI.has("plausible.io") -->
|
|
10
7
|
<!-- See https://plausible.io/docs/plausible-script -->
|
|
11
8
|
<!-- TODO: update data-domain -->
|
|
12
|
-
<component :is="'script'" defer
|
|
13
|
-
data-domain="yourdomain.com"
|
|
14
|
-
src="https://plausible.io/js/script.js" />
|
|
9
|
+
<component :is="'script'" defer data-domain="yourdomain.com" src="https://plausible.io/js/script.js" />
|
|
15
10
|
</template>
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts"></script>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OnCreateAppSync } from "vike-vue";
|
|
2
|
+
import VueGtag from "vue-gtag";
|
|
3
|
+
|
|
4
|
+
// BATI.has("google-analytics")
|
|
5
|
+
export const onCreateApp: OnCreateAppSync = (pageContext): ReturnType<OnCreateAppSync> => {
|
|
6
|
+
const { app } = pageContext;
|
|
7
|
+
|
|
8
|
+
// See https://matteo-gabriele.gitbook.io/vue-gtag/
|
|
9
|
+
app.use(VueGtag, {
|
|
10
|
+
config: {
|
|
11
|
+
id: import.meta.env.PUBLIC_ENV__GOOGLE_ANALYTICS,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
};
|
|
@@ -42,6 +42,7 @@ declare const _default: {
|
|
|
42
42
|
lang: {
|
|
43
43
|
env: {
|
|
44
44
|
server: true;
|
|
45
|
+
client: true;
|
|
45
46
|
};
|
|
46
47
|
};
|
|
47
48
|
ssr: {
|
|
@@ -61,6 +62,29 @@ declare const _default: {
|
|
|
61
62
|
client: true;
|
|
62
63
|
};
|
|
63
64
|
};
|
|
65
|
+
onCreateApp: {
|
|
66
|
+
env: {
|
|
67
|
+
server: true;
|
|
68
|
+
client: true;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
onCreateAppPinia: {
|
|
72
|
+
env: {
|
|
73
|
+
server: true;
|
|
74
|
+
client: true;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
onAfterRenderSSRApp: {
|
|
78
|
+
env: {
|
|
79
|
+
server: true;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
onBeforeMountApp: {
|
|
83
|
+
env: {
|
|
84
|
+
server: false;
|
|
85
|
+
client: true;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
64
88
|
};
|
|
65
89
|
};
|
|
66
90
|
};
|
package/dist/index.js
CHANGED
|
@@ -499,20 +499,28 @@ function transformFileAfterExec(filepath, fileContent) {
|
|
|
499
499
|
if (fileContent === void 0 || fileContent === null)
|
|
500
500
|
return null;
|
|
501
501
|
const parsed = path.parse(filepath);
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
502
|
+
const toTest = [parsed.base, parsed.ext, parsed.name].filter(Boolean);
|
|
503
|
+
for (const ext of toTest) {
|
|
504
|
+
switch (ext) {
|
|
505
|
+
case ".ts":
|
|
506
|
+
case ".js":
|
|
507
|
+
case ".tsx":
|
|
508
|
+
case ".jsx":
|
|
509
|
+
case ".env":
|
|
510
|
+
case ".env.local":
|
|
511
|
+
case ".env.development":
|
|
512
|
+
case ".env.development.local":
|
|
513
|
+
case ".env.test":
|
|
514
|
+
case ".env.test.local":
|
|
515
|
+
case ".env.production":
|
|
516
|
+
case ".env.production.local":
|
|
517
|
+
case ".html":
|
|
518
|
+
return fileContent;
|
|
519
|
+
case ".json":
|
|
520
|
+
return JSON.stringify(fileContent, null, 2);
|
|
521
|
+
}
|
|
515
522
|
}
|
|
523
|
+
throw new Error(`Unsupported file extension ${parsed.base} (${filepath})`);
|
|
516
524
|
}
|
|
517
525
|
async function importTransformer(p) {
|
|
518
526
|
const importFile = isWin ? "file://" + p : p;
|
|
@@ -576,7 +584,7 @@ Please report this issue to https://github.com/magne4000/bati`
|
|
|
576
584
|
// package.json
|
|
577
585
|
var package_default = {
|
|
578
586
|
name: "@batijs/cli",
|
|
579
|
-
version: "0.0.
|
|
587
|
+
version: "0.0.141",
|
|
580
588
|
type: "module",
|
|
581
589
|
scripts: {
|
|
582
590
|
"check-types": "tsc --noEmit",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@batijs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.141",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"description": "Next-gen scaffolder. Get started with fully-functional apps, and choose any tool you want",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"tsup": "^8.0.1",
|
|
20
20
|
"typescript": "^5.3.3",
|
|
21
21
|
"vite": "^5.0.11",
|
|
22
|
-
"@batijs/build": "0.0.
|
|
23
|
-
"@batijs/compile": "0.0.
|
|
22
|
+
"@batijs/build": "0.0.141",
|
|
23
|
+
"@batijs/compile": "0.0.141"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@batijs/core": "0.0.
|
|
27
|
-
"@batijs/features": "0.0.
|
|
26
|
+
"@batijs/core": "0.0.141",
|
|
27
|
+
"@batijs/features": "0.0.141"
|
|
28
28
|
},
|
|
29
29
|
"bin": "./dist/index.js",
|
|
30
30
|
"exports": {
|