office-addin-project
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -24,4 +24,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
yield (0, convert_1.convertProject)(manifestPath, backupPath); | ||
throw new Error("Upgrade function is not ready yet."); | ||
// usageDataObject.reportSuccess("convert"); | ||
defaults_1.usageDataObject.reportSuccess("convert"); | ||
} | ||
@@ -28,0 +27,0 @@ catch (err) { |
@@ -21,2 +21,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
const child_process_1 = require("child_process"); | ||
const office_addin_manifest_converter_1 = require("office-addin-manifest-converter"); | ||
const office_addin_usage_data_1 = require("office-addin-usage-data"); | ||
@@ -27,2 +28,3 @@ /* global console */ | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const outputPath = path.dirname(manifestPath); | ||
if (manifestPath.endsWith(".json")) { | ||
@@ -41,2 +43,3 @@ throw new office_addin_usage_data_1.ExpectedError(`The convert command only works on xml manifest based projects`); | ||
yield updateManifestXmlReferences(); | ||
yield (0, office_addin_manifest_converter_1.convert)(manifestPath, outputPath, false, false); | ||
}); | ||
@@ -48,3 +51,3 @@ } | ||
const question = { | ||
message: `This command will convert your XML manifest to a JSON manifest and upgrade your project dependencies to make it compatible with the new project.\nWould you like to continue?`, | ||
message: `This command will convert your current xml manifest to a json manifest and then proceed to upgrade your project dependencies to ensure compatibility with the new project structure.\nHowever, in order for this newly updated project to function correctly you must be on a private environment that has not yet been released publicly.\nWould you like to continue?`, | ||
name: "didUserConfirm", | ||
@@ -107,3 +110,3 @@ type: "confirm", | ||
console.log(messageToBePrinted.slice(0, -1)); | ||
(0, child_process_1.exec)(command); | ||
(0, child_process_1.execSync)(command); | ||
} | ||
@@ -110,0 +113,0 @@ function updateManifestXmlReferences() { |
{ | ||
"name": "office-addin-project", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Provides project wide commands to an Office Addin Project", | ||
@@ -22,3 +22,5 @@ "main": "./lib/main.js", | ||
"inquirer": "^7.3.3", | ||
"office-addin-usage-data": "^1.6.0", | ||
"office-addin-manifest": "^1.10.1", | ||
"office-addin-manifest-converter": "^0.1.4", | ||
"office-addin-usage-data": "^1.6.1", | ||
"path": "^0.12.7" | ||
@@ -30,3 +32,3 @@ }, | ||
"@types/inquirer": "^6.5.0", | ||
"@types/mocha": "^9.1.0", | ||
"@types/mocha": "^9.1.1", | ||
"@types/node": "^14.17.2", | ||
@@ -36,4 +38,4 @@ "@types/semver": "^7.3.9", | ||
"concurrently": "^7.0.0", | ||
"mocha": "^9.2.0", | ||
"office-addin-lint": "^2.2.0", | ||
"mocha": "^10.0.0", | ||
"office-addin-lint": "^2.2.1", | ||
"rimraf": "^3.0.2", | ||
@@ -55,3 +57,3 @@ "semver": "^7.3.5", | ||
"license": "MIT", | ||
"gitHead": "a4308f6c2b476ccd02ef17cbe151fedfc258a629" | ||
"gitHead": "08fde5a3f8e7a0cbbcdf3329481a7bbb69ba6b29" | ||
} |
@@ -9,2 +9,3 @@ # Office-Addin-Project | ||
## Command-Line Interface | ||
* [convert](#info) | ||
@@ -11,0 +12,0 @@ |
@@ -15,4 +15,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
await convertProject(manifestPath, backupPath); | ||
throw new Error("Upgrade function is not ready yet."); | ||
// usageDataObject.reportSuccess("convert"); | ||
usageDataObject.reportSuccess("convert"); | ||
} catch (err: any) { | ||
@@ -19,0 +18,0 @@ usageDataObject.reportException("convert", err); |
@@ -10,3 +10,4 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
import * as util from "util"; | ||
import { exec } from "child_process"; | ||
import { execSync } from "child_process"; | ||
import { convert } from "office-addin-manifest-converter"; | ||
import { ExpectedError } from "office-addin-usage-data"; | ||
@@ -16,3 +17,3 @@ | ||
const skipBackup: string[] = [ "node_modules" ] | ||
const skipBackup: string[] = ["node_modules"]; | ||
@@ -23,2 +24,3 @@ export async function convertProject( | ||
) { | ||
const outputPath: string = path.dirname(manifestPath); | ||
if (manifestPath.endsWith(".json")) { | ||
@@ -43,2 +45,3 @@ throw new ExpectedError( | ||
await updateManifestXmlReferences(); | ||
await convert(manifestPath, outputPath, false, false); | ||
} | ||
@@ -48,3 +51,3 @@ | ||
const question = { | ||
message: `This command will convert your XML manifest to a JSON manifest and upgrade your project dependencies to make it compatible with the new project.\nWould you like to continue?`, | ||
message: `This command will convert your current xml manifest to a json manifest and then proceed to upgrade your project dependencies to ensure compatibility with the new project structure.\nHowever, in order for this newly updated project to function correctly you must be on a private environment that has not yet been released publicly.\nWould you like to continue?`, | ||
name: "didUserConfirm", | ||
@@ -60,7 +63,7 @@ type: "confirm", | ||
const outputPath: string = path.resolve(backupPath); | ||
const rootDir: string = path.resolve(); | ||
const rootDir: string = path.resolve(); | ||
const files: string[] = fs.readdirSync(rootDir); | ||
files.forEach((entry) => { | ||
const fullPath = path.resolve(entry) | ||
const fullPath = path.resolve(entry); | ||
const entryStats = fs.lstatSync(fullPath); | ||
@@ -109,3 +112,3 @@ | ||
console.log(messageToBePrinted.slice(0, -1)); | ||
exec(command); | ||
execSync(command); | ||
} | ||
@@ -112,0 +115,0 @@ |
@@ -5,5 +5,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
import * as assert from "assert"; | ||
import * as fs from "fs"; | ||
import * as mocha from "mocha"; | ||
import * as path from "path"; | ||
import { convertProject } from "../src/convert"; | ||
import { ExpectedError } from "office-addin-usage-data"; | ||
import { convert } from "office-addin-manifest-converter"; | ||
@@ -26,3 +28,26 @@ describe("office-addin-project tests", function() { | ||
}); | ||
describe("convertManifest", function() { | ||
it("Converts test manifest", async function() { | ||
this.timeout(6000); | ||
const manifestPath = "./test/test-manifest.xml"; | ||
const outputPath = "./temp/"; | ||
await convert(manifestPath, outputPath); | ||
assert.strictEqual(fs.existsSync(path.join(outputPath, "test-manifest.json")), true); | ||
}); | ||
it("Converts TaskPane manifest", async function() { | ||
this.timeout(6000); | ||
const manifestPath = "./test/TaskPane.manifest.xml"; | ||
const outputPath = "./temp/"; | ||
await convert(manifestPath, outputPath); | ||
assert.strictEqual(fs.existsSync(path.join(outputPath, "TaskPane.manifest.json")), true); | ||
}); | ||
it("Can't convert malformed manifest", async function() { | ||
this.timeout(6000); | ||
const manifestPath = "./test/invalid.manifest.xml"; | ||
const outputPath = "./out"; | ||
convert(manifestPath, outputPath); | ||
assert.strictEqual(fs.existsSync(path.join(outputPath, "manifest.json")), false); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
107566
32
957
33
8
+ Added@jridgewell/gen-mapping@0.3.5(transitive)
+ Added@jridgewell/resolve-uri@3.1.2(transitive)
+ Added@jridgewell/set-array@1.2.1(transitive)
+ Added@jridgewell/source-map@0.3.6(transitive)
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@jridgewell/trace-mapping@0.3.25(transitive)
+ Added@microsoft/teams-manifest@0.1.6(transitive)
+ Added@types/fs-extra@11.0.4(transitive)
+ Added@types/jsonfile@6.1.4(transitive)
+ Added@types/node@22.9.0(transitive)
+ Added@types/node-fetch@2.6.12(transitive)
+ Added@xmldom/xmldom@0.8.10(transitive)
+ Addedacorn@8.14.0(transitive)
+ Addedadm-zip@0.5.12(transitive)
+ Addedajv@8.17.1(transitive)
+ Addedajv-draft-04@1.0.0(transitive)
+ Addedajv-formats@3.0.1(transitive)
+ Addedansi-styles@3.2.1(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedat-least-node@1.0.0(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcommander@2.20.39.5.0(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-uri@3.0.3(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedfs-extra@9.1.0(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedjson-schema-traverse@1.0.0(transitive)
+ Addedjsonfile@6.1.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addednode-fetch@2.7.0(transitive)
+ Addedoffice-addin-manifest@1.13.6(transitive)
+ Addedoffice-addin-manifest-converter@0.1.9(transitive)
+ Addedrequire-from-string@2.0.2(transitive)
+ Addedsax@1.4.1(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedsource-map-support@0.5.21(transitive)
+ Addedsupports-color@5.5.0(transitive)
+ Addedterser@5.36.0(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedundici-types@6.19.8(transitive)
+ Addeduniversalify@2.0.1(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
+ Addedxml2js@0.5.0(transitive)
+ Addedxmlbuilder@11.0.1(transitive)