(appDir)
| 27 | } |
| 28 | |
| 29 | async function expandAppLiquidTemplates(appDir) { |
| 30 | const samplePath = path.join(process.cwd(), appDir); |
| 31 | const samples = (await fs.readdir(samplePath, { withFileTypes: true })) |
| 32 | .filter(dirent => dirent.isDirectory()) |
| 33 | .map(dirent => path.join(samplePath, dirent.name)); |
| 34 | |
| 35 | for (const sample of samples) { |
| 36 | const configPath = path.join(sample, "shopify.app.toml"); |
| 37 | if (!existsSync(configPath)) { |
| 38 | console.error(`${configPath} does not exist`); |
| 39 | continue; |
| 40 | } |
| 41 | const appConfig = toml.parse(await fs.readFile(configPath, "utf8")); |
| 42 | |
| 43 | console.log(`Expanding liquid templates for ${appConfig.name}`); |
| 44 | |
| 45 | const liquidData = { |
| 46 | app_name: appConfig.name, |
| 47 | dependency_manager: "yarn", |
| 48 | }; |
| 49 | |
| 50 | await expandLiquidTemplates(sample, liquidData); |
| 51 | |
| 52 | console.log(); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | async function directoryNames(parentPath) { |
| 57 | return (await fs.readdir(parentPath, { withFileTypes: true })) |
no test coverage detected