appetizer-bundle
Advanced tools
Comparing version 0.0.1 to 1.0.0
67
index.js
@@ -40,2 +40,10 @@ 'use strict'; | ||
let entry = 'index.js'; | ||
if (fs.existsSync(path.join(this.dir, 'index.ios.js'))) { | ||
entry = 'index.ios.js'; | ||
} else if (fs.existsSync(path.join(this.dir, 'index.native.js'))) { | ||
entry = 'index.native.js'; | ||
} | ||
this.spawns('react-native', [ | ||
@@ -48,3 +56,3 @@ 'bundle', | ||
'--entry-file', | ||
'index.ios.js', | ||
entry, | ||
'--bundle-output', | ||
@@ -93,5 +101,17 @@ dir + '/main.jsbundle', | ||
const changes = data.split('\n').map((line) => { | ||
if (!~line.indexOf('jsBundleURLForBundleRoot:@"index.')) return line; | ||
// | ||
// React-Native is always actively iterated upon, that means that the | ||
// code structure of this file is also iterated upon. We want to support | ||
// as many versions as possible so we need to drill down further here to | ||
// ensure that we return the correct new bundle location. | ||
// | ||
return ' jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];'; | ||
if (!!~line.indexOf('jsBundleURLForBundleRoot:@"index.')) { | ||
return ' jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];'; | ||
} else if (!!~line.indexOf('jsBundleURLForBundleRoot:@"index"')) { | ||
return ' return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];' | ||
} | ||
return line; | ||
}).join('\n'); | ||
@@ -144,21 +164,30 @@ | ||
let result; | ||
files.sort().some(function find(file) { | ||
const ext = path.extname(file); | ||
/** | ||
* Search the resolved files for files with a given extension. | ||
* | ||
* @param {String} target Extension we're looking for | ||
* @returns {String|Boolean} Name of the file, or false. | ||
* @private | ||
*/ | ||
function search(target) { | ||
for (let i = 0; i < files.length; i++) { | ||
const file = files[i]; | ||
const ext = path.extname(file); | ||
if (ext === '.xcworkspace') result = { | ||
file: file, | ||
name: name, | ||
workspace: true | ||
}; | ||
if (ext === target) return file; | ||
} | ||
if (ext === '.xcodeproj') result = { | ||
file: file, | ||
name: name, | ||
workspace: false | ||
}; | ||
return false; | ||
} | ||
return !!result; | ||
}); | ||
const workspace = search('.xcworkspace'); | ||
const project = search('.xcodeproj'); | ||
let result; | ||
if (workspace) { | ||
result = { file: workspace, name, workspace: true }; | ||
} else if (project) { | ||
result = { file: project, name, workspace: false }; | ||
} | ||
if (result) return next(err, result); | ||
@@ -186,3 +215,3 @@ next(new Error('Unable to locate xcode project files.')); | ||
'-scheme', project.name, | ||
'-derivedDataPath', 'build' | ||
'-derivedDataPath', `build/${project.name}` | ||
], { | ||
@@ -189,0 +218,0 @@ cwd: dir, |
{ | ||
"name": "appetizer-bundle", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"description": "Create/Bundle React-Native apps to on appetize.io", | ||
@@ -28,3 +28,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"diagnostics": "^1.1.0" | ||
"diagnostics": "^2.0.2" | ||
}, | ||
@@ -31,0 +31,0 @@ "devDependencies": { |
@@ -17,2 +17,15 @@ # appetizer-bundle | ||
## Part of the Appetizer suite | ||
This module is part of a larger suite of components that work excellent with each | ||
other. If you liked this module we highly suggest checking out: | ||
- [appetizer][api] A Node.js component for interacting with the Appetize.io API. | ||
- [appetizer-bundle][bundle] Prepares and packs your React-Native application for uploading to Appetize.io. | ||
- [appetizer-component][component] A React Component to embed your uploaded application. | ||
[api]: https://github.com/godaddy/appetizer | ||
[bundle]: https://github.com/godaddy/appetizer-bundle | ||
[component]: https://github.com/godaddy/appetizer-component | ||
## API | ||
@@ -155,2 +168,2 @@ | ||
MIT | ||
[MIT](LICENSE) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
14099
251
0
168
4
+ Addeddiagnostics@2.0.2(transitive)
+ Addedenabled@2.0.0(transitive)
+ Addedeventemitter3@4.0.7(transitive)
+ Addedkuler@2.0.0(transitive)
+ Addedstorage-engine@3.0.7(transitive)
- Removedcolornames@1.1.1(transitive)
- Removeddiagnostics@1.1.1(transitive)
- Removedenabled@1.0.2(transitive)
- Removedenv-variable@0.0.6(transitive)
- Removedkuler@1.0.1(transitive)
Updateddiagnostics@^2.0.2