@citruslime/create-boilerplate 1.0.0-beta.12 → 1.0.0-beta.13

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.
@@ -0,0 +1,7 @@
1
+ command_exists () {
2
+ command -v "$1" >/dev/null 2>&1
3
+ }
4
+
5
+ if command_exists winpty && test -t 1; then
6
+ exec < /dev/tty
7
+ fi
@@ -0,0 +1,11 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+ . "$(dirname "$0")/common.sh"
4
+
5
+ yarn_directory="$APPDATA\npm\node_modules\yarn\bin"
6
+
7
+ if ! command -v "$yarn_directory\yarn" -v; then
8
+ npm install --global yarn
9
+ fi
10
+
11
+ "$yarn_directory\yarn" install -W
@@ -0,0 +1,11 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+ . "$(dirname "$0")/common.sh"
4
+
5
+ yarn_directory="$APPDATA\npm\node_modules\yarn\bin"
6
+
7
+ if ! command -v "$yarn_directory\yarn" -v; then
8
+ npm install --global yarn
9
+ fi
10
+
11
+ "$yarn_directory\yarn" install -W
@@ -0,0 +1,11 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+ . "$(dirname "$0")/common.sh"
4
+
5
+ yarn_directory="$APPDATA\npm\node_modules\yarn\bin"
6
+
7
+ if ! command -v "$yarn_directory\yarn" -v; then
8
+ npm install --global yarn
9
+ fi
10
+
11
+ "$yarn_directory\yarn" pre-commit-lint
@@ -1,15 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { execSync } = require('child_process');
4
- const { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } = require('fs');
5
- const { join } = require('path');
3
+ import { execSync } from 'child_process';
4
+ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'fs';
5
+ import { dirname, join } from 'path';
6
+ import { fileURLToPath } from 'url';
6
7
 
7
- const { lightBlue, green, red } = require('kolorist');
8
- const parseArgs = require('minimist');
9
- const prompts = require('prompts');
8
+ import { lightBlue, green, red } from 'kolorist';
9
+ import parseArgs from 'minimist';
10
+ import prompts from 'prompts';
10
11
 
11
12
  const argv = parseArgs(process.argv.slice(2));
12
13
  const cwd = process.cwd();
14
+ const codeDir = fileURLToPath(dirname(import.meta.url));
13
15
 
14
16
  const placeholdersToReplace = {
15
17
  /* eslint-disable @typescript-eslint/naming-convention */
@@ -260,7 +262,7 @@ function prepareDir (path, empty) {
260
262
  * @param {string} packageDir The directory of the new package.
261
263
  */
262
264
  function copyTemplate (packageDir) {
263
- const templateDir = join(__dirname, 'template');
265
+ const templateDir = join(codeDir, 'template');
264
266
 
265
267
  forEachInDir(templateDir, (item) => copy(templateDir, packageDir, item));
266
268
  }
@@ -272,7 +274,7 @@ function copyTemplate (packageDir) {
272
274
  * @param {string} rootDir The relative path from the package directory to the root of the repository.
273
275
  */
274
276
  function copyHooks (packageDir, rootDir) {
275
- const hooksDir = join(__dirname, 'hooks');
277
+ const hooksDir = join(codeDir, 'hooks');
276
278
  const huskyDir = join(cwd, packageDir, rootDir, '.husky');
277
279
 
278
280
  forEachInDir(hooksDir, (item) => copy(hooksDir, huskyDir, item));
@@ -385,5 +387,9 @@ function print (message, clearPrevious = false) {
385
387
  process.stdout.write(message);
386
388
  }
387
389
 
388
- init()
389
- .catch(e => print(red(`\n${e.message}`)));
390
+ try {
391
+ await init();
392
+ }
393
+ catch (e) {
394
+ print(`\n${red(e.message)}`);
395
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citruslime/create-boilerplate",
3
- "version": "1.0.0-beta.12",
3
+ "version": "1.0.0-beta.13",
4
4
  "author": {
5
5
  "name": "Citrus-Lime Ltd",
6
6
  "url": "https://citruslime.com"
@@ -11,12 +11,13 @@
11
11
  "access": "public"
12
12
  },
13
13
  "files": [
14
- "main.js",
15
- "template-*"
14
+ "main.mjs",
15
+ "template",
16
+ "hooks"
16
17
  ],
17
- "main": "main.js",
18
+ "main": "main.mjs",
18
19
  "bin": {
19
- "create-boilerplate": "main.js"
20
+ "create-boilerplate": "main.mjs"
20
21
  },
21
22
  "engines": {
22
23
  "node": ">=14.0.0"
@@ -0,0 +1,10 @@
1
+ {
2
+ "recommendations": [
3
+ "johnsoncodehk.volar",
4
+ "dbaeumer.vscode-eslint",
5
+ "stylelint.vscode-stylelint",
6
+ "bradlc.vscode-tailwindcss",
7
+ "editorconfig.editorconfig",
8
+ "antfu.iconify"
9
+ ]
10
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "[css]": {
3
+ "editor.insertSpaces": false
4
+ },
5
+ "css.validate": false,
6
+ "editor.codeActionsOnSave": {
7
+ "source.fixAll": true,
8
+ "source.fixAll.eslint": true,
9
+ "source.organizeImports": false
10
+ },
11
+ "editor.formatOnSave": true,
12
+ "editor.linkedEditing": true,
13
+ "eslint.validate": [
14
+ "html",
15
+ "javascript",
16
+ "typescript",
17
+ "vue"
18
+ ],
19
+ "files.encoding": "utf8",
20
+ "files.eol": "\n",
21
+ "files.exclude": {
22
+ "node_modules": true
23
+ },
24
+ "files.trimTrailingWhitespace": true,
25
+ "git.enableSmartCommit": true,
26
+ "git.pruneOnFetch": true,
27
+ "tailwindCSS.includeLanguages": {
28
+ "vue": "html"
29
+ }
30
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "folders": [
3
+ {
4
+ "name": "Root",
5
+ "path": ".."
6
+ },
7
+ {
8
+ "name": "Hooks",
9
+ "path": "../../.husky"
10
+ }
11
+ ],
12
+ "settings": {
13
+ "[css]": {
14
+ "editor.insertSpaces": false
15
+ },
16
+ "css.validate": false,
17
+ "editor.codeActionsOnSave": {
18
+ "source.fixAll": true,
19
+ "source.fixAll.eslint": true,
20
+ "source.organizeImports": false
21
+ },
22
+ "editor.formatOnSave": true,
23
+ "editor.linkedEditing": true,
24
+ "eslint.validate": [
25
+ "html",
26
+ "javascript",
27
+ "typescript",
28
+ "vue"
29
+ ],
30
+ "files.encoding": "utf8",
31
+ "files.eol": "\n",
32
+ "files.exclude": {
33
+ "node_modules": true
34
+ },
35
+ "files.trimTrailingWhitespace": true,
36
+ "git.enableSmartCommit": true,
37
+ "git.pruneOnFetch": true,
38
+ "tailwindCSS.includeLanguages": {
39
+ "vue": "html"
40
+ }
41
+ },
42
+ "extensions": {
43
+ "recommendations": [
44
+ "johnsoncodehk.volar",
45
+ "dbaeumer.vscode-eslint",
46
+ "stylelint.vscode-stylelint",
47
+ "bradlc.vscode-tailwindcss",
48
+ "editorconfig.editorconfig",
49
+ "antfu.iconify"
50
+ ]
51
+ }
52
+ }
@@ -0,0 +1,11 @@
1
+ # Citrus-Lime Boilerplate App
2
+
3
+ This boilerplate should provide a good basis for creating a new Citrus-Lime web app.
4
+
5
+ It makes use of the various @citruslime packages, as well as the current standards for a Vue 3 + TypeScript app and various helpful Vite plugins to make development easier.
6
+
7
+ Linting is provided by default by a combination of ESLint and StyleLint.
8
+
9
+ ## Areas of Consideration
10
+
11
+ Example code is provided in the state and views folders. It should be deleted or replaced, once development is started.
@@ -0,0 +1,10 @@
1
+ [*]
2
+ indent_style = space
3
+ indent_size = 4
4
+ end_of_line = lf
5
+ charset = utf-8
6
+ trim_trailing_whitespace = true
7
+ insert_final_newline = true
8
+
9
+ [*.css]
10
+ indent_style = tab
@@ -0,0 +1,3 @@
1
+ dist
2
+ node_modules
3
+ index.html
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ extends: [ require.resolve('@citruslime/config/eslint') ]
3
+ };
@@ -0,0 +1,6 @@
1
+ node_modules
2
+ .DS_Store
3
+ dist
4
+ dist-ssr
5
+ *.local
6
+ *.log
@@ -0,0 +1,8 @@
1
+ {
2
+ "./**/*.+(js|ts|vue)": [
3
+ "eslint --fix"
4
+ ],
5
+ "./**/*.(css|vue)": [
6
+ "stylelint --fix"
7
+ ]
8
+ }
@@ -0,0 +1,2 @@
1
+ **/dist
2
+ **/node_modules
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ extends: [ require.resolve('@citruslime/config/stylelint') ]
3
+ };
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" href="/favicon.ico" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Citrus-Lime</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/main.ts"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "[[PACKAGE_NAME]]",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "vite",
7
+ "build": "vue-tsc --noEmit && vite build",
8
+ "serve": "vite preview",
9
+ "lint": "eslint . --ext .js,.ts,.vue --fix && stylelint **/*.{css,vue} --fix",
10
+ "pre-commit-lint": "yarn lint-staged",
11
+ "prepare": "cd [[REPOSITORY_ROOT]] && husky install"
12
+ }
13
+ }
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {}
5
+ }
6
+ };
Binary file
@@ -0,0 +1,31 @@
1
+ <script setup lang="ts">
2
+ import { useRoute } from 'vue-router';
3
+
4
+ const route = useRoute();
5
+ </script>
6
+
7
+ <style lang="postcss">
8
+ @import '@citruslime/ui/style';
9
+
10
+ @tailwind base;
11
+ @tailwind components;
12
+ @tailwind utilities;
13
+
14
+ body {
15
+ @apply bg-off-white min-h-screen w-full;
16
+ }
17
+ </style>
18
+
19
+ <template>
20
+ <cl-ui-app>
21
+ <template #header>
22
+ <cl-ui-header />
23
+ </template>
24
+
25
+ <template #navigation>
26
+ <cl-ui-navigation />
27
+ </template>
28
+
29
+ <router-view :key="route.fullPath" />
30
+ </cl-ui-app>
31
+ </template>
@@ -0,0 +1,9 @@
1
+ /// <reference types="vite/client" />
2
+ /// <reference types="vite-plugin-pages/client" />
3
+
4
+ declare module '*.vue' {
5
+ import type { DefineComponent } from 'vue';
6
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
7
+ const component: DefineComponent<{}, {}, any>;
8
+ export default component;
9
+ }
@@ -0,0 +1,17 @@
1
+ import ui from '@citruslime/ui';
2
+ import { createPinia } from 'pinia';
3
+ import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
4
+ import { createApp } from 'vue';
5
+
6
+ import app from './app.vue';
7
+ import router from './router';
8
+
9
+ const pinia = createPinia();
10
+
11
+ pinia.use(piniaPluginPersistedstate);
12
+
13
+ createApp(app)
14
+ .use(router)
15
+ .use(ui)
16
+ .use(pinia)
17
+ .mount('#app');
@@ -0,0 +1,19 @@
1
+ import generatedRoutes from 'virtual:generated-pages';
2
+ import type { RouteRecordRaw } from 'vue-router';
3
+ import { createRouter, createWebHashHistory } from 'vue-router';
4
+
5
+ export const routes: RouteRecordRaw[] = [
6
+ ...generatedRoutes,
7
+ {
8
+ name: 'not-found',
9
+ path: '/:pathMatch(.*)*',
10
+ redirect: '/'
11
+ }
12
+ ];
13
+
14
+ const router = createRouter({
15
+ history: createWebHashHistory(),
16
+ routes
17
+ });
18
+
19
+ export default router;
@@ -0,0 +1,11 @@
1
+ import { defineStore } from 'pinia';
2
+
3
+ export const useAuthStore = defineStore('auth', {
4
+ state: () => ({
5
+ username: 'Nobody',
6
+ loginDate: null as Date | null
7
+ }),
8
+ persist: {
9
+ overwrite: true
10
+ }
11
+ });
@@ -0,0 +1 @@
1
+ export * from './authentication';
@@ -0,0 +1,28 @@
1
+ <route>
2
+ {
3
+ path: '/'
4
+ }
5
+ </route>
6
+
7
+ <script setup lang="ts">
8
+ import { setLocaleMessages } from '@citruslime/ui';
9
+ import { storeToRefs } from 'pinia';
10
+ import { useI18n } from 'vue-i18n';
11
+
12
+ import { useAuthStore } from '@/state';
13
+
14
+ const { username } = storeToRefs(useAuthStore());
15
+ const { t } = useI18n();
16
+
17
+ setLocaleMessages('en-GB', {
18
+ messages: {
19
+ greeting: 'Hello, {name}!'
20
+ }
21
+ });
22
+ </script>
23
+
24
+ <template>
25
+ <div>
26
+ {{ t('messages.greeting', { name: username }) }}
27
+ </div>
28
+ </template>
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ presets: [ require('@citruslime/theme') ],
3
+ content: [
4
+ './index.html',
5
+ './src/**/*.{vue,js,ts,jsx,tsx}'
6
+ ]
7
+ };
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "esnext",
4
+ "useDefineForClassFields": true,
5
+ "module": "esnext",
6
+ "moduleResolution": "node",
7
+ "strict": true,
8
+ "jsx": "preserve",
9
+ "sourceMap": true,
10
+ "resolveJsonModule": true,
11
+ "esModuleInterop": true,
12
+ "lib": [
13
+ "esnext",
14
+ "dom"
15
+ ],
16
+ "paths": {
17
+ "@/*": [
18
+ "./src/*"
19
+ ]
20
+ }
21
+ },
22
+ "include": [
23
+ "src/**/*.ts",
24
+ "src/**/*.d.ts",
25
+ "src/**/*.vue",
26
+ "./components.d.ts"
27
+ ]
28
+ }
@@ -0,0 +1,68 @@
1
+ import path from 'path';
2
+
3
+ import vue from '@vitejs/plugin-vue';
4
+ import { VueUseComponentsResolver } from 'unplugin-vue-components/resolvers';
5
+ import components from 'unplugin-vue-components/vite';
6
+ import { defineConfig } from 'vite';
7
+ import mkcert from 'vite-plugin-mkcert';
8
+ import pages from 'vite-plugin-pages';
9
+
10
+ export default defineConfig({
11
+ plugins: [
12
+ vue(),
13
+ pages({
14
+ pagesDir: 'src/views',
15
+ extensions: [ 'vue' ]
16
+ }),
17
+ components({
18
+ dirs: [
19
+ 'src/components',
20
+ 'src/pages'
21
+ ],
22
+ dts: true,
23
+ resolvers: [ VueUseComponentsResolver() ]
24
+ }),
25
+ mkcert()
26
+ ],
27
+ build: {
28
+ rollupOptions: {
29
+ output: {
30
+ manualChunks (id) {
31
+ if (id.includes('node_modules')) {
32
+ return id.toString().split('node_modules/')[1].split('/')[0].toString();
33
+ }
34
+ }
35
+ }
36
+ }
37
+ },
38
+ define: {
39
+ /* eslint-disable @typescript-eslint/naming-convention */
40
+ __VUE_I18N_FULL_INSTALL__: true,
41
+ __VUE_I18N_LEGACY_API__: false,
42
+ __INTLIFY_PROD_DEVTOOLS__: false
43
+ /* eslint-enable @typescript-eslint/naming-convention */
44
+ },
45
+ optimizeDeps: {
46
+ include: [ 'vue-i18n' ]
47
+ },
48
+ resolve: {
49
+ alias: {
50
+ '@': path.resolve(__dirname, 'src'),
51
+ 'vue-i18n': 'vue-i18n/dist/vue-i18n.esm-bundler.js'
52
+ }
53
+ },
54
+ server: {
55
+ open: true,
56
+ https: true,
57
+ /* eslint-disable array-bracket-spacing */
58
+ port: [[FRONTEND_PORT]],
59
+ /* eslint-enable array-bracket-spacing */
60
+ proxy: {
61
+ '/api': {
62
+ target: 'https://localhost:[[BACKEND_PORT]]',
63
+ secure: false,
64
+ rewrite: (path) => path.replace('/api', '')
65
+ }
66
+ }
67
+ }
68
+ });