@jakubmazanec/carson 1.2.1 → 1.2.2-next.80f405d
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/build/commands/create-project/CreateProject.js +4 -4
- package/build/commands/create-project/CreateProject.js.map +2 -2
- package/build/commands/create-project/runCreateProject.js.map +2 -2
- package/build/commands/create-workspace/CreateWorkspace.js +4 -4
- package/build/commands/create-workspace/CreateWorkspace.js.map +2 -2
- package/build/commands/create-workspace/runCreateWorkspace.js.map +2 -2
- package/build/commands/internals.d.ts +1 -1
- package/build/commands/internals.js +0 -1
- package/build/commands/internals.js.map +2 -2
- package/build/commands/update-workspace/UpdateWorkspace.js +3 -3
- package/build/commands/update-workspace/UpdateWorkspace.js.map +2 -2
- package/build/commands/update-workspace/runUpdateWorkspace.js.map +2 -2
- package/build/commands/update-workspace/updateWorkspaceCommand.js +1 -1
- package/build/commands/update-workspace/updateWorkspaceCommand.js.map +2 -2
- package/build/template/applyTemplateRenders.js.map +2 -2
- package/build/template.d.ts +3 -3
- package/build/template.js +0 -3
- package/build/template.js.map +2 -2
- package/build/workspace/WorkspaceDependencies.js.map +2 -2
- package/build/workspace/internals/getRepositoryBranches.js +1 -1
- package/build/workspace/internals/getRepositoryBranches.js.map +2 -2
- package/build/workspace.d.ts +13 -13
- package/build/workspace.js +0 -13
- package/build/workspace.js.map +2 -2
- package/package.json +10 -10
- package/source/commands/create-project/CreateProject.tsx +4 -4
- package/source/commands/create-project/runCreateProject.ts +1 -1
- package/source/commands/create-workspace/CreateWorkspace.tsx +4 -4
- package/source/commands/create-workspace/runCreateWorkspace.ts +1 -1
- package/source/commands/internals.ts +1 -1
- package/source/commands/update-workspace/UpdateWorkspace.tsx +3 -3
- package/source/commands/update-workspace/runUpdateWorkspace.ts +1 -1
- package/source/commands/update-workspace/updateWorkspaceCommand.tsx +1 -1
- package/source/template/applyTemplateRenders.ts +0 -2
- package/source/template.ts +3 -3
- package/source/workspace/WorkspaceDependencies.ts +0 -2
- package/source/workspace/internals/getRepositoryBranches.ts +1 -1
- package/source/workspace.ts +13 -13
|
@@ -95,17 +95,17 @@ export function CreateProject({ args, workspace }) {
|
|
|
95
95
|
choices: possiblePaths
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
|
-
values: createProjectInputResult,
|
|
99
98
|
marginTop: 1,
|
|
99
|
+
values: createProjectInputResult,
|
|
100
100
|
onChange: setCreateProjectInputResult,
|
|
101
101
|
onComplete: setCreateProjectInputResult
|
|
102
102
|
}
|
|
103
103
|
),
|
|
104
|
-
status === "in-progress" || status === "finished" ? /* @__PURE__ */ jsxs(Box, {
|
|
105
|
-
/* @__PURE__ */ jsx(Header, { showSpinner: status === "in-progress",
|
|
104
|
+
status === "in-progress" || status === "finished" ? /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
|
|
105
|
+
/* @__PURE__ */ jsx(Header, { icon: icons.success, marginBottom: 1, showSpinner: status === "in-progress", children: /* @__PURE__ */ jsx(Text, { children: "Creating project..." }) }),
|
|
106
106
|
jobs.map((job) => /* @__PURE__ */ jsx(Text, { children: `${icons.info} ${job}` }, job))
|
|
107
107
|
] }) : null,
|
|
108
|
-
status === "finished" ? /* @__PURE__ */ jsx(Header, {
|
|
108
|
+
status === "finished" ? /* @__PURE__ */ jsx(Header, { icon: icons.success, marginTop: 1, children: /* @__PURE__ */ jsx(Text, { children: "Done." }) }) : null
|
|
109
109
|
] });
|
|
110
110
|
}
|
|
111
111
|
//# sourceMappingURL=CreateProject.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/commands/create-project/CreateProject.tsx"],
|
|
4
|
-
"sourcesContent": ["import {colors, type CommandArguments, Header, icons, 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 Workspace} from '../../workspace.js';\nimport {type CommandStatus, packageNameToDirectory} from '../internals.js';\nimport {type createProjectCommand} from './createProjectCommand.js';\nimport {CreateProjectInput, type CreateProjectInputResult} from './CreateProjectInput.js';\nimport {runCreateProject} from './runCreateProject.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\n if (!possiblePaths.length) {\n possiblePaths = workspace.projectGlobs\n .filter((projectGlob) => !ONLY_ONE_STAR_REGEXP.test(projectGlob))\n .map((projectGlob) => path.join(workspace.path, projectGlob))\n .map((projectPath) => ({\n value: projectPath,\n label: path.relative(workspace.path, projectPath).replace('\\\\', '/'),\n }));\n }\n\n if (!possiblePaths.length) {\n possiblePaths = [\n {\n value: workspace.path,\n label: workspace.path,\n },\n ];\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
|
|
5
|
-
"mappings": ";AAiHM,cAiBE,YAjBF;AAjHN,SAAQ,QAA+B,QAAQ,OAAO,kBAAiB;AACvE,OAAO,WAAW;AAClB,SAAQ,KAAK,YAAW;AACxB,OAAO,UAAU;AACjB,SAAQ,WAAW,gBAAe;AAGlC,SAA4B,8BAA6B;AAEzD,SAAQ,0BAAwD;AAChE,SAAQ,wBAAuB;AAE/B,MAAM,uBAAuB;AAOtB,gBAAS,cAAc,EAAC,MAAM,UAAS,GAAuB;AACnE,MAAI,CAAC,QAAQ,SAAS,IAAI,SAAwB,aAAa;AAC/D,MAAI,CAAC,cAAc,eAAe,IAAI,SAA4C,IAAI;AACtF,MAAI,CAAC,MAAM,OAAO,IAAI,SAAmB,CAAC,CAAC;AAC3C,MAAI,CAAC,0BAA0B,2BAA2B,IAAI;AAAA,IAC5D,OAAO;AAAA,MACL,aAAa,EAAC,OAAO,KAAK,QAAQ,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from 'chalk';\nimport {Box, Text} from 'ink';\nimport path from 'node:path';\nimport {useEffect, useState} from 'react';\n\nimport {type Workspace} from '../../workspace.js';\nimport {type CommandStatus, packageNameToDirectory} from '../internals.js';\nimport {type createProjectCommand} from './createProjectCommand.js';\nimport {CreateProjectInput, type CreateProjectInputResult} from './CreateProjectInput.js';\nimport {runCreateProject} from './runCreateProject.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\n if (!possiblePaths.length) {\n possiblePaths = workspace.projectGlobs\n .filter((projectGlob) => !ONLY_ONE_STAR_REGEXP.test(projectGlob))\n .map((projectGlob) => path.join(workspace.path, projectGlob))\n .map((projectPath) => ({\n value: projectPath,\n label: path.relative(workspace.path, projectPath).replace('\\\\', '/'),\n }));\n }\n\n if (!possiblePaths.length) {\n possiblePaths = [\n {\n value: workspace.path,\n label: workspace.path,\n },\n ];\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 marginTop={1}\n values={createProjectInputResult}\n onChange={setCreateProjectInputResult}\n onComplete={setCreateProjectInputResult}\n />\n\n {status === 'in-progress' || status === 'finished' ?\n <Box flexDirection=\"column\" marginTop={1}>\n <Header icon={icons.success} marginBottom={1} showSpinner={status === 'in-progress'}>\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 icon={icons.success} marginTop={1}>\n <Text>Done.</Text>\n </Header>\n : null}\n </Box>\n );\n}\n"],
|
|
5
|
+
"mappings": ";AAiHM,cAiBE,YAjBF;AAjHN,SAAQ,QAA+B,QAAQ,OAAO,kBAAiB;AACvE,OAAO,WAAW;AAClB,SAA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AA,IACF,OAAO;AACL,sBAAgB;AAAA,QACd;AAAA,UACE,OAAO,UAAU;AAAA,UACjB,OAAO,UAAU;AAAA,QACnB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SACE,qBAAC,OAAI,eAAc,UACjB;AAAA,wBAAC,QAAK,OAAO,OAAO,MACjB,kDAAwC,MAAM,OAAO,IAAI,EAAE,UAAU,IAAI,CAAC,KAC7E;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,UACJ,aAAa;AAAA,YACX,SAAS;AAAA,UACX;AAAA,QACF;AAAA,QACA,WAAW;AAAA,QACX,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,YAAY;AAAA;AAAA,IACd;AAAA,IAEC,WAAW,iBAAiB,WAAW,aACtC,qBAAC,OAAI,eAAc,UAAS,WAAW,GACrC;AAAA,0BAAC,UAAO,MAAM,MAAM,SAAS,cAAc,GAAG,aAAa,WAAW,eACpE,8BAAC,QAAK,iCAAmB,GAC3B;AAAA,MAEC,KAAK,IAAI,CAAC,QACT,oBAAC,QAAgB,aAAG,MAAM,IAAI,IAAI,GAAG,MAA1B,GAA6B,CACzC;AAAA,OACH,IACA;AAAA,IAED,WAAW,aACV,oBAAC,UAAO,MAAM,MAAM,SAAS,WAAW,GACtC,8BAAC,QAAK,mBAAK,GACb,IACA;AAAA,KACJ;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/commands/create-project/runCreateProject.ts"],
|
|
4
|
-
"sourcesContent": ["import {type CommandArguments} from '@jakubmazanec/cli';\nimport Observable from 'zen-observable';\n\nimport {type Workspace} from '../../workspace.js';\nimport {type createProjectCommand} from './createProjectCommand.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 // if the project doesn't have config with a template ID, it's on purpose, but it's still needed for the next update, so we'll add it manually\n project.config.template ??= templateId;\n\n await project.update({args});\n })()\n .then(() => {\n observer.complete();\n })\n .catch((error) => {\n observer.error(error);\n });\n });\n}\n"],
|
|
5
|
-
"mappings": ";AACA,OAAO,gBAAgB;AAehB,gBAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,SAAO,IAAI,WAAgC,CAAC,aAAa;AACvD,KAAC,YAAY;AACX,eAAS,KAAK,gBAAgB;AAE9B,UAAI,UAAU,MAAM,UAAU,cAAc;AAAA,QAC1C;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAED,eAAS,KAAK,0BAA0B;AAGxC,cAAQ,OAAO,aAAa;AAE5B,YAAM,QAAQ,OAAO,EAAC,KAAI,CAAC;AAAA,IAC7B,GAAG,EACA,KAAK,MAAM;AACV,eAAS,SAAS;AAAA,IACpB,CAAC,EACA,MAAM,CAAC,
|
|
4
|
+
"sourcesContent": ["import {type CommandArguments} from '@jakubmazanec/cli';\nimport Observable from 'zen-observable';\n\nimport {type Workspace} from '../../workspace.js';\nimport {type createProjectCommand} from './createProjectCommand.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 // if the project doesn't have config with a template ID, it's on purpose, but it's still needed for the next update, so we'll add it manually\n project.config.template ??= templateId;\n\n await project.update({args});\n })()\n .then(() => {\n observer.complete();\n })\n .catch((error: unknown) => {\n observer.error(error);\n });\n });\n}\n"],
|
|
5
|
+
"mappings": ";AACA,OAAO,gBAAgB;AAehB,gBAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,SAAO,IAAI,WAAgC,CAAC,aAAa;AACvD,KAAC,YAAY;AACX,eAAS,KAAK,gBAAgB;AAE9B,UAAI,UAAU,MAAM,UAAU,cAAc;AAAA,QAC1C;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAED,eAAS,KAAK,0BAA0B;AAGxC,cAAQ,OAAO,aAAa;AAE5B,YAAM,QAAQ,OAAO,EAAC,KAAI,CAAC;AAAA,IAC7B,GAAG,EACA,KAAK,MAAM;AACV,eAAS,SAAS;AAAA,IACpB,CAAC,EACA,MAAM,CAAC,UAAmB;AACzB,eAAS,MAAM,KAAK;AAAA,IACtB,CAAC;AAAA,EACL,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -52,17 +52,17 @@ export function CreateWorkspace({ args }) {
|
|
|
52
52
|
/* @__PURE__ */ jsx(
|
|
53
53
|
CreateWorkspaceInput,
|
|
54
54
|
{
|
|
55
|
-
values: createWorkspaceInputResult,
|
|
56
55
|
marginTop: 1,
|
|
56
|
+
values: createWorkspaceInputResult,
|
|
57
57
|
onChange: setCreateWorkspaceInputResult,
|
|
58
58
|
onComplete: setCreateWorkspaceInputResult
|
|
59
59
|
}
|
|
60
60
|
),
|
|
61
|
-
status === "in-progress" || status === "finished" ? /* @__PURE__ */ jsxs(Box, {
|
|
62
|
-
/* @__PURE__ */ jsx(Header, { showSpinner: status === "in-progress",
|
|
61
|
+
status === "in-progress" || status === "finished" ? /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
|
|
62
|
+
/* @__PURE__ */ jsx(Header, { icon: icons.success, marginBottom: 1, showSpinner: status === "in-progress", children: /* @__PURE__ */ jsx(Text, { children: "Creating workspace..." }) }),
|
|
63
63
|
jobs.map((job) => /* @__PURE__ */ jsx(Text, { children: `${icons.info} ${job}` }, job))
|
|
64
64
|
] }) : null,
|
|
65
|
-
status === "finished" ? /* @__PURE__ */ jsx(Header, {
|
|
65
|
+
status === "finished" ? /* @__PURE__ */ jsx(Header, { icon: icons.success, marginTop: 1, children: /* @__PURE__ */ jsx(Text, { children: "Done." }) }) : null
|
|
66
66
|
] });
|
|
67
67
|
}
|
|
68
68
|
//# sourceMappingURL=CreateWorkspace.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/commands/create-workspace/CreateWorkspace.tsx"],
|
|
4
|
-
"sourcesContent": ["import {colors, type CommandArguments, Header, icons, 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 CommandStatus} from '../internals.js';\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};\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.info](workspacePath)}.`}</Text>\n\n <CreateWorkspaceInput\n
|
|
5
|
-
"mappings": ";AA+DM,cAUE,YAVF;AA/DN,SAAQ,QAA+B,QAAQ,OAAO,kBAAiB;AACvE,OAAO,WAAW;AAClB,SAAQ,KAAK,YAAW;AACxB,OAAO,UAAU;AACjB,SAAQ,WAAW,gBAAe;AAIlC,SAAQ,4BAA4D;AACpE,SAAQ,0BAAyB;AAM1B,gBAAS,gBAAgB,EAAC,KAAI,GAAyB;AAC5D,MAAI,CAAC,QAAQ,SAAS,IAAI,SAAwB,aAAa;AAC/D,MAAI,CAAC,cAAc,eAAe,IAAI,SAA4C,IAAI;AACtF,MAAI,CAAC,MAAM,OAAO,IAAI,SAAmB,CAAC,CAAC;AAC3C,MAAI,CAAC,4BAA4B,6BAA6B,IAC5D,SAAqC,OAAO;AAAA,IAC1C,YAAY,EAAC,OAAO,KAAK,QAAQ,YAAY,IAAI,YAAY,CAAC,CAAC,KAAK,QAAQ,SAAQ;AAAA,EACtF,EAAE;AACJ,MAAI,EAAC,KAAI,IAAI,WAAW;AACxB,MAAI,gBAAgB,KAAK,QAAQ,QAAQ,IAAI,GAAG,KAAK,QAAQ,QAAQ,EAAE;AAEvE,YAAU,MAAM;AACd,QAAI,OAAO,QAAQ,0BAA0B,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,MAAM,OAAO,UAAU,GAAG;AACvF,gBAAU,aAAa;AAAA,IACzB;AAAA,EACF,GAAG,CAAC,0BAA0B,CAAC;AAE/B,YAAU,MAAM;AACd,QAAI,WAAW,iBAAiB,CAAC,cAAc;AAC7C,UAAI,kBAAkB,mBAAmB;AAAA,QACvC;AAAA,QACA,YAAY,2BAA2B,WAAW;AAAA,QAClD;AAAA,MACF,CAAC,EAAE,UAAU;AAAA,QACX,KAAK,OAAO;AACV,kBAAQ,CAAC,iBAAiB,CAAC,GAAG,cAAc,KAAK,CAAC;AAAA,QACpD;AAAA,QACA,MAAM,OAAO;AACX,eAAK,KAAK;AAAA,QACZ;AAAA,QACA,WAAW;AACT,0BAAgB,YAAY;AAC5B,oBAAU,UAAU;AAAA,QACtB;AAAA,MACF,CAAC;AAED,sBAAgB,eAAe;AAAA,IACjC;AAEA,WAAO,MAAM;AACX,UAAI,cAAc;AAChB,qBAAa,YAAY;AAAA,MAC3B;AAAA,IACF;AAAA,EACF,GAAG,CAAC,4BAA4B,QAAQ,cAAc,MAAM,MAAM,aAAa,CAAC;AAEhF,SACE,qBAAC,OAAI,eAAc,UACjB;AAAA,wBAAC,QAAM,mCAAyB,MAAM,OAAO,IAAI,EAAE,aAAa,CAAC,KAAI;AAAA,IAErE;AAAA,MAAC;AAAA;AAAA,QACC,
|
|
4
|
+
"sourcesContent": ["import {colors, type CommandArguments, Header, icons, 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 CommandStatus} from '../internals.js';\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};\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.info](workspacePath)}.`}</Text>\n\n <CreateWorkspaceInput\n marginTop={1}\n values={createWorkspaceInputResult}\n onChange={setCreateWorkspaceInputResult}\n onComplete={setCreateWorkspaceInputResult}\n />\n\n {status === 'in-progress' || status === 'finished' ?\n <Box flexDirection=\"column\" marginTop={1}>\n <Header icon={icons.success} marginBottom={1} showSpinner={status === 'in-progress'}>\n <Text>Creating workspace...</Text>\n </Header>\n\n {jobs.map((job) => (\n <Text key={job}>{`${icons.info} ${job}`}</Text>\n ))}\n </Box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AAA,QACpD;AAAA,QACA,MAAM,OAAO;AACX,eAAK,KAAK;AAAA,QACZ;AAAA,QACA,WAAW;AACT,0BAAgB,YAAY;AAC5B,oBAAU,UAAU;AAAA,QACtB;AAAA,MACF,CAAC;AAED,sBAAgB,eAAe;AAAA,IACjC;AAEA,WAAO,MAAM;AACX,UAAI,cAAc;AAChB,qBAAa,YAAY;AAAA,MAC3B;AAAA,IACF;AAAA,EACF,GAAG,CAAC,4BAA4B,QAAQ,cAAc,MAAM,MAAM,aAAa,CAAC;AAEhF,SACE,qBAAC,OAAI,eAAc,UACjB;AAAA,wBAAC,QAAM,mCAAyB,MAAM,OAAO,IAAI,EAAE,aAAa,CAAC,KAAI;AAAA,IAErE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,QACX,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,YAAY;AAAA;AAAA,IACd;AAAA,IAEC,WAAW,iBAAiB,WAAW,aACtC,qBAAC,OAAI,eAAc,UAAS,WAAW,GACrC;AAAA,0BAAC,UAAO,MAAM,MAAM,SAAS,cAAc,GAAG,aAAa,WAAW,eACpE,8BAAC,QAAK,mCAAqB,GAC7B;AAAA,MAEC,KAAK,IAAI,CAAC,QACT,oBAAC,QAAgB,aAAG,MAAM,IAAI,IAAI,GAAG,MAA1B,GAA6B,CACzC;AAAA,OACH,IACA;AAAA,IAED,WAAW,aACV,oBAAC,UAAO,MAAM,MAAM,SAAS,WAAW,GACtC,8BAAC,QAAK,mBAAK,GACb,IACA;AAAA,KACJ;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/commands/create-workspace/runCreateWorkspace.ts"],
|
|
4
|
-
"sourcesContent": ["import {type CommandArguments} from '@jakubmazanec/cli';\nimport Observable from 'zen-observable';\n\nimport {Workspace} from '../../workspace.js';\nimport {type createWorkspaceCommand} from './createWorkspaceCommand.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 // if the workspace doesn't have config with a template ID, it's on purpose, but it's still needed for the next update, so we'll add it manually\n workspace.config.template ??= templateId;\n\n await workspace.update({args});\n })()\n .then(() => {\n observer.complete();\n })\n .catch((error) => {\n observer.error(error);\n });\n });\n}\n"],
|
|
5
|
-
"mappings": ";AACA,OAAO,gBAAgB;AAEvB,SAAQ,iBAAgB;AAWjB,gBAAS,mBAAmB,EAAC,eAAe,YAAY,KAAI,GAA2B;AAC5F,SAAO,IAAI,WAAkC,CAAC,aAAa;AACzD,KAAC,YAAY;AACX,eAAS,KAAK,gBAAgB;AAE9B,UAAI,YAAY,MAAM,UAAU,OAAO;AAAA,QACrC;AAAA,QACA,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAED,eAAS,KAAK,4BAA4B;AAG1C,gBAAU,OAAO,aAAa;AAE9B,YAAM,UAAU,OAAO,EAAC,KAAI,CAAC;AAAA,IAC/B,GAAG,EACA,KAAK,MAAM;AACV,eAAS,SAAS;AAAA,IACpB,CAAC,EACA,MAAM,CAAC,
|
|
4
|
+
"sourcesContent": ["import {type CommandArguments} from '@jakubmazanec/cli';\nimport Observable from 'zen-observable';\n\nimport {Workspace} from '../../workspace.js';\nimport {type createWorkspaceCommand} from './createWorkspaceCommand.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 // if the workspace doesn't have config with a template ID, it's on purpose, but it's still needed for the next update, so we'll add it manually\n workspace.config.template ??= templateId;\n\n await workspace.update({args});\n })()\n .then(() => {\n observer.complete();\n })\n .catch((error: unknown) => {\n observer.error(error);\n });\n });\n}\n"],
|
|
5
|
+
"mappings": ";AACA,OAAO,gBAAgB;AAEvB,SAAQ,iBAAgB;AAWjB,gBAAS,mBAAmB,EAAC,eAAe,YAAY,KAAI,GAA2B;AAC5F,SAAO,IAAI,WAAkC,CAAC,aAAa;AACzD,KAAC,YAAY;AACX,eAAS,KAAK,gBAAgB;AAE9B,UAAI,YAAY,MAAM,UAAU,OAAO;AAAA,QACrC;AAAA,QACA,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAED,eAAS,KAAK,4BAA4B;AAG1C,gBAAU,OAAO,aAAa;AAE9B,YAAM,UAAU,OAAO,EAAC,KAAI,CAAC;AAAA,IAC/B,GAAG,EACA,KAAK,MAAM;AACV,eAAS,SAAS;AAAA,IACpB,CAAC,EACA,MAAM,CAAC,UAAmB;AACzB,eAAS,MAAM,KAAK;AAAA,IACtB,CAAC;AAAA,EACL,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './internals/CommandStatus.js';
|
|
1
|
+
export type * from './internals/CommandStatus.js';
|
|
2
2
|
export * from './internals/packageNameToDirectory.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/commands/internals.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './internals/CommandStatus.js';\nexport * from './internals/packageNameToDirectory.js';\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["export type * from './internals/CommandStatus.js';\nexport * from './internals/packageNameToDirectory.js';\n"],
|
|
5
|
+
"mappings": ";AACA,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -27,11 +27,11 @@ export function UpdateWorkspace({ workspace, args }) {
|
|
|
27
27
|
}, [args, exit, workspace]);
|
|
28
28
|
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
29
29
|
/* @__PURE__ */ jsx(Text, { children: `Updating workspace at ${chalk[colors.info](workspace.path)}.` }),
|
|
30
|
-
/* @__PURE__ */ jsxs(Box, {
|
|
31
|
-
/* @__PURE__ */ jsx(Header, {
|
|
30
|
+
/* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
|
|
31
|
+
/* @__PURE__ */ jsx(Header, { icon: icons.success, marginBottom: 1, showSpinner: !isFinished, children: /* @__PURE__ */ jsx(Text, { children: "Updating workspace and projects..." }) }),
|
|
32
32
|
jobs.map((job) => /* @__PURE__ */ jsx(Text, { children: `${icons.info} ${job}` }, job))
|
|
33
33
|
] }),
|
|
34
|
-
isFinished ? /* @__PURE__ */ jsx(Header, {
|
|
34
|
+
isFinished ? /* @__PURE__ */ jsx(Header, { icon: icons.success, marginTop: 1, children: /* @__PURE__ */ jsx(Text, { children: "Done." }) }) : null
|
|
35
35
|
] });
|
|
36
36
|
}
|
|
37
37
|
//# sourceMappingURL=UpdateWorkspace.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/commands/update-workspace/UpdateWorkspace.tsx"],
|
|
4
|
-
"sourcesContent": ["import {colors, type CommandArguments, Header, icons, useProgram} from '@jakubmazanec/cli';\nimport chalk from 'chalk';\nimport {Box, Text} from 'ink';\nimport {useEffect, useState} from 'react';\n\nimport {type Workspace} from '../../workspace.js';\nimport {runUpdateWorkspace} from './runUpdateWorkspace.js';\nimport {type updateWorkspaceCommand} from './updateWorkspaceCommand.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
|
|
5
|
-
"mappings": ";AAuCM,cAEA,YAFA;AAvCN,SAAQ,QAA+B,QAAQ,OAAO,kBAAiB;AACvE,OAAO,WAAW;AAClB,SAAQ,KAAK,YAAW;AACxB,SAAQ,WAAW,gBAAe;AAGlC,SAAQ,0BAAyB;AAQ1B,gBAAS,gBAAgB,EAAC,WAAW,KAAI,GAAyB;AACvE,MAAI,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAChD,MAAI,CAAC,MAAM,OAAO,IAAI,SAAmB,CAAC,CAAC;AAC3C,MAAI,EAAC,KAAI,IAAI,WAAW;AAExB,YAAU,MAAM;AACd,QAAI,eAAe,mBAAmB,EAAC,WAAW,KAAI,CAAC,EAAE,UAAU;AAAA,MACjE,KAAK,OAAO;AACV,gBAAQ,CAAC,iBAAiB,CAAC,GAAG,cAAc,KAAK,CAAC;AAAA,MACpD;AAAA,MACA,MAAM,OAAO;AACX,aAAK,KAAK;AAAA,MACZ;AAAA,MACA,WAAW;AACT,sBAAc,IAAI;AAAA,MACpB;AAAA,IACF,CAAC;AAED,WAAO,MAAM;AACX,mBAAa,YAAY;AAAA,IAC3B;AAAA,EACF,GAAG,CAAC,MAAM,MAAM,SAAS,CAAC;AAE1B,SACE,qBAAC,OAAI,eAAc,UACjB;AAAA,wBAAC,QAAM,mCAAyB,MAAM,OAAO,IAAI,EAAE,UAAU,IAAI,CAAC,KAAI;AAAA,IAEtE,qBAAC,OAAI,
|
|
4
|
+
"sourcesContent": ["import {colors, type CommandArguments, Header, icons, useProgram} from '@jakubmazanec/cli';\nimport chalk from 'chalk';\nimport {Box, Text} from 'ink';\nimport {useEffect, useState} from 'react';\n\nimport {type Workspace} from '../../workspace.js';\nimport {runUpdateWorkspace} from './runUpdateWorkspace.js';\nimport {type updateWorkspaceCommand} from './updateWorkspaceCommand.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 flexDirection=\"column\" marginTop={1}>\n <Header icon={icons.success} marginBottom={1} showSpinner={!isFinished}>\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 icon={icons.success} marginTop={1}>\n <Text>Done.</Text>\n </Header>\n : null}\n </Box>\n );\n}\n"],
|
|
5
|
+
"mappings": ";AAuCM,cAEA,YAFA;AAvCN,SAAQ,QAA+B,QAAQ,OAAO,kBAAiB;AACvE,OAAO,WAAW;AAClB,SAAQ,KAAK,YAAW;AACxB,SAAQ,WAAW,gBAAe;AAGlC,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-
"sourcesContent": ["import {type CommandArguments} from '@jakubmazanec/cli';\nimport Observable from 'zen-observable';\n\nimport {type Workspace} from '../../workspace.js';\nimport {type updateWorkspaceCommand} from './updateWorkspaceCommand.js';\n\nexport type UpdateWorkspaceAndProjectsOptions = {\n workspace: Workspace | Workspace<false>;\n args: CommandArguments<typeof updateWorkspaceCommand>;\n};\n\nexport type UpdateWorkspaceAndProjectsStatus = string;\n\nexport function runUpdateWorkspace({workspace, args}: UpdateWorkspaceAndProjectsOptions) {\n return new Observable<UpdateWorkspaceAndProjectsStatus>((observer) => {\n (async () => {\n // update workspace\n observer.next('Updating workspace');\n\n await workspace.update({args});\n\n // update projects\n for (let project of workspace.projects) {\n observer.next(`Updating project ${project.name ?? '?'}`);\n\n await project.update({args});\n }\n })()\n .then(() => {\n observer.complete();\n })\n .catch((error) => {\n observer.error(error);\n });\n });\n}\n"],
|
|
5
|
-
"mappings": ";AACA,OAAO,gBAAgB;AAYhB,gBAAS,mBAAmB,EAAC,WAAW,KAAI,GAAsC;AACvF,SAAO,IAAI,WAA6C,CAAC,aAAa;AACpE,KAAC,YAAY;AAEX,eAAS,KAAK,oBAAoB;AAElC,YAAM,UAAU,OAAO,EAAC,KAAI,CAAC;AAG7B,eAAS,WAAW,UAAU,UAAU;AACtC,iBAAS,KAAK,oBAAoB,QAAQ,QAAQ,GAAG,EAAE;AAEvD,cAAM,QAAQ,OAAO,EAAC,KAAI,CAAC;AAAA,MAC7B;AAAA,IACF,GAAG,EACA,KAAK,MAAM;AACV,eAAS,SAAS;AAAA,IACpB,CAAC,EACA,MAAM,CAAC,
|
|
4
|
+
"sourcesContent": ["import {type CommandArguments} from '@jakubmazanec/cli';\nimport Observable from 'zen-observable';\n\nimport {type Workspace} from '../../workspace.js';\nimport {type updateWorkspaceCommand} from './updateWorkspaceCommand.js';\n\nexport type UpdateWorkspaceAndProjectsOptions = {\n workspace: Workspace | Workspace<false>;\n args: CommandArguments<typeof updateWorkspaceCommand>;\n};\n\nexport type UpdateWorkspaceAndProjectsStatus = string;\n\nexport function runUpdateWorkspace({workspace, args}: UpdateWorkspaceAndProjectsOptions) {\n return new Observable<UpdateWorkspaceAndProjectsStatus>((observer) => {\n (async () => {\n // update workspace\n observer.next('Updating workspace');\n\n await workspace.update({args});\n\n // update projects\n for (let project of workspace.projects) {\n observer.next(`Updating project ${project.name ?? '?'}`);\n\n await project.update({args});\n }\n })()\n .then(() => {\n observer.complete();\n })\n .catch((error: unknown) => {\n observer.error(error);\n });\n });\n}\n"],
|
|
5
|
+
"mappings": ";AACA,OAAO,gBAAgB;AAYhB,gBAAS,mBAAmB,EAAC,WAAW,KAAI,GAAsC;AACvF,SAAO,IAAI,WAA6C,CAAC,aAAa;AACpE,KAAC,YAAY;AAEX,eAAS,KAAK,oBAAoB;AAElC,YAAM,UAAU,OAAO,EAAC,KAAI,CAAC;AAG7B,eAAS,WAAW,UAAU,UAAU;AACtC,iBAAS,KAAK,oBAAoB,QAAQ,QAAQ,GAAG,EAAE;AAEvD,cAAM,QAAQ,OAAO,EAAC,KAAI,CAAC;AAAA,MAC7B;AAAA,IACF,GAAG,EACA,KAAK,MAAM;AACV,eAAS,SAAS;AAAA,IACpB,CAAC,EACA,MAAM,CAAC,UAAmB;AACzB,eAAS,MAAM,KAAK;AAAA,IACtB,CAAC;AAAA,EACL,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -17,7 +17,7 @@ export const updateWorkspaceCommand = new Command(
|
|
|
17
17
|
throw project.errors[0];
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
await program.renderElement(/* @__PURE__ */ jsx(UpdateWorkspace, {
|
|
20
|
+
await program.renderElement(/* @__PURE__ */ jsx(UpdateWorkspace, { args, workspace }));
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
description: "Updates files in a workspace.",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/commands/update-workspace/updateWorkspaceCommand.tsx"],
|
|
4
|
-
"sourcesContent": ["import {Command} from '@jakubmazanec/cli';\nimport path from 'node:path';\n\nimport {Workspace} from '../../workspace.js';\nimport {UpdateWorkspace} from './UpdateWorkspace.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 if (workspace.errors[0]) {\n throw workspace.errors[0];\n }\n\n for (let project of workspace.projects) {\n if (project.errors[0]) {\n throw project.errors[0];\n }\n }\n\n await program.renderElement(<UpdateWorkspace
|
|
5
|
-
"mappings": ";AAsBgC;AAtBhC,SAAQ,eAAc;AACtB,OAAO,UAAU;AAEjB,SAAQ,iBAAgB;AACxB,SAAQ,uBAAsB;AAEvB,aAAM,yBAAyB,IAAI;AAAA,EACxC;AAAA,EACA,OAAO,MAAM,YAAY;AACvB,QAAI,eAAe,KAAK,QAAQ,QAAQ,IAAI,GAAG,KAAK,QAAQ,QAAQ,EAAE;AACtE,QAAI,YAAY,MAAM,UAAU,YAAY,cAAc,EAAC,iBAAiB,KAAI,CAAC;AAEjF,QAAI,UAAU,OAAO,CAAC,GAAG;AACvB,YAAM,UAAU,OAAO,CAAC;AAAA,IAC1B;AAEA,aAAS,WAAW,UAAU,UAAU;AACtC,UAAI,QAAQ,OAAO,CAAC,GAAG;AACrB,cAAM,QAAQ,OAAO,CAAC;AAAA,MACxB;AAAA,IACF;AAEA,UAAM,QAAQ,cAAc,oBAAC,mBAAgB,WAAsB,
|
|
4
|
+
"sourcesContent": ["import {Command} from '@jakubmazanec/cli';\nimport path from 'node:path';\n\nimport {Workspace} from '../../workspace.js';\nimport {UpdateWorkspace} from './UpdateWorkspace.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 if (workspace.errors[0]) {\n throw workspace.errors[0];\n }\n\n for (let project of workspace.projects) {\n if (project.errors[0]) {\n throw project.errors[0];\n }\n }\n\n await program.renderElement(<UpdateWorkspace args={args} workspace={workspace} />);\n },\n {\n description: 'Updates files in a workspace.',\n options: {\n path: {\n type: 'string',\n },\n },\n },\n);\n"],
|
|
5
|
+
"mappings": ";AAsBgC;AAtBhC,SAAQ,eAAc;AACtB,OAAO,UAAU;AAEjB,SAAQ,iBAAgB;AACxB,SAAQ,uBAAsB;AAEvB,aAAM,yBAAyB,IAAI;AAAA,EACxC;AAAA,EACA,OAAO,MAAM,YAAY;AACvB,QAAI,eAAe,KAAK,QAAQ,QAAQ,IAAI,GAAG,KAAK,QAAQ,QAAQ,EAAE;AACtE,QAAI,YAAY,MAAM,UAAU,YAAY,cAAc,EAAC,iBAAiB,KAAI,CAAC;AAEjF,QAAI,UAAU,OAAO,CAAC,GAAG;AACvB,YAAM,UAAU,OAAO,CAAC;AAAA,IAC1B;AAEA,aAAS,WAAW,UAAU,UAAU;AACtC,UAAI,QAAQ,OAAO,CAAC,GAAG;AACrB,cAAM,QAAQ,OAAO,CAAC;AAAA,MACxB;AAAA,IACF;AAEA,UAAM,QAAQ,cAAc,oBAAC,mBAAgB,MAAY,WAAsB,CAAE;AAAA,EACnF;AAAA,EACA;AAAA,IACE,aAAa;AAAA,IACb,SAAS;AAAA,MACP,MAAM;AAAA,QACJ,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/template/applyTemplateRenders.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import fs from 'fs-extra';\nimport path from 'node:path';\nimport prettier from 'prettier';\n\nimport {CARSON_CONFIG_DIRECTORY} from '../constants.js';\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';\n\nexport type ApplyTemplateRendersOptions = {\n templateRenders: TemplateRenders;\n targetPath: string;\n snapshotPath?: string | undefined;\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 targetPath,\n snapshotPath,\n ignoreStrategies,\n}: ApplyTemplateRendersOptions) {\n // we need to clear Prettier cache, because we are changing file system\n await prettier.clearConfigCache();\n\n // first, we read the existing snapshots and use them to undo previous changes\n if (snapshotPath && (await fs.pathExists(snapshotPath))) {\n let templateRenderSnapshots = await loadTemplateRenderSnapshots(snapshotPath);\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 === 'ensure') {\n await deleteUsingTemplateRender(templateRenderSnapshot, targetPath, {\n onlyDeleteWhenContentsMatch: true,\n });\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 // second, we apply strategies that create files\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 === 'create') {\n await createUsingTemplateRender(templateRender, targetPath);\n }\n\n if (templateRender.attributes.strategy === 'ensure') {\n let to = path.join(targetPath, templateRender.attributes.to);\n let doesToExist = await fs.pathExists(to);\n\n if (!doesToExist) {\n await createUsingTemplateRender(templateRender, targetPath);\n }\n }\n }\n\n // third, we apply strategies that change files\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 if (snapshotPath) {\n await fs.ensureDir(path.join(targetPath, CARSON_CONFIG_DIRECTORY));\n\n await saveTemplateRenderSnapshots(templateRenders, snapshotPath);\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,cAAc;AAErB,SAAQ,+BAA8B;AACtC,SAAQ,2BAA0B;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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a;AAChB,cAAM,0BAA0B,gBAAgB,UAAU;AAAA,MAC5D;AAAA,IACF;AAAA,EACF;AAGA,WAAS,kBAAkB,iBAAiB;AAC1C,QAAI,WACF,OAAO,eAAe,WAAW,aAAa,WAC5C,eAAe,WAAW,WAC1B,eAAe,WAAW,SAAS,CAAC;AAExC,QAAI,iBAAiB,SAAS,QAAQ,GAAG;AACvC;AAAA,IACF;AAEA,QAAI,eAAe,WAAW,aAAa,aAAa;AACtD,YAAM,6BAA6B,gBAAgB,UAAU;AAAA,IAC/D;AAEA,QAAI,eAAe,WAAW,aAAa,SAAS;AAClD,YAAM,yBAAyB,gBAAgB,UAAU;AAAA,IAC3D;AAEA,QAAI,eAAe,WAAW,SAAS,CAAC,MAAM,UAAU;AACtD,YAAM,0BAA0B,gBAAgB,UAAU;AAAA,IAC5D;AAEA,QAAI,eAAe,WAAW,aAAa,SAAS;AAClD,UAAI,KAAK,KAAK,KAAK,YAAY,eAAe,WAAW,EAAE;AAC3D,UAAI,cAAc,MAAM,GAAG,WAAW,EAAE;AAExC,UAAI,CAAC,aAAa;AAChB,cAAM,IAAI,oBAAoB,yBAAyB;AAAA,UACrD,mBAAmB,CAAC,eAAe,WAAW,UAAU,eAAe,SAAS,MAAM,EAAE;AAAA,UACxF,MAAM;AAAA,YACJ,MAAM;AAAA,UACR;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,MAAI,cAAc;AAChB,UAAM,GAAG,UAAU,KAAK,KAAK,YAAY,uBAAuB,CAAC;AAEjE,UAAM,4BAA4B,iBAAiB,YAAY;AAAA,EACjE;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/template.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from './template/applyTemplateRenders.js';
|
|
2
|
-
export * from './template/CarsonTemplate.js';
|
|
2
|
+
export type * from './template/CarsonTemplate.js';
|
|
3
3
|
export * from './template/CarsonTemplateConfig.js';
|
|
4
4
|
export * from './template/CarsonTemplateError.js';
|
|
5
5
|
export * from './template/renderCarsonTemplate.js';
|
|
6
6
|
export * from './template/TemplateAttributes.js';
|
|
7
7
|
export * from './template/TemplateData.js';
|
|
8
|
-
export * from './template/TemplateRender.js';
|
|
9
|
-
export * from './template/TemplateRenders.js';
|
|
8
|
+
export type * from './template/TemplateRender.js';
|
|
9
|
+
export type * from './template/TemplateRenders.js';
|
package/build/template.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
export * from "./template/applyTemplateRenders.js";
|
|
3
|
-
export * from "./template/CarsonTemplate.js";
|
|
4
3
|
export * from "./template/CarsonTemplateConfig.js";
|
|
5
4
|
export * from "./template/CarsonTemplateError.js";
|
|
6
5
|
export * from "./template/renderCarsonTemplate.js";
|
|
7
6
|
export * from "./template/TemplateAttributes.js";
|
|
8
7
|
export * from "./template/TemplateData.js";
|
|
9
|
-
export * from "./template/TemplateRender.js";
|
|
10
|
-
export * from "./template/TemplateRenders.js";
|
|
11
8
|
//# sourceMappingURL=template.js.map
|
package/build/template.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../source/template.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './template/applyTemplateRenders.js';\nexport * from './template/CarsonTemplate.js';\nexport * from './template/CarsonTemplateConfig.js';\nexport * from './template/CarsonTemplateError.js';\nexport * from './template/renderCarsonTemplate.js';\nexport * from './template/TemplateAttributes.js';\nexport * from './template/TemplateData.js';\nexport * from './template/TemplateRender.js';\nexport * from './template/TemplateRenders.js';\n"],
|
|
5
|
-
"mappings": ";AAAA,cAAc;
|
|
4
|
+
"sourcesContent": ["export * from './template/applyTemplateRenders.js';\nexport type * from './template/CarsonTemplate.js';\nexport * from './template/CarsonTemplateConfig.js';\nexport * from './template/CarsonTemplateError.js';\nexport * from './template/renderCarsonTemplate.js';\nexport * from './template/TemplateAttributes.js';\nexport * from './template/TemplateData.js';\nexport type * from './template/TemplateRender.js';\nexport type * from './template/TemplateRenders.js';\n"],
|
|
5
|
+
"mappings": ";AAAA,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/workspace/WorkspaceDependencies.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import _ from 'lodash';\nimport semver from 'semver';\n\nimport {compareSemver, compareWorkspaceDependencyProjectName} from './internals.js';\nimport {type Workspace} from './Workspace.js';\nimport {type WorkspaceDependenciesFromWorkspaceOptions} from './WorkspaceDependenciesFromWorkspaceOptions.js';\nimport {type WorkspaceDependenciesGetVersionsOptions} from './WorkspaceDependenciesGetVersionsOptions.js';\nimport {type WorkspaceDependency} from './WorkspaceDependency.js';\n\n/**\n * A collection of {@link WorkspaceDependency | workspace dependencies} that are installed in {@link Workspace | a workspace}.\n */\nexport class WorkspaceDependencies<M extends boolean = true> extends Array<WorkspaceDependency> {\n /** The workspace the dependencies are installed in. */\n workspace: Workspace<M>;\n\n constructor(...args: [...WorkspaceDependency[], Workspace<M>]) {\n super();\n\n if (args.length === 1) {\n [this.workspace] = args as [Workspace<M>];\n } else {\n let values = args.slice(0, -1) as WorkspaceDependency[];\n let workspace = args.at(-1) as Workspace<M>;\n\n this.push(...values);\n\n this.workspace = workspace;\n }\n }\n\n /**\n * Adds one or more new dependencies.\n *\n * @param newWorkspaceDependencies The dependencies to add.\n * @returns The new length of the collection.\n */\n override push(...newWorkspaceDependencies: WorkspaceDependency[]): number {\n for (let newWorkspaceDependency of newWorkspaceDependencies) {\n let doesExist = false;\n\n for (let workspaceDependency of this) {\n if (workspaceDependency.name === newWorkspaceDependency.name) {\n doesExist = true;\n\n workspaceDependency.versions = _.union(\n workspaceDependency.versions,\n newWorkspaceDependency.versions,\n );\n workspaceDependency.exactVersions = _.union(\n workspaceDependency.exactVersions,\n newWorkspaceDependency.exactVersions,\n );\n workspaceDependency.projects = _.unionWith(\n workspaceDependency.projects,\n newWorkspaceDependency.projects,\n (a, b) => a.name === b.name,\n );\n\n workspaceDependency.versions.sort(compareSemver);\n workspaceDependency.exactVersions.sort(compareSemver);\n workspaceDependency.projects.sort(compareWorkspaceDependencyProjectName);\n }\n }\n\n if (!doesExist) {\n super.push(newWorkspaceDependency);\n }\n }\n\n return this.length;\n }\n\n /**\n * Creates new {@link WorkspaceDependencies} instance from a {@link Workspace} instance and its dependencies.\n *\n * @param workspace The workspace from which the dependnecies are taken.\n * @param options Options.\n * @returns The new {@link WorkspaceDependencies} instance.\n */\n static fromWorkspace<M extends boolean = true>(\n workspace: Workspace<M>,\n options?: WorkspaceDependenciesFromWorkspaceOptions,\n ) {\n let workspaceDependencies: WorkspaceDependency[] = [];\n\n if (options?.includeWorkspaceDependencies) {\n for (let [dependencyName, dependencyVersion] of Object.entries({\n ...workspace.packageJson?.dependencies,\n ...workspace.packageJson?.devDependencies,\n })) {\n let exactDependencyVersion =\n semver.validRange(dependencyVersion) ?\n (semver.minVersion(dependencyVersion)?.format() ??\n semver.coerce(dependencyVersion)?.format() ??\n dependencyVersion.trim())\n : dependencyVersion.trim();\n\n let workspaceDependency: WorkspaceDependency = {\n name: dependencyName,\n versions: [dependencyVersion],\n exactVersions: [exactDependencyVersion],\n projects: [],\n };\n\n workspaceDependencies.push(workspaceDependency);\n }\n }\n\n for (let project of workspace.projects) {\n if (!options?.includeOnlyDevDependencies) {\n for (let [dependencyName, dependencyVersion] of Object.entries(\n project.packageJson.dependencies ?? {},\n )) {\n let exactDependencyVersion =\n semver.validRange(dependencyVersion) ?\n (semver.minVersion(dependencyVersion)?.format() ??\n semver.coerce(dependencyVersion)?.format() ??\n dependencyVersion.trim())\n : dependencyVersion.trim();\n\n let workspaceDependency: WorkspaceDependency = {\n name: dependencyName,\n versions: [dependencyVersion],\n exactVersions: [exactDependencyVersion],\n projects: [],\n };\n\n if (project.name) {\n workspaceDependency.projects = [\n {\n name: project.name,\n version: dependencyVersion,\n exactVersion: exactDependencyVersion,\n },\n ];\n }\n\n workspaceDependencies.push(workspaceDependency);\n }\n }\n\n if (options?.includeDevDependencies || options?.includeOnlyDevDependencies) {\n for (let [dependencyName, dependencyVersion] of Object.entries(\n project.packageJson.devDependencies ?? {},\n )) {\n let exactDependencyVersion =\n semver.validRange(dependencyVersion) ?\n (semver.minVersion(dependencyVersion)?.format() ??\n semver.coerce(dependencyVersion)?.format() ??\n dependencyVersion.trim())\n : dependencyVersion.trim();\n\n let workspaceDependency: WorkspaceDependency = {\n name: dependencyName,\n versions: [dependencyVersion],\n exactVersions: [exactDependencyVersion],\n projects: [],\n };\n\n if (project.name) {\n workspaceDependency.projects = [\n {\n name: project.name,\n version: dependencyVersion,\n exactVersion: exactDependencyVersion,\n },\n ];\n }\n\n workspaceDependencies.push(workspaceDependency);\n }\n }\n }\n\n return new this(...workspaceDependencies, workspace);\n }\n\n /**\n * Creates map of all dependnecies and their installed version.\n *\n * @param options Options.\n * @returns Object whose keys are dependency names and values are sorted versions.\n */\n getVersions(options?: WorkspaceDependenciesGetVersionsOptions) {\n let versions: Record<string, string[]> = {};\n\n for (let dependency of this) {\n versions[dependency.name] =\n options?.useExactVersions ? dependency.exactVersions : dependency.versions;\n }\n\n return versions;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,OAAO;AACd,OAAO,YAAY;AAEnB,SAAQ,eAAe,6CAA4C;AAS5D,aAAM,8BAAwD,MAA2B;AAAA;AAAA,EAE9F;AAAA,EAEA,eAAe,MAAgD;AAC7D,UAAM;AAEN,QAAI,KAAK,WAAW,GAAG;AACrB,OAAC,KAAK,SAAS,IAAI;AAAA,IACrB,OAAO;AACL,UAAI,SAAS,KAAK,MAAM,GAAG,EAAE;AAC7B,UAAI,YAAY,KAAK,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AA,YAC5B,eAAe,CAAC,sBAAsB;AAAA,YACtC,UAAU,CAAC;AAAA,UACb;AAEA,cAAI,QAAQ,MAAM;AAChB,gCAAoB,WAAW;AAAA,cAC7B;AAAA,gBACE,MAAM,QAAQ;AAAA,gBACd,SAAS;AAAA,gBACT,cAAc;AAAA,cAChB;AAAA,YACF;AAAA,UACF;AAEA,gCAAsB,KAAK,mBAAmB;AAAA,QAChD;AAAA,MACF;AAAA,IACF;AAEA,WAAO,IAAI,KAAK,GAAG,uBAAuB,SAAS;AAAA,EACrD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,YAAY,SAAmD;AAC7D,QAAI,WAAqC,CAAC;AAE1C,aAAS,cAAc,MAAM;AAC3B,eAAS,WAAW,IAAI,IACtB,SAAS,mBAAmB,WAAW,gBAAgB,WAAW;AAAA,IACtE;AAEA,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/workspace/internals/getRepositoryBranches.ts"],
|
|
4
|
-
"sourcesContent": ["import {simpleGit} from 'simple-git';\n\nconst REMOTE_NAME_PREFIX_REGEXP = /^[^/]*\\//iu;\n\nexport async function getRepositoryBranches(repositoryPath: string): Promise<string[] | undefined> {\n let repositoryBranches: string[] | undefined;\n\n try {\n let git = simpleGit({\n baseDir: repositoryPath,\n binary: 'git',\n maxConcurrentProcesses: 1,\n });\n\n let branchSummary = await git.branch(['-r']);\n\n repositoryBranches = branchSummary.all.map((branch) =>\n branch.replace(REMOTE_NAME_PREFIX_REGEXP, ''),\n );\n\n if (!repositoryBranches.length) {\n branchSummary = await git.branch(['-a']);\n\n repositoryBranches = branchSummary.all.map((branch) =>\n branch.replace(REMOTE_NAME_PREFIX_REGEXP, ''),\n );\n }\n } catch
|
|
5
|
-
"mappings": ";AAAA,SAAQ,iBAAgB;AAExB,MAAM,4BAA4B;AAElC,sBAAsB,sBAAsB,gBAAuD;AACjG,MAAI;AAEJ,MAAI;AACF,QAAI,MAAM,UAAU;AAAA,MAClB,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,wBAAwB;AAAA,IAC1B,CAAC;AAED,QAAI,gBAAgB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;AAE3C,yBAAqB,cAAc,IAAI;AAAA,MAAI,CAAC,WAC1C,OAAO,QAAQ,2BAA2B,EAAE;AAAA,IAC9C;AAEA,QAAI,CAAC,mBAAmB,QAAQ;AAC9B,sBAAgB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;AAEvC,2BAAqB,cAAc,IAAI;AAAA,QAAI,CAAC,WAC1C,OAAO,QAAQ,2BAA2B,EAAE;AAAA,MAC9C;AAAA,IACF;AAAA,EACF,
|
|
4
|
+
"sourcesContent": ["import {simpleGit} from 'simple-git';\n\nconst REMOTE_NAME_PREFIX_REGEXP = /^[^/]*\\//iu;\n\nexport async function getRepositoryBranches(repositoryPath: string): Promise<string[] | undefined> {\n let repositoryBranches: string[] | undefined;\n\n try {\n let git = simpleGit({\n baseDir: repositoryPath,\n binary: 'git',\n maxConcurrentProcesses: 1,\n });\n\n let branchSummary = await git.branch(['-r']);\n\n repositoryBranches = branchSummary.all.map((branch) =>\n branch.replace(REMOTE_NAME_PREFIX_REGEXP, ''),\n );\n\n if (!repositoryBranches.length) {\n branchSummary = await git.branch(['-a']);\n\n repositoryBranches = branchSummary.all.map((branch) =>\n branch.replace(REMOTE_NAME_PREFIX_REGEXP, ''),\n );\n }\n } catch {\n // no-op\n }\n\n return repositoryBranches;\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAQ,iBAAgB;AAExB,MAAM,4BAA4B;AAElC,sBAAsB,sBAAsB,gBAAuD;AACjG,MAAI;AAEJ,MAAI;AACF,QAAI,MAAM,UAAU;AAAA,MAClB,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,wBAAwB;AAAA,IAC1B,CAAC;AAED,QAAI,gBAAgB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;AAE3C,yBAAqB,cAAc,IAAI;AAAA,MAAI,CAAC,WAC1C,OAAO,QAAQ,2BAA2B,EAAE;AAAA,IAC9C;AAEA,QAAI,CAAC,mBAAmB,QAAQ;AAC9B,sBAAgB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;AAEvC,2BAAqB,cAAc,IAAI;AAAA,QAAI,CAAC,WAC1C,OAAO,QAAQ,2BAA2B,EAAE;AAAA,MAC9C;AAAA,IACF;AAAA,EACF,QAAQ;AAAA,EAER;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/workspace.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
export * from './workspace/Project.js';
|
|
2
2
|
export * from './workspace/ProjectConfig.js';
|
|
3
|
-
export * from './workspace/ProjectCreateOptions.js';
|
|
3
|
+
export type * from './workspace/ProjectCreateOptions.js';
|
|
4
4
|
export * from './workspace/ProjectError.js';
|
|
5
|
-
export * from './workspace/ProjectOptions.js';
|
|
6
|
-
export * from './workspace/ProjectUpdateOptions.js';
|
|
5
|
+
export type * from './workspace/ProjectOptions.js';
|
|
6
|
+
export type * from './workspace/ProjectUpdateOptions.js';
|
|
7
7
|
export * from './workspace/saveProjectConfig.js';
|
|
8
8
|
export * from './workspace/saveWorkspaceConfig.js';
|
|
9
9
|
export * from './workspace/Workspace.js';
|
|
10
10
|
export * from './workspace/WorkspaceConfig.js';
|
|
11
|
-
export * from './workspace/WorkspaceCreateOptions.js';
|
|
12
|
-
export * from './workspace/WorkspaceCreateProjectOptions.js';
|
|
11
|
+
export type * from './workspace/WorkspaceCreateOptions.js';
|
|
12
|
+
export type * from './workspace/WorkspaceCreateProjectOptions.js';
|
|
13
13
|
export * from './workspace/WorkspaceDependencies.js';
|
|
14
14
|
export * from './workspace/WorkspaceError.js';
|
|
15
|
-
export * from './workspace/WorkspaceFindAndReadOptions.js';
|
|
16
|
-
export * from './workspace/WorkspaceOptions.js';
|
|
17
|
-
export * from './workspace/WorkspaceOptionsProject.js';
|
|
18
|
-
export * from './workspace/WorkspacePackageJson.js';
|
|
19
|
-
export * from './workspace/WorkspaceProjectGlobs.js';
|
|
20
|
-
export * from './workspace/WorkspaceProjects.js';
|
|
21
|
-
export * from './workspace/WorkspaceRepository.js';
|
|
22
|
-
export * from './workspace/WorkspaceUpdateOptions.js';
|
|
15
|
+
export type * from './workspace/WorkspaceFindAndReadOptions.js';
|
|
16
|
+
export type * from './workspace/WorkspaceOptions.js';
|
|
17
|
+
export type * from './workspace/WorkspaceOptionsProject.js';
|
|
18
|
+
export type * from './workspace/WorkspacePackageJson.js';
|
|
19
|
+
export type * from './workspace/WorkspaceProjectGlobs.js';
|
|
20
|
+
export type * from './workspace/WorkspaceProjects.js';
|
|
21
|
+
export type * from './workspace/WorkspaceRepository.js';
|
|
22
|
+
export type * from './workspace/WorkspaceUpdateOptions.js';
|
package/build/workspace.js
CHANGED
|
@@ -1,24 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
export * from "./workspace/Project.js";
|
|
3
3
|
export * from "./workspace/ProjectConfig.js";
|
|
4
|
-
export * from "./workspace/ProjectCreateOptions.js";
|
|
5
4
|
export * from "./workspace/ProjectError.js";
|
|
6
|
-
export * from "./workspace/ProjectOptions.js";
|
|
7
|
-
export * from "./workspace/ProjectUpdateOptions.js";
|
|
8
5
|
export * from "./workspace/saveProjectConfig.js";
|
|
9
6
|
export * from "./workspace/saveWorkspaceConfig.js";
|
|
10
7
|
export * from "./workspace/Workspace.js";
|
|
11
8
|
export * from "./workspace/WorkspaceConfig.js";
|
|
12
|
-
export * from "./workspace/WorkspaceCreateOptions.js";
|
|
13
|
-
export * from "./workspace/WorkspaceCreateProjectOptions.js";
|
|
14
9
|
export * from "./workspace/WorkspaceDependencies.js";
|
|
15
10
|
export * from "./workspace/WorkspaceError.js";
|
|
16
|
-
export * from "./workspace/WorkspaceFindAndReadOptions.js";
|
|
17
|
-
export * from "./workspace/WorkspaceOptions.js";
|
|
18
|
-
export * from "./workspace/WorkspaceOptionsProject.js";
|
|
19
|
-
export * from "./workspace/WorkspacePackageJson.js";
|
|
20
|
-
export * from "./workspace/WorkspaceProjectGlobs.js";
|
|
21
|
-
export * from "./workspace/WorkspaceProjects.js";
|
|
22
|
-
export * from "./workspace/WorkspaceRepository.js";
|
|
23
|
-
export * from "./workspace/WorkspaceUpdateOptions.js";
|
|
24
11
|
//# sourceMappingURL=workspace.js.map
|
package/build/workspace.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../source/workspace.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './workspace/Project.js';\nexport * from './workspace/ProjectConfig.js';\nexport * from './workspace/ProjectCreateOptions.js';\nexport * from './workspace/ProjectError.js';\nexport * from './workspace/ProjectOptions.js';\nexport * from './workspace/ProjectUpdateOptions.js';\nexport * from './workspace/saveProjectConfig.js';\nexport * from './workspace/saveWorkspaceConfig.js';\nexport * from './workspace/Workspace.js';\nexport * from './workspace/WorkspaceConfig.js';\nexport * from './workspace/WorkspaceCreateOptions.js';\nexport * from './workspace/WorkspaceCreateProjectOptions.js';\nexport * from './workspace/WorkspaceDependencies.js';\nexport * from './workspace/WorkspaceError.js';\nexport * from './workspace/WorkspaceFindAndReadOptions.js';\nexport * from './workspace/WorkspaceOptions.js';\nexport * from './workspace/WorkspaceOptionsProject.js';\nexport * from './workspace/WorkspacePackageJson.js';\nexport * from './workspace/WorkspaceProjectGlobs.js';\nexport * from './workspace/WorkspaceProjects.js';\nexport * from './workspace/WorkspaceRepository.js';\nexport * from './workspace/WorkspaceUpdateOptions.js';\n"],
|
|
5
|
-
"mappings": ";AAAA,cAAc;AACd,cAAc;
|
|
4
|
+
"sourcesContent": ["export * from './workspace/Project.js';\nexport * from './workspace/ProjectConfig.js';\nexport type * from './workspace/ProjectCreateOptions.js';\nexport * from './workspace/ProjectError.js';\nexport type * from './workspace/ProjectOptions.js';\nexport type * from './workspace/ProjectUpdateOptions.js';\nexport * from './workspace/saveProjectConfig.js';\nexport * from './workspace/saveWorkspaceConfig.js';\nexport * from './workspace/Workspace.js';\nexport * from './workspace/WorkspaceConfig.js';\nexport type * from './workspace/WorkspaceCreateOptions.js';\nexport type * from './workspace/WorkspaceCreateProjectOptions.js';\nexport * from './workspace/WorkspaceDependencies.js';\nexport * from './workspace/WorkspaceError.js';\nexport type * from './workspace/WorkspaceFindAndReadOptions.js';\nexport type * from './workspace/WorkspaceOptions.js';\nexport type * from './workspace/WorkspaceOptionsProject.js';\nexport type * from './workspace/WorkspacePackageJson.js';\nexport type * from './workspace/WorkspaceProjectGlobs.js';\nexport type * from './workspace/WorkspaceProjects.js';\nexport type * from './workspace/WorkspaceRepository.js';\nexport type * from './workspace/WorkspaceUpdateOptions.js';\n"],
|
|
5
|
+
"mappings": ";AAAA,cAAc;AACd,cAAc;AAEd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jakubmazanec/carson",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2-next.80f405d",
|
|
4
4
|
"description": "Tool for managing workspace and project configuration.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"typecheck": "tsc --project tsconfig.typecheck.json"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@jakubmazanec/args": "
|
|
36
|
-
"@jakubmazanec/cli": "
|
|
37
|
-
"@jakubmazanec/error": "
|
|
38
|
-
"@jakubmazanec/fs-utils": "
|
|
39
|
-
"@jakubmazanec/template": "
|
|
40
|
-
"@jakubmazanec/ts-utils": "
|
|
41
|
-
"@jakubmazanec/zod-utils": "
|
|
35
|
+
"@jakubmazanec/args": "2.0.5-next.80f405d",
|
|
36
|
+
"@jakubmazanec/cli": "0.3.5-next.80f405d",
|
|
37
|
+
"@jakubmazanec/error": "3.0.5-next.80f405d",
|
|
38
|
+
"@jakubmazanec/fs-utils": "0.2.5-next.80f405d",
|
|
39
|
+
"@jakubmazanec/template": "2.0.5-next.80f405d",
|
|
40
|
+
"@jakubmazanec/ts-utils": "3.0.5-next.80f405d",
|
|
41
|
+
"@jakubmazanec/zod-utils": "2.0.5-next.80f405d",
|
|
42
42
|
"chalk": "^5.3.0",
|
|
43
43
|
"fast-glob": "^3.3.2",
|
|
44
44
|
"fflate": "^0.8.2",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"zod": "^3.23.8"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@jakubmazanec/eslint-config": "
|
|
58
|
+
"@jakubmazanec/eslint-config": "4.0.0-next.80f405d",
|
|
59
59
|
"@types/fs-extra": "^11.0.4",
|
|
60
60
|
"@types/lodash": "^4.17.13",
|
|
61
61
|
"@types/micromatch": "^4.0.9",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"concurrently": "^9.1.0",
|
|
68
68
|
"del-cli": "^6.0.0",
|
|
69
69
|
"esbuild": "^0.24.0",
|
|
70
|
-
"eslint": "^
|
|
70
|
+
"eslint": "^9.15.0",
|
|
71
71
|
"ink": "^5.0.1",
|
|
72
72
|
"lodash": "^4.17.21",
|
|
73
73
|
"prettier": "^3.3.3",
|
|
@@ -121,15 +121,15 @@ export function CreateProject({args, workspace}: CreateProjectProps) {
|
|
|
121
121
|
choices: possiblePaths,
|
|
122
122
|
},
|
|
123
123
|
}}
|
|
124
|
-
values={createProjectInputResult}
|
|
125
124
|
marginTop={1}
|
|
125
|
+
values={createProjectInputResult}
|
|
126
126
|
onChange={setCreateProjectInputResult}
|
|
127
127
|
onComplete={setCreateProjectInputResult}
|
|
128
128
|
/>
|
|
129
129
|
|
|
130
130
|
{status === 'in-progress' || status === 'finished' ?
|
|
131
|
-
<Box marginTop={1}
|
|
132
|
-
<Header showSpinner={status === 'in-progress'}
|
|
131
|
+
<Box flexDirection="column" marginTop={1}>
|
|
132
|
+
<Header icon={icons.success} marginBottom={1} showSpinner={status === 'in-progress'}>
|
|
133
133
|
<Text>Creating project...</Text>
|
|
134
134
|
</Header>
|
|
135
135
|
|
|
@@ -140,7 +140,7 @@ export function CreateProject({args, workspace}: CreateProjectProps) {
|
|
|
140
140
|
: null}
|
|
141
141
|
|
|
142
142
|
{status === 'finished' ?
|
|
143
|
-
<Header
|
|
143
|
+
<Header icon={icons.success} marginTop={1}>
|
|
144
144
|
<Text>Done.</Text>
|
|
145
145
|
</Header>
|
|
146
146
|
: null}
|
|
@@ -64,15 +64,15 @@ export function CreateWorkspace({args}: CreateWorkspaceProps) {
|
|
|
64
64
|
<Text>{`Creating workspace at ${chalk[colors.info](workspacePath)}.`}</Text>
|
|
65
65
|
|
|
66
66
|
<CreateWorkspaceInput
|
|
67
|
-
values={createWorkspaceInputResult}
|
|
68
67
|
marginTop={1}
|
|
68
|
+
values={createWorkspaceInputResult}
|
|
69
69
|
onChange={setCreateWorkspaceInputResult}
|
|
70
70
|
onComplete={setCreateWorkspaceInputResult}
|
|
71
71
|
/>
|
|
72
72
|
|
|
73
73
|
{status === 'in-progress' || status === 'finished' ?
|
|
74
|
-
<Box marginTop={1}
|
|
75
|
-
<Header showSpinner={status === 'in-progress'}
|
|
74
|
+
<Box flexDirection="column" marginTop={1}>
|
|
75
|
+
<Header icon={icons.success} marginBottom={1} showSpinner={status === 'in-progress'}>
|
|
76
76
|
<Text>Creating workspace...</Text>
|
|
77
77
|
</Header>
|
|
78
78
|
|
|
@@ -83,7 +83,7 @@ export function CreateWorkspace({args}: CreateWorkspaceProps) {
|
|
|
83
83
|
: null}
|
|
84
84
|
|
|
85
85
|
{status === 'finished' ?
|
|
86
|
-
<Header
|
|
86
|
+
<Header icon={icons.success} marginTop={1}>
|
|
87
87
|
<Text>Done.</Text>
|
|
88
88
|
</Header>
|
|
89
89
|
: null}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './internals/CommandStatus.js';
|
|
1
|
+
export type * from './internals/CommandStatus.js';
|
|
2
2
|
export * from './internals/packageNameToDirectory.js';
|
|
@@ -39,8 +39,8 @@ export function UpdateWorkspace({workspace, args}: UpdateWorkspaceProps) {
|
|
|
39
39
|
<Box flexDirection="column">
|
|
40
40
|
<Text>{`Updating workspace at ${chalk[colors.info](workspace.path)}.`}</Text>
|
|
41
41
|
|
|
42
|
-
<Box marginTop={1}
|
|
43
|
-
<Header
|
|
42
|
+
<Box flexDirection="column" marginTop={1}>
|
|
43
|
+
<Header icon={icons.success} marginBottom={1} showSpinner={!isFinished}>
|
|
44
44
|
<Text>Updating workspace and projects...</Text>
|
|
45
45
|
</Header>
|
|
46
46
|
|
|
@@ -50,7 +50,7 @@ export function UpdateWorkspace({workspace, args}: UpdateWorkspaceProps) {
|
|
|
50
50
|
</Box>
|
|
51
51
|
|
|
52
52
|
{isFinished ?
|
|
53
|
-
<Header
|
|
53
|
+
<Header icon={icons.success} marginTop={1}>
|
|
54
54
|
<Text>Done.</Text>
|
|
55
55
|
</Header>
|
|
56
56
|
: null}
|
|
@@ -20,7 +20,7 @@ export const updateWorkspaceCommand = new Command(
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
await program.renderElement(<UpdateWorkspace
|
|
23
|
+
await program.renderElement(<UpdateWorkspace args={args} workspace={workspace} />);
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
description: 'Updates files in a workspace.',
|
package/source/template.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from './template/applyTemplateRenders.js';
|
|
2
|
-
export * from './template/CarsonTemplate.js';
|
|
2
|
+
export type * from './template/CarsonTemplate.js';
|
|
3
3
|
export * from './template/CarsonTemplateConfig.js';
|
|
4
4
|
export * from './template/CarsonTemplateError.js';
|
|
5
5
|
export * from './template/renderCarsonTemplate.js';
|
|
6
6
|
export * from './template/TemplateAttributes.js';
|
|
7
7
|
export * from './template/TemplateData.js';
|
|
8
|
-
export * from './template/TemplateRender.js';
|
|
9
|
-
export * from './template/TemplateRenders.js';
|
|
8
|
+
export type * from './template/TemplateRender.js';
|
|
9
|
+
export type * from './template/TemplateRenders.js';
|
package/source/workspace.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
export * from './workspace/Project.js';
|
|
2
2
|
export * from './workspace/ProjectConfig.js';
|
|
3
|
-
export * from './workspace/ProjectCreateOptions.js';
|
|
3
|
+
export type * from './workspace/ProjectCreateOptions.js';
|
|
4
4
|
export * from './workspace/ProjectError.js';
|
|
5
|
-
export * from './workspace/ProjectOptions.js';
|
|
6
|
-
export * from './workspace/ProjectUpdateOptions.js';
|
|
5
|
+
export type * from './workspace/ProjectOptions.js';
|
|
6
|
+
export type * from './workspace/ProjectUpdateOptions.js';
|
|
7
7
|
export * from './workspace/saveProjectConfig.js';
|
|
8
8
|
export * from './workspace/saveWorkspaceConfig.js';
|
|
9
9
|
export * from './workspace/Workspace.js';
|
|
10
10
|
export * from './workspace/WorkspaceConfig.js';
|
|
11
|
-
export * from './workspace/WorkspaceCreateOptions.js';
|
|
12
|
-
export * from './workspace/WorkspaceCreateProjectOptions.js';
|
|
11
|
+
export type * from './workspace/WorkspaceCreateOptions.js';
|
|
12
|
+
export type * from './workspace/WorkspaceCreateProjectOptions.js';
|
|
13
13
|
export * from './workspace/WorkspaceDependencies.js';
|
|
14
14
|
export * from './workspace/WorkspaceError.js';
|
|
15
|
-
export * from './workspace/WorkspaceFindAndReadOptions.js';
|
|
16
|
-
export * from './workspace/WorkspaceOptions.js';
|
|
17
|
-
export * from './workspace/WorkspaceOptionsProject.js';
|
|
18
|
-
export * from './workspace/WorkspacePackageJson.js';
|
|
19
|
-
export * from './workspace/WorkspaceProjectGlobs.js';
|
|
20
|
-
export * from './workspace/WorkspaceProjects.js';
|
|
21
|
-
export * from './workspace/WorkspaceRepository.js';
|
|
22
|
-
export * from './workspace/WorkspaceUpdateOptions.js';
|
|
15
|
+
export type * from './workspace/WorkspaceFindAndReadOptions.js';
|
|
16
|
+
export type * from './workspace/WorkspaceOptions.js';
|
|
17
|
+
export type * from './workspace/WorkspaceOptionsProject.js';
|
|
18
|
+
export type * from './workspace/WorkspacePackageJson.js';
|
|
19
|
+
export type * from './workspace/WorkspaceProjectGlobs.js';
|
|
20
|
+
export type * from './workspace/WorkspaceProjects.js';
|
|
21
|
+
export type * from './workspace/WorkspaceRepository.js';
|
|
22
|
+
export type * from './workspace/WorkspaceUpdateOptions.js';
|