urbit / create-landscape-app

Get started making a simple app for Landscape with a few commands.
86 stars 21 forks source link

install.js: delete .DS_Store before MoveDir() in setupFull() #35

Closed jfranklin9000 closed 4 years ago

jfranklin9000 commented 4 years ago

If you clone the repository and do macOS Finder operations that create .DS_Store and full/.DS_Store you get this when you npm start:

What's the name of your application? Lowercase and no spaces, please.: test
Is your app just a tile, or a full application? (tile/full): full
Where is your Urbit pier's desk located? For example, /Users/dev/zod/home: /
(node:74511) UnhandledPromiseRejectionWarning: Error: dest already exists.
    at /xxx/create-landscape-app/node_modules/fs-extra/lib/move/move.js:41:31
    at /xxx/create-landscape-app/node_modules/universalify/index.js:23:46

The dest is ./.DS_Store. This PR deletes it, if it exists. I tested all 4 combinations of the existence of .DS-Store and full/.DS_Store.

It also simplifies the deHyphenatedName assignment. I tested by creating a full app with a non-hyphenated name, and a tile app with a hyphenated name. I also ran this code:

const name1 = 'hello-goodbye--z---'
console.log(name1)
console.log(name1.indexOf('-'))
console.log(name1.replace(/-/g, ''))
const name2 = 'abcdefg'
console.log(name2)
console.log(name2.indexOf('-'))
console.log(name2.replace(/-/g, ''))
hello-goodbye--z---
5
hellogoodbyez
abcdefg
-1
abcdefg

I also added an "All done" message to setupFull() to match setupTile().