@konomi-app/k2 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,11 +11,16 @@ import packer from '@kintone/plugin-packer';
|
|
|
11
11
|
import { uploadZip } from '../lib/utils.js';
|
|
12
12
|
import base from './dev-base-esbuild.js';
|
|
13
13
|
export default function command() {
|
|
14
|
-
program
|
|
14
|
+
program
|
|
15
|
+
.command('dev')
|
|
16
|
+
.option('-p, --ppk <ppk>', '.ppk file path', path.join(PLUGIN_WORKSPACE_DIRECTORY, 'private.ppk'))
|
|
17
|
+
.description('Start development server.')
|
|
18
|
+
.action(action);
|
|
15
19
|
}
|
|
16
|
-
export async function action() {
|
|
20
|
+
export async function action(options) {
|
|
17
21
|
console.group('🍳 Start development server');
|
|
18
22
|
try {
|
|
23
|
+
const { ppk: ppkPath } = options;
|
|
19
24
|
const config = await importPluginConfig();
|
|
20
25
|
const port = config.server?.port ?? DEFAULT_PORT;
|
|
21
26
|
const manifest = await outputManifest('dev', {
|
|
@@ -63,10 +68,11 @@ export async function action() {
|
|
|
63
68
|
watcher.on('unlink', contentsListener);
|
|
64
69
|
await outputContentsZip(manifest);
|
|
65
70
|
const buffer = await getContentsZipBuffer();
|
|
66
|
-
const pluginPrivateKey = await fs.readFile(path.
|
|
71
|
+
const pluginPrivateKey = await fs.readFile(path.resolve(ppkPath), 'utf8');
|
|
67
72
|
const output = await packer(buffer, pluginPrivateKey);
|
|
68
73
|
const zipFileName = `plugin${getZipFileNameSuffix('dev')}.zip`;
|
|
69
74
|
await fs.writeFile(path.join(PLUGIN_WORKSPACE_DIRECTORY, zipFileName), output.plugin);
|
|
75
|
+
console.log(`📤 uploading ${zipFileName} to your kintone`);
|
|
70
76
|
uploadZip('dev').then(({ stdout, stderr }) => {
|
|
71
77
|
console.log(stdout);
|
|
72
78
|
console.error(stderr);
|
|
@@ -12,12 +12,13 @@ export default function command() {
|
|
|
12
12
|
.command('zip')
|
|
13
13
|
.description('generate plugin zip')
|
|
14
14
|
.option('-e, --env <env>', 'plugin environment (dev, prod, standalone)', 'prod')
|
|
15
|
+
.option('-p, --ppk <ppk>', '.ppk file path', path.join(PLUGIN_WORKSPACE_DIRECTORY, 'private.ppk'))
|
|
15
16
|
.action(action);
|
|
16
17
|
}
|
|
17
18
|
async function action(options) {
|
|
18
19
|
console.group('🍳 Executing plugin zip generation');
|
|
19
20
|
try {
|
|
20
|
-
const { env } = options;
|
|
21
|
+
const { env, ppk: ppkPath } = options;
|
|
21
22
|
if (!isEnv(env)) {
|
|
22
23
|
throw new Error('Invalid environment');
|
|
23
24
|
}
|
|
@@ -27,7 +28,7 @@ async function action(options) {
|
|
|
27
28
|
console.log(`📝 manifest.json generated (${env})`);
|
|
28
29
|
await outputContentsZip(manifest);
|
|
29
30
|
const buffer = await getContentsZipBuffer();
|
|
30
|
-
const privateKey = await fs.readFile(path.
|
|
31
|
+
const privateKey = await fs.readFile(path.resolve(ppkPath), 'utf8');
|
|
31
32
|
const output = await packer(buffer, privateKey);
|
|
32
33
|
const zipFileName = `plugin${getZipFileNameSuffix(env)}.zip`;
|
|
33
34
|
await fs.writeFile(path.join(PLUGIN_WORKSPACE_DIRECTORY, zipFileName), output.plugin);
|