...
 
Commits (2)
......@@ -66,3 +66,7 @@ gulp.task('publish', gulp.series(clean_generated, lint_ts, compile_ts, shell.tas
], [
'cd definition && npm publish --access public && npm pack'
])));
gulp.task('publish-alpha', gulp.series(clean_generated, lint_ts, compile_ts, shell.task([
'npm publish --access public --tag alpha && npm pack'
])));
......@@ -10,6 +10,7 @@
"fix-lint": "tslint --project tsconfig.json --fix",
"compile": "gulp compile",
"go-publish": "gulp publish",
"go-publish-alpha": "gulp publish-alpha",
"unit-tests": "ts-node ./tests/runner.ts",
"test-and-coverage": "nyc npm run unit-tests && nyc report",
"view-coverage": "npm run test-and-coverage && http-server coverage -p 9082 -c-1",
......
......@@ -14,10 +14,10 @@ export class AppPackageParser {
// tslint:disable-next-line:max-line-length
public static uuid4Regex: RegExp = /^[0-9a-fA-f]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/;
private allowedIconExts: Array<string> = ['.png', '.jpg', '.jpeg', '.gif'];
private appsTsDefVer: string;
private appsEngineVersion: string;
constructor() {
this.appsTsDefVer = this.getTsDefVersion();
this.appsEngineVersion = this.getEngineVersion();
}
public async parseZip(compiler: AppCompiler, zipBase64: string): Promise<IParseZipResult> {
......@@ -42,8 +42,8 @@ export class AppPackageParser {
throw new Error('Invalid App package. No "app.json" file.');
}
if (!semver.satisfies(this.appsTsDefVer, info.requiredApiVersion)) {
throw new RequiredApiVersionError(info, this.appsTsDefVer);
if (!semver.satisfies(this.appsEngineVersion, info.requiredApiVersion)) {
throw new RequiredApiVersionError(info, this.appsEngineVersion);
}
// Load all of the TypeScript only files
......@@ -145,18 +145,20 @@ export class AppPackageParser {
return `data:image/${ ext.replace('.', '') };base64,${ base64 }`;
}
private getTsDefVersion(): string {
private getEngineVersion(): string {
const devLocation = path.join(__dirname, '../../../package.json');
const prodLocation = path.join(__dirname, '../../package.json');
let info: { version: string };
if (fs.existsSync(devLocation)) {
const info = JSON.parse(fs.readFileSync(devLocation, 'utf8'));
return info.version as string;
info = JSON.parse(fs.readFileSync(devLocation, 'utf8'));
} else if (fs.existsSync(prodLocation)) {
const info = JSON.parse(fs.readFileSync(prodLocation, 'utf8'));
return info.version as string;
info = JSON.parse(fs.readFileSync(prodLocation, 'utf8'));
} else {
throw new Error('Could not find the Apps TypeScript Definition Package Version!');
}
return info.version.replace(/^[^0-9]/, '').split('-')[0];
}
}