Skip to content

Commit

Permalink
[BUG] Fix and refactor Create Adastra CLI cause it deosn't work on wi…
Browse files Browse the repository at this point in the history
…ndows machines. (#26)
  • Loading branch information
blanklob authored Mar 5, 2023
1 parent 587acab commit a41db2e
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion examples/with-gsap/templates/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"main": {
"type": "hello-world",
"settings": {
"heading": "Welcome to Adastra ✨ with Gsap."
"heading": "Welcome to Adastra ✨ with GSAP."
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vue/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Adastra Example With Lit
# Adastra Example With Vue

```shell
npm create adastra@latest -- --template blanklob/adastra/examples/with-vue
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"dev": "turbo run dev --filter=*adastra* --parallel",
"dev:templates": "turbo run dev --filter=template-* --parallel",
"build": "turbo run build --filter=*adastra* --filter=template-*",
"build": "turbo run build --filter=*adastra*",
"lint": "turbo run lint",
"typecheck": "turbo run typecheck",
"check": "turbo run check",
Expand Down
2 changes: 1 addition & 1 deletion packages/adastra-cli-kit/src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const say = async (
export const label = (
text: string,
c = color.bgHex(COLORS.yellowGreen),
t = color.whiteBright
t = color.black
): string => c(` ${t(text)} `)

export const colored = (
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions packages/create-adastra/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# `create-adastra`

## 0.1.5

### Patch Changes

- 5e49684: Fixed issue with template command not cloning the template from Github

## 0.1.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/create-adastra/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-adastra",
"version": "0.1.4",
"version": "0.1.5",
"author": "Blanklob",
"license": "MIT",
"type": "module",
Expand Down
13 changes: 4 additions & 9 deletions packages/create-adastra/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const isValidProjectDirectory = (dirPath: string): boolean => {
return conflicts.length === 0
}

const FILES_TO_REMOVE = ['.theme-check.yml', 'CHANGELOG.md'] // some files are only needed for online editors when using adastra.new. Remove for create-adastra installs.
const FILES_TO_REMOVE = ['CHANGELOG.md'] // some files are only needed for online editors when using adastra.new. Remove for create-adastra installs.

export async function main(): Promise<void> {
const pkgManager = detectPackageManager()?.name || 'npm'
Expand Down Expand Up @@ -161,23 +161,18 @@ export async function main(): Promise<void> {
'Copying theme files and folders...'
)

// eslint-disable-next-line
const hash = args.commit ? `#${args.commit}` : ''

const isThirdParty = options.template.includes('/') as boolean
const templateTarget = isThirdParty
? options.template
: `gh:blanklob/adastra/examples/${options.template}#latest`

? `gh:${options.template}`
: `gh:blanklob/adastra/templates/${options.template}`
if (!args.dryRun) {
try {
await downloadTemplate(`${templateTarget}${hash}`, {
await downloadTemplate(`${templateTarget}`, {
force: true,
provider: 'github',
cwd,
dir: '.'
})
// eslint-disable-next-line
} catch (error: any) {
fs.rmdirSync(cwd)
if (error.message.includes('404')) {
Expand Down
10 changes: 9 additions & 1 deletion templates/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Adastra Templates/Themes Library

### Official Templates
Adastra ✨ comes with these templates by default

- Basics: has everything you need if you are familiar with Tailwind and prettier, and also comes with ready-to-use theme snippets, like `image.liquid` and `media.liquid` and more..

- Minimal: Is an empty theme without any styling or framework configuration, built to be extended with your own frontend tools, instead of using Tailwind.

- Necessary: Like it's name suggests, it's the minimalistic of all above and comes without the Adastra CLI if you prefer to use Vite or have a custom CLI workflow.

## Official Templates

The easiest way to check out one of these templates on your local machine is by running this command in an empty directory:

Expand Down

0 comments on commit a41db2e

Please sign in to comment.