@batijs/cli 0.0.94 → 0.0.95

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.
@@ -51,7 +51,7 @@ async function startServer() {
51
51
  username: { label: "Username", type: "text", placeholder: "jsmith" },
52
52
  password: { label: "Password", type: "password" },
53
53
  },
54
- async authorize(credentials, req) {
54
+ async authorize() {
55
55
  // Add logic here to look up the user from the credentials supplied
56
56
  const user = { id: "1", name: "J Smith", email: "jsmith@example.com" };
57
57
 
@@ -70,7 +70,7 @@ async function startServer() {
70
70
  username: { label: "Username", type: "text", placeholder: "jsmith" },
71
71
  password: { label: "Password", type: "password" },
72
72
  },
73
- async authorize(credentials, req) {
73
+ async authorize() {
74
74
  // Add logic here to look up the user from the credentials supplied
75
75
  const user = { id: "1", name: "J Smith", email: "jsmith@example.com" };
76
76
 
@@ -48,7 +48,7 @@ if (import.meta.BATI_MODULES?.includes("authjs")) {
48
48
  username: { label: "Username", type: "text", placeholder: "username" },
49
49
  password: { label: "Password", type: "password" },
50
50
  },
51
- async authorize(credentials, req) {
51
+ async authorize() {
52
52
  // Add logic here to look up the user from the credentials supplied
53
53
  const user = { id: "1", name: "J Smith", email: "jsmith@example.com" };
54
54
 
@@ -9,6 +9,9 @@ async function getEslintConfig(props) {
9
9
  eslintConfig.parserOptions.parser = "@typescript-eslint/parser";
10
10
  eslintConfig.rules ??= {};
11
11
  eslintConfig.rules["vue/multi-word-component-names"] = "off";
12
+ eslintConfig.rules["vue/singleline-html-element-content-newline"] = "off";
13
+ eslintConfig.rules["vue/max-attributes-per-line"] = "off";
14
+ eslintConfig.rules["vue/html-self-closing"] = "off";
12
15
  return eslintConfig;
13
16
  }
14
17
  export {
@@ -1,24 +1,29 @@
1
- {{{! /* We are using the SquirrellyJS template syntax */ _}}}
2
-
3
1
  <template>
4
2
  <div id="page-container">
3
+ <!-- import.meta.BATI_MODULES?.includes("tailwindcss") -->
5
4
  <div
6
5
  id="page-content"
7
- {{{ @if (it.import.meta.BATI_MODULES?.includes("tailwindcss")) }}}
8
6
  class="p-5 pb-12 min-h-screen"
9
- {{{ #else }}}
7
+ >
8
+ <slot />
9
+ </div>
10
+ <!-- !import.meta.BATI_MODULES?.includes("tailwindcss") -->
11
+ <div
12
+ id="page-content"
10
13
  style="
11
14
  padding: 20px;
12
15
  padding-bottom: 50px;
13
16
  min-height: 100vh;
14
17
  "
15
- {{{ /if }}}
16
18
  >
17
19
  <slot />
18
20
  </div>
19
21
  </div>
20
22
  </template>
21
23
 
24
+ <script setup lang="ts">
25
+ </script>
26
+
22
27
  <style>
23
28
  /* Page Transition Animation */
24
29
  body.page-is-transitioning #page-content {
@@ -33,3 +38,4 @@ body.page-is-transitioning #page-content {
33
38
  transition: opacity 0.3s ease-in-out;
34
39
  }
35
40
  </style>
41
+
@@ -1,11 +1,15 @@
1
- {{{! /* We are using the SquirrellyJS template syntax */ _}}}
2
-
3
1
  <template>
2
+ <!-- import.meta.BATI_MODULES?.includes("tailwindcss") -->
4
3
  <button
5
4
  type="button"
6
- {{{ @if (it.import.meta.BATI_MODULES?.includes("tailwindcss")) }}}
7
5
  class="inline-block border border-black rounded bg-gray-200 px-2 py-1 text-xs font-medium uppercase leading-normal"
8
- {{{ /if }}}
6
+ @click="state.count++"
7
+ >
8
+ Counter {{ state.count }}
9
+ </button>
10
+ <!-- !import.meta.BATI_MODULES?.includes("tailwindcss") -->
11
+ <button
12
+ type="button"
9
13
  @click="state.count++"
10
14
  >
11
15
  Counter {{ state.count }}
@@ -13,7 +17,8 @@
13
17
  </template>
14
18
 
15
19
  <script lang="ts">
16
- import { reactive } from 'vue'
20
+ import { reactive } from "vue";
21
+
17
22
  export default {
18
23
  setup() {
19
24
  const state = reactive({ count: 0 })
@@ -1,15 +1,22 @@
1
- {{{! /* We are using the SquirrellyJS template syntax */ _}}}
2
-
3
1
  <template>
2
+ <!-- import.meta.BATI_MODULES?.includes("tailwindcss") -->
4
3
  <div
5
- {{{ @if (it.import.meta.BATI_MODULES?.includes("tailwindcss")) }}}
6
4
  class="p-5 mb-2"
7
- {{{ #else }}}
5
+ >
6
+ <a href="/">
7
+ <img
8
+ src="../assets/logo.svg"
9
+ height="64"
10
+ width="64"
11
+ >
12
+ </a>
13
+ </div>
14
+ <!-- !import.meta.BATI_MODULES?.includes("tailwindcss") -->
15
+ <div
8
16
  style="
9
17
  margin-top: 20px;
10
18
  margin-bottom: 10px;
11
19
  "
12
- {{{ /if }}}
13
20
  >
14
21
  <a href="/">
15
22
  <img
@@ -20,3 +27,5 @@
20
27
  </a>
21
28
  </div>
22
29
  </template>
30
+ <script setup lang="ts">
31
+ </script>
@@ -1,11 +1,14 @@
1
- {{{! /* We are using the SquirrellyJS template syntax */ _}}}
2
-
3
1
  <template>
2
+ <!-- import.meta.BATI_MODULES?.includes("tailwindcss") -->
4
3
  <div
5
4
  id="sidebar"
6
- {{{ @if (it.import.meta.BATI_MODULES?.includes("tailwindcss")) }}}
7
5
  class="p-5 flex flex-col shrink-0 border-r-2 border-r-gray-200"
8
- {{{ #else }}}
6
+ >
7
+ <slot />
8
+ </div>
9
+ <!-- !import.meta.BATI_MODULES?.includes("tailwindcss") -->
10
+ <div
11
+ id="sidebar"
9
12
  style="
10
13
  padding: 20px;
11
14
  flex-shrink: 0;
@@ -14,8 +17,9 @@
14
17
  line-height: 1.8em;
15
18
  border-right: 2px solid #eee;
16
19
  "
17
- {{{ /if }}}
18
20
  >
19
21
  <slot />
20
22
  </div>
21
23
  </template>
24
+ <script setup lang="ts">
25
+ </script>
@@ -1,5 +1,3 @@
1
- {{{! /* We are using the SquirrellyJS template syntax */ _}}}
2
-
3
1
  <!-- Default <head> (can be overridden by pages) -->
4
2
 
5
3
  <template>
@@ -7,13 +5,13 @@
7
5
  name="viewport"
8
6
  content="width=device-width, initial-scale=1"
9
7
  >
10
- {{{ @if (it.import.meta.BATI_MODULES?.includes("plausible.io")) }}}
8
+
9
+ <!-- import.meta.BATI_MODULES?.includes("plausible.io") -->
11
10
  <!-- See https://plausible.io/docs/plausible-script -->
12
11
  <!-- TODO: update data-domain -->
13
- <script
14
- defer
15
- data-domain="yourdomain.com"
16
- src="https://plausible.io/js/script.js"
17
- />
18
- {{{ /if }}}
12
+ <component :is="'script'" defer
13
+ data-domain="yourdomain.com"
14
+ src="https://plausible.io/js/script.js" />
19
15
  </template>
16
+ <script setup lang="ts">
17
+ </script>
@@ -1,6 +1,3 @@
1
-
2
- {{{! /* We are using the SquirrellyJS template syntax */ _}}}
3
-
4
1
  <template>
5
2
  <div class="layout">
6
3
  <Sidebar>
@@ -8,11 +5,10 @@
8
5
  <Link href="/">
9
6
  Welcome
10
7
  </Link>
11
- {{{ @if (it.import.meta.BATI_MODULES?.includes("telefunc")) }}}
8
+ <!-- import.meta.BATI_MODULES?.includes("telefunc") -->
12
9
  <Link href="/todo">
13
10
  Todo
14
11
  </Link>
15
- {{{ /if }}}
16
12
  <Link href="/star-wars">
17
13
  Data Fetching
18
14
  </Link>
@@ -29,10 +25,11 @@ import Content from "../components/Content.vue";
29
25
  </script>
30
26
 
31
27
  <style>
32
- {{{ @if (it.import.meta.BATI_MODULES?.includes("tailwindcss")) }}}
33
- @import "./tailwind.css"; /* see https://stackoverflow.com/questions/55206901/how-to-import-css-files-in-vue-3-child-components */
28
+ /*{ @if (it.import.meta.BATI_MODULES?.includes("tailwindcss")) }*/
29
+ /* see https://stackoverflow.com/questions/55206901/how-to-import-css-files-in-vue-3-child-components */
30
+ @import "./tailwind.css";
31
+ /*{ /if }*/
34
32
 
35
- {{{ /if }}}
36
33
  body {
37
34
  margin: 0;
38
35
  font-family: sans-serif;
@@ -1,11 +1,10 @@
1
- {{{! /* We are using the SquirrellyJS template syntax */ _}}}
2
-
3
1
  <template>
4
- {{{ @if (it.import.meta.BATI_MODULES?.includes("tailwindcss")) }}}
2
+ <!-- import.meta.BATI_MODULES?.includes("tailwindcss") -->
5
3
  <h1 class="font-bold text-3xl pb-4">
6
- {{{ #else }}}
4
+ My Vike app
5
+ </h1>
6
+ <!-- !import.meta.BATI_MODULES?.includes("tailwindcss") -->
7
7
  <h1>
8
- {{{ /if }}}
9
8
  My Vike app
10
9
  </h1>
11
10
  This page is:
@@ -18,7 +17,8 @@
18
17
  </template>
19
18
 
20
19
  <script lang="ts">
21
- import Counter from '../../components/Counter.vue'
22
- const components = { Counter }
23
- export default { components }
20
+ import Counter from "../../components/Counter.vue";
21
+
22
+ const components = { Counter }
23
+ export default { components }
24
24
  </script>
package/dist/index.js CHANGED
@@ -450,9 +450,9 @@ async function runMain(cmd, opts = {}) {
450
450
 
451
451
  // ../build/dist/index.js
452
452
  import { existsSync } from "fs";
453
- import { copyFile, mkdir, opendir, readFile, writeFile } from "fs/promises";
453
+ import { mkdir, opendir, readFile, writeFile } from "fs/promises";
454
454
  import path from "path";
455
- import { loadFile, renderSquirrelly, transformAstAndGenerate } from "@batijs/core";
455
+ import { transformAndFormat } from "@batijs/core";
456
456
  function queue() {
457
457
  const tasks = [];
458
458
  return {
@@ -474,13 +474,6 @@ function toDist(filepath, source, dist) {
474
474
  split[split.length - 1] = split[split.length - 1].replace(/^\$\$?(.*)\.[tj]sx?$/, "$1");
475
475
  return split.join(path.sep).replace(source, dist);
476
476
  }
477
- async function safeCopyFile(source, destination) {
478
- const destinationDir = path.dirname(destination);
479
- await mkdir(destinationDir, {
480
- recursive: true
481
- });
482
- await copyFile(source, destination);
483
- }
484
477
  async function safeWriteFile(destination, content) {
485
478
  const destinationDir = path.dirname(destination);
486
479
  await mkdir(destinationDir, {
@@ -518,10 +511,6 @@ function transformFileAfterExec(filepath, fileContent) {
518
511
  throw new Error(`Unsupported extension ${ext} (${filepath})`);
519
512
  }
520
513
  }
521
- async function fileContainsBatiMeta(filepath) {
522
- const code = await readFile(filepath, { encoding: "utf-8" });
523
- return code.includes("import.meta.BATI_");
524
- }
525
514
  async function importTransformer(p) {
526
515
  const importFile = isWin ? "file://" + p : p;
527
516
  const f = await import(importFile);
@@ -563,33 +552,17 @@ Please report this issue to https://github.com/magne4000/bati`
563
552
  targets.add(target);
564
553
  }
565
554
  });
566
- } else if (await fileContainsBatiMeta(p)) {
555
+ } else {
567
556
  transformAndWriteQ.add(async () => {
568
- let fileContent = "";
569
- if (parsed.ext.match(/\.[tj]sx?$/)) {
570
- const mod = await loadFile(p);
571
- fileContent = await transformAstAndGenerate(mod.$ast, meta, {
572
- filepath: p
573
- });
574
- } else {
575
- const template = await readFile(p, { encoding: "utf-8" });
576
- try {
577
- fileContent = renderSquirrelly(template, meta);
578
- } catch (e) {
579
- console.error("SquirrellyJS error while rendering", p);
580
- throw e;
581
- }
582
- }
557
+ const code = await readFile(p, { encoding: "utf-8" });
558
+ const fileContent = await transformAndFormat(code, meta, {
559
+ filepath: p
560
+ });
583
561
  if (fileContent) {
584
562
  await safeWriteFile(target, fileContent);
585
563
  targets.add(target);
586
564
  }
587
565
  });
588
- } else {
589
- simpleCopyQ.add(async () => {
590
- await safeCopyFile(p, target);
591
- targets.add(target);
592
- });
593
566
  }
594
567
  }
595
568
  }
@@ -600,7 +573,7 @@ Please report this issue to https://github.com/magne4000/bati`
600
573
  // package.json
601
574
  var package_default = {
602
575
  name: "@batijs/cli",
603
- version: "0.0.94",
576
+ version: "0.0.95",
604
577
  type: "module",
605
578
  scripts: {
606
579
  "check-types": "tsc --noEmit",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batijs/cli",
3
- "version": "0.0.94",
3
+ "version": "0.0.95",
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": "^7.2.0",
20
20
  "typescript": "^5.2.2",
21
21
  "vite": "^4.4.11",
22
- "@batijs/build": "0.0.94",
23
- "@batijs/tsup": "0.0.94"
22
+ "@batijs/build": "0.0.95",
23
+ "@batijs/tsup": "0.0.95"
24
24
  },
25
25
  "dependencies": {
26
- "@batijs/core": "0.0.94",
27
- "@batijs/features": "0.0.94"
26
+ "@batijs/core": "0.0.95",
27
+ "@batijs/features": "0.0.95"
28
28
  },
29
29
  "bin": "./dist/index.js",
30
30
  "exports": {