aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/create.mjs (renamed from scripts/create.js)9
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/create.js b/scripts/create.mjs
index 872b527..096257e 100644
--- a/scripts/create.js
+++ b/scripts/create.mjs
@@ -3,9 +3,10 @@
3/** 3/**
4 * Create a new recipe for your service 4 * Create a new recipe for your service
5 */ 5 */
6const fs = require('fs-extra'); 6import fs from 'fs-extra';
7const path = require('path'); 7
8const open = require('open'); 8import path from 'path';
9import open from 'open';
9 10
10if (process.argv.length < 3) { 11if (process.argv.length < 3) {
11 console.log(`Usage: pnpm create <Recipe name> [Folder name] 12 console.log(`Usage: pnpm create <Recipe name> [Folder name]
@@ -49,7 +50,7 @@ const pascalCasedName = toPascalCase(recipe); // PascalCased recipe ID only cont
49 const recipesFolder = path.join(userData, folderName, 'recipes'); 50 const recipesFolder = path.join(userData, folderName, 'recipes');
50 const devRecipeFolder = path.join(recipesFolder, 'dev'); 51 const devRecipeFolder = path.join(recipesFolder, 'dev');
51 const newRecipeFolder = path.join(devRecipeFolder, recipe); 52 const newRecipeFolder = path.join(devRecipeFolder, recipe);
52 const sampleRecipe = path.join(__dirname, 'sample_recipe'); 53 const sampleRecipe = path.join(import.meta.dirname, 'sample_recipe'); // Starting with Node.js 20.11 / 21.2, you can use import.meta.dirname
53 54
54 // Make sure dev recipe folder exists 55 // Make sure dev recipe folder exists
55 if (!fs.existsSync(recipesFolder)) { 56 if (!fs.existsSync(recipesFolder)) {