@omen.foundation/node-microservice-runtime 0.1.0 → 0.1.1
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/package.json +1 -1
- package/scripts/publish-service.mjs +4 -34
package/package.json
CHANGED
|
@@ -838,34 +838,9 @@ async function prepareDockerContext({ entry, distDir, openapiPath, packageJson,
|
|
|
838
838
|
const pkg = JSON.parse(await fs.readFile(packageJson, 'utf8'));
|
|
839
839
|
const modifiedPkg = { ...pkg };
|
|
840
840
|
|
|
841
|
-
//
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
// Copy the Microservice package from node_modules (it should be installed locally)
|
|
845
|
-
// The file: path is relative to the package.json location
|
|
846
|
-
const packageJsonDir = path.dirname(packageJson);
|
|
847
|
-
const filePath = runtimeDep.replace('file:', '');
|
|
848
|
-
const microservicePath = path.resolve(packageJsonDir, filePath);
|
|
849
|
-
const microserviceDest = path.join(appDir, 'node_modules/@omen.foundation/node-microservice-runtime');
|
|
850
|
-
|
|
851
|
-
try {
|
|
852
|
-
await fs.access(microservicePath);
|
|
853
|
-
await fs.mkdir(path.dirname(microserviceDest), { recursive: true });
|
|
854
|
-
await copyDirectory(microservicePath, microserviceDest);
|
|
855
|
-
// Change the dependency to point to the local copy in Docker
|
|
856
|
-
modifiedPkg.dependencies['@omen.foundation/node-microservice-runtime'] = 'file:./node_modules/@omen.foundation/node-microservice-runtime';
|
|
857
|
-
} catch (error) {
|
|
858
|
-
// If the path doesn't exist, we need to install first
|
|
859
|
-
// For now, throw a helpful error
|
|
860
|
-
throw new Error(
|
|
861
|
-
`Cannot find @omen.foundation/node-microservice-runtime at ${microservicePath}. ` +
|
|
862
|
-
`Please run 'npm install' in the microservice project directory first. ` +
|
|
863
|
-
`Original error: ${error instanceof Error ? error.message : String(error)}`
|
|
864
|
-
);
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
await fs.writeFile(path.join(appDir, 'package.json'), JSON.stringify(modifiedPkg, null, 2), 'utf8');
|
|
841
|
+
// No need to handle file: dependencies anymore - the runtime is published to npm
|
|
842
|
+
// Just copy the package.json as-is
|
|
843
|
+
await fs.copyFile(packageJson, path.join(appDir, 'package.json'));
|
|
869
844
|
|
|
870
845
|
try {
|
|
871
846
|
await fs.copyFile(packageLock, path.join(appDir, 'package-lock.json'));
|
|
@@ -880,10 +855,6 @@ async function prepareDockerContext({ entry, distDir, openapiPath, packageJson,
|
|
|
880
855
|
await fs.writeFile(path.join(appDir, 'beam_openApi.json'), '{}\n');
|
|
881
856
|
}
|
|
882
857
|
|
|
883
|
-
// Check if we copied node_modules (for file: dependencies)
|
|
884
|
-
const nodeModulesPath = path.join(appDir, 'node_modules/@omen.foundation');
|
|
885
|
-
const hasNodeModules = await fs.access(nodeModulesPath).then(() => true).catch(() => false);
|
|
886
|
-
|
|
887
858
|
const dockerfile = `# syntax=docker/dockerfile:1
|
|
888
859
|
ARG NODE_VERSION=${nodeVersion}
|
|
889
860
|
FROM node:${nodeVersion}-alpine
|
|
@@ -891,9 +862,8 @@ FROM node:${nodeVersion}-alpine
|
|
|
891
862
|
WORKDIR /beam/service
|
|
892
863
|
|
|
893
864
|
COPY app/package*.json ./
|
|
894
|
-
# Install dependencies
|
|
865
|
+
# Install dependencies (runtime is now on npm, so no special handling needed)
|
|
895
866
|
RUN npm install --omit=dev && npm cache clean --force
|
|
896
|
-
${hasNodeModules ? '# Copy pre-installed @omen.foundation package AFTER npm install (so it doesn't get overwritten)\nCOPY app/node_modules/@omen.foundation ./node_modules/@omen.foundation\n' : ''}
|
|
897
867
|
|
|
898
868
|
COPY app/dist ./dist
|
|
899
869
|
COPY app/beam_openApi.json ./beam_openApi.json
|