@jakubmazanec/carson 0.1.0-593aae1 → 0.1.0-5f6d70c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/create-project/CreateProject.js.map +1 -1
- package/dist/commands/create-project/CreateProjectInput.js +1 -1
- package/dist/commands/create-project/CreateProjectInput.js.map +1 -1
- package/dist/commands/create-project/createProjectCommand.js +3 -4
- package/dist/commands/create-project/createProjectCommand.js.map +1 -1
- package/dist/commands/create-project/runCreateProject.js +3 -13
- package/dist/commands/create-project/runCreateProject.js.map +1 -1
- package/dist/commands/create-workspace/CreateWorkspace.d.ts +1 -2
- package/dist/commands/create-workspace/CreateWorkspace.js +6 -4
- package/dist/commands/create-workspace/CreateWorkspace.js.map +1 -1
- package/dist/commands/create-workspace/createWorkspaceCommand.js +1 -11
- package/dist/commands/create-workspace/createWorkspaceCommand.js.map +1 -1
- package/dist/commands/create-workspace/runCreateWorkspace.js +3 -12
- package/dist/commands/create-workspace/runCreateWorkspace.js.map +1 -1
- package/dist/commands/internals/CommandStatus.d.ts +1 -0
- package/dist/commands/internals/CommandStatus.js +3 -0
- package/dist/commands/internals/CommandStatus.js.map +1 -0
- package/dist/commands/internals.d.ts +1 -0
- package/dist/commands/internals.js +1 -0
- package/dist/commands/internals.js.map +1 -1
- package/dist/commands/update-workspace/UpdateWorkspace.js +1 -1
- package/dist/commands/update-workspace/UpdateWorkspace.js.map +1 -1
- package/dist/commands/update-workspace/updateWorkspaceCommand.js +3 -4
- package/dist/commands/update-workspace/updateWorkspaceCommand.js.map +1 -1
- package/dist/template/CarsonTemplate.d.ts +1 -1
- package/dist/template/CarsonTemplate.js.map +1 -1
- package/dist/template/CarsonTemplateConfig.d.ts +1 -1
- package/dist/template/CarsonTemplateConfig.js.map +1 -1
- package/dist/template/CarsonTemplateError.d.ts +8 -0
- package/dist/template/CarsonTemplateError.js +13 -0
- package/dist/template/CarsonTemplateError.js.map +1 -0
- package/dist/template/TemplateRender.d.ts +6 -2
- package/dist/template/TemplateRender.js.map +1 -1
- package/dist/template/TemplateRenders.d.ts +1 -1
- package/dist/template/TemplateRenders.js.map +1 -1
- package/dist/template/applyTemplateRenders.d.ts +3 -0
- package/dist/template/applyTemplateRenders.js +15 -3
- package/dist/template/applyTemplateRenders.js.map +1 -1
- package/dist/template/internals/TemplateRenderSnapshot.d.ts +13 -0
- package/dist/template/internals/TemplateRenderSnapshot.js +4 -1
- package/dist/template/internals/TemplateRenderSnapshot.js.map +1 -1
- package/dist/template/internals/TemplateRenderSnapshots.d.ts +13 -0
- package/dist/template/internals/insertUsingTemplateRender.js +11 -1
- package/dist/template/internals/insertUsingTemplateRender.js.map +1 -1
- package/dist/template/internals/loadTemplateRenderSnapshots.d.ts +3 -0
- package/dist/template/internals/mergeUsingTemplateRender.js +11 -1
- package/dist/template/internals/mergeUsingTemplateRender.js.map +1 -1
- package/dist/template/internals/parseCarsonTemplateId.js +6 -1
- package/dist/template/internals/parseCarsonTemplateId.js.map +1 -1
- package/dist/template/internals/readCarsonTemplate.js +7 -1
- package/dist/template/internals/readCarsonTemplate.js.map +1 -1
- package/dist/template/internals/saveTemplateRenderSnapshots.js +3 -3
- package/dist/template/internals/saveTemplateRenderSnapshots.js.map +1 -1
- package/dist/template/internals/uninsertUsingTemplateRender.js +11 -1
- package/dist/template/internals/uninsertUsingTemplateRender.js.map +1 -1
- package/dist/template/internals/unmerge.d.ts +1 -1
- package/dist/template/internals/unmerge.js +1 -1
- package/dist/template/internals/unmerge.js.map +1 -1
- package/dist/template/internals/unmergeUsingTemplateRender.js +11 -1
- package/dist/template/internals/unmergeUsingTemplateRender.js.map +1 -1
- package/dist/template/renderCarsonTemplate.d.ts +3 -0
- package/dist/template/renderCarsonTemplate.js +15 -4
- package/dist/template/renderCarsonTemplate.js.map +1 -1
- package/dist/template.d.ts +1 -0
- package/dist/template.js +1 -0
- package/dist/template.js.map +1 -1
- package/dist/workspace/Project.d.ts +2 -2
- package/dist/workspace/Project.js +19 -4
- package/dist/workspace/Project.js.map +1 -1
- package/dist/workspace/ProjectConfig.d.ts +3 -0
- package/dist/workspace/ProjectConfig.js.map +1 -1
- package/dist/workspace/ProjectCreateOptions.d.ts +3 -0
- package/dist/workspace/ProjectCreateOptions.js.map +1 -1
- package/dist/workspace/ProjectError.d.ts +5 -2
- package/dist/workspace/ProjectError.js +6 -2
- package/dist/workspace/ProjectError.js.map +1 -1
- package/dist/workspace/ProjectOptions.d.ts +1 -1
- package/dist/workspace/ProjectOptions.js.map +1 -1
- package/dist/workspace/ProjectUpdateOptions.d.ts +3 -0
- package/dist/workspace/ProjectUpdateOptions.js +3 -1
- package/dist/workspace/ProjectUpdateOptions.js.map +1 -1
- package/dist/workspace/Workspace.d.ts +8 -6
- package/dist/workspace/Workspace.js +98 -33
- package/dist/workspace/Workspace.js.map +1 -1
- package/dist/workspace/WorkspaceConfig.d.ts +3 -0
- package/dist/workspace/WorkspaceConfig.js.map +1 -1
- package/dist/workspace/WorkspaceCreateOptions.d.ts +3 -0
- package/dist/workspace/WorkspaceCreateOptions.js +3 -1
- package/dist/workspace/WorkspaceCreateOptions.js.map +1 -1
- package/dist/workspace/WorkspaceCreateProjectOptions.d.ts +3 -0
- package/dist/workspace/WorkspaceCreateProjectOptions.js +3 -1
- package/dist/workspace/WorkspaceCreateProjectOptions.js.map +1 -1
- package/dist/workspace/WorkspaceDependencies.d.ts +26 -19
- package/dist/workspace/WorkspaceDependencies.js +27 -9
- package/dist/workspace/WorkspaceDependencies.js.map +1 -1
- package/dist/workspace/WorkspaceDependenciesFromWorkspaceOptions.d.ts +8 -0
- package/dist/workspace/WorkspaceDependenciesFromWorkspaceOptions.js +5 -0
- package/dist/workspace/WorkspaceDependenciesFromWorkspaceOptions.js.map +1 -0
- package/dist/workspace/WorkspaceDependenciesGetVersionsOptions.d.ts +6 -0
- package/dist/workspace/WorkspaceDependenciesGetVersionsOptions.js +5 -0
- package/dist/workspace/WorkspaceDependenciesGetVersionsOptions.js.map +1 -0
- package/dist/workspace/WorkspaceDependency.d.ts +14 -0
- package/dist/workspace/WorkspaceDependency.js +3 -0
- package/dist/workspace/WorkspaceDependency.js.map +1 -0
- package/dist/workspace/WorkspaceDependencyProject.d.ts +11 -0
- package/dist/workspace/WorkspaceDependencyProject.js +5 -0
- package/dist/workspace/WorkspaceDependencyProject.js.map +1 -0
- package/dist/workspace/WorkspaceError.d.ts +5 -2
- package/dist/workspace/WorkspaceError.js +10 -3
- package/dist/workspace/WorkspaceError.js.map +1 -1
- package/dist/workspace/WorkspaceFindAndReadOptions.d.ts +6 -0
- package/dist/workspace/WorkspaceFindAndReadOptions.js +5 -0
- package/dist/workspace/WorkspaceFindAndReadOptions.js.map +1 -0
- package/dist/workspace/WorkspaceOptions.d.ts +4 -4
- package/dist/workspace/WorkspaceOptions.js.map +1 -1
- package/dist/workspace/{WorkspaceOptionsProjectOptions.d.ts → WorkspaceOptionsProject.d.ts} +4 -1
- package/dist/workspace/WorkspaceOptionsProject.js +3 -0
- package/dist/workspace/WorkspaceOptionsProject.js.map +1 -0
- package/dist/workspace/WorkspacePackageJson.d.ts +3 -0
- package/dist/workspace/WorkspacePackageJson.js.map +1 -1
- package/dist/workspace/WorkspaceProjectGlobs.d.ts +3 -0
- package/dist/workspace/WorkspaceProjectGlobs.js +3 -1
- package/dist/workspace/WorkspaceProjectGlobs.js.map +1 -1
- package/dist/workspace/WorkspaceProjects.d.ts +3 -0
- package/dist/workspace/WorkspaceProjects.js.map +1 -1
- package/dist/workspace/WorkspaceRepository.d.ts +3 -0
- package/dist/workspace/WorkspaceRepository.js +3 -1
- package/dist/workspace/WorkspaceRepository.js.map +1 -1
- package/dist/workspace/WorkspaceUpdateOptions.d.ts +3 -0
- package/dist/workspace/WorkspaceUpdateOptions.js +3 -1
- package/dist/workspace/WorkspaceUpdateOptions.js.map +1 -1
- package/dist/workspace/internals/compareProjectPath.d.ts +2 -0
- package/dist/workspace/internals/compareProjectPath.js +10 -0
- package/dist/workspace/internals/compareProjectPath.js.map +1 -0
- package/dist/workspace/internals/compareWorkspaceDependencyProjectName.d.ts +2 -0
- package/dist/workspace/internals/compareWorkspaceDependencyProjectName.js +10 -0
- package/dist/workspace/internals/compareWorkspaceDependencyProjectName.js.map +1 -0
- package/dist/workspace/internals/getRepositoryUrl.js +0 -1
- package/dist/workspace/internals/getRepositoryUrl.js.map +1 -1
- package/dist/workspace/internals.d.ts +2 -0
- package/dist/workspace/internals.js +2 -0
- package/dist/workspace/internals.js.map +1 -1
- package/dist/workspace/saveProjectConfig.d.ts +8 -0
- package/dist/workspace/saveProjectConfig.js +5 -1
- package/dist/workspace/saveProjectConfig.js.map +1 -1
- package/dist/workspace/saveWorkspaceConfig.d.ts +8 -0
- package/dist/workspace/saveWorkspaceConfig.js +5 -1
- package/dist/workspace/saveWorkspaceConfig.js.map +1 -1
- package/dist/workspace.d.ts +12 -0
- package/dist/workspace.js +12 -0
- package/dist/workspace.js.map +1 -1
- package/package.json +8 -8
- package/src/commands/create-project/CreateProject.tsx +2 -2
- package/src/commands/create-project/CreateProjectInput.ts +1 -1
- package/src/commands/create-project/createProjectCommand.tsx +1 -5
- package/src/commands/create-project/runCreateProject.ts +4 -17
- package/src/commands/create-workspace/CreateWorkspace.tsx +7 -5
- package/src/commands/create-workspace/createWorkspaceCommand.tsx +1 -14
- package/src/commands/create-workspace/runCreateWorkspace.ts +4 -16
- package/src/commands/internals/CommandStatus.ts +1 -0
- package/src/commands/internals.ts +1 -0
- package/src/commands/update-workspace/UpdateWorkspace.tsx +1 -1
- package/src/commands/update-workspace/updateWorkspaceCommand.tsx +1 -5
- package/src/template/CarsonTemplate.ts +1 -2
- package/src/template/CarsonTemplateConfig.ts +1 -1
- package/src/template/CarsonTemplateError.ts +19 -0
- package/src/template/TemplateRender.ts +6 -2
- package/src/template/TemplateRenders.ts +1 -1
- package/src/template/applyTemplateRenders.ts +11 -2
- package/src/template/internals/TemplateRenderSnapshot.ts +5 -0
- package/src/template/internals/insertUsingTemplateRender.ts +11 -1
- package/src/template/internals/mergeUsingTemplateRender.ts +11 -1
- package/src/template/internals/parseCarsonTemplateId.ts +5 -1
- package/src/template/internals/readCarsonTemplate.ts +4 -1
- package/src/template/internals/saveTemplateRenderSnapshots.ts +2 -2
- package/src/template/internals/uninsertUsingTemplateRender.ts +11 -1
- package/src/template/internals/unmerge.ts +1 -1
- package/src/template/internals/unmergeUsingTemplateRender.ts +11 -1
- package/src/template/renderCarsonTemplate.ts +28 -7
- package/src/template.ts +1 -0
- package/src/workspace/Project.ts +16 -4
- package/src/workspace/ProjectConfig.ts +3 -0
- package/src/workspace/ProjectCreateOptions.ts +3 -0
- package/src/workspace/ProjectError.ts +5 -0
- package/src/workspace/ProjectOptions.ts +1 -1
- package/src/workspace/ProjectUpdateOptions.ts +3 -0
- package/src/workspace/Workspace.ts +117 -42
- package/src/workspace/WorkspaceConfig.ts +3 -0
- package/src/workspace/WorkspaceCreateOptions.ts +3 -0
- package/src/workspace/WorkspaceCreateProjectOptions.ts +3 -0
- package/src/workspace/WorkspaceDependencies.ts +30 -27
- package/src/workspace/WorkspaceDependenciesFromWorkspaceOptions.ts +8 -0
- package/src/workspace/WorkspaceDependenciesGetVersionsOptions.ts +6 -0
- package/src/workspace/WorkspaceDependency.ts +18 -0
- package/src/workspace/WorkspaceDependencyProject.ts +13 -0
- package/src/workspace/WorkspaceError.ts +10 -1
- package/src/workspace/WorkspaceFindAndReadOptions.ts +6 -0
- package/src/workspace/WorkspaceOptions.ts +4 -4
- package/src/workspace/{WorkspaceOptionsProjectOptions.ts → WorkspaceOptionsProject.ts} +4 -1
- package/src/workspace/WorkspacePackageJson.ts +3 -0
- package/src/workspace/WorkspaceProjectGlobs.ts +3 -0
- package/src/workspace/WorkspaceProjects.ts +3 -0
- package/src/workspace/WorkspaceRepository.ts +3 -0
- package/src/workspace/WorkspaceUpdateOptions.ts +3 -0
- package/src/workspace/internals/compareProjectPath.ts +14 -0
- package/src/workspace/internals/compareWorkspaceDependencyProjectName.ts +14 -0
- package/src/workspace/internals/getRepositoryUrl.ts +0 -1
- package/src/workspace/internals.ts +2 -0
- package/src/workspace/saveProjectConfig.ts +8 -0
- package/src/workspace/saveWorkspaceConfig.ts +8 -0
- package/src/workspace.ts +12 -0
- package/dist/workspace/WorkspaceOptionsProjectOptions.js +0 -3
- package/dist/workspace/WorkspaceOptionsProjectOptions.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/create-project/CreateProject.tsx"],"sourcesContent":["import {Header, icons, colors, type CommandArguments, useProgram} from '@jakubmazanec/cli';\nimport chalk from 'chalk';\nimport {Box, Text} from 'ink';\nimport path from 'node:path';\nimport {useEffect, useState} from 'react';\n\nimport {type createProjectCommand} from './createProjectCommand.js';\nimport {CreateProjectInput, type CreateProjectInputResult} from './CreateProjectInput.js';\nimport {runCreateProject} from './runCreateProject.js';\nimport {type Workspace} from '../../workspace.js';\nimport {packageNameToDirectory} from '../internals.js';\n\nconst ONLY_ONE_STAR_REGEXP = /^(?!(.*?\\*){2,}|.*? |\\*$).*?\\*.*$/;\n\nexport type CreateProjectProps = {\n args: CommandArguments<typeof createProjectCommand>;\n workspace: Workspace | Workspace<false>;\n};\n\nexport function CreateProject({args, workspace}: CreateProjectProps) {\n let [status, setStatus] = useState<
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/create-project/CreateProject.tsx"],"sourcesContent":["import {Header, icons, colors, type CommandArguments, useProgram} from '@jakubmazanec/cli';\nimport chalk from 'chalk';\nimport {Box, Text} from 'ink';\nimport path from 'node:path';\nimport {useEffect, useState} from 'react';\n\nimport {type createProjectCommand} from './createProjectCommand.js';\nimport {CreateProjectInput, type CreateProjectInputResult} from './CreateProjectInput.js';\nimport {runCreateProject} from './runCreateProject.js';\nimport {type Workspace} from '../../workspace.js';\nimport {packageNameToDirectory, type CommandStatus} from '../internals.js';\n\nconst ONLY_ONE_STAR_REGEXP = /^(?!(.*?\\*){2,}|.*? |\\*$).*?\\*.*$/;\n\nexport type CreateProjectProps = {\n args: CommandArguments<typeof createProjectCommand>;\n workspace: Workspace | Workspace<false>;\n};\n\nexport function CreateProject({args, workspace}: CreateProjectProps) {\n let [status, setStatus] = useState<CommandStatus>('not-started');\n let [subscription, setSubscription] = useState<ZenObservable.Subscription | null>(null);\n let [jobs, setJobs] = useState<string[]>([]);\n let [createProjectInputResult, setCreateProjectInputResult] = useState<CreateProjectInputResult>(\n () => ({\n projectName: {value: args.options.name ?? '', isComplete: !!args.options.name},\n projectPath: {value: '', isComplete: false},\n templateId: {value: args.options.template ?? '', isComplete: !!args.options.template},\n }),\n );\n let {exit} = useProgram();\n\n useEffect(() => {\n if (Object.entries(createProjectInputResult).every(([, result]) => result.isComplete)) {\n setStatus('in-progress');\n }\n }, [createProjectInputResult]);\n\n useEffect(() => {\n if (status === 'in-progress' && !subscription) {\n let newSubscription = runCreateProject({\n projectPath: createProjectInputResult.projectPath.value,\n templateId: createProjectInputResult.templateId.value,\n projectName: createProjectInputResult.projectName.value,\n workspace,\n args,\n }).subscribe({\n next(value) {\n setJobs((previousJobs) => [...previousJobs, value]);\n },\n error(error) {\n exit(error);\n },\n complete() {\n newSubscription.unsubscribe();\n setStatus('finished');\n },\n });\n setSubscription(newSubscription);\n }\n\n return () => {\n if (subscription) {\n subscription.unsubscribe();\n }\n };\n }, [args, createProjectInputResult, exit, status, subscription, workspace]);\n\n let possiblePaths: Array<{value: string; label: string}> = [];\n\n if (createProjectInputResult.projectName.value) {\n let destinationDirectory = packageNameToDirectory(createProjectInputResult.projectName.value);\n\n if (workspace.projectGlobs) {\n possiblePaths = workspace.projectGlobs\n .filter((projectGlob) => ONLY_ONE_STAR_REGEXP.test(projectGlob))\n .map((projectGlob) => projectGlob.replace(/\\*/, destinationDirectory))\n .map((projectGlob) => path.join(workspace.path, projectGlob))\n .map((projectPath) => ({\n value: projectPath,\n label: path.relative(workspace.path, projectPath).replace('\\\\', '/'),\n }));\n } else {\n possiblePaths = [\n {\n value: workspace.path,\n label: workspace.path,\n },\n ];\n }\n }\n\n return (\n <Box flexDirection=\"column\">\n <Text color={colors.body}>\n {`Creating project in the workspace at ${chalk[colors.info](workspace.path)}.`}\n </Text>\n\n <CreateProjectInput\n rows={{\n projectPath: {\n choices: possiblePaths,\n },\n }}\n values={createProjectInputResult}\n marginTop={1}\n onChange={setCreateProjectInputResult}\n onComplete={setCreateProjectInputResult}\n />\n\n {status === 'in-progress' || status === 'finished' ? (\n <Box marginTop={1} flexDirection=\"column\">\n <Header showSpinner={status === 'in-progress'} icon={icons.success} marginBottom={1}>\n <Text>Creating project...</Text>\n </Header>\n\n {jobs.map((job) => (\n <Text key={job}>{`${icons.info} ${job}`}</Text>\n ))}\n </Box>\n ) : null}\n\n {status === 'finished' ? (\n <Header marginTop={1} icon={icons.success}>\n <Text>Done.</Text>\n </Header>\n ) : null}\n </Box>\n );\n}\n"],"names":["Header","icons","colors","useProgram","chalk","Box","Text","path","useEffect","useState","CreateProjectInput","runCreateProject","packageNameToDirectory","ONLY_ONE_STAR_REGEXP","CreateProject","args","workspace","status","setStatus","subscription","setSubscription","jobs","setJobs","createProjectInputResult","setCreateProjectInputResult","projectName","value","options","name","isComplete","projectPath","templateId","template","exit","Object","entries","every","result","newSubscription","subscribe","next","previousJobs","error","complete","unsubscribe","possiblePaths","destinationDirectory","projectGlobs","filter","projectGlob","test","map","replace","join","label","relative","flexDirection","color","body","info","rows","choices","values","marginTop","onChange","onComplete","showSpinner","icon","success","marginBottom","job"],"mappings":";AAAA,SAAQA,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAyBC,UAAU,QAAO,oBAAoB;AAC3F,OAAOC,WAAW,QAAQ;AAC1B,SAAQC,GAAG,EAAEC,IAAI,QAAO,MAAM;AAC9B,OAAOC,UAAU,YAAY;AAC7B,SAAQC,SAAS,EAAEC,QAAQ,QAAO,QAAQ;AAG1C,SAAQC,kBAAkB,QAAsC,0BAA0B;AAC1F,SAAQC,gBAAgB,QAAO,wBAAwB;AAEvD,SA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D,WAAW;gBAAGP,eAAc;;kCAC/B,KAACxD;wBAAOkE,aAAajD,WAAW;wBAAekD,MAAMlE,MAAMmE,OAAO;wBAAEC,cAAc;kCAChF,cAAA,KAAC/D;sCAAK;;;oBAGPe,KAAK8B,GAAG,CAAC,CAACmB,oBACT,KAAChE;sCAAgB,CAAC,EAAEL,MAAM0D,IAAI,CAAC,CAAC,EAAEW,IAAI,CAAC;2BAA5BA;;iBAGb;YAEHrD,WAAW,2BACV,KAACjB;gBAAO+D,WAAW;gBAAGI,MAAMlE,MAAMmE,OAAO;0BACvC,cAAA,KAAC9D;8BAAK;;iBAEN;;;AAGV"}
|
|
@@ -17,7 +17,7 @@ export const CreateProjectInput = createForm({
|
|
|
17
17
|
label: 'What is the project name?',
|
|
18
18
|
validate: (value)=>{
|
|
19
19
|
if (!PROJECT_NAME_ID_REGEXP.test(value)) {
|
|
20
|
-
throw new Error('Project name can
|
|
20
|
+
throw new Error('Project name can contain only lowercase letters, numbers, hyphen, @, dot or /.');
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/create-project/CreateProjectInput.ts"],"sourcesContent":["import {type FormResult, createForm} from '@jakubmazanec/cli';\n\nconst TEMPLATE_ID_REGEXP = /^.+:.+$/;\nconst PROJECT_NAME_ID_REGEXP = /^[\\d./@a-z-]+$/;\n\nexport const CreateProjectInput = createForm({\n rows: {\n templateId: {\n type: 'text',\n label: 'What template do you want to use?',\n validate: (value: string) => {\n if (!TEMPLATE_ID_REGEXP.test(value)) {\n throw new Error(\n 'Template ID must consist of a module ID and a template name separated by a colon.',\n );\n }\n },\n },\n projectName: {\n type: 'text',\n label: 'What is the project name?',\n validate: (value: string) => {\n if (!PROJECT_NAME_ID_REGEXP.test(value)) {\n throw new Error(\n 'Project name can
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/create-project/CreateProjectInput.ts"],"sourcesContent":["import {type FormResult, createForm} from '@jakubmazanec/cli';\n\nconst TEMPLATE_ID_REGEXP = /^.+:.+$/;\nconst PROJECT_NAME_ID_REGEXP = /^[\\d./@a-z-]+$/;\n\nexport const CreateProjectInput = createForm({\n rows: {\n templateId: {\n type: 'text',\n label: 'What template do you want to use?',\n validate: (value: string) => {\n if (!TEMPLATE_ID_REGEXP.test(value)) {\n throw new Error(\n 'Template ID must consist of a module ID and a template name separated by a colon.',\n );\n }\n },\n },\n projectName: {\n type: 'text',\n label: 'What is the project name?',\n validate: (value: string) => {\n if (!PROJECT_NAME_ID_REGEXP.test(value)) {\n throw new Error(\n 'Project name can contain only lowercase letters, numbers, hyphen, @, dot or /.',\n );\n }\n },\n },\n projectPath: {\n type: 'select',\n label: 'What is the project location?',\n },\n },\n});\n\nexport type CreateProjectInputResult = FormResult<typeof CreateProjectInput>;\n"],"names":["createForm","TEMPLATE_ID_REGEXP","PROJECT_NAME_ID_REGEXP","CreateProjectInput","rows","templateId","type","label","validate","value","test","Error","projectName","projectPath"],"mappings":"AAAA,SAAyBA,UAAU,QAAO,oBAAoB;AAE9D,MAAMC,qBAAqB;AAC3B,MAAMC,yBAAyB;AAE/B,OAAO,MAAMC,qBAAqBH,WAAW;IAC3CI,MAAM;QACJC,YAAY;YACVC,MAAM;YACNC,OAAO;YACPC,UAAU,CAACC;gBACT,IAAI,CAACR,mBAAmBS,IAAI,CAACD,QAAQ;oBACnC,MAAM,IAAIE,MACR;gBAEJ;YACF;QACF;QACAC,aAAa;YACXN,MAAM;YACNC,OAAO;YACPC,UAAU,CAACC;gBACT,IAAI,CAACP,uBAAuBQ,IAAI,CAACD,QAAQ;oBACvC,MAAM,IAAIE,MACR;gBAEJ;YACF;QACF;QACAE,aAAa;YACXP,MAAM;YACNC,OAAO;QACT;IACF;AACF,GAAG"}
|
|
@@ -5,10 +5,9 @@ import { CreateProject } from './CreateProject.js';
|
|
|
5
5
|
import { Workspace } from '../../workspace.js';
|
|
6
6
|
export const createProjectCommand = new Command('create project', async (args, program)=>{
|
|
7
7
|
let targetPath = path.resolve(process.cwd(), args.options.path ?? '');
|
|
8
|
-
let workspace = await Workspace.findAndRead(targetPath
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
8
|
+
let workspace = await Workspace.findAndRead(targetPath, {
|
|
9
|
+
throwIfNotFound: true
|
|
10
|
+
});
|
|
12
11
|
await program.renderElement(/*#__PURE__*/ _jsx(CreateProject, {
|
|
13
12
|
args: args,
|
|
14
13
|
workspace: workspace
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/create-project/createProjectCommand.tsx"],"sourcesContent":["import {Command} from '@jakubmazanec/cli';\nimport path from 'node:path';\n\nimport {CreateProject} from './CreateProject.js';\nimport {Workspace} from '../../workspace.js';\n\nexport const createProjectCommand = new Command(\n 'create project',\n async (args, program) => {\n let targetPath = path.resolve(process.cwd(), args.options.path ?? '');\n let workspace = await Workspace.findAndRead(targetPath
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/create-project/createProjectCommand.tsx"],"sourcesContent":["import {Command} from '@jakubmazanec/cli';\nimport path from 'node:path';\n\nimport {CreateProject} from './CreateProject.js';\nimport {Workspace} from '../../workspace.js';\n\nexport const createProjectCommand = new Command(\n 'create project',\n async (args, program) => {\n let targetPath = path.resolve(process.cwd(), args.options.path ?? '');\n let workspace = await Workspace.findAndRead(targetPath, {throwIfNotFound: true});\n\n await program.renderElement(<CreateProject args={args} workspace={workspace} />);\n },\n {\n description: 'Creates a new project in an existing workspace.',\n options: {\n path: {\n type: 'string',\n },\n template: {\n type: 'string',\n },\n name: {\n type: 'string',\n },\n },\n },\n);\n"],"names":["Command","path","CreateProject","Workspace","createProjectCommand","args","program","targetPath","resolve","process","cwd","options","workspace","findAndRead","throwIfNotFound","renderElement","description","type","template","name"],"mappings":";AAAA,SAAQA,OAAO,QAAO,oBAAoB;AAC1C,OAAOC,UAAU,YAAY;AAE7B,SAAQC,aAAa,QAAO,qBAAqB;AACjD,SAAQC,SAAS,QAAO,qBAAqB;AAE7C,OAAO,MAAMC,uBAAuB,IAAIJ,QACtC,kBACA,OAAOK,MAAMC;IACX,IAAIC,aAAaN,KAAKO,OAAO,CAACC,QAAQC,GAAG,IAAIL,KAAKM,OAAO,CAACV,IAAI,IAAI;IAClE,IAAIW,YAAY,MAAMT,UAAUU,WAAW,CAACN,YAAY;QAACO,iBAAiB;IAAI;IAE9E,MAAMR,QAAQS,aAAa,eAAC,KAACb;QAAcG,MAAMA;QAAMO,WAAWA;;AACpE,GACA;IACEI,aAAa;IACbL,SAAS;QACPV,MAAM;YACJgB,MAAM;QACR;QACAC,UAAU;YACRD,MAAM;QACR;QACAE,MAAM;YACJF,MAAM;QACR;IACF;AACF,GACA"}
|
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
import { isEmptyDirectory } from '@jakubmazanec/fs-utils';
|
|
2
|
-
import fs from 'fs-extra';
|
|
3
|
-
import path from 'node:path';
|
|
4
1
|
import Observable from 'zen-observable';
|
|
5
2
|
export function runCreateProject({ projectPath, templateId, projectName, workspace, args }) {
|
|
6
3
|
return new Observable((observer)=>{
|
|
7
4
|
(async ()=>{
|
|
8
|
-
observer.next('
|
|
9
|
-
let resolvedProjectPath = path.resolve(projectPath);
|
|
10
|
-
// check if path is ok
|
|
11
|
-
await fs.ensureDir(resolvedProjectPath);
|
|
12
|
-
let isProjectPathEmpty = await isEmptyDirectory(resolvedProjectPath);
|
|
13
|
-
if (!isProjectPathEmpty) {
|
|
14
|
-
throw new Error(`Directory "${resolvedProjectPath}" must be empty`);
|
|
15
|
-
}
|
|
16
|
-
// create new project
|
|
5
|
+
observer.next('Creating files');
|
|
17
6
|
let project = await workspace.createProject({
|
|
18
|
-
projectPath
|
|
7
|
+
projectPath,
|
|
19
8
|
projectName,
|
|
20
9
|
templateId,
|
|
21
10
|
args
|
|
22
11
|
});
|
|
12
|
+
observer.next('Updating the new project');
|
|
23
13
|
await project.update({
|
|
24
14
|
args
|
|
25
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/create-project/runCreateProject.ts"],"sourcesContent":["import {type CommandArguments} from '@jakubmazanec/cli';\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/create-project/runCreateProject.ts"],"sourcesContent":["import {type CommandArguments} from '@jakubmazanec/cli';\nimport Observable from 'zen-observable';\n\nimport {type createProjectCommand} from './createProjectCommand.js';\nimport {type Workspace} from '../../workspace.js';\n\nexport type CreateProjectOptions = {\n projectPath: string;\n projectName: string;\n templateId: string;\n workspace: Workspace | Workspace<false>;\n args: CommandArguments<typeof createProjectCommand>;\n};\n\nexport type CreateProjectStatus = string;\n\nexport function runCreateProject({\n projectPath,\n templateId,\n projectName,\n workspace,\n args,\n}: CreateProjectOptions) {\n return new Observable<CreateProjectStatus>((observer) => {\n (async () => {\n observer.next('Creating files');\n\n let project = await workspace.createProject({\n projectPath,\n projectName,\n templateId,\n args,\n });\n\n observer.next('Updating the new project');\n\n await project.update({args});\n })()\n .then(() => {\n observer.complete();\n })\n .catch((error) => {\n observer.error(error);\n });\n });\n}\n"],"names":["Observable","runCreateProject","projectPath","templateId","projectName","workspace","args","observer","next","project","createProject","update","then","complete","catch","error"],"mappings":"AACA,OAAOA,gBAAgB,iBAAiB;AAexC,OAAO,SAASC,iBAAiB,EAC/BC,WAAW,EACXC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,IAAI,EACiB;IACrB,OAAO,IAAIN,WAAgC,CAACO;QACzC,CAAA;YACCA,SAASC,IAAI,CAAC;YAEd,IAAIC,UAAU,MAAMJ,UAAUK,aAAa,CAAC;gBAC1CR;gBACAE;gBACAD;gBACAG;YACF;YAEAC,SAASC,IAAI,CAAC;YAEd,MAAMC,QAAQE,MAAM,CAAC;gBAACL;YAAI;QAC5B,CAAA,IACGM,IAAI,CAAC;YACJL,SAASM,QAAQ;QACnB,GACCC,KAAK,CAAC,CAACC;YACNR,SAASQ,KAAK,CAACA;QACjB;IACJ;AACF"}
|
|
@@ -2,6 +2,5 @@ import { type CommandArguments } from '@jakubmazanec/cli';
|
|
|
2
2
|
import { type createWorkspaceCommand } from './createWorkspaceCommand.js';
|
|
3
3
|
export type CreateWorkspaceProps = {
|
|
4
4
|
args: CommandArguments<typeof createWorkspaceCommand>;
|
|
5
|
-
path: string;
|
|
6
5
|
};
|
|
7
|
-
export declare function CreateWorkspace({ args
|
|
6
|
+
export declare function CreateWorkspace({ args }: CreateWorkspaceProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,10 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Header, icons, colors, useProgram } from '@jakubmazanec/cli';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { Box, Text } from 'ink';
|
|
5
|
+
import path from 'node:path';
|
|
5
6
|
import { useEffect, useState } from 'react';
|
|
6
7
|
import { CreateWorkspaceInput } from './CreateWorkspaceInput.js';
|
|
7
8
|
import { runCreateWorkspace } from './runCreateWorkspace.js';
|
|
8
|
-
export function CreateWorkspace({ args
|
|
9
|
+
export function CreateWorkspace({ args }) {
|
|
9
10
|
let [status, setStatus] = useState('not-started');
|
|
10
11
|
let [subscription, setSubscription] = useState(null);
|
|
11
12
|
let [jobs, setJobs] = useState([]);
|
|
@@ -16,6 +17,7 @@ export function CreateWorkspace({ args, path }) {
|
|
|
16
17
|
}
|
|
17
18
|
}));
|
|
18
19
|
let { exit } = useProgram();
|
|
20
|
+
let workspacePath = path.resolve(process.cwd(), args.options.path ?? '');
|
|
19
21
|
useEffect(()=>{
|
|
20
22
|
if (Object.entries(createWorkspaceInputResult).every(([, result])=>result.isComplete)) {
|
|
21
23
|
setStatus('in-progress');
|
|
@@ -26,7 +28,7 @@ export function CreateWorkspace({ args, path }) {
|
|
|
26
28
|
useEffect(()=>{
|
|
27
29
|
if (status === 'in-progress' && !subscription) {
|
|
28
30
|
let newSubscription = runCreateWorkspace({
|
|
29
|
-
workspacePath
|
|
31
|
+
workspacePath,
|
|
30
32
|
templateId: createWorkspaceInputResult.templateId.value,
|
|
31
33
|
args
|
|
32
34
|
}).subscribe({
|
|
@@ -53,11 +55,11 @@ export function CreateWorkspace({ args, path }) {
|
|
|
53
55
|
};
|
|
54
56
|
}, [
|
|
55
57
|
createWorkspaceInputResult,
|
|
56
|
-
path,
|
|
57
58
|
status,
|
|
58
59
|
subscription,
|
|
59
60
|
args,
|
|
60
|
-
exit
|
|
61
|
+
exit,
|
|
62
|
+
workspacePath
|
|
61
63
|
]);
|
|
62
64
|
return /*#__PURE__*/ _jsxs(Box, {
|
|
63
65
|
flexDirection: "column",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/create-workspace/CreateWorkspace.tsx"],"sourcesContent":["import {Header, icons, colors, type CommandArguments, useProgram} from '@jakubmazanec/cli';\nimport chalk from 'chalk';\nimport {Box, Text} from 'ink';\nimport {useEffect, useState} from 'react';\n\nimport {type createWorkspaceCommand} from './createWorkspaceCommand.js';\nimport {CreateWorkspaceInput, type CreateWorkspaceInputResult} from './CreateWorkspaceInput.js';\nimport {runCreateWorkspace} from './runCreateWorkspace.js';\n\nexport type CreateWorkspaceProps = {\n args: CommandArguments<typeof createWorkspaceCommand>;\n
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/create-workspace/CreateWorkspace.tsx"],"sourcesContent":["import {Header, icons, colors, type CommandArguments, useProgram} from '@jakubmazanec/cli';\nimport chalk from 'chalk';\nimport {Box, Text} from 'ink';\nimport path from 'node:path';\nimport {useEffect, useState} from 'react';\n\nimport {type createWorkspaceCommand} from './createWorkspaceCommand.js';\nimport {CreateWorkspaceInput, type CreateWorkspaceInputResult} from './CreateWorkspaceInput.js';\nimport {runCreateWorkspace} from './runCreateWorkspace.js';\nimport {type CommandStatus} from '../internals.js';\n\nexport type CreateWorkspaceProps = {\n args: CommandArguments<typeof createWorkspaceCommand>;\n};\n\nexport function CreateWorkspace({args}: CreateWorkspaceProps) {\n let [status, setStatus] = useState<CommandStatus>('not-started');\n let [subscription, setSubscription] = useState<ZenObservable.Subscription | null>(null);\n let [jobs, setJobs] = useState<string[]>([]);\n let [createWorkspaceInputResult, setCreateWorkspaceInputResult] =\n useState<CreateWorkspaceInputResult>(() => ({\n templateId: {value: args.options.template ?? '', isComplete: !!args.options.template},\n }));\n let {exit} = useProgram();\n let workspacePath = path.resolve(process.cwd(), args.options.path ?? '');\n\n useEffect(() => {\n if (Object.entries(createWorkspaceInputResult).every(([, result]) => result.isComplete)) {\n setStatus('in-progress');\n }\n }, [createWorkspaceInputResult]);\n\n useEffect(() => {\n if (status === 'in-progress' && !subscription) {\n let newSubscription = runCreateWorkspace({\n workspacePath,\n templateId: createWorkspaceInputResult.templateId.value,\n args,\n }).subscribe({\n next(value) {\n setJobs((previousJobs) => [...previousJobs, value]);\n },\n error(error) {\n exit(error);\n },\n complete() {\n newSubscription.unsubscribe();\n setStatus('finished');\n },\n });\n\n setSubscription(newSubscription);\n }\n\n return () => {\n if (subscription) {\n subscription.unsubscribe();\n }\n };\n }, [createWorkspaceInputResult, status, subscription, args, exit, workspacePath]);\n\n return (\n <Box flexDirection=\"column\">\n <Text>{`Creating workspace at ${chalk[colors.highlighted](path)}.`}</Text>\n\n <CreateWorkspaceInput\n values={createWorkspaceInputResult}\n marginTop={1}\n onChange={setCreateWorkspaceInputResult}\n onComplete={setCreateWorkspaceInputResult}\n />\n\n {status === 'in-progress' || status === 'finished' ? (\n <Box marginTop={1} flexDirection=\"column\">\n <Header showSpinner={status === 'in-progress'} icon={icons.success} marginBottom={1}>\n <Text>Creating workspace...</Text>\n </Header>\n\n {jobs.map((job) => (\n <Text key={job}>{`${icons.info} ${job}`}</Text>\n ))}\n </Box>\n ) : null}\n\n {status === 'finished' ? (\n <Header marginTop={1} icon={icons.success}>\n <Text>Done.</Text>\n </Header>\n ) : null}\n </Box>\n );\n}\n"],"names":["Header","icons","colors","useProgram","chalk","Box","Text","path","useEffect","useState","CreateWorkspaceInput","runCreateWorkspace","CreateWorkspace","args","status","setStatus","subscription","setSubscription","jobs","setJobs","createWorkspaceInputResult","setCreateWorkspaceInputResult","templateId","value","options","template","isComplete","exit","workspacePath","resolve","process","cwd","Object","entries","every","result","newSubscription","subscribe","next","previousJobs","error","complete","unsubscribe","flexDirection","highlighted","values","marginTop","onChange","onComplete","showSpinner","icon","success","marginBottom","map","job","info"],"mappings":";AAAA,SAAQA,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAyBC,UAAU,QAAO,oBAAoB;AAC3F,OAAOC,WAAW,QAAQ;AAC1B,SAAQC,GAAG,EAAEC,IAAI,QAAO,MAAM;AAC9B,OAAOC,UAAU,YAAY;AAC7B,SAAQC,SAAS,EAAEC,QAAQ,QAAO,QAAQ;AAG1C,SAAQC,oBAAoB,QAAwC,4BAA4B;AAChG,SAAQC,kBAAkB,QAAO,0BAA0B;AAO3D,OAAO,SAASC,gBAAgB,EAACC,IAAI,EAAuB;IAC1D,IAAI,CAACC,QAAQC,UAAU,GAAGN,SAAwB;IAClD,IAAI,CAACO,cAAcC,gBAAgB,GAAGR,SAA4C;IAClF,IAAI,CAACS,MAAMC,QAAQ,GAAGV,SAAmB,EAAE;IAC3C,IAAI,CAACW,4BAA4BC,8BAA8B,GAC7DZ,SAAqC,IAAO,CAAA;YAC1Ca,YAAY;gBAACC,OAAOV,KAAKW,OAAO,CAACC,QAAQ,IAAI;gBAAIC,YAAY,CAAC,CAACb,KAAKW,OAAO,CAACC,QAAQ;YAAA;QACtF,CAAA;IACF,IAAI,EAACE,IAAI,EAAC,GAAGxB;IACb,IAAIyB,gBAAgBrB,KAAKsB,OAAO,CAACC,QAAQC,GAAG,IAAIlB,KAAKW,OAAO,CAACjB,IAAI,IAAI;IAErEC,UAAU;QACR,IAAIwB,OAAOC,OAAO,CAACb,4BAA4Bc,KAAK,CAAC,CAAC,GAAGC,OAAO,GAAKA,OAAOT,UAAU,GAAG;YACvFX,UAAU;QACZ;IACF,GAAG;QAACK;KAA2B;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runtime";
|
|
2
2
|
import { Command } from '@jakubmazanec/cli';
|
|
3
|
-
import { isEmptyDirectory } from '@jakubmazanec/fs-utils';
|
|
4
|
-
import fs from 'fs-extra';
|
|
5
|
-
import path from 'node:path';
|
|
6
3
|
import { CreateWorkspace } from './CreateWorkspace.js';
|
|
7
4
|
export const createWorkspaceCommand = new Command('create workspace', async (args, program)=>{
|
|
8
|
-
let workspacePath = path.resolve(process.cwd(), args.options.path ?? '');
|
|
9
|
-
await fs.ensureDir(workspacePath);
|
|
10
|
-
let isWorkspacePathEmpty = await isEmptyDirectory(workspacePath);
|
|
11
|
-
if (!isWorkspacePathEmpty) {
|
|
12
|
-
throw new Error(`Directory "${workspacePath}" must be empty`);
|
|
13
|
-
}
|
|
14
5
|
await program.renderElement(/*#__PURE__*/ _jsx(CreateWorkspace, {
|
|
15
|
-
args: args
|
|
16
|
-
path: workspacePath
|
|
6
|
+
args: args
|
|
17
7
|
}));
|
|
18
8
|
}, {
|
|
19
9
|
description: 'Creates a new workspacee.',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/create-workspace/createWorkspaceCommand.tsx"],"sourcesContent":["import {Command} from '@jakubmazanec/cli';\
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/create-workspace/createWorkspaceCommand.tsx"],"sourcesContent":["import {Command} from '@jakubmazanec/cli';\n\nimport {CreateWorkspace} from './CreateWorkspace.js';\n\nexport const createWorkspaceCommand = new Command(\n 'create workspace',\n async (args, program) => {\n await program.renderElement(<CreateWorkspace args={args} />);\n },\n {\n description: 'Creates a new workspacee.',\n options: {\n path: {\n type: 'string',\n },\n template: {\n type: 'string',\n },\n },\n },\n);\n"],"names":["Command","CreateWorkspace","createWorkspaceCommand","args","program","renderElement","description","options","path","type","template"],"mappings":";AAAA,SAAQA,OAAO,QAAO,oBAAoB;AAE1C,SAAQC,eAAe,QAAO,uBAAuB;AAErD,OAAO,MAAMC,yBAAyB,IAAIF,QACxC,oBACA,OAAOG,MAAMC;IACX,MAAMA,QAAQC,aAAa,eAAC,KAACJ;QAAgBE,MAAMA;;AACrD,GACA;IACEG,aAAa;IACbC,SAAS;QACPC,MAAM;YACJC,MAAM;QACR;QACAC,UAAU;YACRD,MAAM;QACR;IACF;AACF,GACA"}
|
|
@@ -1,24 +1,15 @@
|
|
|
1
|
-
import { isEmptyDirectory } from '@jakubmazanec/fs-utils';
|
|
2
|
-
import fs from 'fs-extra';
|
|
3
|
-
import path from 'node:path';
|
|
4
1
|
import Observable from 'zen-observable';
|
|
5
2
|
import { Workspace } from '../../workspace.js';
|
|
6
3
|
export function runCreateWorkspace({ workspacePath, templateId, args }) {
|
|
7
4
|
return new Observable((observer)=>{
|
|
8
5
|
(async ()=>{
|
|
9
|
-
observer.next('
|
|
10
|
-
let resolvedWorkspacePath = path.resolve(workspacePath);
|
|
11
|
-
await fs.ensureDir(resolvedWorkspacePath);
|
|
12
|
-
let isWorkspacePathEmpty = await isEmptyDirectory(resolvedWorkspacePath);
|
|
13
|
-
if (!isWorkspacePathEmpty) {
|
|
14
|
-
throw new Error(`Directory "${resolvedWorkspacePath}" must be empty`);
|
|
15
|
-
}
|
|
16
|
-
// create new workspace
|
|
6
|
+
observer.next('Creating files');
|
|
17
7
|
let workspace = await Workspace.create({
|
|
18
8
|
args,
|
|
19
|
-
path:
|
|
9
|
+
path: workspacePath,
|
|
20
10
|
templateId
|
|
21
11
|
});
|
|
12
|
+
observer.next('Updating the new workspace');
|
|
22
13
|
await workspace.update({
|
|
23
14
|
args
|
|
24
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/create-workspace/runCreateWorkspace.ts"],"sourcesContent":["import {type CommandArguments} from '@jakubmazanec/cli';\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/create-workspace/runCreateWorkspace.ts"],"sourcesContent":["import {type CommandArguments} from '@jakubmazanec/cli';\nimport Observable from 'zen-observable';\n\nimport {type createWorkspaceCommand} from './createWorkspaceCommand.js';\nimport {Workspace} from '../../workspace.js';\n\nexport type CreateWorkspaceOptions = {\n workspacePath: string;\n templateId: string;\n args: CommandArguments<typeof createWorkspaceCommand>;\n};\n\nexport type CreateWorkspaceStatus = string;\n\nexport function runCreateWorkspace({workspacePath, templateId, args}: CreateWorkspaceOptions) {\n return new Observable<CreateWorkspaceStatus>((observer) => {\n (async () => {\n observer.next('Creating files');\n\n let workspace = await Workspace.create({\n args,\n path: workspacePath,\n templateId,\n });\n\n observer.next('Updating the new workspace');\n\n await workspace.update({args});\n })()\n .then(() => {\n observer.complete();\n })\n .catch((error) => {\n observer.error(error);\n });\n });\n}\n"],"names":["Observable","Workspace","runCreateWorkspace","workspacePath","templateId","args","observer","next","workspace","create","path","update","then","complete","catch","error"],"mappings":"AACA,OAAOA,gBAAgB,iBAAiB;AAGxC,SAAQC,SAAS,QAAO,qBAAqB;AAU7C,OAAO,SAASC,mBAAmB,EAACC,aAAa,EAAEC,UAAU,EAAEC,IAAI,EAAyB;IAC1F,OAAO,IAAIL,WAAkC,CAACM;QAC3C,CAAA;YACCA,SAASC,IAAI,CAAC;YAEd,IAAIC,YAAY,MAAMP,UAAUQ,MAAM,CAAC;gBACrCJ;gBACAK,MAAMP;gBACNC;YACF;YAEAE,SAASC,IAAI,CAAC;YAEd,MAAMC,UAAUG,MAAM,CAAC;gBAACN;YAAI;QAC9B,CAAA,IACGO,IAAI,CAAC;YACJN,SAASO,QAAQ;QACnB,GACCC,KAAK,CAAC,CAACC;YACNT,SAASS,KAAK,CAACA;QACjB;IACJ;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type CommandStatus = 'finished' | 'in-progress' | 'not-started';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/internals/CommandStatus.ts"],"sourcesContent":["export type CommandStatus = 'finished' | 'in-progress' | 'not-started';\n"],"names":[],"mappings":"AAAA,WAAuE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/internals.ts"],"sourcesContent":["export * from './internals/packageNameToDirectory.js';\n"],"names":[],"mappings":"AAAA,cAAc,wCAAwC"}
|
|
1
|
+
{"version":3,"sources":["../../src/commands/internals.ts"],"sourcesContent":["export * from './internals/CommandStatus.js';\nexport * from './internals/packageNameToDirectory.js';\n"],"names":[],"mappings":"AAAA,cAAc,+BAA+B;AAC7C,cAAc,wCAAwC"}
|
|
@@ -49,7 +49,7 @@ export function UpdateWorkspace({ workspace, args }) {
|
|
|
49
49
|
icon: icons.success,
|
|
50
50
|
marginBottom: 1,
|
|
51
51
|
children: /*#__PURE__*/ _jsx(Text, {
|
|
52
|
-
children: "Updating workspace..."
|
|
52
|
+
children: "Updating workspace and projects..."
|
|
53
53
|
})
|
|
54
54
|
}),
|
|
55
55
|
jobs.map((job)=>/*#__PURE__*/ _jsx(Text, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/update-workspace/UpdateWorkspace.tsx"],"sourcesContent":["import {type CommandArguments, Header, icons, colors, useProgram} from '@jakubmazanec/cli';\nimport chalk from 'chalk';\nimport {Box, Text} from 'ink';\nimport {useEffect, useState} from 'react';\n\nimport {runUpdateWorkspace} from './runUpdateWorkspace.js';\nimport {type updateWorkspaceCommand} from './updateWorkspaceCommand.js';\nimport {type Workspace} from '../../workspace.js';\n\nexport type UpdateWorkspaceProps = {\n args: CommandArguments<typeof updateWorkspaceCommand>;\n workspace: Workspace | Workspace<false>;\n};\n\nexport function UpdateWorkspace({workspace, args}: UpdateWorkspaceProps) {\n let [isFinished, setIsFinished] = useState(false);\n let [jobs, setJobs] = useState<string[]>([]);\n let {exit} = useProgram();\n\n useEffect(() => {\n let subscription = runUpdateWorkspace({workspace, args}).subscribe({\n next(value) {\n setJobs((previousJobs) => [...previousJobs, value]);\n },\n error(error) {\n exit(error);\n },\n complete() {\n setIsFinished(true);\n },\n });\n\n return () => {\n subscription.unsubscribe();\n };\n }, [args, exit, workspace]);\n\n return (\n <Box flexDirection=\"column\">\n <Text>{`Updating workspace at ${chalk[colors.info](workspace.path)}.`}</Text>\n\n <Box marginTop={1} flexDirection=\"column\">\n <Header showSpinner={!isFinished} icon={icons.success} marginBottom={1}>\n <Text>Updating workspace...</Text>\n </Header>\n\n {jobs.map((job) => (\n <Text key={job}>{`${icons.info} ${job}`}</Text>\n ))}\n </Box>\n\n {isFinished ? (\n <Header marginTop={1} icon={icons.success}>\n <Text>Done.</Text>\n </Header>\n ) : null}\n </Box>\n );\n}\n"],"names":["Header","icons","colors","useProgram","chalk","Box","Text","useEffect","useState","runUpdateWorkspace","UpdateWorkspace","workspace","args","isFinished","setIsFinished","jobs","setJobs","exit","subscription","subscribe","next","value","previousJobs","error","complete","unsubscribe","flexDirection","info","path","marginTop","showSpinner","icon","success","marginBottom","map","job"],"mappings":";AAAA,SAA+BA,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAEC,UAAU,QAAO,oBAAoB;AAC3F,OAAOC,WAAW,QAAQ;AAC1B,SAAQC,GAAG,EAAEC,IAAI,QAAO,MAAM;AAC9B,SAAQC,SAAS,EAAEC,QAAQ,QAAO,QAAQ;AAE1C,SAAQC,kBAAkB,QAAO,0BAA0B;AAS3D,OAAO,SAASC,gBAAgB,EAACC,SAAS,EAAEC,IAAI,EAAuB;IACrE,IAAI,CAACC,YAAYC,cAAc,GAAGN,SAAS;IAC3C,IAAI,CAACO,MAAMC,QAAQ,GAAGR,SAAmB,EAAE;IAC3C,IAAI,EAACS,IAAI,EAAC,GAAGd;IAEbI,UAAU;QACR,IAAIW,eAAeT,mBAAmB;YAACE;YAAWC;QAAI,GAAGO,SAAS,CAAC;YACjEC,MAAKC,KAAK;gBACRL,QAAQ,CAACM,eAAiB;2BAAIA;wBAAcD;qBAAM;YACpD;YACAE,OAAMA,KAAK;gBACTN,KAAKM;YACP;YACAC;gBACEV,cAAc;YAChB;QACF;QAEA,OAAO;YACLI,aAAaO,WAAW;QAC1B;IACF,GAAG;QAACb;QAAMK;QAAMN;KAAU;IAE1B,qBACE,MAACN;QAAIqB,eAAc;;0BACjB,KAACpB;0BAAM,CAAC,sBAAsB,EAAEF,KAAK,CAACF,OAAOyB,IAAI,CAAC,CAAChB,UAAUiB,IAAI,EAAE,CAAC,CAAC;;0BAErE,MAACvB;gBAAIwB,WAAW;gBAAGH,eAAc;;kCAC/B,KAAC1B;wBAAO8B,aAAa,CAACjB;wBAAYkB,MAAM9B,MAAM+B,OAAO;wBAAEC,cAAc;kCACnE,cAAA,KAAC3B;sCAAK;;;oBAGPS,KAAKmB,GAAG,CAAC,CAACC,oBACT,KAAC7B;sCAAgB,CAAC,EAAEL,MAAM0B,IAAI,CAAC,CAAC,EAAEQ,IAAI,CAAC;2BAA5BA;;;YAIdtB,2BACC,KAACb;gBAAO6B,WAAW;gBAAGE,MAAM9B,MAAM+B,OAAO;0BACvC,cAAA,KAAC1B;8BAAK;;iBAEN;;;AAGV"}
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/update-workspace/UpdateWorkspace.tsx"],"sourcesContent":["import {type CommandArguments, Header, icons, colors, useProgram} from '@jakubmazanec/cli';\nimport chalk from 'chalk';\nimport {Box, Text} from 'ink';\nimport {useEffect, useState} from 'react';\n\nimport {runUpdateWorkspace} from './runUpdateWorkspace.js';\nimport {type updateWorkspaceCommand} from './updateWorkspaceCommand.js';\nimport {type Workspace} from '../../workspace.js';\n\nexport type UpdateWorkspaceProps = {\n args: CommandArguments<typeof updateWorkspaceCommand>;\n workspace: Workspace | Workspace<false>;\n};\n\nexport function UpdateWorkspace({workspace, args}: UpdateWorkspaceProps) {\n let [isFinished, setIsFinished] = useState(false);\n let [jobs, setJobs] = useState<string[]>([]);\n let {exit} = useProgram();\n\n useEffect(() => {\n let subscription = runUpdateWorkspace({workspace, args}).subscribe({\n next(value) {\n setJobs((previousJobs) => [...previousJobs, value]);\n },\n error(error) {\n exit(error);\n },\n complete() {\n setIsFinished(true);\n },\n });\n\n return () => {\n subscription.unsubscribe();\n };\n }, [args, exit, workspace]);\n\n return (\n <Box flexDirection=\"column\">\n <Text>{`Updating workspace at ${chalk[colors.info](workspace.path)}.`}</Text>\n\n <Box marginTop={1} flexDirection=\"column\">\n <Header showSpinner={!isFinished} icon={icons.success} marginBottom={1}>\n <Text>Updating workspace and projects...</Text>\n </Header>\n\n {jobs.map((job) => (\n <Text key={job}>{`${icons.info} ${job}`}</Text>\n ))}\n </Box>\n\n {isFinished ? (\n <Header marginTop={1} icon={icons.success}>\n <Text>Done.</Text>\n </Header>\n ) : null}\n </Box>\n );\n}\n"],"names":["Header","icons","colors","useProgram","chalk","Box","Text","useEffect","useState","runUpdateWorkspace","UpdateWorkspace","workspace","args","isFinished","setIsFinished","jobs","setJobs","exit","subscription","subscribe","next","value","previousJobs","error","complete","unsubscribe","flexDirection","info","path","marginTop","showSpinner","icon","success","marginBottom","map","job"],"mappings":";AAAA,SAA+BA,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAEC,UAAU,QAAO,oBAAoB;AAC3F,OAAOC,WAAW,QAAQ;AAC1B,SAAQC,GAAG,EAAEC,IAAI,QAAO,MAAM;AAC9B,SAAQC,SAAS,EAAEC,QAAQ,QAAO,QAAQ;AAE1C,SAAQC,kBAAkB,QAAO,0BAA0B;AAS3D,OAAO,SAASC,gBAAgB,EAACC,SAAS,EAAEC,IAAI,EAAuB;IACrE,IAAI,CAACC,YAAYC,cAAc,GAAGN,SAAS;IAC3C,IAAI,CAACO,MAAMC,QAAQ,GAAGR,SAAmB,EAAE;IAC3C,IAAI,EAACS,IAAI,EAAC,GAAGd;IAEbI,UAAU;QACR,IAAIW,eAAeT,mBAAmB;YAACE;YAAWC;QAAI,GAAGO,SAAS,CAAC;YACjEC,MAAKC,KAAK;gBACRL,QAAQ,CAACM,eAAiB;2BAAIA;wBAAcD;qBAAM;YACpD;YACAE,OAAMA,KAAK;gBACTN,KAAKM;YACP;YACAC;gBACEV,cAAc;YAChB;QACF;QAEA,OAAO;YACLI,aAAaO,WAAW;QAC1B;IACF,GAAG;QAACb;QAAMK;QAAMN;KAAU;IAE1B,qBACE,MAACN;QAAIqB,eAAc;;0BACjB,KAACpB;0BAAM,CAAC,sBAAsB,EAAEF,KAAK,CAACF,OAAOyB,IAAI,CAAC,CAAChB,UAAUiB,IAAI,EAAE,CAAC,CAAC;;0BAErE,MAACvB;gBAAIwB,WAAW;gBAAGH,eAAc;;kCAC/B,KAAC1B;wBAAO8B,aAAa,CAACjB;wBAAYkB,MAAM9B,MAAM+B,OAAO;wBAAEC,cAAc;kCACnE,cAAA,KAAC3B;sCAAK;;;oBAGPS,KAAKmB,GAAG,CAAC,CAACC,oBACT,KAAC7B;sCAAgB,CAAC,EAAEL,MAAM0B,IAAI,CAAC,CAAC,EAAEQ,IAAI,CAAC;2BAA5BA;;;YAIdtB,2BACC,KAACb;gBAAO6B,WAAW;gBAAGE,MAAM9B,MAAM+B,OAAO;0BACvC,cAAA,KAAC1B;8BAAK;;iBAEN;;;AAGV"}
|
|
@@ -5,10 +5,9 @@ import { UpdateWorkspace } from './UpdateWorkspace.js';
|
|
|
5
5
|
import { Workspace } from '../../workspace.js';
|
|
6
6
|
export const updateWorkspaceCommand = new Command('update workspace', async (args, program)=>{
|
|
7
7
|
let resolvedPath = path.resolve(process.cwd(), args.options.path ?? '');
|
|
8
|
-
let workspace = await Workspace.findAndRead(resolvedPath
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
8
|
+
let workspace = await Workspace.findAndRead(resolvedPath, {
|
|
9
|
+
throwIfNotFound: true
|
|
10
|
+
});
|
|
12
11
|
await program.renderElement(/*#__PURE__*/ _jsx(UpdateWorkspace, {
|
|
13
12
|
workspace: workspace,
|
|
14
13
|
args: args
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/update-workspace/updateWorkspaceCommand.tsx"],"sourcesContent":["import {Command} from '@jakubmazanec/cli';\nimport path from 'node:path';\n\nimport {UpdateWorkspace} from './UpdateWorkspace.js';\nimport {Workspace} from '../../workspace.js';\n\nexport const updateWorkspaceCommand = new Command(\n 'update workspace',\n async (args, program) => {\n let resolvedPath = path.resolve(process.cwd(), args.options.path ?? '');\n let workspace = await Workspace.findAndRead(resolvedPath
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/update-workspace/updateWorkspaceCommand.tsx"],"sourcesContent":["import {Command} from '@jakubmazanec/cli';\nimport path from 'node:path';\n\nimport {UpdateWorkspace} from './UpdateWorkspace.js';\nimport {Workspace} from '../../workspace.js';\n\nexport const updateWorkspaceCommand = new Command(\n 'update workspace',\n async (args, program) => {\n let resolvedPath = path.resolve(process.cwd(), args.options.path ?? '');\n let workspace = await Workspace.findAndRead(resolvedPath, {throwIfNotFound: true});\n\n await program.renderElement(<UpdateWorkspace workspace={workspace} args={args} />);\n },\n {\n description: 'Updates files in a workspace.',\n options: {\n path: {\n type: 'string',\n },\n },\n },\n);\n"],"names":["Command","path","UpdateWorkspace","Workspace","updateWorkspaceCommand","args","program","resolvedPath","resolve","process","cwd","options","workspace","findAndRead","throwIfNotFound","renderElement","description","type"],"mappings":";AAAA,SAAQA,OAAO,QAAO,oBAAoB;AAC1C,OAAOC,UAAU,YAAY;AAE7B,SAAQC,eAAe,QAAO,uBAAuB;AACrD,SAAQC,SAAS,QAAO,qBAAqB;AAE7C,OAAO,MAAMC,yBAAyB,IAAIJ,QACxC,oBACA,OAAOK,MAAMC;IACX,IAAIC,eAAeN,KAAKO,OAAO,CAACC,QAAQC,GAAG,IAAIL,KAAKM,OAAO,CAACV,IAAI,IAAI;IACpE,IAAIW,YAAY,MAAMT,UAAUU,WAAW,CAACN,cAAc;QAACO,iBAAiB;IAAI;IAEhF,MAAMR,QAAQS,aAAa,eAAC,KAACb;QAAgBU,WAAWA;QAAWP,MAAMA;;AAC3E,GACA;IACEW,aAAa;IACbL,SAAS;QACPV,MAAM;YACJgB,MAAM;QACR;IACF;AACF,GACA"}
|
|
@@ -10,6 +10,6 @@ export type CarsonTemplate = {
|
|
|
10
10
|
name: string;
|
|
11
11
|
/** Carson template config. */
|
|
12
12
|
config: CarsonTemplateConfig;
|
|
13
|
-
/** Carson template files, actually instances of {@
|
|
13
|
+
/** Carson template files, actually instances of {@link Template}. */
|
|
14
14
|
files: Array<Template<typeof templateAttributesSchema, typeof templateDataSchema>>;
|
|
15
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/template/CarsonTemplate.ts"],"sourcesContent":["import {type Template} from '@jakubmazanec/template';\n\nimport {type CarsonTemplateConfig} from './CarsonTemplateConfig.js';\nimport {type templateAttributesSchema} from './TemplateAttributes.js';\nimport {type templateDataSchema} from './TemplateData.js';\n\n/**\n * Carson template.\n */\nexport type CarsonTemplate = {\n /** Carson template name. */\n
|
|
1
|
+
{"version":3,"sources":["../../src/template/CarsonTemplate.ts"],"sourcesContent":["import {type Template} from '@jakubmazanec/template';\n\nimport {type CarsonTemplateConfig} from './CarsonTemplateConfig.js';\nimport {type templateAttributesSchema} from './TemplateAttributes.js';\nimport {type templateDataSchema} from './TemplateData.js';\n\n/**\n * Carson template.\n */\nexport type CarsonTemplate = {\n /** Carson template name. */\n name: string;\n\n /** Carson template config. */\n config: CarsonTemplateConfig;\n\n /** Carson template files, actually instances of {@link Template}. */\n files: Array<Template<typeof templateAttributesSchema, typeof templateDataSchema>>;\n};\n"],"names":[],"mappings":"AAAA,WAkBE"}
|
|
@@ -10,6 +10,6 @@ export declare const carsonTemplateConfigSchema: z.ZodObject<{
|
|
|
10
10
|
disallowSingleProjectWorkspace?: boolean | undefined;
|
|
11
11
|
}>;
|
|
12
12
|
/**
|
|
13
|
-
* Carson
|
|
13
|
+
* Carson template config.
|
|
14
14
|
*/
|
|
15
15
|
export type CarsonTemplateConfig = z.infer<typeof carsonTemplateConfigSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/template/CarsonTemplateConfig.ts"],"sourcesContent":["import {z} from 'zod';\n\nexport const carsonTemplateConfigSchema = z\n .object({\n disallowMultiProjectWorkspace: z.boolean().optional(),\n disallowSingleProjectWorkspace: z.boolean().optional(),\n\n // TODO: add extends property to allow reuisng template files from another carson template\n })\n .strict();\n\n/**\n * Carson
|
|
1
|
+
{"version":3,"sources":["../../src/template/CarsonTemplateConfig.ts"],"sourcesContent":["import {z} from 'zod';\n\nexport const carsonTemplateConfigSchema = z\n .object({\n disallowMultiProjectWorkspace: z.boolean().optional(),\n disallowSingleProjectWorkspace: z.boolean().optional(),\n\n // TODO: add extends property to allow reuisng template files from another carson template\n })\n .strict();\n\n/**\n * Carson template config.\n */\nexport type CarsonTemplateConfig = z.infer<typeof carsonTemplateConfigSchema>;\n"],"names":["z","carsonTemplateConfigSchema","object","disallowMultiProjectWorkspace","boolean","optional","disallowSingleProjectWorkspace","strict"],"mappings":"AAAA,SAAQA,CAAC,QAAO,MAAM;AAEtB,OAAO,MAAMC,6BAA6BD,EACvCE,MAAM,CAAC;IACNC,+BAA+BH,EAAEI,OAAO,GAAGC,QAAQ;IACnDC,gCAAgCN,EAAEI,OAAO,GAAGC,QAAQ;AAGtD,GACCE,MAAM,GAAG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A subclass of `Error` that indicates a Carson template failure.
|
|
3
|
+
*/
|
|
4
|
+
export declare const CarsonTemplateError: new (code: "INVALID_CARSON_TEMPLATE_ID" | "CARSON_TEMPLATE_NOT_FOUND" | "STRATEGY_UNSUPPORTED_EXTENSION" | "STRATEGY_MISSING_FILE", options?: import("@jakubmazanec/error").CustomErrorWithDataOptions<{
|
|
5
|
+
path?: string;
|
|
6
|
+
}> | undefined) => import("@jakubmazanec/error").CustomErrorWithData<"INVALID_CARSON_TEMPLATE_ID" | "CARSON_TEMPLATE_NOT_FOUND" | "STRATEGY_UNSUPPORTED_EXTENSION" | "STRATEGY_MISSING_FILE" | "UNKNOWN_ERROR", {
|
|
7
|
+
path?: string;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createCustomErrorWithData } from '@jakubmazanec/error';
|
|
2
|
+
/**
|
|
3
|
+
* A subclass of `Error` that indicates a Carson template failure.
|
|
4
|
+
*/ export const CarsonTemplateError = createCustomErrorWithData('CarsonTemplateError', {
|
|
5
|
+
INVALID_CARSON_TEMPLATE_ID: 'Invalid Carson template ID "{0}". Carson template ID must consist of a module ID and a template name separated by a colon.',
|
|
6
|
+
CARSON_TEMPLATE_NOT_FOUND: 'Carson template "{0}" was not found in module "{1}".',
|
|
7
|
+
STRATEGY_UNSUPPORTED_EXTENSION: 'Strategy "{0}" in the template file "{1}" doesn\'t support extension "{2}".',
|
|
8
|
+
STRATEGY_MISSING_FILE: 'Strategy "{0}" in the template file "{1}" is missing file "{2}".'
|
|
9
|
+
}, class CarsonTemplateErrorData {
|
|
10
|
+
path;
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=CarsonTemplateError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/template/CarsonTemplateError.ts"],"sourcesContent":["import {createCustomErrorWithData} from '@jakubmazanec/error';\n\n/**\n * A subclass of `Error` that indicates a Carson template failure.\n */\nexport const CarsonTemplateError = createCustomErrorWithData(\n 'CarsonTemplateError',\n {\n INVALID_CARSON_TEMPLATE_ID:\n 'Invalid Carson template ID \"{0}\". Carson template ID must consist of a module ID and a template name separated by a colon.',\n CARSON_TEMPLATE_NOT_FOUND: 'Carson template \"{0}\" was not found in module \"{1}\".',\n STRATEGY_UNSUPPORTED_EXTENSION:\n 'Strategy \"{0}\" in the template file \"{1}\" doesn\\'t support extension \"{2}\".',\n STRATEGY_MISSING_FILE: 'Strategy \"{0}\" in the template file \"{1}\" is missing file \"{2}\".',\n },\n class CarsonTemplateErrorData {\n path?: string;\n },\n);\n"],"names":["createCustomErrorWithData","CarsonTemplateError","INVALID_CARSON_TEMPLATE_ID","CARSON_TEMPLATE_NOT_FOUND","STRATEGY_UNSUPPORTED_EXTENSION","STRATEGY_MISSING_FILE","CarsonTemplateErrorData","path"],"mappings":"AAAA,SAAQA,yBAAyB,QAAO,sBAAsB;AAE9D;;CAEC,GACD,OAAO,MAAMC,sBAAsBD,0BACjC,uBACA;IACEE,4BACE;IACFC,2BAA2B;IAC3BC,gCACE;IACFC,uBAAuB;AACzB,GACA,MAAMC;IACJC,KAAc;AAChB,GACA"}
|
|
@@ -2,6 +2,10 @@ import { type TemplateRender as BaseTemplateRender } from '@jakubmazanec/templat
|
|
|
2
2
|
import { type templateAttributesSchema } from './TemplateAttributes.js';
|
|
3
3
|
import { type templateDataSchema } from './TemplateData.js';
|
|
4
4
|
/**
|
|
5
|
-
* A template
|
|
5
|
+
* A result of rendering a Carson template file.
|
|
6
6
|
*/
|
|
7
|
-
export type TemplateRender = BaseTemplateRender<typeof templateAttributesSchema, typeof templateDataSchema
|
|
7
|
+
export type TemplateRender = BaseTemplateRender<typeof templateAttributesSchema, typeof templateDataSchema> & {
|
|
8
|
+
template: {
|
|
9
|
+
path: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/template/TemplateRender.ts"],"sourcesContent":["import {type TemplateRender as BaseTemplateRender} from '@jakubmazanec/template';\n\nimport {type templateAttributesSchema} from './TemplateAttributes.js';\nimport {type templateDataSchema} from './TemplateData.js';\n\n/**\n * A template
|
|
1
|
+
{"version":3,"sources":["../../src/template/TemplateRender.ts"],"sourcesContent":["import {type TemplateRender as BaseTemplateRender} from '@jakubmazanec/template';\n\nimport {type templateAttributesSchema} from './TemplateAttributes.js';\nimport {type templateDataSchema} from './TemplateData.js';\n\n/**\n * A result of rendering a Carson template file.\n */\nexport type TemplateRender = BaseTemplateRender<\n typeof templateAttributesSchema,\n typeof templateDataSchema\n> & {\n template: {\n path: string;\n };\n};\n"],"names":[],"mappings":"AAAA,WAeE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/template/TemplateRenders.ts"],"sourcesContent":["import {type TemplateRender} from './TemplateRender.js';\n\n/**\n * A
|
|
1
|
+
{"version":3,"sources":["../../src/template/TemplateRenders.ts"],"sourcesContent":["import {type TemplateRender} from './TemplateRender.js';\n\n/**\n * A {@link TemplateRender} collection.\n */\nexport type TemplateRenders = TemplateRender[];\n"],"names":[],"mappings":"AAAA,WAK+C"}
|
|
@@ -4,4 +4,7 @@ export type ApplyTemplateRendersOptions = {
|
|
|
4
4
|
path: string;
|
|
5
5
|
ignoreStrategies: string[];
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Applies rendered Carson template to a specified path, i.e. creates and updates files based on the result of rendering each Carson template file.
|
|
9
|
+
*/
|
|
7
10
|
export declare function applyTemplateRenders({ templateRenders, path: targetPath, ignoreStrategies, }: ApplyTemplateRendersOptions): Promise<void>;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import prettier from 'prettier';
|
|
4
|
+
import { CarsonTemplateError } from './CarsonTemplateError.js';
|
|
4
5
|
import { createUsingTemplateRender, deleteUsingTemplateRender, insertUsingTemplateRender, loadTemplateRenderSnapshots, mergeUsingTemplateRender, overwriteUsingTemplateRender, saveTemplateRenderSnapshots, uninsertUsingTemplateRender, unmergeUsingTemplateRender } from './internals.js';
|
|
5
6
|
import { CARSON_CONFIG_DIRECTORY, SNAPSHOTS_FILENAME } from '../constants.js';
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Applies rendered Carson template to a specified path, i.e. creates and updates files based on the result of rendering each Carson template file.
|
|
9
|
+
*/ export async function applyTemplateRenders({ templateRenders, path: targetPath, ignoreStrategies }) {
|
|
7
10
|
// we need to clear Prettier cache, because we are changing file system
|
|
8
11
|
prettier.clearConfigCache();
|
|
9
12
|
let templateRenderSnapshotsPath = path.join(targetPath, CARSON_CONFIG_DIRECTORY, SNAPSHOTS_FILENAME);
|
|
@@ -46,11 +49,20 @@ export async function applyTemplateRenders({ templateRenders, path: targetPath,
|
|
|
46
49
|
if (templateRender.attributes.strategy[0] === 'insert') {
|
|
47
50
|
await insertUsingTemplateRender(templateRender, targetPath);
|
|
48
51
|
}
|
|
49
|
-
if (
|
|
52
|
+
if (templateRender.attributes.strategy === 'check') {
|
|
50
53
|
let to = path.join(targetPath, templateRender.attributes.to);
|
|
51
54
|
let doesToExist = await fs.pathExists(to);
|
|
52
55
|
if (!doesToExist) {
|
|
53
|
-
throw new
|
|
56
|
+
throw new CarsonTemplateError('STRATEGY_MISSING_FILE', {
|
|
57
|
+
messageParameters: [
|
|
58
|
+
templateRender.attributes.strategy,
|
|
59
|
+
templateRender.template.path,
|
|
60
|
+
to
|
|
61
|
+
],
|
|
62
|
+
data: {
|
|
63
|
+
path: to
|
|
64
|
+
}
|
|
65
|
+
});
|
|
54
66
|
}
|
|
55
67
|
}
|
|
56
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/template/applyTemplateRenders.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport path from 'node:path';\nimport prettier from 'prettier';\n\nimport {\n createUsingTemplateRender,\n deleteUsingTemplateRender,\n insertUsingTemplateRender,\n loadTemplateRenderSnapshots,\n mergeUsingTemplateRender,\n overwriteUsingTemplateRender,\n saveTemplateRenderSnapshots,\n uninsertUsingTemplateRender,\n unmergeUsingTemplateRender,\n} from './internals.js';\nimport {type TemplateRenders} from './TemplateRenders.js';\nimport {CARSON_CONFIG_DIRECTORY, SNAPSHOTS_FILENAME} from '../constants.js';\n\nexport type ApplyTemplateRendersOptions = {\n templateRenders: TemplateRenders;\n path: string;\n ignoreStrategies: string[];\n};\n\nexport async function applyTemplateRenders({\n templateRenders,\n path: targetPath,\n ignoreStrategies,\n}: ApplyTemplateRendersOptions) {\n // we need to clear Prettier cache, because we are changing file system\n prettier.clearConfigCache();\n\n let templateRenderSnapshotsPath = path.join(\n targetPath,\n CARSON_CONFIG_DIRECTORY,\n SNAPSHOTS_FILENAME,\n );\n\n if (await fs.pathExists(templateRenderSnapshotsPath)) {\n let templateRenderSnapshots = await loadTemplateRenderSnapshots(templateRenderSnapshotsPath);\n\n for (let templateRenderSnapshot of templateRenderSnapshots) {\n let strategy =\n typeof templateRenderSnapshot.attributes.strategy === 'string'\n ? templateRenderSnapshot.attributes.strategy\n : templateRenderSnapshot.attributes.strategy[0];\n\n if (ignoreStrategies.includes(strategy)) {\n continue;\n }\n\n if (templateRenderSnapshot.attributes.strategy === 'overwrite') {\n await deleteUsingTemplateRender(templateRenderSnapshot, targetPath);\n }\n\n if (templateRenderSnapshot.attributes.strategy === 'merge') {\n await unmergeUsingTemplateRender(templateRenderSnapshot, targetPath);\n }\n\n if (templateRenderSnapshot.attributes.strategy[0] === 'insert') {\n await uninsertUsingTemplateRender(templateRenderSnapshot, targetPath);\n }\n }\n }\n\n if (!ignoreStrategies.includes('create')) {\n for (let templateRender of templateRenders) {\n if (templateRender.attributes.strategy === 'create') {\n await createUsingTemplateRender(templateRender, targetPath);\n }\n }\n }\n\n for (let templateRender of templateRenders) {\n let strategy =\n typeof templateRender.attributes.strategy === 'string'\n ? templateRender.attributes.strategy\n : templateRender.attributes.strategy[0];\n\n if (ignoreStrategies.includes(strategy)) {\n continue;\n }\n\n if (templateRender.attributes.strategy === 'overwrite') {\n await overwriteUsingTemplateRender(templateRender, targetPath);\n }\n\n if (templateRender.attributes.strategy === 'merge') {\n await mergeUsingTemplateRender(templateRender, targetPath);\n }\n\n if (templateRender.attributes.strategy[0] === 'insert') {\n await insertUsingTemplateRender(templateRender, targetPath);\n }\n\n if (
|
|
1
|
+
{"version":3,"sources":["../../src/template/applyTemplateRenders.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport path from 'node:path';\nimport prettier from 'prettier';\n\nimport {CarsonTemplateError} from './CarsonTemplateError.js';\nimport {\n createUsingTemplateRender,\n deleteUsingTemplateRender,\n insertUsingTemplateRender,\n loadTemplateRenderSnapshots,\n mergeUsingTemplateRender,\n overwriteUsingTemplateRender,\n saveTemplateRenderSnapshots,\n uninsertUsingTemplateRender,\n unmergeUsingTemplateRender,\n} from './internals.js';\nimport {type TemplateRenders} from './TemplateRenders.js';\nimport {CARSON_CONFIG_DIRECTORY, SNAPSHOTS_FILENAME} from '../constants.js';\n\nexport type ApplyTemplateRendersOptions = {\n templateRenders: TemplateRenders;\n path: string;\n ignoreStrategies: string[];\n};\n\n/**\n * Applies rendered Carson template to a specified path, i.e. creates and updates files based on the result of rendering each Carson template file.\n */\nexport async function applyTemplateRenders({\n templateRenders,\n path: targetPath,\n ignoreStrategies,\n}: ApplyTemplateRendersOptions) {\n // we need to clear Prettier cache, because we are changing file system\n prettier.clearConfigCache();\n\n let templateRenderSnapshotsPath = path.join(\n targetPath,\n CARSON_CONFIG_DIRECTORY,\n SNAPSHOTS_FILENAME,\n );\n\n if (await fs.pathExists(templateRenderSnapshotsPath)) {\n let templateRenderSnapshots = await loadTemplateRenderSnapshots(templateRenderSnapshotsPath);\n\n for (let templateRenderSnapshot of templateRenderSnapshots) {\n let strategy =\n typeof templateRenderSnapshot.attributes.strategy === 'string'\n ? templateRenderSnapshot.attributes.strategy\n : templateRenderSnapshot.attributes.strategy[0];\n\n if (ignoreStrategies.includes(strategy)) {\n continue;\n }\n\n if (templateRenderSnapshot.attributes.strategy === 'overwrite') {\n await deleteUsingTemplateRender(templateRenderSnapshot, targetPath);\n }\n\n if (templateRenderSnapshot.attributes.strategy === 'merge') {\n await unmergeUsingTemplateRender(templateRenderSnapshot, targetPath);\n }\n\n if (templateRenderSnapshot.attributes.strategy[0] === 'insert') {\n await uninsertUsingTemplateRender(templateRenderSnapshot, targetPath);\n }\n }\n }\n\n if (!ignoreStrategies.includes('create')) {\n for (let templateRender of templateRenders) {\n if (templateRender.attributes.strategy === 'create') {\n await createUsingTemplateRender(templateRender, targetPath);\n }\n }\n }\n\n for (let templateRender of templateRenders) {\n let strategy =\n typeof templateRender.attributes.strategy === 'string'\n ? templateRender.attributes.strategy\n : templateRender.attributes.strategy[0];\n\n if (ignoreStrategies.includes(strategy)) {\n continue;\n }\n\n if (templateRender.attributes.strategy === 'overwrite') {\n await overwriteUsingTemplateRender(templateRender, targetPath);\n }\n\n if (templateRender.attributes.strategy === 'merge') {\n await mergeUsingTemplateRender(templateRender, targetPath);\n }\n\n if (templateRender.attributes.strategy[0] === 'insert') {\n await insertUsingTemplateRender(templateRender, targetPath);\n }\n\n if (templateRender.attributes.strategy === 'check') {\n let to = path.join(targetPath, templateRender.attributes.to);\n let doesToExist = await fs.pathExists(to);\n\n if (!doesToExist) {\n throw new CarsonTemplateError('STRATEGY_MISSING_FILE', {\n messageParameters: [templateRender.attributes.strategy, templateRender.template.path, to],\n data: {\n path: to,\n },\n });\n }\n }\n }\n\n await saveTemplateRenderSnapshots(templateRenders, templateRenderSnapshotsPath);\n}\n"],"names":["fs","path","prettier","CarsonTemplateError","createUsingTemplateRender","deleteUsingTemplateRender","insertUsingTemplateRender","loadTemplateRenderSnapshots","mergeUsingTemplateRender","overwriteUsingTemplateRender","saveTemplateRenderSnapshots","uninsertUsingTemplateRender","unmergeUsingTemplateRender","CARSON_CONFIG_DIRECTORY","SNAPSHOTS_FILENAME","applyTemplateRenders","templateRenders","targetPath","ignoreStrategies","clearConfigCache","templateRenderSnapshotsPath","join","pathExists","templateRenderSnapshots","templateRenderSnapshot","strategy","attributes","includes","templateRender","to","doesToExist","messageParameters","template","data"],"mappings":"AAAA,OAAOA,QAAQ,WAAW;AAC1B,OAAOC,UAAU,YAAY;AAC7B,OAAOC,cAAc,WAAW;AAEhC,SAAQC,mBAAmB,QAAO,2BAA2B;AAC7D,SACEC,yBAAyB,EACzBC,yBAAyB,EACzBC,yBAAyB,EACzBC,2BAA2B,EAC3BC,wBAAwB,EACxBC,4BAA4B,EAC5BC,2BAA2B,EAC3BC,2BAA2B,EAC3BC,0BAA0B,QACrB,iBAAiB;AAExB,SAAQC,uBAAuB,EAAEC,kBAAkB,QAAO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