Skip to content

Commit

Permalink
deprecate packPluginFromManifest
Browse files Browse the repository at this point in the history
  • Loading branch information
tasshi-me committed Oct 25, 2024
1 parent 72e56b2 commit b9a1a4e
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/cli/plugin/pack.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type yargs from "yargs";
import type { CommandModule } from "yargs";
import run from "../../plugin/packer/cli";
import run from "../../plugin/packer/cli/cli";

Check failure on line 3 in src/cli/plugin/pack.ts

View workflow job for this annotation

GitHub Actions / Prepare npm package

Cannot find module '../../plugin/packer/cli/cli' or its corresponding type declarations.

Check failure on line 3 in src/cli/plugin/pack.ts

View workflow job for this annotation

GitHub Actions / Node.js ubuntu-latest 18.x

Cannot find module '../../plugin/packer/cli/cli' or its corresponding type declarations.

Check failure on line 3 in src/cli/plugin/pack.ts

View workflow job for this annotation

GitHub Actions / Node.js ubuntu-latest 18.x

Cannot find module '../../plugin/packer/cli/cli' or its corresponding type declarations.

Check failure on line 3 in src/cli/plugin/pack.ts

View workflow job for this annotation

GitHub Actions / Unit test - Node.js ubuntu-latest 18.x

Cannot find module '../../plugin/packer/cli/cli' or its corresponding type declarations.
import { emitExperimentalWarning } from "../../utils/stability";

const command = "pack";
Expand Down
12 changes: 6 additions & 6 deletions src/plugin/packer/cli.ts → src/plugin/packer/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import os from "os";
import * as chokidar from "chokidar";
import { mkdirp } from "mkdirp";
import _debug from "debug";
import packer from "./index";
import { logger } from "../../utils/log";
import { ManifestFactory } from "./manifest";
import { generateErrorMessages } from "./manifest/validate";
import { ContentsZip } from "./contents-zip";
import type { PluginZipInterface } from "./plugin-zip";
import packer from "../index";
import { logger } from "../../../utils/log";
import { ManifestFactory } from "../manifest";
import { generateErrorMessages } from "../manifest/validate";
import { ContentsZip } from "../contents-zip";
import type { PluginZipInterface } from "../plugin-zip";

const debug = _debug("cli");
const writeFile = promisify(fs.writeFile);
Expand Down
15 changes: 15 additions & 0 deletions src/plugin/packer/from-manifest/__tests__/fixtures/private.ppk
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgQDDH5jleaiQagMnSS6XjrOQCJIDhjutOV7fJyzrsGhIGhFnZk7y
K5YAm+kfOMlCEUZNHavcfS3WrJRP5sanc6E0dobTXNBYVwx97pEZk1KPhPVCiVCC
HBRPvef+Ai98o4aeSVamP6bD9aIZ51+prjcf0uh9+vzzm1XvqF9rgMkhkQIDAQAB
AoGAT8GGmaXUxNLQXyqGpORreSBHrrEbi367zLMSpXQB7BbbrkwfUNWIBs+zxlNL
0HmHJtZN/V4dcnYwWUiXQrL83OHdVgqgcUBKBX5znY9GJcPJoDM6ZhiYR7K79IQq
eAzKCveFm3bhk9+mnOdiZO+q39IPE+3PPz3dQ1PNRwbCh8ECQQDtKstAHmfRcIwf
4woOV+TllxRMDkexThxs/YWV+5Sq3lLUqOjJolLFdW1DwqQHjeyeN008C3IhNLyy
1xeRLLydAkEA0p4gHlCnxUz9nVuRkz2Dk0GMpkdz156Opcf1nKUXar4CbdSp9gbJ
LEBulEDRVop4nY6J4W5hW0bDjuPGnSR0hQJATpU2YVlxxtjG5S3iQBxpcJVdmVHF
+X7LNmXOZILGoNMnmOUatOy/BkRBXwlYNlSVSVtDkRityUjjGVLhsS2klQJAbkQY
3qYtX69SK/sPuP2AkCzGPRu1e1JorkSEwzDvlJPL48JuBP9CfWdyPS2+K0etpBdG
+n32fHoM0hdQGV9HnQJAGed+BG6jxfXJe7KRhPoT3bF4lc4xmdXGfLMoutLqoZ8y
GrKcvq1TcxsA/QSkvSGGEd0667t/9djFq1Ift02RMQ==
-----END RSA PRIVATE KEY-----
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"manifest_version": 1,
"version": 1,
"type": "APP",
"name": {
"en": "sample extension"
},
"icon": "image/icon.png"
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import path from "path";
import fs from "fs";
import packer from "../index";
import packer from "../../index";
import { packPluginFromManifest } from "../pack-plugin-from-manifest";
import { ManifestFactory } from "../manifest";
import { ContentsZip } from "../contents-zip";
import { ManifestFactory } from "../../manifest";
import { ContentsZip } from "../../contents-zip";

const fixturesDir = path.join(__dirname, "fixtures");
const ppkFilePath = path.join(fixturesDir, "private.ppk");
const pluginDir = path.join(fixturesDir, "sample-plugin", "plugin-dir");
const pluginDir = path.join(fixturesDir, "sample-plugin");

describe("pack-plugin-from-manifest", () => {
it("should be able to create a plugin from the manifest json path", async () => {
Expand Down
24 changes: 24 additions & 0 deletions src/plugin/packer/from-manifest/pack-plugin-from-manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import path from "path";
import packer from "../index";
import { ManifestFactory } from "../manifest";
import { ContentsZip } from "../contents-zip";
import type { PluginZip } from "../plugin-zip";

// TODO: We can consider deleting this function. Originally, it is used by webpack-plugin-kintone-plugin.
// In cli-kintone, it is no longer needed.
// ref. https://github.com/kintone/js-sdk/blob/fb125766efe1b0866dfb50d56a4aa80c1a8f0de8/packages/webpack-plugin-kintone-plugin/src/plugin.ts#L4
// ref.https://github.com/kintone-labs/plugin-packer/pull/49
/**
* @deprecated
*/
export const packPluginFromManifest = async (
manifestJSONPath: string,
privateKey: string,
): Promise<{ plugin: PluginZip; privateKey: string; id: string }> => {
const manifest = await ManifestFactory.loadJsonFile(manifestJSONPath);
const contentsZip = await ContentsZip.createFromManifest(
path.dirname(manifestJSONPath),
manifest,
);
return packer(contentsZip, privateKey);
};
17 changes: 0 additions & 17 deletions src/plugin/packer/pack-plugin-from-manifest.ts

This file was deleted.

0 comments on commit b9a1a4e

Please sign in to comment.