chore: Add copy-schema script, update Dockerfile schema path, and adjust npm prod workflow

This commit is contained in:
Andreas Hilbig 2026-01-14 10:28:33 +01:00
parent 70e64448e5
commit 437321ef6d
3 changed files with 71 additions and 51 deletions

112
.idea/workspace.xml generated
View file

@ -4,20 +4,9 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="d7a71994-2699-4ae4-9fd2-ee13b7f33d35" name="Changes" comment="chore: Replace copying of `schema.graphql` with `extensions` in Dockerfile">
<list default="true" id="d7a71994-2699-4ae4-9fd2-ee13b7f33d35" name="Changes" comment="chore: Add `copy-schema` script, update Dockerfile schema path, and adjust npm prod workflow">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Dockerfile" beforeDir="false" afterPath="$PROJECT_DIR$/Dockerfile" afterDir="false" />
<change beforePath="$PROJECT_DIR$/codegen.ts" beforeDir="false" afterPath="$PROJECT_DIR$/codegen.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/extensions/display_devices.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/extensions/display_devices.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/extensions/location_tracker_commons.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/extensions/location_tracker_commons.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/extensions/location_tracker_devices.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/extensions/location_tracker_devices.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/api/schema.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/api/schema.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/schema/api_commons.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/api_commons.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/schema/device_value_commons.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/device_value_commons.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/schema/devices.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/devices.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/schema/mutations.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/mutations.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/schema/queries.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/queries.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/schema/zabbix.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/zabbix.graphql" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -49,38 +38,39 @@
<option name="openDirectoriesWithSingleClick" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;NIXITCH_NIXPKGS_CONFIG&quot;: &quot;&quot;,
&quot;NIXITCH_NIX_CONF_DIR&quot;: &quot;&quot;,
&quot;NIXITCH_NIX_OTHER_STORES&quot;: &quot;&quot;,
&quot;NIXITCH_NIX_PATH&quot;: &quot;&quot;,
&quot;NIXITCH_NIX_PROFILES&quot;: &quot;&quot;,
&quot;NIXITCH_NIX_REMOTE&quot;: &quot;&quot;,
&quot;NIXITCH_NIX_USER_PROFILE_DIR&quot;: &quot;&quot;,
&quot;Node.js.index.ts.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.MCP Project settings loaded&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252&quot;: &quot;true&quot;,
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
&quot;RunOnceActivity.typescript.service.memoryLimit.init&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;main&quot;,
&quot;go.import.settings.migrated&quot;: &quot;true&quot;,
&quot;javascript.preferred.runtime.type.id&quot;: &quot;node&quot;,
&quot;last_opened_file_path&quot;: &quot;//wsl.localhost/Ubuntu/home/ahilbig/git/vcr/zabbix-graphql-api/src/test&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_interpreter_path&quot;: &quot;wsl://Ubuntu@/home/ahilbig/.nvm/versions/node/v24.12.0/bin/node&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;npm.compile.executor&quot;: &quot;Run&quot;,
&quot;npm.prod.executor&quot;: &quot;Run&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.sourceCode.TypeScript&quot;,
&quot;ts.external.directory.path&quot;: &quot;\\\\wsl.localhost\\Ubuntu\\home\\ahilbig\\git\\vcr\\zabbix-graphql-api\\node_modules\\typescript\\lib&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"NIXITCH_NIXPKGS_CONFIG": "",
"NIXITCH_NIX_CONF_DIR": "",
"NIXITCH_NIX_OTHER_STORES": "",
"NIXITCH_NIX_PATH": "",
"NIXITCH_NIX_PROFILES": "",
"NIXITCH_NIX_REMOTE": "",
"NIXITCH_NIX_USER_PROFILE_DIR": "",
"Node.js.index.ts.executor": "Run",
"RunOnceActivity.MCP Project settings loaded": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
"RunOnceActivity.git.unshallow": "true",
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
"git-widget-placeholder": "main",
"go.import.settings.migrated": "true",
"javascript.preferred.runtime.type.id": "node",
"last_opened_file_path": "//wsl.localhost/Ubuntu/home/ahilbig/git/vcr/zabbix-graphql-api/src/test",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_interpreter_path": "wsl://Ubuntu@/home/ahilbig/.nvm/versions/node/v24.12.0/bin/node",
"nodejs_package_manager_path": "npm",
"npm.compile.executor": "Run",
"npm.copy-schema.executor": "Run",
"npm.prod.executor": "Run",
"settings.editor.selected.configurable": "preferences.sourceCode.TypeScript",
"ts.external.directory.path": "\\\\wsl.localhost\\Ubuntu\\home\\ahilbig\\git\\vcr\\zabbix-graphql-api\\node_modules\\typescript\\lib",
"vue.rearranger.settings.migration": "true"
}
}</component>
}]]></component>
<component name="RecapSpentCounter">
<option name="endsOfQuotaMs" value="1768327208764" />
<option name="spentUsd" value="0.04010335" />
@ -99,6 +89,16 @@
</key>
</component>
<component name="RunManager" selected="npm.prod">
<configuration name="copy-schema" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="copy-schema" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
<configuration name="prod" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
@ -124,11 +124,13 @@
<item itemvalue="Node.js.index.ts" />
<item itemvalue="npm.compile" />
<item itemvalue="npm.codegen" />
<item itemvalue="npm.copy-schema" />
<item itemvalue="npm.prod" />
</list>
<recent_temporary>
<list>
<item itemvalue="npm.prod" />
<item itemvalue="npm.copy-schema" />
</list>
</recent_temporary>
</component>
@ -147,7 +149,7 @@
<option name="presentableId" value="Default" />
<updated>1768273021451</updated>
<workItem from="1768273025985" duration="11343000" />
<workItem from="1768380302361" duration="1020000" />
<workItem from="1768380302361" duration="4784000" />
</task>
<task id="LOCAL-00001" summary="chore: Update IntelliJ workspace settings and add GitHub Actions workflow for Docker deployment">
<option name="closed" value="true" />
@ -213,7 +215,23 @@
<option name="project" value="LOCAL" />
<updated>1768313032612</updated>
</task>
<option name="localTasksCounter" value="9" />
<task id="LOCAL-00009" summary="chore: Move schema directory away from src; Migrate `extensions` to `schema` directory, update Dockerfile and configuration paths">
<option name="closed" value="true" />
<created>1768381426293</created>
<option name="number" value="00009" />
<option name="presentableId" value="LOCAL-00009" />
<option name="project" value="LOCAL" />
<updated>1768381426293</updated>
</task>
<task id="LOCAL-00010" summary="chore: Add `copy-schema` script, update Dockerfile schema path, and adjust npm prod workflow">
<option name="closed" value="true" />
<created>1768382917600</created>
<option name="number" value="00010" />
<option name="presentableId" value="LOCAL-00010" />
<option name="project" value="LOCAL" />
<updated>1768382917600</updated>
</task>
<option name="localTasksCounter" value="11" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -240,6 +258,8 @@
<MESSAGE value="chore: Add dry-run mode and configure logger for operation mode logging" />
<MESSAGE value="chore: Add test for Zabbix API arguments parsing" />
<MESSAGE value="chore: Replace copying of `schema.graphql` with `extensions` in Dockerfile" />
<option name="LAST_COMMIT_MESSAGE" value="chore: Replace copying of `schema.graphql` with `extensions` in Dockerfile" />
<MESSAGE value="chore: Move schema directory away from src; Migrate `extensions` to `schema` directory, update Dockerfile and configuration paths" />
<MESSAGE value="chore: Add `copy-schema` script, update Dockerfile schema path, and adjust npm prod workflow" />
<option name="LAST_COMMIT_MESSAGE" value="chore: Add `copy-schema` script, update Dockerfile schema path, and adjust npm prod workflow" />
</component>
</project>

View file

@ -17,10 +17,9 @@ ARG API_VERSION
ENV API_VERSION=${API_VERSION}
WORKDIR /usr/app
COPY package*.json ./
COPY schema ./
RUN npm install --production
COPY --from=builder /usr/app/dist ./dist
CMD node dist/index.js
ADD schema ./dist/schema
CMD node ./dist/index.js
EXPOSE 4000

View file

@ -7,10 +7,11 @@
"scripts": {
"compile": "tsc",
"start": "nodemon --watch \"src/**\" --watch \"schema.graphql\" --ext \"ts,json\" --exec \"tsc & node --require ts-node/register --inspect --import tsx/esm ./src/index.ts\"",
"prod": "node ./dist/index.js",
"prod": "npm run copy-schema && node ./dist/index.js",
"test": "jest --detectOpenHandles --forceExit --bail",
"codegen": "graphql-codegen --config codegen.ts --watch \"schema.graphql\"",
"nodemon": "nodemon --watch \"src/**\" --watch \"schema.graphql\" --ext \"ts,json\" --exec \"tsc"
"nodemon": "nodemon --watch \"src/**\" --watch \"schema.graphql\" --ext \"ts,json\" --exec \"tsc",
"copy-schema": "cp -R schema ./dist/"
},
"keywords": [],
"author": "Andreas Hilbig",