MCPcopy
hub / github.com/QwikDev/qwik / copyStartersDir

Function copyStartersDir

scripts/create-qwik-cli.ts:132–166  ·  view source on GitHub ↗
(
  config: BuildConfig,
  distCliDir: string,
  typeDirs: ('apps' | 'features' | 'adapters')[]
)

Source from the content-addressed store, hash-verified

130}
131
132export async function copyStartersDir(
133 config: BuildConfig,
134 distCliDir: string,
135 typeDirs: ('apps' | 'features' | 'adapters')[]
136) {
137 const distStartersDir = join(distCliDir, 'starters');
138 try {
139 await mkdir(distStartersDir);
140 } catch (e) {
141 //
142 }
143
144 await Promise.all(
145 typeDirs.map(async (typeDir) => {
146 const srcDir = join(config.startersDir, typeDir);
147 const distDir = join(distStartersDir, typeDir);
148
149 await rm(distDir, { force: true, recursive: true });
150
151 await copyDir(config, srcDir, distDir);
152
153 const distStartersDirs = await readdir(distDir);
154 await Promise.all(
155 distStartersDirs
156 .filter((a) => a !== '.DS_Store')
157 .map(async (distStartersDir) => {
158 const pkgJsonPath = join(distDir, distStartersDir, 'package.json');
159 if (!existsSync(pkgJsonPath)) {
160 throw new Error(`CLI starter missing package.json: ${pkgJsonPath}`);
161 }
162 })
163 );
164 })
165 );
166}
167
168async function copyDir(config: BuildConfig, srcDir: string, destDir: string) {
169 await mkdir(destDir);

Callers 2

submoduleCliFunction · 0.90
buildCreateQwikCliFunction · 0.85

Calls 2

joinFunction · 0.85
copyDirFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…