@varlabs/create-solidstep 0.1.0 → 0.1.1
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/bin/main.js +65 -0
- package/package.json +4 -4
package/bin/main.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { parseArgs } from 'node:util';
|
|
3
|
+
import { sep, join } from 'node:path';
|
|
4
|
+
import { mkdir, cp } from 'node:fs/promises';
|
|
5
|
+
import packageJson from '../package.json' with { type: 'json' };
|
|
6
|
+
const { values, positionals } = parseArgs({
|
|
7
|
+
args: process.argv.slice(2),
|
|
8
|
+
options: {
|
|
9
|
+
help: {
|
|
10
|
+
type: 'boolean',
|
|
11
|
+
short: 'h',
|
|
12
|
+
description: 'Display help information'
|
|
13
|
+
},
|
|
14
|
+
version: {
|
|
15
|
+
type: 'boolean',
|
|
16
|
+
short: 'v',
|
|
17
|
+
description: 'Display version information'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
strict: true,
|
|
21
|
+
allowPositionals: true,
|
|
22
|
+
});
|
|
23
|
+
const main = async () => {
|
|
24
|
+
if (values.help) {
|
|
25
|
+
console.log('Usage: create-solidstep [options] [app-name]');
|
|
26
|
+
console.log('Options:');
|
|
27
|
+
console.log(' -h, --help Display help information');
|
|
28
|
+
console.log(' -v, --version Display version information');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (values.version) {
|
|
32
|
+
console.log(`create-solidstep version ${packageJson.version}`);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
let createAppDir = true;
|
|
37
|
+
// get the current name of the app or extract from the current directory
|
|
38
|
+
let appName = positionals[0];
|
|
39
|
+
if (!appName) {
|
|
40
|
+
appName = process.cwd().split(sep).pop();
|
|
41
|
+
createAppDir = false;
|
|
42
|
+
}
|
|
43
|
+
if (createAppDir) {
|
|
44
|
+
await mkdir(appName, { recursive: true });
|
|
45
|
+
}
|
|
46
|
+
const templateDir = join(import.meta.dirname, '../generate');
|
|
47
|
+
const targetDir = createAppDir ? join(process.cwd(), appName) : process.cwd();
|
|
48
|
+
await cp(templateDir, targetDir, {
|
|
49
|
+
recursive: true,
|
|
50
|
+
filter: (src) => {
|
|
51
|
+
// Exclude node_modules and .git directories
|
|
52
|
+
const relativePath = src.replace(templateDir, '');
|
|
53
|
+
return !relativePath.startsWith('node_modules') && !relativePath.startsWith('.git');
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
console.log(`SolidStep app created successfully in ${targetDir}`);
|
|
57
|
+
console.log('Install dependencies using a package manager of your choice (npm, yarn, pnpm, etc.) and run the app using the "dev" or "start" script.');
|
|
58
|
+
process.exit(0);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
console.error('An error occurred:', error);
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlabs/create-solidstep",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Next Step SolidJS CLI for building web applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "HamzaKV <hamzakv333@gmail.com>",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"minor": "pnpm git:main && npm version minor && pnpm git:push:main",
|
|
27
27
|
"major": "pnpm git:main && npm version major && pnpm git:push:main",
|
|
28
28
|
"roll": "pnpm build && cd dist && npm publish",
|
|
29
|
-
"roll:patch": "pnpm patch && pnpm roll",
|
|
30
|
-
"roll:minor": "pnpm minor && pnpm roll",
|
|
31
|
-
"roll:major": "pnpm major && pnpm roll"
|
|
29
|
+
"roll:patch": "pnpm run patch && pnpm roll",
|
|
30
|
+
"roll:minor": "pnpm run minor && pnpm roll",
|
|
31
|
+
"roll:major": "pnpm run major && pnpm roll"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^22.15.17",
|