create-nuxt-base 0.3.4 → 0.3.6

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/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.3.6](https://github.com/lenneTech/nuxt-base-starter/compare/v0.3.5...v0.3.6) (2025-02-17)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **DEV-55:** Add remote .gitignore and custom messages ([cd8ca5c](https://github.com/lenneTech/nuxt-base-starter/commit/cd8ca5c92905c87c794703434c4b555c3cbd60e5))
11
+ * **DEV-56:** Postbuild hook stopping process ([ee93a71](https://github.com/lenneTech/nuxt-base-starter/commit/ee93a7146c08cb4c4e70f2454e56bfcb3e1435ed))
12
+
13
+ ### [0.3.5](https://github.com/lenneTech/nuxt-base-starter/compare/v0.3.4...v0.3.5) (2025-02-06)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **TEC-46:** Ensure .gitignore is copied during setup ([f579ce0](https://github.com/lenneTech/nuxt-base-starter/commit/f579ce0d59c7ffc2da8e4c50c3405fefaf181ede))
19
+
5
20
  ### [0.3.4](https://github.com/lenneTech/nuxt-base-starter/compare/v0.3.3...v0.3.4) (2025-02-06)
6
21
 
7
22
 
package/index.js CHANGED
@@ -37,10 +37,17 @@ async function create() {
37
37
  process.exit(-1);
38
38
  }
39
39
 
40
- await copyFiles(__dirname + '/nuxt-base-template', projectDir);
40
+ await copyFiles(__dirname + '/nuxt-base-template', projectDir, 'Copied nuxt base template successfully!');
41
+
42
+ // Copy .gitignore
43
+ await writeFile(
44
+ projectDir + '/.gitignore',
45
+ await getRemoteContent('https://raw.githubusercontent.com/lenneTech/nuxt-base-starter/refs/heads/main/nuxt-base-template/.gitignore'),
46
+ 'Copied .gitignore successfully!'
47
+ );
41
48
 
42
49
  // Copy .env
43
- await copyFiles(__dirname + '/nuxt-base-template/.env.example', projectDir + '/.env');
50
+ await copyFiles(__dirname + '/nuxt-base-template/.env.example', projectDir + '/.env', 'Copied .env successfully!');
44
51
 
45
52
  const projectPackageJson = require(path.join(projectDir, 'package.json'));
46
53
 
@@ -110,17 +117,50 @@ function waitForChildProcess(process) {
110
117
  });
111
118
  }
112
119
 
113
- async function copyFiles(from, to) {
120
+ async function copyFiles(from, to, msg) {
114
121
  const fse = require('fs-extra');
115
122
  try {
116
123
  await fse.copy(from, to);
117
- console.log('Copied nuxt base template successfully!');
124
+ console.log(msg);
118
125
  } catch (err) {
119
126
  console.error(err);
120
127
  process.exit(-1);
121
128
  }
122
129
  }
123
130
 
131
+ async function writeFile(path, content, msg) {
132
+ try {
133
+ const fs = require('node:fs');
134
+ await fs.writeFile(path, content, (err) => err && console.error(err));
135
+ console.log(msg);
136
+ } catch (error) {
137
+ console.error(`Failed to write to ${path}:`, error);
138
+ process.exit(-1);
139
+ }
140
+ }
141
+
142
+ async function getRemoteContent(url) {
143
+ const https = require('node:https');
144
+ return new Promise((resolve, reject) => {
145
+ https.get(url, (res) => {
146
+ let data = '';
147
+ res.on('data', (chunk) => {
148
+ data += chunk;
149
+ });
150
+ res.on('end', () => {
151
+ if (res.statusCode === 200) {
152
+ resolve(data);
153
+ } else {
154
+ reject(new Error(`Failed to fetch content: ${res.statusCode} ${res.statusMessage}`));
155
+ }
156
+ });
157
+ }).on('error', (err) => {
158
+ reject(err);
159
+ });
160
+ });
161
+
162
+ }
163
+
124
164
  function getPackageData(packageName) {
125
165
  const https = require('https');
126
166
 
@@ -1,47 +1,32 @@
1
1
  // https://nuxt.com/docs/api/configuration/nuxt-config
2
- import tailwindcss from '@tailwindcss/vite'
2
+ import tailwindcss from '@tailwindcss/vite';
3
3
 
4
4
  export default defineNuxtConfig({
5
- ssr: true,
6
-
7
- spaLoadingTemplate: false,
5
+ app: {
6
+ head: {
7
+ title: 'Nuxt Base Starter',
8
+ viewport: 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no',
9
+ },
10
+ },
8
11
 
9
- srcDir: './src',
12
+ colorMode: {
13
+ classSuffix: '',
14
+ },
10
15
 
11
- modules: [
12
- '@nuxt/test-utils/module',
13
- '@lenne.tech/nuxt-base',
14
- '@vueuse/nuxt',
15
- '@nuxtjs/google-fonts',
16
- '@nuxtjs/color-mode',
17
- '@nuxt/image',
18
- '@nuxtjs/robots',
19
- '@nuxtjs/sitemap',
20
- '@nuxtjs/plausible',
21
- ],
16
+ compatibilityDate: '2024-09-05',
22
17
 
23
18
  css: ['~/assets/css/tailwind.css'],
24
19
 
25
- vite: {
26
- plugins: [tailwindcss()],
27
- },
28
-
29
- plausible: {
30
- apiHost: '',
20
+ devServer: {
21
+ port: 3001,
31
22
  },
32
23
 
33
- compatibilityDate: '2024-09-05',
34
-
35
24
  experimental: {
36
25
  asyncContext: true,
37
26
  renderJsonPayloads: false,
38
27
  typedPages: true,
39
28
  },
40
29
 
41
- sitemap: {
42
- exclude: ['/app/**'],
43
- },
44
-
45
30
  image: {
46
31
  ipx: {
47
32
  maxAge: 2592000,
@@ -49,6 +34,22 @@ export default defineNuxtConfig({
49
34
  provider: 'ipx',
50
35
  },
51
36
 
37
+ imports: {
38
+ dirs: ['./states', './stores', './forms', './interfaces', './base', './plugins'],
39
+ },
40
+
41
+ modules: [
42
+ '@nuxt/test-utils/module',
43
+ '@lenne.tech/nuxt-base',
44
+ '@vueuse/nuxt',
45
+ '@nuxtjs/google-fonts',
46
+ '@nuxtjs/color-mode',
47
+ '@nuxt/image',
48
+ '@nuxtjs/robots',
49
+ '@nuxtjs/sitemap',
50
+ '@nuxtjs/plausible',
51
+ ],
52
+
52
53
  nuxtBase: {
53
54
  generateTypes: process.env['GENERATE_TYPES'] === '1',
54
55
  gqlHost: process.env.API_URL + '/graphql',
@@ -57,11 +58,8 @@ export default defineNuxtConfig({
57
58
  storagePrefix: process.env.STORAGE_PREFIX,
58
59
  },
59
60
 
60
- app: {
61
- head: {
62
- title: 'Nuxt Base Starter',
63
- viewport: 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no',
64
- },
61
+ plausible: {
62
+ apiHost: '',
65
63
  },
66
64
 
67
65
  runtimeConfig: {
@@ -72,13 +70,15 @@ export default defineNuxtConfig({
72
70
  },
73
71
  },
74
72
 
75
- devServer: {
76
- port: 3001,
73
+ sitemap: {
74
+ exclude: ['/app/**'],
77
75
  },
78
76
 
79
- colorMode: {
80
- classSuffix: '',
81
- },
77
+ spaLoadingTemplate: false,
78
+
79
+ srcDir: './src',
80
+
81
+ ssr: true,
82
82
 
83
83
  // googleFonts: {
84
84
  // families: {
@@ -90,9 +90,9 @@ export default defineNuxtConfig({
90
90
  // stylePath: '~/assets/css/fonts.css',
91
91
  // },
92
92
 
93
- imports: {
94
- dirs: ['./states', './stores', './forms', './interfaces', './base', './plugins'],
95
- },
96
-
97
93
  telemetry: false,
94
+
95
+ vite: {
96
+ plugins: [tailwindcss()],
97
+ },
98
98
  });
@@ -1,12 +1,26 @@
1
1
  import { execSync } from 'child_process';
2
2
  import * as path from 'path';
3
+
3
4
  const tslibPath = path.resolve('.output', 'server', 'node_modules', 'tslib');
4
- process.chdir(tslibPath);
5
- const command = 'npm pkg set "exports[.].import.node"="./tslib.es6.mjs"';
6
- try {
7
- execSync(command, { stdio: 'inherit' });
8
- console.debug('✅ Successfully ran postinstall script');
9
- } catch (error) {
10
- console.error('❌ Error executing postinstall script: ', error);
11
- process.exit(1);
5
+
6
+ async function runPostinstall() {
7
+ const { default: config } = await import('./nuxt.config.ts');
8
+
9
+ if (!config.ssr) {
10
+ console.debug('⚠️ SSR is disabled, skipping postinstall script.');
11
+ process.exit(0);
12
+ }
13
+
14
+ try {
15
+ process.chdir(tslibPath);
16
+ const command = 'npm pkg set \'exports[.].import.node\'=\'./tslib.es6.mjs\'';
17
+ execSync(command, { stdio: 'inherit' });
18
+ console.debug('✅ Successfully ran postinstall script');
19
+ } catch (error) {
20
+ console.error('❌ Error executing postinstall script:', error);
21
+ process.exit(1);
22
+ }
23
+
12
24
  }
25
+
26
+ runPostinstall();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nuxt-base",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "Starter to generate a configured environment with VueJS, Nuxt, Tailwind, Eslint, @lenne.tech/nuxt-base, Unit Tests, Cypress etc.",
5
5
  "main": "index.js",
6
6
  "engines": {