diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-09-08 10:33:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-08 10:33:47 +0200 |
commit | b94c29c9890c46bb6388d53bc549cc24f19f0649 (patch) | |
tree | ed38a70538414db7e8f6091d6ce5b85e50728354 /scripts/create.js | |
parent | Remove dependency on 'require' of 'electron' and 'electron/remote' modules. (diff) | |
download | ferdium-recipes-b94c29c9890c46bb6388d53bc549cc24f19f0649.tar.gz ferdium-recipes-b94c29c9890c46bb6388d53bc549cc24f19f0649.tar.zst ferdium-recipes-b94c29c9890c46bb6388d53bc549cc24f19f0649.zip |
build: migrate from npm to pnpm (#603)
Diffstat (limited to 'scripts/create.js')
-rw-r--r-- | scripts/create.js | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/scripts/create.js b/scripts/create.js index 506364a..0e785fa 100644 --- a/scripts/create.js +++ b/scripts/create.js | |||
@@ -6,13 +6,13 @@ const path = require('path'); | |||
6 | const open = require('open'); | 6 | const open = require('open'); |
7 | 7 | ||
8 | if (process.argv.length < 3) { | 8 | if (process.argv.length < 3) { |
9 | console.log(`Usage: npm run create <Recipe name> [Folder name] | 9 | console.log(`Usage: pnpm run create <Recipe name> [Folder name] |
10 | For example: | 10 | For example: |
11 | npm run create WhatsApp | 11 | pnpm run create WhatsApp |
12 | npm run create "Google Hangouts" | 12 | pnpm run create "Google Hangouts" |
13 | You can set "Folder name" to "FerdiDev" to use Ferdi's development instance instead: | 13 | You can set "Folder name" to "FerdiDev" to use Ferdi's development instance instead: |
14 | 14 | ||
15 | npm run create WhatsApp FerdiDev | 15 | pnpm run create WhatsApp FerdiDev |
16 | `); | 16 | `); |
17 | return; | 17 | return; |
18 | } | 18 | } |
@@ -25,15 +25,21 @@ const filesThatNeedTextReplace = ['package.json', 'index.js', 'webview.js', 'REA | |||
25 | 25 | ||
26 | (async () => { | 26 | (async () => { |
27 | // Folder paths | 27 | // Folder paths |
28 | const userData = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME + "/.config"); | 28 | const userData = |
29 | const recipesFolder = path.join(userData, folderName, "recipes"); | 29 | process.env.APPDATA || |
30 | const devRecipeFolder = path.join(recipesFolder, "dev"); | 30 | (process.platform == 'darwin' |
31 | ? process.env.HOME + '/Library/Application Support' | ||
32 | : process.env.HOME + '/.config'); | ||
33 | const recipesFolder = path.join(userData, folderName, 'recipes'); | ||
34 | const devRecipeFolder = path.join(recipesFolder, 'dev'); | ||
31 | const newRecipeFolder = path.join(devRecipeFolder, recipe); | 35 | const newRecipeFolder = path.join(devRecipeFolder, recipe); |
32 | const sampleRecipe = path.join(__dirname, 'sample_recipe'); | 36 | const sampleRecipe = path.join(__dirname, 'sample_recipe'); |
33 | 37 | ||
34 | // Make sure dev recipe folder exists | 38 | // Make sure dev recipe folder exists |
35 | if (!await fs.exists(recipesFolder)) { | 39 | if (!(await fs.exists(recipesFolder))) { |
36 | console.log(`Couldn't find your recipe folder (${recipesFolder}). Is Ferdi installed?`); | 40 | console.log( |
41 | `Couldn't find your recipe folder (${recipesFolder}). Is Ferdi installed?`, | ||
42 | ); | ||
37 | return; | 43 | return; |
38 | } | 44 | } |
39 | await fs.ensureDir(devRecipeFolder); | 45 | await fs.ensureDir(devRecipeFolder); |