@catladder/pipeline 1.99.0 → 1.99.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.
@@ -74,13 +74,7 @@ var createNodeBuildJobs = function (context) {
74
74
  cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
75
75
  variables: {
76
76
  // only required for non static
77
- YARN_INSTALL: (0, yarn_1.getYarnInstallCommand)(context, {
78
- prodOnly: true
79
- }),
80
- YARN_INSTALL_WITHOUT_SCRIPTS: (0, yarn_1.getYarnInstallCommand)(context, {
81
- prodOnly: true,
82
- noScripts: true
83
- }),
77
+ DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context),
84
78
  DOCKER_COPY_WORKSPACE_FILES: (_e = (_d = context.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.pathsToCopyInDocker.map(function (dir) {
85
79
  return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir);
86
80
  })) === null || _e === void 0 ? void 0 : _e.join("\n")
@@ -1,7 +1,4 @@
1
1
  import type { Context } from "../../types";
2
- export declare const getYarnInstallCommand: (context: Context, options?: {
3
- prodOnly?: boolean | undefined;
4
- noScripts?: boolean | undefined;
5
- } | undefined) => string;
6
2
  export declare const ensureNodeVersion: (context: Context) => string[];
7
- export declare const getYarnInstall: (context: Context) => string[];
3
+ export declare const getYarnInstall: (context: Context) => string[];
4
+ export declare const getDockerAppCopyAndBuildScript: (context: Context) => string;
@@ -32,28 +32,40 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
32
32
  return to.concat(ar || Array.prototype.slice.call(from));
33
33
  };
34
34
  exports.__esModule = true;
35
- exports.getYarnInstall = exports.ensureNodeVersion = exports.getYarnInstallCommand = void 0;
36
- var getYarnInstallCommand = function (context, options) {
35
+ exports.getDockerAppCopyAndBuildScript = exports.getYarnInstall = exports.ensureNodeVersion = void 0;
36
+ var YARN_INSTALL_CLASSIC = "yarn install --frozen-lockfile";
37
+ // FIXME: check why and when rebuild is needed
38
+ var YARN_BERRY_PROD_REBUILD = "yarn workspaces focus --production && yarn rebuild";
39
+ var getYarnInstallCommand = function (context) {
37
40
  var _a;
38
41
  if ((_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.isClassic) {
39
- return "yarn install --frozen-lockfile ".concat((options === null || options === void 0 ? void 0 : options.prodOnly) ? "--production" : "", " ").concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "--ignore-scripts" : "");
42
+ return YARN_INSTALL_CLASSIC;
40
43
  }
41
- // is modern
42
- // yarn >= 4 ships with build in plugins, see https://github.com/yarnpkg/berry/pull/4253
43
- // trying to import those fail on this version
44
- var doesNotShipWithBuiltInPlugins = ["2", "3"].some(function (v) {
45
- var _a;
46
- return (_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.version.startsWith(v);
47
- });
48
- return (options === null || options === void 0 ? void 0 : options.prodOnly) ? "".concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "YARN_ENABLE_SCRIPTS=false " : "").concat(doesNotShipWithBuiltInPlugins ? "yarn plugin import workspace-tools && " : " ", "yarn workspaces focus --production && yarn rebuild") // needs yarn plugin import workspace-tools
49
- : "".concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "YARN_ENABLE_SCRIPTS=false " : "", "yarn install --immutable");
44
+ return "yarn install --immutable";
50
45
  };
51
- exports.getYarnInstallCommand = getYarnInstallCommand;
52
46
  var ensureNodeVersion = function (context) {
53
47
  return ["if [ -f ./.nvmrc ]; then source /root/.nvm/nvm.sh && nvm install <<< .nvmrc; fi"];
54
48
  };
55
49
  exports.ensureNodeVersion = ensureNodeVersion;
56
50
  var getYarnInstall = function (context) {
57
- return __spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), [(0, exports.getYarnInstallCommand)(context)], false);
51
+ return __spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), [getYarnInstallCommand(context)], false);
52
+ };
53
+ exports.getYarnInstall = getYarnInstall;
54
+ var DOCKER_COPY_FILES = "COPY --chown=node:node $APP_DIR .";
55
+ var getDockerAppCopyAndBuildScript = function (context) {
56
+ var _a;
57
+ if ((_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.isClassic) {
58
+ return "\nRUN ".concat(YARN_INSTALL_CLASSIC, " --production --ignore-scripts\n").concat(DOCKER_COPY_FILES, "\nRUN ").concat(YARN_INSTALL_CLASSIC, " --production \n ").trim();
59
+ }
60
+ // yarn >= 4 ships with build in plugins, see https://github.com/yarnpkg/berry/pull/4253
61
+ // trying to import those fail on this version
62
+ var doesNotShipWithBuiltInPlugins = ["2", "3"].some(function (v) {
63
+ var _a;
64
+ return (_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.version.startsWith(v);
65
+ });
66
+ var maybeAddWorkspaceToolsCommand = doesNotShipWithBuiltInPlugins ? "RUN yarn plugin import workspace-tools" : "";
67
+ // copy first everything and then install
68
+ // rebuild first does not work as it will run postinstall and that might require files in the app
69
+ return "\n".concat(DOCKER_COPY_FILES, "\n").concat(maybeAddWorkspaceToolsCommand, "\nRUN ").concat(YARN_BERRY_PROD_REBUILD, "\n\n ").trim();
58
70
  };
59
- exports.getYarnInstall = getYarnInstall;
71
+ exports.getDockerAppCopyAndBuildScript = getDockerAppCopyAndBuildScript;