create-nuxt-base 0.3.5 → 0.3.7
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 +15 -0
- package/index.js +48 -11
- package/nuxt-base-template/nuxt.config.ts +42 -42
- package/nuxt-base-template/postbuild.js +22 -8
- package/package.json +1 -1
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.7](https://github.com/lenneTech/nuxt-base-starter/compare/v0.3.6...v0.3.7) (2025-02-17)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* change commands from npm to pnpm ([0e513ee](https://github.com/lenneTech/nuxt-base-starter/commit/0e513eeb14c122cdbeb76fb2344ac60dd731d8bd))
|
|
11
|
+
|
|
12
|
+
### [0.3.6](https://github.com/lenneTech/nuxt-base-starter/compare/v0.3.5...v0.3.6) (2025-02-17)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **DEV-55:** Add remote .gitignore and custom messages ([cd8ca5c](https://github.com/lenneTech/nuxt-base-starter/commit/cd8ca5c92905c87c794703434c4b555c3cbd60e5))
|
|
18
|
+
* **DEV-56:** Postbuild hook stopping process ([ee93a71](https://github.com/lenneTech/nuxt-base-starter/commit/ee93a7146c08cb4c4e70f2454e56bfcb3e1435ed))
|
|
19
|
+
|
|
5
20
|
### [0.3.5](https://github.com/lenneTech/nuxt-base-starter/compare/v0.3.4...v0.3.5) (2025-02-06)
|
|
6
21
|
|
|
7
22
|
|
package/index.js
CHANGED
|
@@ -37,13 +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
41
|
|
|
42
42
|
// Copy .gitignore
|
|
43
|
-
await
|
|
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
|
+
);
|
|
44
48
|
|
|
45
49
|
// Copy .env
|
|
46
|
-
await copyFiles(__dirname + '/nuxt-base-template/.env.example', projectDir + '/.env');
|
|
50
|
+
await copyFiles(__dirname + '/nuxt-base-template/.env.example', projectDir + '/.env', 'Copied .env successfully!');
|
|
47
51
|
|
|
48
52
|
const projectPackageJson = require(path.join(projectDir, 'package.json'));
|
|
49
53
|
|
|
@@ -58,8 +62,8 @@ async function create() {
|
|
|
58
62
|
await waitForChildProcess(gitInit);
|
|
59
63
|
|
|
60
64
|
console.log('Installing dependencies ...');
|
|
61
|
-
const
|
|
62
|
-
await waitForSpawn(
|
|
65
|
+
const runInstall = spawn('pnpm', ['install'], { stdio: 'inherit' });
|
|
66
|
+
await waitForSpawn(runInstall);
|
|
63
67
|
|
|
64
68
|
const removeGit = spawn('npx', ['rimraf', '.git'], { stdio: 'inherit' });
|
|
65
69
|
await waitForSpawn(removeGit);
|
|
@@ -68,8 +72,8 @@ async function create() {
|
|
|
68
72
|
|
|
69
73
|
if (autoStart) {
|
|
70
74
|
console.log('Building Project ...');
|
|
71
|
-
const
|
|
72
|
-
await waitForSpawn(
|
|
75
|
+
const runBuild = spawn('pnpm', ['build'], { stdio: 'inherit' });
|
|
76
|
+
await waitForSpawn(runBuild)
|
|
73
77
|
.then(() => console.log('✅ Project was successfully built'))
|
|
74
78
|
.catch(() => console.log('❌ Error while building the project'));
|
|
75
79
|
|
|
@@ -82,8 +86,8 @@ async function create() {
|
|
|
82
86
|
await waitForMS(1000);
|
|
83
87
|
console.log(`Launching ${projectName} ... 🚀`);
|
|
84
88
|
await waitForMS(1000);
|
|
85
|
-
const
|
|
86
|
-
await waitForSpawn(
|
|
89
|
+
const runDev = spawn('pnpm', ['start'], { stdio: 'inherit' });
|
|
90
|
+
await waitForSpawn(runDev);
|
|
87
91
|
}
|
|
88
92
|
}
|
|
89
93
|
|
|
@@ -113,17 +117,50 @@ function waitForChildProcess(process) {
|
|
|
113
117
|
});
|
|
114
118
|
}
|
|
115
119
|
|
|
116
|
-
async function copyFiles(from, to) {
|
|
120
|
+
async function copyFiles(from, to, msg) {
|
|
117
121
|
const fse = require('fs-extra');
|
|
118
122
|
try {
|
|
119
123
|
await fse.copy(from, to);
|
|
120
|
-
console.log(
|
|
124
|
+
console.log(msg);
|
|
121
125
|
} catch (err) {
|
|
122
126
|
console.error(err);
|
|
123
127
|
process.exit(-1);
|
|
124
128
|
}
|
|
125
129
|
}
|
|
126
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
|
+
|
|
127
164
|
function getPackageData(packageName) {
|
|
128
165
|
const https = require('https');
|
|
129
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
12
|
+
colorMode: {
|
|
13
|
+
classSuffix: '',
|
|
14
|
+
},
|
|
10
15
|
|
|
11
|
-
|
|
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
|
-
|
|
26
|
-
|
|
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
|
-
|
|
61
|
-
|
|
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
|
-
|
|
76
|
-
|
|
73
|
+
sitemap: {
|
|
74
|
+
exclude: ['/app/**'],
|
|
77
75
|
},
|
|
78
76
|
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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