mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
remove back dir
This commit is contained in:
parent
a5e6ba2269
commit
8a3d982abd
@ -478,8 +478,8 @@ Packager.prototype._createDistFolder = Promise.method(function() {
|
||||
// Copy entire test project to temp folder
|
||||
_this._excludePatterns = _this._awsmJson.lambda.package.excludePatterns || [];
|
||||
wrench.copyDirSyncRecursive(
|
||||
path.join(_this._JAWS._meta.projectRootPath, 'back'),
|
||||
path.join(_this._distDir, 'back'),
|
||||
_this._JAWS._meta.projectRootPath,
|
||||
_this._distDir,
|
||||
{
|
||||
exclude: function(name, prefix) {
|
||||
if (!_this._excludePatterns.length) {
|
||||
@ -487,8 +487,7 @@ Packager.prototype._createDistFolder = Promise.method(function() {
|
||||
}
|
||||
|
||||
var relPath = path.join(
|
||||
prefix.replace(path.join(_this._distDir, 'back'), ''),
|
||||
name);
|
||||
prefix.replace(_this._distDir, ''), name);
|
||||
|
||||
return _this._excludePatterns.some(function(sRegex) {
|
||||
relPath = (relPath.charAt(0) == path.sep) ? relPath.substr(1) : relPath;
|
||||
@ -515,8 +514,7 @@ Packager.prototype._createDistFolder = Promise.method(function() {
|
||||
// Get ENV file from S3
|
||||
return _this._JAWS.getEnvFile(_this._region, _this._stage)
|
||||
.then(function(s3ObjData) {
|
||||
var targetBackDir = path.join(_this._distDir, 'back');
|
||||
fs.writeFileSync(path.join(targetBackDir, '.env'), s3ObjData.Body);
|
||||
fs.writeFileSync(path.join(_this._distDir, '.env'), s3ObjData.Body);
|
||||
});
|
||||
});
|
||||
|
||||
@ -540,7 +538,7 @@ Packager.prototype._packageNodeJs = Promise.method(function() {
|
||||
|
||||
// Lambda freaks out if code doesnt end in newline
|
||||
var ocbWithNewline = optimizedCodeBuffer.concat(new Buffer('\n'));
|
||||
var envData = fs.readFileSync(path.join(_this._distDir, 'back', '.env'));
|
||||
var envData = fs.readFileSync(path.join(_this._distDir, '.env'));
|
||||
|
||||
var handlerFileName = _this._awsmJson.lambda.cloudFormation.Handler.split('.')[0],
|
||||
compressPaths = [
|
||||
@ -607,7 +605,7 @@ Packager.prototype._browserifyBundle = Promise.method(function() {
|
||||
compress: {},
|
||||
};
|
||||
var b = browserify({
|
||||
basedir: path.join(_this._distDir, 'back'),
|
||||
basedir: _this._distDir,
|
||||
entries: [_this._awsmJson.lambda.cloudFormation.Handler.split('.')[0] + '.js'],
|
||||
standalone: 'lambda',
|
||||
browserField: false, // Setup for node app (copy logic of --node in bin/args.js)
|
||||
@ -680,7 +678,7 @@ Packager.prototype._generateIncludePaths = function() {
|
||||
|
||||
_this._awsmJson.lambda.package.optimize.includePaths.forEach(function(p) {
|
||||
try {
|
||||
var fullPath = path.resolve(path.join(_this._distDir, 'back', p));
|
||||
var fullPath = path.resolve(path.join(_this._distDir, p));
|
||||
var stats = fs.lstatSync(fullPath);
|
||||
} catch (e) {
|
||||
console.error('Cant find includePath ', p, e);
|
||||
|
||||
@ -27,7 +27,7 @@ module.exports.getEnvFileAsMap = function(JAWS, stage, region) {
|
||||
var deferred;
|
||||
|
||||
if (stage == 'local') {
|
||||
deferred = Promise.resolve(fs.readFileSync(path.join(JAWS._meta.projectRootPath, 'back', '.env')));
|
||||
deferred = Promise.resolve(fs.readFileSync(path.join(JAWS._meta.projectRootPath, '.env')));
|
||||
} else {
|
||||
deferred = JAWS.getEnvFile(region, stage)
|
||||
.then(function(s3ObjData) {
|
||||
@ -83,9 +83,9 @@ module.exports._getEnvFiles = function(JAWS, stage, region) {
|
||||
*/
|
||||
module.exports.listEnv = function(JAWS, stage, region, showWhereUsed) {
|
||||
var _this = this,
|
||||
backDir = path.join(JAWS._meta.projectRootPath, 'back');
|
||||
projRootDir = JAWS._meta.projectRootPath;
|
||||
|
||||
return utils.findAllAwsmJsons(backDir)
|
||||
return utils.findAllAwsmJsons(projRootDir)
|
||||
.then(function(awsmJsonPaths) {
|
||||
return [awsmJsonPaths, _this._getEnvFiles(JAWS, stage, region)];
|
||||
})
|
||||
@ -107,7 +107,7 @@ module.exports.listEnv = function(JAWS, stage, region, showWhereUsed) {
|
||||
var awsmJson = require(ajp);
|
||||
if (awsmJson.lambda && awsmJson.lambda.envVars) {
|
||||
awsmJson.lambda.envVars.forEach(function(key) {
|
||||
var rel = path.relative(path.join(backDir, 'aws_modules'), ajp);
|
||||
var rel = path.relative(path.join(projRootDir, 'aws_modules'), ajp);
|
||||
if (envInBackMap[key]) {
|
||||
envInBackMap[key].push(rel);
|
||||
} else {
|
||||
@ -201,7 +201,7 @@ module.exports.setEnvKey = function(JAWS, stage, region, key, val) {
|
||||
});
|
||||
|
||||
if (stage == 'local') {
|
||||
putEnvQ.push(utils.writeFile(path.join(JAWS._meta.projectRootPath, 'back', '.env'), contents));
|
||||
putEnvQ.push(utils.writeFile(path.join(JAWS._meta.projectRootPath, '.env'), contents));
|
||||
} else {
|
||||
putEnvQ.push(JAWS.putEnvFile(mapForRegion.regionName, stage, contents));
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ CMD.prototype._installCore = Promise.method(function() {
|
||||
}
|
||||
|
||||
if (!!jawsCoreName) {
|
||||
var existingJawsCorePath = path.join(_this._JAWS._meta.projectRootPath, 'back', 'aws_modules', jawsCoreName);
|
||||
var existingJawsCorePath = path.join(_this._JAWS._meta.projectRootPath, 'aws_modules', jawsCoreName);
|
||||
|
||||
utils.jawsDebug('Looking for existing jaws core in ' + existingJawsCorePath);
|
||||
|
||||
@ -123,7 +123,6 @@ CMD.prototype._createSkeleton = Promise.method(function() {
|
||||
var actionTemplateJson = utils.readAndParseJsonSync(path.join(templatesPath, 'action.awsm.json'));
|
||||
var modulePath = path.join(
|
||||
_this._JAWS._meta.projectRootPath,
|
||||
'back',
|
||||
'aws_modules',
|
||||
_this._module.name);
|
||||
var actionPath = path.join(modulePath, _this._module.action);
|
||||
|
||||
@ -147,7 +147,7 @@ CMD.prototype._downloadMod = Promise.method(function() {
|
||||
CMD.prototype._installFiles = Promise.method(function(tempDirPath) {
|
||||
var _this = this,
|
||||
srcAwsmJsonPath = path.join(tempDirPath, 'awsm.json'),
|
||||
awsModsPath = path.join(_this._JAWS._meta.projectRootPath, 'back', 'aws_modules');
|
||||
awsModsPath = path.join(_this._JAWS._meta.projectRootPath, 'aws_modules');
|
||||
|
||||
if (!utils.fileExistsSync(srcAwsmJsonPath)) {
|
||||
throw new JawsError('Module missing awsm.json file in root of project', JawsError.errorCodes.UNKNOWN);
|
||||
|
||||
@ -86,10 +86,10 @@ CMD.prototype.run = Promise.method(function() {
|
||||
|
||||
return Promise.try(function() {
|
||||
|
||||
// ASCII Greeting
|
||||
JawsCLI.ascii();
|
||||
// ASCII Greeting
|
||||
JawsCLI.ascii();
|
||||
|
||||
})
|
||||
})
|
||||
.bind(_this)
|
||||
.then(_this._prompt)
|
||||
.then(_this._prepareProjectData)
|
||||
@ -365,15 +365,15 @@ CMD.prototype._createProjectDirectory = Promise.method(function() {
|
||||
|
||||
// Create Project Scaffolding
|
||||
return utils.writeFile(
|
||||
path.join(_this._projectRootPath, 'back', '.env'),
|
||||
'JAWS_STAGE=' + _this._stage
|
||||
+ '\nJAWS_DATA_MODEL_STAGE=' + _this._stage
|
||||
)
|
||||
path.join(_this._projectRootPath, '.env'),
|
||||
'JAWS_STAGE=' + _this._stage
|
||||
+ '\nJAWS_DATA_MODEL_STAGE=' + _this._stage
|
||||
)
|
||||
.then(function() {
|
||||
return Promise.all([
|
||||
fs.mkdirAsync(path.join(_this._projectRootPath, 'front')),
|
||||
fs.mkdirAsync(path.join(_this._projectRootPath, 'tests')),
|
||||
fs.mkdirAsync(path.join(_this._projectRootPath, 'back', 'aws_modules')),
|
||||
fs.mkdirAsync(path.join(_this._projectRootPath, 'aws_modules')),
|
||||
utils.writeFile(path.join(_this._projectRootPath, 'admin.env'), adminEnv),
|
||||
utils.generateResourcesCf(
|
||||
_this._projectRootPath,
|
||||
@ -444,15 +444,15 @@ CMD.prototype._createCfStack = Promise.method(function() {
|
||||
|
||||
// Create CF stack
|
||||
return AWSUtils.cfCreateResourcesStack(
|
||||
_this._profile,
|
||||
_this._region,
|
||||
_this._projectRootPath,
|
||||
_this._name,
|
||||
_this._stage,
|
||||
_this._domain,
|
||||
_this._notificationEmail,
|
||||
_this._jawsBucket
|
||||
)
|
||||
_this._profile,
|
||||
_this._region,
|
||||
_this._projectRootPath,
|
||||
_this._name,
|
||||
_this._stage,
|
||||
_this._domain,
|
||||
_this._notificationEmail,
|
||||
_this._jawsBucket
|
||||
)
|
||||
.then(function(cfData) {
|
||||
return AWSUtils.monitorCf(cfData, _this._profile, _this._region, 'create');
|
||||
});
|
||||
|
||||
@ -36,7 +36,7 @@ exports.findAllAwsmPathsOfType = function(projectRootPath, type) {
|
||||
break;
|
||||
}
|
||||
|
||||
return _this.readRecursively(path.join(projectRootPath, 'back'), '*awsm.json')
|
||||
return _this.readRecursively(projectRootPath, '*awsm.json')
|
||||
.then(function(jsonPaths) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
|
||||
@ -44,7 +44,7 @@ exports.findAllAwsmPathsOfType = function(projectRootPath, type) {
|
||||
|
||||
// Check each file to ensure it is a lambda
|
||||
async.eachLimit(jsonPaths, 10, function(jsonPath, cb) {
|
||||
var lambdaJawsPath = path.join(projectRootPath, 'back', jsonPath),
|
||||
var lambdaJawsPath = path.join(projectRootPath, jsonPath),
|
||||
json = require(lambdaJawsPath);
|
||||
|
||||
if (typeof json[jawsJsonAttr] !== 'undefined') jawsPathsOfType.push(lambdaJawsPath);
|
||||
@ -397,7 +397,7 @@ function getStack() {
|
||||
var origPrepareStackTrace = Error.prepareStackTrace;
|
||||
|
||||
// Override with function that just returns `stack`
|
||||
Error.prepareStackTrace = function (_, stack) {
|
||||
Error.prepareStackTrace = function(_, stack) {
|
||||
return stack;
|
||||
};
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ describe('Test "dash" command', function() {
|
||||
'back/aws_modules/bundle/nonoptimized'])
|
||||
.then(function(pp) {
|
||||
projPath = pp;
|
||||
process.chdir(path.join(projPath, 'back'));
|
||||
process.chdir(projPath);
|
||||
JAWS = new Jaws();
|
||||
})
|
||||
.then(function() {
|
||||
|
||||
@ -33,9 +33,9 @@ describe('Test deploy endpoint command', function() {
|
||||
JAWS = new Jaws();
|
||||
|
||||
// Get Lambda Paths
|
||||
lambdaPaths.lambda1 = path.join(projPath, 'back', 'aws_modules', 'sessions', 'show', 'awsm.json');
|
||||
lambdaPaths.lambda2 = path.join(projPath, 'back', 'aws_modules', 'sessions', 'create', 'awsm.json');
|
||||
lambdaPaths.lambda3 = path.join(projPath, 'back', 'aws_modules', 'users', 'create', 'awsm.json');
|
||||
lambdaPaths.lambda1 = path.join(projPath, 'aws_modules', 'sessions', 'show', 'awsm.json');
|
||||
lambdaPaths.lambda2 = path.join(projPath, 'aws_modules', 'sessions', 'create', 'awsm.json');
|
||||
lambdaPaths.lambda3 = path.join(projPath, 'aws_modules', 'users', 'create', 'awsm.json');
|
||||
})
|
||||
.then(function() {
|
||||
CmdTag.tagAll(JAWS, 'endpoint', false);
|
||||
|
||||
@ -26,7 +26,7 @@ describe('Test "env" command', function() {
|
||||
config.usEast1Bucket)
|
||||
.then(function(pp) {
|
||||
projPath = pp;
|
||||
process.chdir(path.join(projPath, 'back', 'aws_modules', 'sessions', 'show'));
|
||||
process.chdir(path.join(projPath, 'aws_modules', 'sessions', 'show'));
|
||||
JAWS = new Jaws();
|
||||
done();
|
||||
});
|
||||
|
||||
@ -29,7 +29,7 @@ describe('Test "new module" command', function() {
|
||||
config.usEast1Bucket)
|
||||
.then(function(pp) {
|
||||
projPath = pp;
|
||||
process.chdir(path.join(projPath, 'back'));
|
||||
process.chdir(projPath);
|
||||
JAWS = new Jaws();
|
||||
done();
|
||||
});
|
||||
|
||||
@ -29,10 +29,10 @@ describe('Test "install" command', function() {
|
||||
config.usEast1Bucket)
|
||||
.then(function(pp) {
|
||||
projPath = pp;
|
||||
process.chdir(path.join(projPath, 'back', 'aws_modules', 'sessions', 'show'));
|
||||
process.chdir(path.join(projPath, 'aws_modules', 'sessions', 'show'));
|
||||
|
||||
// Delete jaws-core-js temporarily
|
||||
rimraf.sync(path.join(projPath, 'back', 'aws_modules', 'jaws-core-js'));
|
||||
rimraf.sync(path.join(projPath, 'aws_modules', 'jaws-core-js'));
|
||||
|
||||
JAWS = new Jaws();
|
||||
done();
|
||||
|
||||
@ -36,7 +36,7 @@ describe('Test "new stage/region" command', function() {
|
||||
config.usEast1Bucket)
|
||||
.then(function(pp) {
|
||||
projPath = pp;
|
||||
process.chdir(path.join(projPath, 'back'));
|
||||
process.chdir(projPath);
|
||||
JAWS = new Jaws();
|
||||
done();
|
||||
});
|
||||
|
||||
@ -26,7 +26,7 @@ describe('Test "run" command', function() {
|
||||
config.usEast1Bucket)
|
||||
.then(function(pp) {
|
||||
projPath = pp;
|
||||
process.chdir(path.join(projPath, 'back', 'aws_modules', 'sessions', 'show'));
|
||||
process.chdir(path.join(projPath, 'aws_modules', 'sessions', 'show'));
|
||||
JAWS = new Jaws();
|
||||
done();
|
||||
});
|
||||
|
||||
@ -33,9 +33,9 @@ describe('Test "tag" command', function() {
|
||||
JAWS = new Jaws();
|
||||
|
||||
// Get Lambda Paths
|
||||
modulePaths.lambda1 = path.join(projPath, 'back', 'aws_modules', 'sessions', 'show', 'awsm.json');
|
||||
modulePaths.lambda2 = path.join(projPath, 'back', 'aws_modules', 'sessions', 'create', 'awsm.json');
|
||||
modulePaths.lambda3 = path.join(projPath, 'back', 'aws_modules', 'users', 'create', 'awsm.json');
|
||||
modulePaths.lambda1 = path.join(projPath, 'aws_modules', 'sessions', 'show', 'awsm.json');
|
||||
modulePaths.lambda2 = path.join(projPath, 'aws_modules', 'sessions', 'create', 'awsm.json');
|
||||
modulePaths.lambda3 = path.join(projPath, 'aws_modules', 'users', 'create', 'awsm.json');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
//Testing how the top npm modules work with browserify
|
||||
//https://www.npmjs.com/browse/depended
|
||||
|
||||
require('../../jaws-core-js/env');
|
||||
require('../../jaws-core-js/env/index');
|
||||
|
||||
var action = require('./index.js');
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
//Testing how the top npm modules work with browserify
|
||||
//https://www.npmjs.com/browse/depended
|
||||
|
||||
require('../../jaws-core-js/env');
|
||||
require('../../jaws-core-js/env/index');
|
||||
|
||||
var action = require('./index.js');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user