New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@journeyapps/cloudcode-build-legacy

Package Overview
Dependencies
Maintainers
0
Versions
127
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@journeyapps/cloudcode-build-legacy - npm Package Compare versions

Comparing version 0.0.0-dev.a6261c7 to 0.0.0-dev.a832f00

7

dist/build.d.ts
/**
* @param src - path to the task. Must contain a cloudcode folder.
* @param dest - destination folder. Will contain an `app/cloudcode` folder after building.
* @param [zipPath] - path to use for creating a zip of dest. No zip created if this is null.
* @param zipPath - path to use for creating a zip of dest.
* @param config - task config, written to config.json.
* @param options - build options.
*/
export declare function build(src: string, dest: string, zipPath: string | null, config: any): Promise<string>;
export declare function build(src: string, dest: string, zipPath: string, config: any, options: {
yarnHome: string;
}): Promise<string>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.build = void 0;
exports.build = build;
const babel = require("@babel/core");

@@ -9,7 +9,6 @@ const jetpack = require("fs-jetpack");

const path = require("path");
const glob = require("glob-promise");
const glob_1 = require("glob");
const cloudcodeBuild = require("@journeyapps/cloudcode-build");
const yarn_1 = require("./yarn");
const error_1 = require("./error");
const { YARN_HOME } = require('./config');
const debug = require('debug')('build');

@@ -40,3 +39,3 @@ // Babel config for tasks that don't have a defined "build" step.

const fullSrc = path.join(root, src);
var files = await glob(fullSrc + '/**/*.js');
var files = await (0, glob_1.glob)(fullSrc + '/**/*.js');
debug('building files in', fullSrc, ':', files);

@@ -112,9 +111,9 @@ for (let file of files) {

* @param dest - destination folder. Will contain an `app/cloudcode` folder after building.
* @param [zipPath] - path to use for creating a zip of dest. No zip created if this is null.
* @param zipPath - path to use for creating a zip of dest.
* @param config - task config, written to config.json.
* @param options - build options.
*/
async function build(src, dest, zipPath, config) {
async function build(src, dest, zipPath, config, options) {
const taskName = config.task;
// true if safe to run user- or package-defined scripts as part of the install process.
const runInstallScripts = config.runInstallScripts;
const yarnHome = options.yarnHome;
await jetpack.dir(dest, { empty: true });

@@ -146,3 +145,3 @@ debug('copy app');

}
else if (!runInstallScripts && !isCloudCodeBuild) {
else if (!isCloudCodeBuild) {
throw new error_1.BuildError(`Custom build scripts not allowed. Use \`"build": "cloudcode-build"\` in package.json.`, {

@@ -156,3 +155,3 @@ error: 'CLOUDCODE/BUILD/BUILD_FAILED'

}
const cacheOptions = ['--cache-folder', path.join(YARN_HOME, 'yarn-cache')];
const cacheOptions = ['--cache-folder', path.join(yarnHome, 'yarn-cache')];
let args = [

@@ -169,19 +168,6 @@ 'install',

];
if (!runInstallScripts) {
// runInstallScripts is behind a hidden feature flag,
// Don't run lifecycle scripts when installing, which could be a security issue, unless it's
// authorized by the feature flag.
//
// The security issue is that this Lambda process may be re-used when rebuilding the next app,
// and lifecycle scripts could theoretically spawn a long-running process that can then read
// the source of the next app.
//
// Disabling scripts prevents certain packages from being installed correctly, especially packages using
// native extensions, or downloading external resources.
args.push('--ignore-scripts');
}
let env = {
// Yarn is hardcoded to store configuration in the user's home dir.
// Since our home dir is read-only, we override it for yarn.
HOME: YARN_HOME
// Since our home dir might be read-only, we override it for yarn.
HOME: yarnHome
};

@@ -207,3 +193,3 @@ try {

}
else if (hasBuild && runInstallScripts) {
else if (hasBuild) {
// Custom build script.

@@ -268,12 +254,6 @@ await (0, yarn_1.runScript)(taskPath, ['run', '--quiet', 'build'], { env });

await createEntry(dest, destTaskPath);
if (zipPath) {
debug('zip');
await zip(dest, zipPath);
return zipPath;
}
else {
return dest;
}
debug('zip');
await zip(dest, zipPath);
return zipPath;
}
exports.build = build;
//# sourceMappingURL=build.js.map

@@ -6,3 +6,4 @@ export interface BuildParameters {

outPath: string;
zipPath?: string;
zipPath: string;
yarnHome?: string;
}

@@ -12,5 +12,5 @@ #!/usr/bin/env node

.option('out', { string: true, demandOption: true })
.option('zip', { string: true })
.option('zip', { string: true, demandOption: true })
.option('task', { string: true, demandOption: true })
.option('runInstallScripts', { default: false })
.option('yarnHome', { string: true })
// TODO: investigate yargs.config() for reading task config blob from a file. But how to ensure required args?

@@ -31,5 +31,5 @@ .option('appId', { string: true, demandOption: true, describe: "CloudCode's reference id" })

appInstanceIds: [argv.backendId],
backendUrl: argv.backendUrl,
runInstallScripts: argv.runInstallScripts
}
backendUrl: argv.backendUrl
},
yarnHome: argv.yarnHome
});

@@ -36,0 +36,0 @@ }))

declare const TMP_PATH = "/tmp/cloudcode-build";
declare const WORKING_PATH: string;
declare const APP_PATH: string;
declare const OUTPUT_PATH: string;
declare const ZIP_PATH: string;
declare const YARN_HOME: string;
export { TMP_PATH, WORKING_PATH, APP_PATH, OUTPUT_PATH, ZIP_PATH, YARN_HOME };
export { TMP_PATH, YARN_HOME };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.YARN_HOME = exports.ZIP_PATH = exports.OUTPUT_PATH = exports.APP_PATH = exports.WORKING_PATH = exports.TMP_PATH = void 0;
const TMP_PATH = '/tmp/cloudcode-build'; // FIXME: maybe use mktemp or other task-specific workdir?
exports.YARN_HOME = exports.TMP_PATH = void 0;
const TMP_PATH = '/tmp/cloudcode-build';
exports.TMP_PATH = TMP_PATH;
const WORKING_PATH = TMP_PATH + '/extract';
exports.WORKING_PATH = WORKING_PATH;
const APP_PATH = WORKING_PATH + '/app';
exports.APP_PATH = APP_PATH;
const OUTPUT_PATH = TMP_PATH + '/dist';
exports.OUTPUT_PATH = OUTPUT_PATH;
const ZIP_PATH = TMP_PATH + '/build.zip';
exports.ZIP_PATH = ZIP_PATH;
const YARN_HOME = TMP_PATH + '/yarn';
exports.YARN_HOME = YARN_HOME;
//# sourceMappingURL=config.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.handle = void 0;
exports.handle = handle;
const jetpack = require("fs-jetpack");

@@ -8,14 +8,14 @@ const build_1 = require("./build");

const debug = require('debug')('build');
const { TMP_PATH, APP_PATH, ZIP_PATH, OUTPUT_PATH } = require('./config');
const { TMP_PATH, YARN_HOME } = require('./config');
async function handle(event) {
var _a, _b;
var _a;
try {
await jetpack.dir(TMP_PATH, { empty: true });
await jetpack.dir(APP_PATH, { empty: true });
const outPath = (_a = event.outPath) !== null && _a !== void 0 ? _a : OUTPUT_PATH;
const zipPath = (_b = event.zipPath) !== null && _b !== void 0 ? _b : ZIP_PATH;
debug('copying...');
await jetpack.copy(event.appPath, APP_PATH, { overwrite: true }); // FIXME: this might cause copy-loops if outPath is inside event.appPath
// await jetpack.dir(TMP_PATH, { empty: true });
await jetpack.dir(TMP_PATH, {});
const appPath = event.appPath;
const outPath = event.outPath;
const zipPath = event.zipPath;
const yarnHome = (_a = event.yarnHome) !== null && _a !== void 0 ? _a : YARN_HOME;
debug('building...');
var zipFile = await (0, build_1.build)(APP_PATH, outPath, zipPath, event.taskConfig);
var zipFile = await (0, build_1.build)(appPath, outPath, zipPath, event.taskConfig, { yarnHome });
debug('built', outPath, zipFile);

@@ -28,7 +28,5 @@ debug('done.');

console.error(wrappedError); // Includes error.stack
// return wrappedError;
throw wrappedError;
}
}
exports.handle = handle;
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.runScript = exports.runYarn = void 0;
exports.runYarn = runYarn;
exports.runScript = runScript;
const child_process_promise_1 = require("child-process-promise");

@@ -11,3 +12,2 @@ const debug = require('debug')('build');

}
exports.runYarn = runYarn;
async function runScript(dir, args, options) {

@@ -46,3 +46,2 @@ const yarnPath = require.resolve('yarn/bin/yarn.js');

}
exports.runScript = runScript;
/**

@@ -49,0 +48,0 @@ * Run a yarn command and log the output.

{
"name": "@journeyapps/cloudcode-build-legacy",
"version": "0.0.0-dev.a6261c7",
"version": "0.0.0-dev.a832f00",
"description": "Port of JourneyApps CloudCode's legacy build tooling.",

@@ -16,23 +16,22 @@ "publishConfig": {

"dependencies": {
"@babel/core": "^7.14.6",
"@babel/plugin-transform-modules-commonjs": "^7.14.5",
"@babel/core": "^7.25.2",
"@babel/plugin-transform-modules-commonjs": "^7.24.8",
"@journeyapps/cloudcode": "1.12.0",
"@journeyapps/cloudcode-build": "1.12.0",
"archiver": "^1.0.1",
"aws-sdk": "^2.5.2",
"child-process-promise": "^2.2.0",
"concat-stream": "^1.6.0",
"debug": "^2.6.0",
"fs-jetpack": "^0.9.2",
"glob": "^7.0.5",
"glob-promise": "^3.1.0",
"lodash": "^4.17.2",
"mkdirp": "^0.5.1",
"source-map-support": "^0.4.2",
"yargs": "17.7.1",
"yarn": "^1.7.0"
"archiver": "^7.0.1",
"aws-sdk": "^2.1681.0",
"child-process-promise": "^2.2.1",
"concat-stream": "^2.0.0",
"debug": "^4.3.6",
"fs-jetpack": "^5.1.0",
"glob": "^11.0.0",
"lodash": "^4.17.21",
"mkdirp": "^3.0.1",
"source-map-support": "^0.5.21",
"yargs": "17.7.2",
"yarn": "^1.22.22"
},
"devDependencies": {
"@types/node": "14.18.36",
"@types/yargs": "17.0.22"
"@types/node": "22.5.0",
"@types/yargs": "17.0.33"
},

@@ -39,0 +38,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc