Skip to content

Commit db55467

Browse files
committed
2.0.0
1 parent 9736453 commit db55467

File tree

5 files changed

+39
-20
lines changed

5 files changed

+39
-20
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "create-start-ui",
33
"description": "Scaffold a new Start-UI project",
4-
"version": "1.0.0-2",
4+
"version": "2.0.0",
55
"license": "MIT",
66
"type": "module",
77
"bin": {
@@ -38,7 +38,8 @@
3838
"move-file": "3.1.0",
3939
"ora": "8.1.1",
4040
"tar": "7.4.3",
41-
"tempy": "3.1.0"
41+
"tempy": "3.1.0",
42+
"ts-pattern": "5.7.0"
4243
},
4344
"devDependencies": {
4445
"@biomejs/biome": "1.9.4",

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { config } from '@/lib/conf.js';
1919
import { debug } from '@/lib/debug.js';
2020
import { type Target, repos } from '@/lib/repos.js';
2121
import { spinner } from '@/lib/spinner.js';
22+
import { match } from 'ts-pattern';
2223

2324
const parsedCliArgs = program.parse(process.argv);
2425
const outDirPath = Option.fromNullable(parsedCliArgs.args[0]);
@@ -30,6 +31,7 @@ if (outDirPath.isNone()) {
3031
const options = parsedCliArgs.opts();
3132
const type = Option.fromNullable(options.type).getOr('web') as Target;
3233

34+
// [NOTE]
3335
// We make this option available in the global scope,
3436
// so debug() function can access it without the need to pass it
3537
// as a parameter everytime we want to use it
@@ -77,21 +79,6 @@ await temporaryDirectoryTask(async (tmpDir) => {
7779
spinner.succeed();
7880
process.chdir(outDirPath.value);
7981

80-
// Init git repository and add first commit
81-
if (!options.skipGitInit) {
82-
spinner.start('Initializing repository...');
83-
84-
try {
85-
await $`git init`;
86-
await $`git add .`;
87-
await $`git commit -m "${'feat: initial commit'}"`;
88-
spinner.succeed();
89-
} catch (error) {
90-
debug('Failed to initialize git repository', error);
91-
spinner.warn('Unable to run git init, skipping');
92-
}
93-
}
94-
9582
if (!options.skipInstall) {
9683
spinner.start('Installing dependencies with pnpm...');
9784

@@ -113,11 +100,30 @@ if (!options.skipInstall) {
113100
});
114101
}
115102

103+
// Init git repository and add first commit
104+
if (!options.skipGitInit) {
105+
spinner.start('Initializing repository...');
106+
107+
try {
108+
await $`git init`;
109+
await $`git add .`;
110+
await $`git commit -m "${'feat: initial commit'}"`;
111+
spinner.succeed();
112+
} catch (error) {
113+
debug('Failed to initialize git repository', error);
114+
spinner.warn('Unable to run git init, skipping');
115+
}
116+
}
117+
116118
console.log('');
117119
console.log(chalk.green('✅ Project created!'));
118120
console.log(
119121
`➡️ Run \`${chalk.grey(`cd ${outDirPath.value}`)}\` and follow getting started instructions in the README.md`,
120122
);
121-
if (type === 'web') {
122-
console.log('ℹ️ Check https://docs.web.start-ui.com/ for additional guides or details about 🚀 Start UI [web]');
123-
}
123+
124+
// Once the repo template has been copied into
125+
// the disired folder, run target specific scripts
126+
match(type)
127+
.with('web', () => import('@/target/web/index.js'))
128+
.with('native', () => import('@/target/native/index.js'))
129+
.exhaustive();

src/target/native/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// TODO: add native specific scripts here
2+
// - renaming assets
3+
// - updating package names

src/target/web/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('ℹ️ Check https://docs.web.start-ui.com/ for additional guides or details about 🚀 Start UI [web]');

0 commit comments

Comments
 (0)