@konomi-app/k2 1.4.2 → 1.4.3
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.
- package/dist/lib/utils.js +25 -14
- package/dist/lib/webpack.js +6 -1
- package/dist/plugin.js +0 -2
- package/package.json +1 -2
- package/dist/commands/upload/index.js +0 -30
package/dist/lib/utils.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { PLUGIN_WORKSPACE_DIRECTORY } from './constants.js';
|
|
2
|
-
import { exec } from './exec.js';
|
|
3
2
|
import { KintoneApiClient } from './kintone-api-client.js';
|
|
4
3
|
import { getZipFileNameSuffix } from './zip.js';
|
|
5
|
-
import { config } from 'dotenv';
|
|
6
4
|
import fs from 'fs-extra';
|
|
7
5
|
import path from 'path';
|
|
8
6
|
export const isEnv = (env) => {
|
|
@@ -35,20 +33,33 @@ export const apiUploadZip = async (params) => {
|
|
|
35
33
|
/**
|
|
36
34
|
* @kintone/plugin-uploaderを利用してプラグインをアップロードします
|
|
37
35
|
* APIを使用した方が高速ですが、2024年11月までは設定により無効になる可能性があるため、暫定的に残しています
|
|
36
|
+
* 使用するには@kintone/plugin-uploaderがインストールされている必要があります
|
|
38
37
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
/*
|
|
39
|
+
export const uploadZip = async (env: Plugin.Meta.Env) => {
|
|
40
|
+
config();
|
|
41
|
+
|
|
42
|
+
const {
|
|
43
|
+
KINTONE_BASE_URL,
|
|
44
|
+
KINTONE_USERNAME,
|
|
45
|
+
KINTONE_PASSWORD,
|
|
46
|
+
KINTONE_BASIC_AUTH_USERNAME = '',
|
|
47
|
+
KINTONE_BASIC_AUTH_PASSWORD = '',
|
|
48
|
+
} = process.env;
|
|
49
|
+
if (!KINTONE_BASE_URL || !KINTONE_USERNAME || !KINTONE_PASSWORD) {
|
|
50
|
+
throw new Error(`.envの設定が不十分です。以下のパラメータは必須です
|
|
44
51
|
KINTONE_BASE_URL
|
|
45
52
|
KINTONE_USERNAME
|
|
46
53
|
KINTONE_PASSWORD`);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const zipFileName = `plugin${getZipFileNameSuffix(env)}.zip`;
|
|
57
|
+
|
|
58
|
+
let command = `kintone-plugin-uploader ${PLUGIN_WORKSPACE_DIRECTORY}/${zipFileName} --base-url ${KINTONE_BASE_URL} --username ${KINTONE_USERNAME} --password ${KINTONE_PASSWORD}`;
|
|
59
|
+
if (KINTONE_BASIC_AUTH_USERNAME && KINTONE_BASIC_AUTH_PASSWORD) {
|
|
60
|
+
command += ` --basic-auth-username ${KINTONE_BASIC_AUTH_USERNAME} --basic-auth-password ${KINTONE_BASIC_AUTH_PASSWORD}`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return exec(command);
|
|
54
64
|
};
|
|
65
|
+
*/
|
package/dist/lib/webpack.js
CHANGED
|
@@ -40,7 +40,12 @@ export const buildWithWebpack = async (props) => {
|
|
|
40
40
|
plugins: [new MiniCssExtractPlugin()],
|
|
41
41
|
optimization: {
|
|
42
42
|
minimize: true,
|
|
43
|
-
minimizer: [
|
|
43
|
+
minimizer: [
|
|
44
|
+
new TerserPlugin({
|
|
45
|
+
terserOptions: { format: { comments: false } },
|
|
46
|
+
extractComments: false,
|
|
47
|
+
}),
|
|
48
|
+
],
|
|
44
49
|
},
|
|
45
50
|
}, (err, stats) => {
|
|
46
51
|
if (err) {
|
package/dist/plugin.js
CHANGED
|
@@ -7,7 +7,6 @@ import genkey from './commands/plugin-genkey.js';
|
|
|
7
7
|
import init from './commands/plugin-init.js';
|
|
8
8
|
import manifest from './commands/manifest/index.js';
|
|
9
9
|
import test from './commands/test/index.js';
|
|
10
|
-
import upload from './commands/upload/index.js';
|
|
11
10
|
import zip from './commands/plugin-zip.js';
|
|
12
11
|
import lint from './commands/lint.js';
|
|
13
12
|
program.name('plugin').version('1.4.0').description('🍳 kintone kitchen 🍳 for kintone plugin');
|
|
@@ -18,7 +17,6 @@ genkey();
|
|
|
18
17
|
init();
|
|
19
18
|
manifest();
|
|
20
19
|
test();
|
|
21
|
-
upload();
|
|
22
20
|
zip();
|
|
23
21
|
lint();
|
|
24
22
|
program.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@konomi-app/k2",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "kintone sdk",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"license": "ISC",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@kintone/plugin-packer": "^8",
|
|
28
|
-
"@kintone/plugin-uploader": "^9",
|
|
29
28
|
"@typescript-eslint/eslint-plugin": "^7",
|
|
30
29
|
"@typescript-eslint/parser": "^7",
|
|
31
30
|
"archiver": "^7",
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { program } from 'commander';
|
|
2
|
-
import { config } from 'dotenv';
|
|
3
|
-
import { isEnv, uploadZip } from '../../lib/utils.js';
|
|
4
|
-
export default function command() {
|
|
5
|
-
program
|
|
6
|
-
.command('upload')
|
|
7
|
-
.description('upload plugin.zip to your kintone')
|
|
8
|
-
.option('-e, --env <env>', 'plugin environment (dev, prod, standalone)', 'prod')
|
|
9
|
-
.action(action);
|
|
10
|
-
}
|
|
11
|
-
async function action(options) {
|
|
12
|
-
console.group('🚀 Uploading plugin.zip to your kintone');
|
|
13
|
-
try {
|
|
14
|
-
config();
|
|
15
|
-
const { env } = options;
|
|
16
|
-
if (!isEnv(env)) {
|
|
17
|
-
throw new Error('Invalid environment');
|
|
18
|
-
}
|
|
19
|
-
const { stderr } = await uploadZip(env);
|
|
20
|
-
if (stderr) {
|
|
21
|
-
console.error(JSON.stringify(stderr, null, 2));
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
throw error;
|
|
26
|
-
}
|
|
27
|
-
finally {
|
|
28
|
-
console.groupEnd();
|
|
29
|
-
}
|
|
30
|
-
}
|