@trackunit/iris-app 2.16.14 → 2.16.16
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/CHANGELOG.md +15 -0
- package/migrations/entry.js.map +1 -0
- package/migrations/p-content-space-codemod/invent-content-space.js.map +1 -0
- package/migrations/p-content-space-codemod/orchestrator.js.map +1 -0
- package/migrations/p-content-space-codemod/remove-redundant-padding.js.map +1 -0
- package/migrations/p-content-space-codemod/report-run-messaging.js.map +1 -0
- package/migrations/p-content-space-codemod/report-unresolved.js.map +1 -0
- package/migrations/p-content-space-codemod/resolve-content-shell.js.map +1 -0
- package/migrations/p-content-space-codemod/rewrite-page-content.js.map +1 -0
- package/migrations/p-content-space-codemod/shell-skip-reason.js.map +1 -0
- package/migrations/repair-tsconfig/repair-tsconfig.js +205 -0
- package/migrations/repair-tsconfig/repair-tsconfig.js.map +1 -0
- package/migrations/utils/classname-ast-rewrite.js.map +1 -0
- package/migrations/utils/resolve-extension-types.js.map +1 -0
- package/migrations.json +5 -0
- package/package.json +20 -6
- package/src/executors/submit/executor.js.map +1 -0
- package/src/executors/unpublish/executor.js.map +1 -0
- package/src/executors/utils/authentication.js.map +1 -0
- package/src/executors/utils/irisAppServerSettings.js.map +1 -0
- package/src/executors/utils/src/index.js.map +1 -0
- package/src/generators/ai-agent-sync/generator.js.map +1 -0
- package/src/generators/create/files/tsconfig.app.json__template__ +1 -0
- package/src/generators/create/generator.js +13 -21
- package/src/generators/create/generator.js.map +1 -0
- package/src/generators/extend/dependencies.js.map +1 -0
- package/src/generators/extend/generator.js +26 -34
- package/src/generators/extend/generator.js.map +1 -0
- package/src/generators/preset/generator.js +3 -7
- package/src/generators/preset/generator.js.map +1 -0
- package/src/generators/utils/get-package-manifest.js.map +1 -0
- package/src/generators/utils/link-claude-skills.js.map +1 -0
- package/src/generators/utils/own-package-json/own-package-json.d.ts +14 -0
- package/src/generators/utils/own-package-json/own-package-json.js +29 -0
- package/src/generators/utils/own-package-json/own-package-json.js.map +1 -0
- package/src/generators/utils/pinned-versions/pinned-versions.d.ts +30 -0
- package/src/generators/utils/pinned-versions/pinned-versions.js +45 -0
- package/src/generators/utils/pinned-versions/pinned-versions.js.map +1 -0
- package/src/generators/utils/uses-trackunit-eslint-plugin.js.map +1 -0
- package/src/generators/utils/write-trackunit-project-eslint-config.js.map +1 -0
- package/src/index.js.map +1 -0
- package/src/utils/ast/astUtils.js.map +1 -0
- package/src/utils/fileUpdater.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/generators/extend/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAWoB;AACpB,uCAAoC;AACpC,+BAAmD;AACnD,8CAA8C;AAC9C,qCAA6C;AAC7C,0DAAwF;AACxF,wEAAqE;AACrE,mDAA6B;AAC7B,yCAAsC;AACtC,uCAAoE;AACpE,8EAA4E;AAC5E,wFAAkF;AAClF,0GAAmG;AACnG,iDAAmE;AAmCnE,MAAM,oBAAoB,GAAG,CAAC,MAAiC,EAAQ,EAAE;IACvE,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;IACT,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;IACzC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;QACzC,MAAM,CAAC,SAAS,GAAG,CAAC,GAAG,SAAS,EAAE,eAAe,CAAC,CAAC;IACrD,CAAC;AACH,CAAC,CAAC;AAEF;;GAEG;AACI,MAAM,oBAAoB,GAAG,KAAK,EAAE,IAAU,EAAE,OAAiC,EAAiB,EAAE;IACzG,MAAM,IAAA,yCAAmB,EAAC,IAAI,EAAE;QAC9B,OAAO,EAAE,OAAO,CAAC,WAAW;QAC5B,YAAY,EAAE,QAAQ;QACtB,aAAa,EAAE,KAAK;KACrB,CAAC,CAAC;IAEH,I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,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,gEAAa,gBAAgB,GAAC,CAAC;YAE1E,MAAM,WAAW,GAAG,MAAM,YAAY,CAAC;gBACrC,OAAO,EAAE,4EAA4E;gBACrF,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC7D,QAAQ,EAAE,EAAE;aACb,CAAC,CAAC;YAEH,IAAI,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;gBAC1B,MAAM,CAAC,sBAAsB,CAAC,CAAC;gBAC/B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YAED,OAAO,CAAC,GAAG,GAAG,WAAW,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import {\n addDependenciesToPackageJson,\n formatFiles,\n generateFiles,\n getWorkspaceLayout,\n installPackagesTask,\n joinPathFragments,\n names,\n offsetFromRoot,\n Tree,\n updateJson,\n} from \"@nx/devkit\";\nimport { Linter } from \"@nx/eslint\";\nimport { getRootTsConfigPathInTree } from \"@nx/js\";\nimport { getNpmScope } from \"@nx/js/internal\";\nimport { libraryGenerator } from \"@nx/react\";\nimport { nonUiExtensionTypes, serverSideExtensionTypes } from \"@trackunit/iris-app-api\";\nimport { addGraphqlGenerator } from \"@trackunit/react-graphql-tools\";\nimport * as path from \"path\";\nimport { camelCase } from \"string-ts\";\nimport { Project, SyntaxKind, VariableDeclaration } from \"ts-morph\";\nimport { getPinnedVersion } from \"../utils/pinned-versions/pinned-versions\";\nimport { usesTrackunitEslintPlugin } from \"../utils/uses-trackunit-eslint-plugin\";\nimport { writeTrackunitProjectEslintConfig } from \"../utils/write-trackunit-project-eslint-config\";\nimport { spaDependencies, testDependencies } from \"./dependencies\";\nimport { IrisAppExtensionGeneratorSchema } from \"./schema\";\n\ntype Schema = Parameters<typeof libraryGenerator>[1];\n\ninterface NormalizedSchema extends IrisAppExtensionGeneratorSchema {\n projectName: string;\n projectRoot: string;\n projectDirectory: string;\n projectCamelcase: string;\n importPath: string;\n sourceRoot: string;\n dependencyDefinitionFile: string;\n}\n\ntype ServersideGraphqlOptions = {\n readonly projectName: string;\n readonly projectRoot: string;\n readonly className: string;\n readonly serversideUtilsVersion: string;\n};\n\ntype ProjectTarget = {\n dependsOn?: Array<string | Record<string, unknown>>;\n options?: Record<string, unknown>;\n};\n\ntype ProjectJson = {\n targets: Record<string, ProjectTarget>;\n};\n\ntype DependencyPackageJson = {\n dependencies?: Record<string, string>;\n};\n\nconst addGraphqlDependency = (target: ProjectTarget | undefined): void => {\n if (!target) {\n return;\n }\n\n const dependsOn = target.dependsOn ?? [];\n if (!dependsOn.includes(\"graphql-hooks\")) {\n target.dependsOn = [...dependsOn, \"graphql-hooks\"];\n }\n};\n\n/**\n * Adds public-schema codegen and a typed Hono example to a generated serverside extension.\n */\nexport const addServersideGraphql = async (tree: Tree, options: ServersideGraphqlOptions): Promise<void> => {\n await addGraphqlGenerator(tree, {\n project: options.projectName,\n schemaSource: \"public\",\n generateMocks: false,\n });\n\n generateFiles(tree, path.join(__dirname, \"files\", \"SERVERSIDE_API_EXTENSION_GRAPHQL\"), options.projectRoot, {\n ...options,\n template: \"\",\n });\n\n updateJson<ProjectJson>(tree, joinPathFragments(options.projectRoot, \"project.json\"), projectJson => {\n addGraphqlDependency(projectJson.targets.build);\n addGraphqlDependency(projectJson.targets.test);\n addGraphqlDependency(projectJson.targets.serve);\n addGraphqlDependency(projectJson.targets[\"tsc-validate\"]);\n return projectJson;\n });\n\n updateJson<DependencyPackageJson>(tree, joinPathFragments(options.projectRoot, \"package.json\"), packageJson => {\n packageJson.dependencies = {\n ...packageJson.dependencies,\n \"@trackunit/serverside-utils\": options.serversideUtilsVersion,\n };\n return packageJson;\n });\n};\n\nfunction normalizeOptions(tree: Tree, options: IrisAppExtensionGeneratorSchema): NormalizedSchema {\n const name = names(options.name).fileName;\n const projectDirectory = options.directory ? `${names(options.directory).fileName}/${name}` : name;\n const projectName = projectDirectory.replace(new RegExp(\"/\", \"g\"), \"-\");\n const projectCamelcase = camelCase(projectName);\n const wsLayout = getWorkspaceLayout(tree);\n const projectRoot = `${wsLayout.libsDir}/${projectDirectory}`;\n const sourceRoot = `${wsLayout.libsDir}/${projectDirectory}/src`;\n const dependencyDefinitionFile = `${wsLayout.libsDir}/${projectDirectory}/package.json`;\n\n const npmScope = getNpmScope(tree);\n if (!npmScope) {\n throw new Error(\"Could not find npm scope in package.json\");\n }\n const importPath = `@${npmScope}/${projectName}`;\n\n return {\n ...options,\n projectName,\n projectRoot,\n projectDirectory,\n projectCamelcase,\n importPath,\n sourceRoot,\n dependencyDefinitionFile,\n };\n}\n\n/**\n * Iris App Extension Generator.\n *\n * @param tree the nx tree\n * @param options the generator options\n * @returns { Promise<void> } void\n */\nexport const IrisAppExtensionGenerator = async function (tree: Tree, options: IrisAppExtensionGeneratorSchema) {\n const adjustedOptions = await updateAppName(tree, options);\n\n const normalizedOptions = normalizeOptions(tree, adjustedOptions);\n\n const templateOptions = {\n ...normalizedOptions,\n ...names(normalizedOptions.name),\n offsetFromRoot: offsetFromRoot(normalizedOptions.projectRoot),\n template: \"\",\n };\n const irisAppExtensionType = normalizedOptions.type;\n\n if (normalizedOptions.graphql && irisAppExtensionType !== \"SERVERSIDE_API_EXTENSION\") {\n throw new Error(\"GraphQL setup is only supported for SERVERSIDE_API_EXTENSION\");\n }\n\n if (!tree.exists(`${getWorkspaceLayout(tree).appsDir}/${normalizedOptions.app}`)) {\n throw new Error(\n `The app does not exist: ${getWorkspaceLayout(tree).appsDir}/${\n normalizedOptions.app\n } make sure you enter the right app name`\n );\n }\n\n const manifestPath = `${getWorkspaceLayout(tree).appsDir}/${normalizedOptions.app}/iris-app-manifest.ts`;\n if (!tree.exists(manifestPath)) {\n throw new Error(\n `The app does not have an iris-app-manifest.ts: ${manifestPath} make sure you enter the right app name, which has an iris-app-manifest.ts`\n );\n }\n\n const useTrackunitLint = usesTrackunitEslintPlugin(tree);\n\n if (normalizedOptions.updatePackageJson) {\n const uiExtensionDependencies: Record<string, string> = nonUiExtensionTypes.includes(irisAppExtensionType)\n ? {}\n : { \"@trackunit/iris-app-runtime-core\": getPinnedVersion(\"@trackunit/iris-app-runtime-core\") };\n addDependenciesToPackageJson(tree, uiExtensionDependencies, {\n ...spaDependencies,\n ...testDependencies,\n \"@trackunit/react-vite-test-setup\": getPinnedVersion(\"@trackunit/react-vite-test-setup\"),\n });\n }\n\n const schema: Schema = {\n name: normalizedOptions.projectName,\n style: \"none\",\n skipFormat: false,\n strict: true,\n unitTestRunner: \"vitest\",\n linter: Linter.EsLint,\n routing: false,\n directory: normalizedOptions.projectRoot,\n skipTsConfig: false,\n skipPackageJson: true,\n ...(useTrackunitLint ? { tags: \"type:extension\" } : {}),\n };\n\n await libraryGenerator(tree, schema);\n\n tree.delete(joinPathFragments(normalizedOptions.projectRoot, \"vite.config.mts\"));\n\n generateFiles(\n tree,\n path.join(__dirname, \"files\", irisAppExtensionType),\n normalizedOptions.projectRoot,\n templateOptions\n );\n\n if (nonUiExtensionTypes.includes(irisAppExtensionType)) {\n generateFiles(tree, path.join(__dirname, \"files\", \"non-ui-test\"), normalizedOptions.projectRoot, templateOptions);\n } else {\n generateFiles(tree, path.join(__dirname, \"files\", \"react-app\"), normalizedOptions.projectRoot, templateOptions);\n if (!tree.exists(\"vitest.empty-stub.ts\")) {\n tree.write(\"vitest.empty-stub.ts\", \"export default {};\\n\");\n }\n }\n\n if (useTrackunitLint) {\n writeTrackunitProjectEslintConfig(tree, normalizedOptions.projectRoot, templateOptions.offsetFromRoot);\n }\n\n tree.delete(joinPathFragments(normalizedOptions.projectRoot, \"jest.config.ts\"));\n tree.delete(joinPathFragments(normalizedOptions.projectRoot, \"jest.config.cts\"));\n tree.delete(joinPathFragments(normalizedOptions.projectRoot, \"test\", \"config\", \"jest.setup.tsx\"));\n\n updateJson<ProjectJson>(tree, joinPathFragments(normalizedOptions.projectRoot, \"project.json\"), projectJson => {\n const testTarget = projectJson.targets.test;\n if (testTarget) {\n testTarget.options = {\n ...testTarget.options,\n configFile: joinPathFragments(normalizedOptions.projectRoot, \"vitest.config.ts\"),\n };\n }\n return projectJson;\n });\n\n const rootTsConfigPath = getRootTsConfigPathInTree(tree);\n if (!rootTsConfigPath) {\n throw new Error(\"Could not find root tsconfig.json\");\n }\n updateJson(tree, rootTsConfigPath, tsConfigBase => {\n // For server side extension types, we need to add deno types to the tsconfig and make Typescript accept Deno import syntax\n if (serverSideExtensionTypes.includes(irisAppExtensionType)) {\n tsConfigBase.compilerOptions = {\n ...tsConfigBase.compilerOptions,\n types: [\"node\"],\n esModuleInterop: true,\n };\n }\n\n // Bug fix: prefix \"./\" (SDK-576). Root cause: with TypeScript 6 and no `baseUrl` in the generated\n // workspace, non-relative `paths` entries are rejected (TS5090) and break type-checked builds.\n tsConfigBase.compilerOptions.paths[normalizedOptions.importPath] = [\n `./${joinPathFragments(normalizedOptions.projectRoot, \"extension-manifest.ts\")}`,\n ];\n return tsConfigBase;\n });\n\n // Add working serve target to the project.json for DENO extensions\n if (serverSideExtensionTypes.includes(irisAppExtensionType)) {\n updateJson(tree, joinPathFragments(normalizedOptions.projectRoot, \"project.json\"), projectJson => {\n projectJson.targets.serve = {\n executor: \"@nx/js:node\",\n options: {\n buildTarget: `${normalizedOptions.projectName}:build:development`,\n inspect: true,\n },\n configurations: {\n breakOnStart: {\n inspect: \"inspect-brk\",\n },\n },\n };\n projectJson.targets.build = {\n executor: \"@nx/esbuild:esbuild\",\n outputs: [\"{options.outputPath}\"],\n defaultConfiguration: \"production\",\n options: {\n platform: \"node\",\n outputPath: `dist/${normalizedOptions.projectRoot}`,\n format: [\"cjs\"],\n bundle: true,\n thirdParty: true,\n external: [],\n main: `${normalizedOptions.sourceRoot}/index.ts`,\n tsConfig: `libs/${normalizedOptions.projectDirectory}/tsconfig.lib.json`,\n esbuildOptions: {\n sourcemap: true,\n outExtension: {\n \".js\": \".js\",\n },\n },\n },\n configurations: {\n development: {\n main: `${normalizedOptions.sourceRoot}/local-serve.ts`,\n },\n production: {\n esbuildOptions: {\n sourcemap: false,\n outExtension: {\n \".js\": \".js\",\n },\n },\n },\n },\n };\n return projectJson;\n });\n }\n\n if (normalizedOptions.graphql) {\n await addServersideGraphql(tree, {\n projectName: normalizedOptions.projectName,\n projectRoot: normalizedOptions.projectRoot,\n className: names(normalizedOptions.name).className,\n serversideUtilsVersion: getPinnedVersion(\"@trackunit/serverside-utils\"),\n });\n }\n\n //TODO: Change the following to update the manifest in the virtual Tree - not on the file system.\n const project = new Project({\n tsConfigFilePath: `${getWorkspaceLayout(tree).appsDir}/${normalizedOptions.app}/tsconfig.app.json`,\n });\n\n const manifest = project.getSourceFileOrThrow(manifestPath);\n\n manifest.addImportDeclaration({\n moduleSpecifier: normalizedOptions.importPath,\n defaultImport: normalizedOptions.projectCamelcase,\n });\n\n // Get the default export symbol from the manifest\n const defaultExportSymbol = manifest.getDefaultExportSymbolOrThrow();\n\n // Get the aliased symbol if the default export is an alias\n const aliasedSymbol = defaultExportSymbol.getAliasedSymbol() || defaultExportSymbol;\n\n // Get the declaration of the aliased symbol\n const declaration = aliasedSymbol.getDeclarations()[0];\n\n if (!VariableDeclaration.isVariableDeclaration(declaration)) {\n throw new Error(\"Expected variable declaration\");\n }\n const irisAppManifestObject = declaration.getInitializer()?.asKindOrThrow(SyntaxKind.ObjectLiteralExpression);\n\n if (!irisAppManifestObject) {\n throw new Error(`irisAppManifest not exported from the file: ${manifestPath}`);\n }\n // Find the extensions property within the irisAppManifest object\n const extensionsProperty = irisAppManifestObject.getPropertyOrThrow(\"extensions\");\n\n if (extensionsProperty.getKind() === SyntaxKind.PropertyAssignment) {\n const extensionsArray = extensionsProperty.getFirstChildByKindOrThrow(SyntaxKind.ArrayLiteralExpression);\n extensionsArray.addElement(`${normalizedOptions.projectCamelcase}`);\n }\n\n await manifest.save();\n\n if (!serverSideExtensionTypes.includes(irisAppExtensionType)) {\n tree.delete(joinPathFragments(normalizedOptions.projectRoot, \"src\", \"index.ts\"));\n }\n\n updateJson(tree, joinPathFragments(normalizedOptions.projectRoot, \"tsconfig.spec.json\"), tsConfigSpec => {\n const isUiExtension = !nonUiExtensionTypes.includes(irisAppExtensionType);\n tsConfigSpec.compilerOptions.types = isUiExtension\n ? [\"vitest/globals\", \"node\", \"@testing-library/jest-dom\"]\n : [\"vitest/globals\", \"node\"];\n tsConfigSpec.include = [\n \"vitest.config.ts\",\n ...(isUiExtension ? [\"test/config/vitest.setup.tsx\"] : []),\n \"**/*.spec.ts\",\n ...(isUiExtension ? [\"**/*.spec.tsx\"] : []),\n \"**/*.d.ts\",\n \"extension-manifest.ts\",\n ];\n return tsConfigSpec;\n });\n\n await formatFiles(tree);\n return () => {\n installPackagesTask(tree, true);\n\n // eslint-disable-next-line no-console\n console.log(\"🥳 Successfully created an app extensions and it is already added to the Iris App!\");\n };\n};\nconst IRIS_APP_MANIFEST_FILE = \"iris-app-manifest.ts\";\n\n/**\n * The Iris apps in the workspace, as paths relative to the apps directory: an app either sits directly in a folder\n * of it or one level further down, and is recognised by its `iris-app-manifest.ts`. Reads the Tree, not the disk.\n */\nconst findIrisApps = (tree: Tree): Array<string> => {\n const { appsDir } = getWorkspaceLayout(tree);\n const directoriesIn = (dir: string): Array<string> =>\n tree.children(dir).filter(name => !tree.isFile(joinPathFragments(dir, name)));\n const hasManifest = (dir: string): boolean => tree.isFile(joinPathFragments(dir, IRIS_APP_MANIFEST_FILE));\n\n return directoriesIn(appsDir).flatMap(folder => {\n const folderPath = joinPathFragments(appsDir, folder);\n return hasManifest(folderPath)\n ? [folder]\n : directoriesIn(folderPath)\n .filter(subFolder => hasManifest(joinPathFragments(folderPath, subFolder)))\n .map(subFolder => joinPathFragments(folder, subFolder));\n });\n};\n\nconst updateAppName = async (tree: Tree, options: IrisAppExtensionGeneratorSchema) => {\n if (!options.app) {\n const tileApps = findIrisApps(tree);\n\n if (tileApps.length === 1) {\n options.app = tileApps[0] || \"<Missing iris app name>\";\n } else if (tileApps.length === 0) {\n throw new Error(\"Please add an iris-app using: nx g @trackunit/iris-app:create \");\n } else {\n // Dynamic import to avoid loading ESM module at test time when not needed\n const { autocomplete, isCancel, cancel } = await import(\"@clack/prompts\");\n\n const selectedApp = await autocomplete({\n message: \"Select the iris app that this extension should belong to (type to filter):\",\n options: tileApps.map(item => ({ value: item, label: item })),\n maxItems: 15,\n });\n\n if (isCancel(selectedApp)) {\n cancel(\"Operation cancelled.\");\n process.exit(0);\n }\n\n options.app = selectedApp;\n }\n }\n return options;\n};\n"]}
|
|
@@ -6,8 +6,8 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
7
|
const react_1 = require("@nx/react");
|
|
8
8
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
9
|
-
const get_package_manifest_1 = require("../utils/get-package-manifest");
|
|
10
9
|
const link_claude_skills_1 = require("../utils/link-claude-skills");
|
|
10
|
+
const pinned_versions_1 = require("../utils/pinned-versions/pinned-versions");
|
|
11
11
|
const uses_trackunit_eslint_plugin_1 = require("../utils/uses-trackunit-eslint-plugin");
|
|
12
12
|
/**
|
|
13
13
|
* Preset generator for Iris apps workspace.
|
|
@@ -54,18 +54,14 @@ async function presetGenerator(tree, options) {
|
|
|
54
54
|
tsconfig.compilerOptions.strict = true;
|
|
55
55
|
return tsconfig;
|
|
56
56
|
});
|
|
57
|
-
const [migrationsManifest, eslintPluginTrackunitManifest] = await Promise.all([
|
|
58
|
-
(0, get_package_manifest_1.getPackageManifest)("@trackunit/migrations"),
|
|
59
|
-
(0, get_package_manifest_1.getPackageManifest)(uses_trackunit_eslint_plugin_1.TRACKUNIT_ESLINT_PLUGIN),
|
|
60
|
-
]);
|
|
61
57
|
(0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
62
58
|
react: "19.3.0",
|
|
63
59
|
"react-dom": "19.3.0",
|
|
64
60
|
}, {
|
|
65
61
|
// Ships the generator that upgrades every @trackunit/* dependency, so a new
|
|
66
62
|
// workspace can run the documented upgrade flow without installing it first.
|
|
67
|
-
"@trackunit/migrations":
|
|
68
|
-
[uses_trackunit_eslint_plugin_1.TRACKUNIT_ESLINT_PLUGIN]:
|
|
63
|
+
"@trackunit/migrations": (0, pinned_versions_1.getPinnedVersion)("@trackunit/migrations"),
|
|
64
|
+
[uses_trackunit_eslint_plugin_1.TRACKUNIT_ESLINT_PLUGIN]: (0, pinned_versions_1.getPinnedVersion)(uses_trackunit_eslint_plugin_1.TRACKUNIT_ESLINT_PLUGIN),
|
|
69
65
|
"@typescript-eslint/parser": "8.71.2",
|
|
70
66
|
eslint: "9.33.0",
|
|
71
67
|
"@nx/eslint": "23.3.0",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/generators/preset/generator.ts"],"names":[],"mappings":";;AAuBA,0CAgGC;;AAvHD,uCASoB;AACpB,+BAA0D;AAC1D,qCAA+C;AAC/C,wDAAwB;AACxB,oEAA+D;AAC/D,8EAA4E;AAC5E,wFAAgF;AAGhF;;;;GAIG;AACI,KAAK,UAAU,eAAe,CAAC,IAAU,EAAE,OAA8B;IAC9E,kBAAkB;IAClB,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,KAAK,CACR,gBAAgB,EAChB,4LAA4L,CAC7L,CAAC;IACF,IAAI,CAAC,KAAK,CACR,gBAAgB,EAChB,oIAAoI,CACrI,CAAC;IAEF,MAAM,cAAc,GAAG,yBAAyB,CAAC;IAEjD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC;QACjC,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,IAAA,sBAAa,EAAC,IAA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,\n updateNxJson,\n} from \"@nx/devkit\";\nimport { initGenerator as jsInitGenerator } from \"@nx/js\";\nimport { reactInitGenerator } from \"@nx/react\";\nimport path from \"path\";\nimport { linkClaudeSkills } from \"../utils/link-claude-skills\";\nimport { getPinnedVersion } from \"../utils/pinned-versions/pinned-versions\";\nimport { TRACKUNIT_ESLINT_PLUGIN } from \"../utils/uses-trackunit-eslint-plugin\";\nimport { PresetGeneratorSchema } from \"./schema\";\n\n/**\n * Preset generator for Iris apps workspace.\n * Use with create-nx-workspace to create a new workspace for developing Iris apps.\n * ```npx create-nx-workspace --preset=iris-app```\n */\nexport async function presetGenerator(tree: Tree, options: PresetGeneratorSchema) {\n // setup workspace\n updateWorkspaceLayout(tree);\n tree.write(\n \"apps/readme.md\",\n `# Apps\\n\\nThis folder contains all apps in the workspace.\\n\\nApps are the main entry point for the Iris App SDK.\\nCreate an app by running \\`nx g @trackunit/iris-app:create <app-name>\\`.`\n );\n tree.write(\n \"libs/readme.md\",\n `# Libs\\n\\nThis folder contains all libs in the workspace.\\nCreate a lib by running \\`nx g @trackunit/iris-app:extend <lib-name>\\`.`\n );\n\n const extensionsPath = \".vscode/extensions.json\";\n\n if (!tree.exists(extensionsPath)) {\n tree.write(extensionsPath, \"{}\");\n }\n\n generateFiles(tree, path.join(__dirname, \"files\"), \".\", {});\n generateFiles(tree, path.join(__dirname, \"root-files\"), \".\", { template: \"\" });\n if (!tree.exists(\"vitest.empty-stub.ts\")) {\n tree.write(\"vitest.empty-stub.ts\", \"export default {};\\n\");\n }\n\n updateJson(tree, extensionsPath, value => {\n if (!value.recommendations) {\n value.recommendations = [];\n }\n value.recommendations = value.recommendations.filter(\n (recommendation: string) => recommendation !== \"firsttris.vscode-jest-runner\"\n );\n value.recommendations.push(\n \"graphql.vscode-graphql\",\n \"graphql.vscode-graphql-syntax\",\n \"bradlc.vscode-tailwindcss\",\n \"vitest.explorer\",\n \"dbaeumer.vscode-eslint\"\n );\n return value;\n });\n\n const jsInitTask = await jsInitGenerator(tree, {\n ...options,\n tsConfigName: \"tsconfig.base.json\",\n // Since Nx 23.3 an unset formatter is detected from the tree, and a fresh workspace has none.\n formatter: \"prettier\",\n skipFormat: true,\n });\n\n updateJson(tree, \"tsconfig.base.json\", (tsconfig: { compilerOptions?: Record<string, unknown> }) => {\n if (!tsconfig.compilerOptions) {\n tsconfig.compilerOptions = {};\n }\n tsconfig.compilerOptions.ignoreDeprecations = \"6.0\";\n tsconfig.compilerOptions.esModuleInterop = true;\n tsconfig.compilerOptions.resolveJsonModule = true;\n tsconfig.compilerOptions.moduleResolution = \"bundler\";\n tsconfig.compilerOptions.strict = true;\n return tsconfig;\n });\n\n addDependenciesToPackageJson(\n tree,\n {\n react: \"19.3.0\",\n \"react-dom\": \"19.3.0\",\n },\n {\n // Ships the generator that upgrades every @trackunit/* dependency, so a new\n // workspace can run the documented upgrade flow without installing it first.\n \"@trackunit/migrations\": getPinnedVersion(\"@trackunit/migrations\"),\n [TRACKUNIT_ESLINT_PLUGIN]: getPinnedVersion(TRACKUNIT_ESLINT_PLUGIN),\n \"@typescript-eslint/parser\": \"8.71.2\",\n eslint: \"9.33.0\",\n \"@nx/eslint\": \"23.3.0\",\n }\n );\n\n registerEslintPlugin(tree);\n\n // This react generator adds react 19 and react-dom 19 to the package.json if we don't add react 18 above.\n const initReact = await reactInitGenerator(tree, {});\n\n // Post-flush task: symlink .claude/skills -> ../.agents/skills so Claude Code\n // auto-discovers the same skills as Cursor/Codex without manual setup.\n const linkSkillsTask = () => {\n const result = linkClaudeSkills(tree.root);\n if (result.status === \"skipped\") {\n logger.warn(\n `[iris-app:preset] Skipped creating .claude/skills symlink: ${result.reason}. ` +\n `Claude Code users may need to create it manually: ln -s ../.agents/skills .claude/skills`\n );\n }\n };\n\n return runTasksInSerial(jsInitTask, initReact, linkSkillsTask);\n}\n\nfunction updateWorkspaceLayout(tree: Tree) {\n const nxJson = readNxJson(tree) ?? {};\n nxJson.workspaceLayout = {\n libsDir: \"libs\",\n appsDir: \"apps\",\n };\n updateNxJson(tree, nxJson);\n}\n\n// Nx's own ESLint init skips this setup once a root config exists, so the preset does it.\nfunction registerEslintPlugin(tree: Tree) {\n const nxJson = readNxJson(tree) ?? {};\n const plugins = nxJson.plugins ?? [];\n const isRegistered = plugins.some(\n plugin => (typeof plugin === \"string\" ? plugin : plugin.plugin) === \"@nx/eslint/plugin\"\n );\n if (!isRegistered) {\n nxJson.plugins = [...plugins, { plugin: \"@nx/eslint/plugin\", options: { targetName: \"lint\" } }];\n }\n const production = nxJson.namedInputs?.production;\n if (nxJson.namedInputs && production) {\n nxJson.namedInputs.production = Array.from(new Set([...production, \"!{projectRoot}/eslint.config.cjs\"]));\n }\n updateNxJson(tree, nxJson);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-package-manifest.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/generators/utils/get-package-manifest.ts"],"names":[],"mappings":";;;;AAAA,uDAAiC;AAEjC;;GAEG;AACI,MAAM,kBAAkB,GAAG,CAAC,WAAmB,EAAE,EAAE,CACxD,MAAM,CAAC,QAAQ,CACb,WAAW,EACX,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,SAAS,CACpF,CAAC;AAJS,QAAA,kBAAkB,sBAI3B","sourcesContent":["import * as pacote from \"pacote\";\n\n/**\n * Keeps Trackunit registry overrides consistent across package-consuming generators.\n */\nexport const getPackageManifest = (packageName: string) =>\n pacote.manifest(\n packageName,\n process.env.TU_NPM_REGISTRY ? { registry: process.env.TU_NPM_REGISTRY } : undefined\n );\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-claude-skills.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/generators/utils/link-claude-skills.ts"],"names":[],"mappings":";;AAqBA,4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EAAE,CAAC;QACzB,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,sCAAsC,aAAa,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,EAAE;SACnG,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,EAAE,CAAC,WAAW,CAAC,iBAAiB,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QACnD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAC/B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,6BAA6B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;SAC9F,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,CAAS;IAC1B,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAOD,SAAS,oBAAoB,CAAC,EAAE,aAAa,EAAE,cAAc,EAA6B;IACxF,IAAI,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import * as fs from \"fs\";\nimport * as path from \"path\";\n\nconst CLAUDE_DIR = \".claude\";\nconst CLAUDE_SKILLS_NAME = \"skills\";\nconst AGENTS_SKILLS_REL = path.join(\"..\", \".agents\", \"skills\");\n\nexport type LinkClaudeSkillsResult =\n | { status: \"created\" }\n | { status: \"already-linked\" }\n | { status: \"skipped\"; reason: string };\n\n/**\n * Ensures `.claude/skills` is a symlink to `../.agents/skills` so Claude Code\n * auto-discovers skills shared via `.agents/skills`.\n *\n * Idempotent: leaves an existing valid symlink alone, refuses to overwrite a\n * real `.claude/skills` directory or file. Cross-platform-safe: catches\n * symlink permission errors (e.g. Windows without Developer Mode) and returns\n * a `skipped` result instead of throwing.\n */\nexport function linkClaudeSkills(workspaceRoot: string): LinkClaudeSkillsResult {\n const claudeDir = path.join(workspaceRoot, CLAUDE_DIR);\n const linkPath = path.join(claudeDir, CLAUDE_SKILLS_NAME);\n const agentsSkillsAbs = path.join(workspaceRoot, \".agents\", \"skills\");\n\n if (!fs.existsSync(agentsSkillsAbs)) {\n return { status: \"skipped\", reason: \".agents/skills does not exist\" };\n }\n\n fs.mkdirSync(claudeDir, { recursive: true });\n\n const existingLstat = safeLstat(linkPath);\n if (existingLstat?.isSymbolicLink()) {\n const currentTarget = fs.readlinkSync(linkPath);\n if (\n resolveSymlinkTarget({\n currentTarget,\n linkParentPath: claudeDir,\n }) === path.resolve(agentsSkillsAbs)\n ) {\n return { status: \"already-linked\" };\n }\n return {\n status: \"skipped\",\n reason: `.claude/skills already exists as a symlink to ${currentTarget}`,\n };\n } else if (existingLstat) {\n return {\n status: \"skipped\",\n reason: `.claude/skills already exists as a ${existingLstat.isDirectory() ? \"directory\" : \"file\"}`,\n };\n }\n\n try {\n fs.symlinkSync(AGENTS_SKILLS_REL, linkPath, \"dir\");\n return { status: \"created\" };\n } catch (error) {\n return {\n status: \"skipped\",\n reason: `failed to create symlink: ${error instanceof Error ? error.message : String(error)}`,\n };\n }\n}\n\nfunction safeLstat(p: string): fs.Stats | undefined {\n try {\n return fs.lstatSync(p);\n } catch {\n return undefined;\n }\n}\n\ntype ResolveSymlinkTargetInput = {\n readonly currentTarget: string;\n readonly linkParentPath: string;\n};\n\nfunction resolveSymlinkTarget({ currentTarget, linkParentPath }: ResolveSymlinkTargetInput): string {\n if (path.isAbsolute(currentTarget)) {\n return path.resolve(currentTarget);\n }\n\n return path.resolve(linkParentPath, currentTarget);\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PackageJson } from "nx/src/utils/package-json";
|
|
2
|
+
/** This package's own package.json, the one place in the SDK that locates it. */
|
|
3
|
+
export declare const OWN_PACKAGE_JSON_PATH: string;
|
|
4
|
+
export type OwnPackageJson = PackageJson & {
|
|
5
|
+
engines?: Record<string, string>;
|
|
6
|
+
/** Exact versions of the packages the generators write into workspaces; CI's sync-versions step sets them. */
|
|
7
|
+
pinnedVersions?: Record<string, string | undefined>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Reads this package's own package.json.
|
|
11
|
+
*
|
|
12
|
+
* @returns {OwnPackageJson} the parsed package.json of `@trackunit/iris-app`
|
|
13
|
+
*/
|
|
14
|
+
export declare const readOwnPackageJson: () => OwnPackageJson;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readOwnPackageJson = exports.OWN_PACKAGE_JSON_PATH = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
7
|
+
/**
|
|
8
|
+
* Finds this package's own package.json with TypeScript's upward search from this file, so nothing here depends on how
|
|
9
|
+
* deep the file sits. The nearest package.json upward is the package's own in all three layouts: the monorepo source
|
|
10
|
+
* (`libs/iris-app-sdk/iris-app/`), the build (`dist/libs/iris-app-sdk/iris-app/`) and an install
|
|
11
|
+
* (`node_modules/@trackunit/iris-app/`). Nothing under `src/` may get a package.json of its own.
|
|
12
|
+
*/
|
|
13
|
+
const findOwnPackageJson = () => {
|
|
14
|
+
const found = ts.findConfigFile(__dirname, ts.sys.fileExists, "package.json");
|
|
15
|
+
if (found === undefined) {
|
|
16
|
+
throw new Error(`Could not find the package.json of @trackunit/iris-app above ${__dirname}. The SDK install is incomplete; reinstall @trackunit/iris-app.`);
|
|
17
|
+
}
|
|
18
|
+
return found;
|
|
19
|
+
};
|
|
20
|
+
/** This package's own package.json, the one place in the SDK that locates it. */
|
|
21
|
+
exports.OWN_PACKAGE_JSON_PATH = findOwnPackageJson();
|
|
22
|
+
/**
|
|
23
|
+
* Reads this package's own package.json.
|
|
24
|
+
*
|
|
25
|
+
* @returns {OwnPackageJson} the parsed package.json of `@trackunit/iris-app`
|
|
26
|
+
*/
|
|
27
|
+
const readOwnPackageJson = () => (0, devkit_1.readJsonFile)(exports.OWN_PACKAGE_JSON_PATH);
|
|
28
|
+
exports.readOwnPackageJson = readOwnPackageJson;
|
|
29
|
+
//# sourceMappingURL=own-package-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"own-package-json.js","sourceRoot":"","sources":["../../../../../../../../libs/iris-app-sdk/iris-app/src/generators/utils/own-package-json/own-package-json.ts"],"names":[],"mappings":";;;;AAAA,uCAA0C;AAE1C,uDAAiC;AAEjC;;;;;GAKG;AACH,MAAM,kBAAkB,GAAG,GAAW,EAAE;IACtC,MAAM,KAAK,GAAG,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAC9E,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACb,gEAAgE,SAAS,iEAAiE,CAC3I,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,iFAAiF;AACpE,QAAA,qBAAqB,GAAG,kBAAkB,EAAE,CAAC;AAQ1D;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,GAAmB,EAAE,CAAC,IAAA,qBAAY,EAAiB,6BAAqB,CAAC,CAAC;AAA/F,QAAA,kBAAkB,sBAA6E","sourcesContent":["import { readJsonFile } from \"@nx/devkit\";\nimport type { PackageJson } from \"nx/src/utils/package-json\";\nimport * as ts from \"typescript\";\n\n/**\n * Finds this package's own package.json with TypeScript's upward search from this file, so nothing here depends on how\n * deep the file sits. The nearest package.json upward is the package's own in all three layouts: the monorepo source\n * (`libs/iris-app-sdk/iris-app/`), the build (`dist/libs/iris-app-sdk/iris-app/`) and an install\n * (`node_modules/@trackunit/iris-app/`). Nothing under `src/` may get a package.json of its own.\n */\nconst findOwnPackageJson = (): string => {\n const found = ts.findConfigFile(__dirname, ts.sys.fileExists, \"package.json\");\n if (found === undefined) {\n throw new Error(\n `Could not find the package.json of @trackunit/iris-app above ${__dirname}. The SDK install is incomplete; reinstall @trackunit/iris-app.`\n );\n }\n return found;\n};\n\n/** This package's own package.json, the one place in the SDK that locates it. */\nexport const OWN_PACKAGE_JSON_PATH = findOwnPackageJson();\n\nexport type OwnPackageJson = PackageJson & {\n engines?: Record<string, string>;\n /** Exact versions of the packages the generators write into workspaces; CI's sync-versions step sets them. */\n pinnedVersions?: Record<string, string | undefined>;\n};\n\n/**\n * Reads this package's own package.json.\n *\n * @returns {OwnPackageJson} the parsed package.json of `@trackunit/iris-app`\n */\nexport const readOwnPackageJson = (): OwnPackageJson => readJsonFile<OwnPackageJson>(OWN_PACKAGE_JSON_PATH);\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type PinnedVersionsOptions = {
|
|
2
|
+
/** Absolute path of the package.json to read the pins from. Defaults to this package's own, used by tests. */
|
|
3
|
+
packageJsonPath?: string;
|
|
4
|
+
};
|
|
5
|
+
type PinnedVersions = Readonly<Record<string, string | undefined>>;
|
|
6
|
+
/**
|
|
7
|
+
* Reads the `pinnedVersions` field of a package.json: the exact `@trackunit/*` versions this release of the SDK was
|
|
8
|
+
* built against. The one way to read the pins, so specs read them the way the generators do.
|
|
9
|
+
*
|
|
10
|
+
* @param packageJsonPath absolute path of the package.json to read; defaults to this package's own
|
|
11
|
+
* @returns {PinnedVersions} the pins by package name, empty when the field is missing
|
|
12
|
+
* @throws {Error} naming the file when it is missing (ENOENT) or not valid JSON; devkit's `readJsonFile` puts the path
|
|
13
|
+
* in both messages
|
|
14
|
+
*/
|
|
15
|
+
export declare const readPinnedVersions: (packageJsonPath?: string) => PinnedVersions;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the exact version of a `@trackunit/*` package this release of the SDK was built against.
|
|
18
|
+
*
|
|
19
|
+
* The pins live in the `pinnedVersions` field of this package's own package.json, which CI's sync-versions step
|
|
20
|
+
* sets to the to-be-published versions before the package is built and published.
|
|
21
|
+
*
|
|
22
|
+
* Never consults the npm registry and never returns "latest": a missing pin is a broken install and fails loudly,
|
|
23
|
+
* so workspace creation cannot pick a version the developer's npm release-age policy forbids.
|
|
24
|
+
*
|
|
25
|
+
* @param packageName full package name, e.g. `@trackunit/react-components`
|
|
26
|
+
* @param options override location of the package.json, used by tests
|
|
27
|
+
* @returns {string} the exact pinned version, e.g. `6.0.17`
|
|
28
|
+
*/
|
|
29
|
+
export declare const getPinnedVersion: (packageName: string, options?: PinnedVersionsOptions) => string;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPinnedVersion = exports.readPinnedVersions = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const semver_1 = require("semver");
|
|
6
|
+
const own_package_json_1 = require("../own-package-json/own-package-json");
|
|
7
|
+
/**
|
|
8
|
+
* A pin must be an exact version: "", "latest" and ranges would reopen the registry-"latest" problem.
|
|
9
|
+
* `valid` normalises (trims, strips a leading "v"), so only a string it returns unchanged is exact.
|
|
10
|
+
*/
|
|
11
|
+
const isExactVersion = (version) => (0, semver_1.valid)(version) === version;
|
|
12
|
+
/**
|
|
13
|
+
* Reads the `pinnedVersions` field of a package.json: the exact `@trackunit/*` versions this release of the SDK was
|
|
14
|
+
* built against. The one way to read the pins, so specs read them the way the generators do.
|
|
15
|
+
*
|
|
16
|
+
* @param packageJsonPath absolute path of the package.json to read; defaults to this package's own
|
|
17
|
+
* @returns {PinnedVersions} the pins by package name, empty when the field is missing
|
|
18
|
+
* @throws {Error} naming the file when it is missing (ENOENT) or not valid JSON; devkit's `readJsonFile` puts the path
|
|
19
|
+
* in both messages
|
|
20
|
+
*/
|
|
21
|
+
const readPinnedVersions = (packageJsonPath = own_package_json_1.OWN_PACKAGE_JSON_PATH) => (0, devkit_1.readJsonFile)(packageJsonPath).pinnedVersions ?? {};
|
|
22
|
+
exports.readPinnedVersions = readPinnedVersions;
|
|
23
|
+
/**
|
|
24
|
+
* Returns the exact version of a `@trackunit/*` package this release of the SDK was built against.
|
|
25
|
+
*
|
|
26
|
+
* The pins live in the `pinnedVersions` field of this package's own package.json, which CI's sync-versions step
|
|
27
|
+
* sets to the to-be-published versions before the package is built and published.
|
|
28
|
+
*
|
|
29
|
+
* Never consults the npm registry and never returns "latest": a missing pin is a broken install and fails loudly,
|
|
30
|
+
* so workspace creation cannot pick a version the developer's npm release-age policy forbids.
|
|
31
|
+
*
|
|
32
|
+
* @param packageName full package name, e.g. `@trackunit/react-components`
|
|
33
|
+
* @param options override location of the package.json, used by tests
|
|
34
|
+
* @returns {string} the exact pinned version, e.g. `6.0.17`
|
|
35
|
+
*/
|
|
36
|
+
const getPinnedVersion = (packageName, options = {}) => {
|
|
37
|
+
const packageJsonPath = options.packageJsonPath ?? own_package_json_1.OWN_PACKAGE_JSON_PATH;
|
|
38
|
+
const version = (0, exports.readPinnedVersions)(packageJsonPath)[packageName];
|
|
39
|
+
if (!isExactVersion(version)) {
|
|
40
|
+
throw new Error(`No valid pinned version for ${packageName} in the "pinnedVersions" field of ${packageJsonPath}. The SDK install is incomplete; reinstall @trackunit/iris-app.`);
|
|
41
|
+
}
|
|
42
|
+
return version;
|
|
43
|
+
};
|
|
44
|
+
exports.getPinnedVersion = getPinnedVersion;
|
|
45
|
+
//# sourceMappingURL=pinned-versions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pinned-versions.js","sourceRoot":"","sources":["../../../../../../../../libs/iris-app-sdk/iris-app/src/generators/utils/pinned-versions/pinned-versions.ts"],"names":[],"mappings":";;;AAAA,uCAA0C;AAC1C,mCAA+B;AAC/B,2EAAkG;AASlG;;;GAGG;AACH,MAAM,cAAc,GAAG,CAAC,OAA2B,EAAqB,EAAE,CAAC,IAAA,cAAK,EAAC,OAAO,CAAC,KAAK,OAAO,CAAC;AAEtG;;;;;;;;GAQG;AACI,MAAM,kBAAkB,GAAG,CAAC,kBAA0B,wCAAqB,EAAkB,EAAE,CACpG,IAAA,qBAAY,EAAiB,eAAe,CAAC,CAAC,cAAc,IAAI,EAAE,CAAC;AADxD,QAAA,kBAAkB,sBACsC;AAErE;;;;;;;;;;;;GAYG;AACI,MAAM,gBAAgB,GAAG,CAAC,WAAmB,EAAE,UAAiC,EAAE,EAAU,EAAE;IACnG,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,wCAAqB,CAAC;IACzE,MAAM,OAAO,GAAG,IAAA,0BAAkB,EAAC,eAAe,CAAC,CAAC,WAAW,CAAC,CAAC;IACjE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CACb,+BAA+B,WAAW,qCAAqC,eAAe,iEAAiE,CAChK,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AATW,QAAA,gBAAgB,oBAS3B","sourcesContent":["import { readJsonFile } from \"@nx/devkit\";\nimport { valid } from \"semver\";\nimport { OWN_PACKAGE_JSON_PATH, type OwnPackageJson } from \"../own-package-json/own-package-json\";\n\ntype PinnedVersionsOptions = {\n /** Absolute path of the package.json to read the pins from. Defaults to this package's own, used by tests. */\n packageJsonPath?: string;\n};\n\ntype PinnedVersions = Readonly<Record<string, string | undefined>>;\n\n/**\n * A pin must be an exact version: \"\", \"latest\" and ranges would reopen the registry-\"latest\" problem.\n * `valid` normalises (trims, strips a leading \"v\"), so only a string it returns unchanged is exact.\n */\nconst isExactVersion = (version: string | undefined): version is string => valid(version) === version;\n\n/**\n * Reads the `pinnedVersions` field of a package.json: the exact `@trackunit/*` versions this release of the SDK was\n * built against. The one way to read the pins, so specs read them the way the generators do.\n *\n * @param packageJsonPath absolute path of the package.json to read; defaults to this package's own\n * @returns {PinnedVersions} the pins by package name, empty when the field is missing\n * @throws {Error} naming the file when it is missing (ENOENT) or not valid JSON; devkit's `readJsonFile` puts the path\n * in both messages\n */\nexport const readPinnedVersions = (packageJsonPath: string = OWN_PACKAGE_JSON_PATH): PinnedVersions =>\n readJsonFile<OwnPackageJson>(packageJsonPath).pinnedVersions ?? {};\n\n/**\n * Returns the exact version of a `@trackunit/*` package this release of the SDK was built against.\n *\n * The pins live in the `pinnedVersions` field of this package's own package.json, which CI's sync-versions step\n * sets to the to-be-published versions before the package is built and published.\n *\n * Never consults the npm registry and never returns \"latest\": a missing pin is a broken install and fails loudly,\n * so workspace creation cannot pick a version the developer's npm release-age policy forbids.\n *\n * @param packageName full package name, e.g. `@trackunit/react-components`\n * @param options override location of the package.json, used by tests\n * @returns {string} the exact pinned version, e.g. `6.0.17`\n */\nexport const getPinnedVersion = (packageName: string, options: PinnedVersionsOptions = {}): string => {\n const packageJsonPath = options.packageJsonPath ?? OWN_PACKAGE_JSON_PATH;\n const version = readPinnedVersions(packageJsonPath)[packageName];\n if (!isExactVersion(version)) {\n throw new Error(\n `No valid pinned version for ${packageName} in the \"pinnedVersions\" field of ${packageJsonPath}. The SDK install is incomplete; reinstall @trackunit/iris-app.`\n );\n }\n return version;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uses-trackunit-eslint-plugin.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/generators/utils/uses-trackunit-eslint-plugin.ts"],"names":[],"mappings":";;;AAkBA,8DAUC;AA5BD,uCAA4C;AAE/B,QAAA,uBAAuB,GAAG,oCAAoC,CAAC;AAO5E;;;;;;;;GAQG;AACH,SAAgB,yBAAyB,CAAC,IAAU;IAClD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,CAAC;QACtE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,GAAG,IAAA,iBAAQ,EAAuB,IAAI,EAAE,cAAc,CAAC,CAAC;IAE/F,OAAO,CACL,YAAY,EAAE,CAAC,+BAAuB,CAAC,KAAK,SAAS,IAAI,eAAe,EAAE,CAAC,+BAAuB,CAAC,KAAK,SAAS,CAClH,CAAC;AACJ,CAAC","sourcesContent":["import { readJson, Tree } from \"@nx/devkit\";\n\nexport const TRACKUNIT_ESLINT_PLUGIN = \"@trackunit/eslint-plugin-trackunit\";\n\ntype WorkspacePackageJson = {\n readonly dependencies?: Record<string, string>;\n readonly devDependencies?: Record<string, string>;\n};\n\n/**\n * Returns true when the workspace root `package.json` declares\n * `@trackunit/eslint-plugin-trackunit` in `dependencies` or `devDependencies`\n * and the workspace has a root `eslint.config.cjs`.\n *\n * Generated project configs `require` the root `eslint.config.cjs`, so a workspace\n * with the plugin but another root config (e.g. Nx's `eslint.config.mjs`) is\n * treated as not using it.\n */\nexport function usesTrackunitEslintPlugin(tree: Tree): boolean {\n if (!tree.exists(\"package.json\") || !tree.exists(\"eslint.config.cjs\")) {\n return false;\n }\n\n const { dependencies, devDependencies } = readJson<WorkspacePackageJson>(tree, \"package.json\");\n\n return (\n dependencies?.[TRACKUNIT_ESLINT_PLUGIN] !== undefined || devDependencies?.[TRACKUNIT_ESLINT_PLUGIN] !== undefined\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-trackunit-project-eslint-config.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/generators/utils/write-trackunit-project-eslint-config.ts"],"names":[],"mappings":";;AAUA,8EAOC;AAjBD,uCAAqD;AAErD;;;;;;;GAOG;AACH,SAAgB,iCAAiC,CAAC,IAAU,EAAE,WAAmB,EAAE,cAAsB;IACvG,qEAAqE;IACrE,IAAI,CAAC,MAAM,CAAC,IAAA,0BAAiB,EAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC,CAAC;IACjE,IAAI,CAAC,KAAK,CACR,IAAA,0BAAiB,EAAC,WAAW,EAAE,mBAAmB,CAAC,EACnD,iCAAiC,cAAc,yBAAyB,CACzE,CAAC;AACJ,CAAC","sourcesContent":["import { joinPathFragments, Tree } from \"@nx/devkit\";\n\n/**\n * Writes a project `eslint.config.cjs` that only extends the workspace root\n * `eslint.config.cjs`, for workspaces where `usesTrackunitEslintPlugin` is true.\n *\n * @param tree the nx tree\n * @param projectRoot the project directory, relative to the workspace root\n * @param offsetFromRoot relative path from the project directory to the workspace root, ending in `/`\n */\nexport function writeTrackunitProjectEslintConfig(tree: Tree, projectRoot: string, offsetFromRoot: string): void {\n // ESLint prefers eslint.config.mjs over a sibling eslint.config.cjs.\n tree.delete(joinPathFragments(projectRoot, \"eslint.config.mjs\"));\n tree.write(\n joinPathFragments(projectRoot, \"eslint.config.cjs\"),\n `module.exports = [...require('${offsetFromRoot}eslint.config.cjs')];\\n`\n );\n}\n"]}
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/iris-app-sdk/iris-app/src/index.ts"],"names":[],"mappings":";;;;AAAA,mEAAkE;AAAzD,gHAAA,cAAc,OAAA;AACvB,iFAAsE;AAA7D,oHAAA,WAAW,OAAA;AAEpB,2DAAiE;AAAxD,6GAAA,gBAAgB,OAAA;AAEzB,2DAA0E;AAAjE,sHAAA,yBAAyB,OAAA;AAElC,+DAAqC;AACrC,8DAAoC","sourcesContent":["export { getAccessToken } from \"./executors/utils/authentication\";\nexport { getSettings } from \"./executors/utils/irisAppServerSettings\";\nexport type { Settings } from \"./executors/utils/irisAppServerSettings\";\nexport { IrisAppGenerator } from \"./generators/create/generator\";\nexport type { IrisAppGeneratorSchema } from \"./generators/create/schema\";\nexport { IrisAppExtensionGenerator } from \"./generators/extend/generator\";\nexport type { IrisAppExtensionGeneratorSchema } from \"./generators/extend/schema\";\nexport * from \"./utils/ast/astUtils\";\nexport * from \"./utils/fileUpdater\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astUtils.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/utils/ast/astUtils.ts"],"names":[],"mappings":";;AAWA,wDAiBC;AAUD,kDAwCC;AAQD,kDA0BC;AASD,kDA2CC;;AApKD,uDAAoD;AACpD,0DAAwD;AACxD,uDAAiC;AAEjC;;;;;;GAMG;AACH,SAAgB,sBAAsB,CAAC,WAAmB,EAAE,GAAG,aAA4B;IACzF,MAAM,UAAU,GAAG,iBAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC5C,MAAM,iBAAiB,GAAG,iBAAO,CAAC,GAAG,CAAC,UAAU,EAAE,yBAAyB,EAAE,IAAI,CAAC,EAAE;QAClF,IAAI,EAAE,CAAC,yBAAyB,CAAC,IAAI,CAAC,EAAE,CAAC;YACvC,gCAAgC;YAChC,MAAM,iBAAiB,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;gBAC1D,OAAO,CAAC,CACN,EAAE,CAAC,oBAAoB,CAAC,QAAQ,CAAC;oBACjC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC;oBAC9B,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAC3C,CAAC;YACJ,CAAC,CAAC,CAAC;YACH,OAAO,EAAE,CAAC,OAAO,CAAC,6BAA6B,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;QAC3E,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IAC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@trackunit/shared-utils\";\nimport * as ts from \"typescript\";\n\n/**\n * This function removes a property with a given name from an object literal\n * provided as a text string.\n *\n * @param {string} fileContent The source code as text\n * @param {string} propertyNames The properties to remove from the object\n */\nexport function removePropertyWithName(fileContent: string, ...propertyNames: Array<string>): string {\n const sourceFile = tsquery.ast(fileContent);\n const updatedSourceFile = tsquery.map(sourceFile, \"ObjectLiteralExpression\", node => {\n if (ts.isObjectLiteralExpression(node)) {\n // Filter out the given property\n const updatedProperties = node.properties.filter(property => {\n return !(\n ts.isPropertyAssignment(property) &&\n ts.isIdentifier(property.name) &&\n propertyNames.includes(property.name.text)\n );\n });\n return ts.factory.createObjectLiteralExpression(updatedProperties, true);\n }\n return node;\n });\n return ts.createPrinter().printFile(updatedSourceFile);\n}\n\n/**\n * This function adds a new property with a given name and value to an object literal\n * provided as a text string.\n *\n * @param {string} fileContent - the source code as text\n * @param {string} propertyName - the name of the property to add\n * @param {string | string[]} propertyValue - the value of the property to add\n */\nexport function addPropertyWithName(\n fileContent: string,\n propertyName: string,\n propertyValue: string | Array<string> | Record<string, string>\n) {\n const sourceFile = tsquery.ast(fileContent);\n const updatedSourceFile = tsquery.map(sourceFile, \"ObjectLiteralExpression\", node => {\n if (ts.isObjectLiteralExpression(node)) {\n // Add a new property to the object literal\n let updatedProperties;\n if (typeof propertyValue === \"string\") {\n updatedProperties = [\n ...node.properties,\n ts.factory.createPropertyAssignment(\n ts.factory.createIdentifier(propertyName),\n ts.factory.createStringLiteral(propertyValue)\n ),\n ];\n } else if (Array.isArray(propertyValue)) {\n const arrayLiteral = ts.factory.createArrayLiteralExpression(\n propertyValue.map(value => ts.factory.createStringLiteral(value))\n );\n updatedProperties = [\n ...node.properties,\n ts.factory.createPropertyAssignment(ts.factory.createIdentifier(propertyName), arrayLiteral),\n ];\n } else if (typeof propertyValue === \"object\") {\n updatedProperties = [\n ...node.properties,\n ts.factory.createPropertyAssignment(\n ts.factory.createIdentifier(propertyName),\n ts.factory.createObjectLiteralExpression(createObjectLiteralElementLike(propertyValue))\n ),\n ];\n }\n return ts.factory.createObjectLiteralExpression(updatedProperties, true);\n }\n return node;\n });\n return ts.createPrinter().printFile(updatedSourceFile);\n}\n\n/**\n * This function adds a spread assignment to an object literal.\n *\n * @param {string} fileContent - the source code as text\n * @param {string} variableName - the name of the variable to spread\n */\nexport function addSpreadAssignment(fileContent: string, variableName: string) {\n const sourceFile = tsquery.ast(fileContent);\n\n // First check if the spread already exists\n const existingSpreads = tsquery(sourceFile, \"SpreadAssignment\");\n const hasExistingSpread = existingSpreads.some(spread => {\n if (ts.isSpreadAssignment(spread)) {\n return spread.expression.getText() === variableName;\n }\n return false;\n });\n\n if (hasExistingSpread) {\n return fileContent; // Already has the spread, no changes needed\n }\n\n const updatedSourceFile = tsquery.map(sourceFile, \"ObjectLiteralExpression\", node => {\n if (ts.isObjectLiteralExpression(node)) {\n // Add the spread assignment to the object literal\n const spreadAssignment = ts.factory.createSpreadAssignment(ts.factory.createIdentifier(variableName));\n const updatedProperties = [...node.properties, spreadAssignment];\n return ts.factory.createObjectLiteralExpression(updatedProperties, true);\n }\n return node;\n });\n return ts.createPrinter().printFile(updatedSourceFile);\n}\n\n/**\n * This function adds a require statement to a file after existing require statements.\n *\n * @param {string} fileContent - the source code as text\n * @param {string} variableName - the name of the variable to assign to\n * @param {string} modulePath - the module path to require\n */\nexport function addRequireStatement(fileContent: string, variableName: string, modulePath: string) {\n const sourceFile = tsquery.ast(fileContent);\n\n // Check if the require statement already exists\n const existingRequires = tsquery(sourceFile, \"CallExpression\");\n const hasExistingRequire = existingRequires.some(call => {\n if (\n ts.isCallExpression(call) &&\n ts.isIdentifier(call.expression) &&\n call.expression.text === \"require\" &&\n call.arguments.length > 0\n ) {\n const firstArg = call.arguments[0];\n if (firstArg && ts.isStringLiteral(firstArg)) {\n return firstArg.text === modulePath;\n }\n }\n return false;\n });\n\n if (hasExistingRequire) {\n return fileContent; // Already has the require, no changes needed\n }\n\n // Find all variable statements with require calls\n const requireStatements = tsquery(sourceFile, \"VariableStatement\").filter(stmt =>\n stmt.getText().includes(\"require(\")\n );\n\n const requireStatement = `const ${variableName} = require(\"${modulePath}\").default;`;\n\n if (requireStatements.length > 0) {\n // Add after the last require statement\n const lastRequire = requireStatements[requireStatements.length - 1];\n if (lastRequire) {\n const lastRequireEnd = lastRequire.getEnd();\n\n return `${fileContent.slice(0, lastRequireEnd)}\\n${requireStatement}${fileContent.slice(lastRequireEnd)}`;\n }\n }\n\n // Add at the beginning if no require statements found\n return `${requireStatement}\\n${fileContent}`;\n}\n\nfunction createObjectLiteralElementLike(obj: Record<string, string>): Array<ts.ObjectLiteralElementLike> {\n const properties: Array<ts.ObjectLiteralElementLike> = [];\n for (const [key, value] of objectEntries(obj)) {\n properties.push(\n ts.factory.createPropertyAssignment(ts.factory.createStringLiteral(key), ts.factory.createStringLiteral(value))\n );\n }\n return properties;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileUpdater.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app/src/utils/fileUpdater.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACI,MAAM,gBAAgB,GAAG,CAAC,IAAU,EAAE,IAAY,EAAE,OAAwC,EAAE,EAAE;IACrG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC7C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;IACD,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAEpC,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;QAC3B,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC,CAAC;AAdW,QAAA,gBAAgB,oBAc3B","sourcesContent":["import { Tree } from \"@nx/devkit\";\n\n/**\n *\n * @param tree File system tree\n * @param path Path to source file in the Tree\n * @param updater Function that maps the current file content to a new to be written to the Tree\n */\nexport const updateFileInTree = (tree: Tree, path: string, updater: (fileContent: string) => string) => {\n if (!tree.exists(path)) {\n throw new Error(`File not found: ${path}`);\n }\n\n const fileContent = tree.read(path, \"utf-8\");\n if (!fileContent) {\n throw new Error(`File is empty: ${path}`);\n }\n const result = updater(fileContent);\n\n if (result !== fileContent) {\n tree.write(path, result);\n }\n};\n"]}
|