@konomi-app/k2 1.11.0 → 1.11.1
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/commands/build-base.d.ts +6 -0
- package/dist/commands/build-base.d.ts.map +1 -0
- package/dist/commands/build-base.js +7 -0
- package/dist/commands/build-base.js.map +1 -0
- package/dist/commands/build-esbuild.d.ts +7 -0
- package/dist/commands/build-esbuild.d.ts.map +1 -0
- package/dist/commands/build-esbuild.js +63 -0
- package/dist/commands/build-esbuild.js.map +1 -0
- package/dist/commands/build-tailwind.d.ts +2 -0
- package/dist/commands/build-tailwind.d.ts.map +1 -0
- package/dist/commands/build-tailwind.js +18 -0
- package/dist/commands/build-tailwind.js.map +1 -0
- package/dist/commands/build.d.ts +7 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +52 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/dev/index.d.ts +9 -0
- package/dist/commands/dev/index.d.ts.map +1 -0
- package/dist/commands/dev/index.js +60 -0
- package/dist/commands/dev/index.js.map +1 -0
- package/dist/commands/dev/tailwind.d.ts +5 -0
- package/dist/commands/dev/tailwind.d.ts.map +1 -0
- package/dist/commands/dev/tailwind.js +30 -0
- package/dist/commands/dev/tailwind.js.map +1 -0
- package/dist/commands/dev-base-esbuild.d.ts +8 -0
- package/dist/commands/dev-base-esbuild.d.ts.map +1 -0
- package/dist/commands/dev-base-esbuild.js +18 -0
- package/dist/commands/dev-base-esbuild.js.map +1 -0
- package/dist/commands/genkey-base.d.ts +4 -0
- package/dist/commands/genkey-base.d.ts.map +1 -0
- package/dist/commands/genkey-base.js +19 -0
- package/dist/commands/genkey-base.js.map +1 -0
- package/dist/commands/genkey.d.ts +5 -0
- package/dist/commands/genkey.d.ts.map +1 -0
- package/dist/commands/genkey.js +14 -0
- package/dist/commands/genkey.js.map +1 -0
- package/dist/commands/lint.d.ts +8 -0
- package/dist/commands/lint.d.ts.map +1 -0
- package/dist/commands/lint.js +20 -0
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/manifest/index.d.ts +2 -0
- package/dist/commands/manifest/index.d.ts.map +1 -0
- package/dist/commands/manifest/index.js +29 -0
- package/dist/commands/manifest/index.js.map +1 -0
- package/dist/commands/plugin-build.d.ts +3 -0
- package/dist/commands/plugin-build.d.ts.map +1 -0
- package/dist/commands/plugin-build.js +60 -0
- package/dist/commands/plugin-build.js.map +1 -0
- package/dist/commands/plugin-dev/create-manifest.d.ts +5 -0
- package/dist/commands/plugin-dev/create-manifest.d.ts.map +1 -0
- package/dist/commands/plugin-dev/create-manifest.js +30 -0
- package/dist/commands/plugin-dev/create-manifest.js.map +1 -0
- package/dist/commands/plugin-dev/index.d.ts +6 -0
- package/dist/commands/plugin-dev/index.d.ts.map +1 -0
- package/dist/commands/plugin-dev/index.js +50 -0
- package/dist/commands/plugin-dev/index.js.map +1 -0
- package/dist/commands/plugin-dev/tailwind.d.ts +2 -0
- package/dist/commands/plugin-dev/tailwind.d.ts.map +1 -0
- package/dist/commands/plugin-dev/tailwind.js +42 -0
- package/dist/commands/plugin-dev/tailwind.js.map +1 -0
- package/dist/commands/plugin-dev/upload.d.ts +5 -0
- package/dist/commands/plugin-dev/upload.d.ts.map +1 -0
- package/dist/commands/plugin-dev/upload.js +58 -0
- package/dist/commands/plugin-dev/upload.js.map +1 -0
- package/dist/commands/plugin-esbuild.d.ts +3 -0
- package/dist/commands/plugin-esbuild.d.ts.map +1 -0
- package/dist/commands/plugin-esbuild.js +66 -0
- package/dist/commands/plugin-esbuild.js.map +1 -0
- package/dist/commands/plugin-genkey.d.ts +3 -0
- package/dist/commands/plugin-genkey.d.ts.map +1 -0
- package/dist/commands/plugin-genkey.js +13 -0
- package/dist/commands/plugin-genkey.js.map +1 -0
- package/dist/commands/plugin-init.d.ts +3 -0
- package/dist/commands/plugin-init.d.ts.map +1 -0
- package/dist/commands/plugin-init.js +45 -0
- package/dist/commands/plugin-init.js.map +1 -0
- package/dist/commands/plugin-tsup.d.ts +3 -0
- package/dist/commands/plugin-tsup.d.ts.map +1 -0
- package/dist/commands/plugin-tsup.js +65 -0
- package/dist/commands/plugin-tsup.js.map +1 -0
- package/dist/commands/plugin-zip.d.ts +2 -0
- package/dist/commands/plugin-zip.d.ts.map +1 -0
- package/dist/commands/plugin-zip.js +46 -0
- package/dist/commands/plugin-zip.js.map +1 -0
- package/dist/commands/test/index.d.ts +3 -0
- package/dist/commands/test/index.d.ts.map +1 -0
- package/dist/commands/test/index.js +17 -0
- package/dist/commands/test/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cert.d.ts +4 -0
- package/dist/lib/cert.d.ts.map +1 -0
- package/dist/lib/cert.js +16 -0
- package/dist/lib/cert.js.map +1 -0
- package/dist/lib/constants.d.ts +13 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/constants.js +14 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/esbuild.d.ts +6 -0
- package/dist/lib/esbuild.d.ts.map +1 -0
- package/dist/lib/esbuild.js +39 -0
- package/dist/lib/esbuild.js.map +1 -0
- package/dist/lib/exec.d.ts +3 -0
- package/dist/lib/exec.d.ts.map +1 -0
- package/dist/lib/exec.js +4 -0
- package/dist/lib/exec.js.map +1 -0
- package/dist/lib/import.d.ts +4 -0
- package/dist/lib/import.d.ts.map +1 -0
- package/dist/lib/import.js +18 -0
- package/dist/lib/import.js.map +1 -0
- package/dist/lib/k2.d.ts +2 -0
- package/dist/lib/k2.d.ts.map +1 -0
- package/dist/lib/k2.js +9 -0
- package/dist/lib/k2.js.map +1 -0
- package/dist/lib/kintone-api-client.d.ts +57 -0
- package/dist/lib/kintone-api-client.d.ts.map +1 -0
- package/dist/lib/kintone-api-client.js +95 -0
- package/dist/lib/kintone-api-client.js.map +1 -0
- package/dist/lib/lint.d.ts +2 -0
- package/dist/lib/lint.d.ts.map +1 -0
- package/dist/lib/lint.js +28 -0
- package/dist/lib/lint.js.map +1 -0
- package/dist/lib/plugin-contents.d.ts +5 -0
- package/dist/lib/plugin-contents.d.ts.map +1 -0
- package/dist/lib/plugin-contents.js +28 -0
- package/dist/lib/plugin-contents.js.map +1 -0
- package/dist/lib/plugin-manifest.d.ts +4 -0
- package/dist/lib/plugin-manifest.d.ts.map +1 -0
- package/dist/lib/plugin-manifest.js +13 -0
- package/dist/lib/plugin-manifest.js.map +1 -0
- package/dist/lib/tailwind.d.ts +33 -0
- package/dist/lib/tailwind.d.ts.map +1 -0
- package/dist/lib/tailwind.js +91 -0
- package/dist/lib/tailwind.js.map +1 -0
- package/dist/lib/tsup.d.ts +3 -0
- package/dist/lib/tsup.d.ts.map +1 -0
- package/dist/lib/tsup.js +26 -0
- package/dist/lib/tsup.js.map +1 -0
- package/dist/lib/utils.d.ts +16 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +66 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/webpack.d.ts +6 -0
- package/dist/lib/webpack.d.ts.map +1 -0
- package/dist/lib/webpack.js +72 -0
- package/dist/lib/webpack.js.map +1 -0
- package/dist/lib/zip.d.ts +4 -0
- package/dist/lib/zip.d.ts.map +1 -0
- package/dist/lib/zip.js +65 -0
- package/dist/lib/zip.js.map +1 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +25 -0
- package/dist/plugin.js.map +1 -0
- package/package.json +1 -1
package/dist/lib/tsup.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { build } from 'tsup';
|
|
2
|
+
/**
|
|
3
|
+
* 受け取ったビルドオプションに対して、共通するビルドオプションを補完します
|
|
4
|
+
*
|
|
5
|
+
* @param params
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
const completeBuildOptions = (params) => {
|
|
9
|
+
return {
|
|
10
|
+
bundle: true,
|
|
11
|
+
minify: 'terser',
|
|
12
|
+
splitting: false,
|
|
13
|
+
noExternal: [/.*/],
|
|
14
|
+
platform: 'browser',
|
|
15
|
+
dts: true,
|
|
16
|
+
...params,
|
|
17
|
+
esbuildOptions(options, context) {
|
|
18
|
+
options.legalComments = 'none';
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export const buildWithTsup = async (buildOptions) => {
|
|
23
|
+
const options = completeBuildOptions(buildOptions);
|
|
24
|
+
await build(options);
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=tsup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsup.js","sourceRoot":"","sources":["../../src/lib/tsup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,EAAE,MAAM,MAAM,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,oBAAoB,GAAG,CAAC,MAAe,EAAW,EAAE;IACxD,OAAO;QACL,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,KAAK;QAChB,UAAU,EAAE,CAAC,IAAI,CAAC;QAClB,QAAQ,EAAE,SAAS;QACnB,GAAG,EAAE,IAAI;QACT,GAAG,MAAM;QACT,cAAc,CAAC,OAAO,EAAE,OAAO;YAC7B,OAAO,CAAC,aAAa,GAAG,MAAM,CAAC;QACjC,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,YAAqB,EAAE,EAAE;IAC3D,MAAM,OAAO,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;IACnD,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const isEnv: (env: string) => env is Plugin.Meta.Env;
|
|
2
|
+
/**
|
|
3
|
+
* プラグインを追加・更新するAPIを利用してプラグインをアップロードします
|
|
4
|
+
*/
|
|
5
|
+
export declare const apiUploadZip: (params: {
|
|
6
|
+
env: Plugin.Meta.Env;
|
|
7
|
+
pluginId: string;
|
|
8
|
+
}) => Promise<{
|
|
9
|
+
method: "PUT" | "POST";
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* @kintone/plugin-uploaderを利用してプラグインをアップロードします
|
|
13
|
+
* APIを使用した方が高速ですが、2024年11月までは設定により無効になる可能性があるため、暫定的に残しています
|
|
14
|
+
* 使用するには@kintone/plugin-uploaderがインストールされている必要があります
|
|
15
|
+
*/
|
|
16
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,KAAK,GAAI,KAAK,MAAM,KAAG,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAEtD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GAAU,QAAQ;IACzC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB,KAAG,OAAO,CAAC;IAAE,MAAM,EAAE,KAAK,GAAG,MAAM,CAAA;CAAE,CA0BrC,CAAC;AAEF;;;;GAIG"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { PLUGIN_WORKSPACE_DIRECTORY } from './constants.js';
|
|
2
|
+
import { KintoneApiClient } from './kintone-api-client.js';
|
|
3
|
+
import { getZipFileNameSuffix } from './zip.js';
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
export const isEnv = (env) => {
|
|
7
|
+
return ['prod', 'dev', 'standalone'].includes(env);
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* プラグインを追加・更新するAPIを利用してプラグインをアップロードします
|
|
11
|
+
*/
|
|
12
|
+
export const apiUploadZip = async (params) => {
|
|
13
|
+
const { env, pluginId } = params;
|
|
14
|
+
const kc = new KintoneApiClient();
|
|
15
|
+
const zipFileName = `plugin${getZipFileNameSuffix(env)}.zip`;
|
|
16
|
+
const zipFile = new Blob([await fs.readFile(path.join(PLUGIN_WORKSPACE_DIRECTORY, zipFileName))]);
|
|
17
|
+
const fileKey = await kc.upload({ blob: zipFile, fileName: zipFileName });
|
|
18
|
+
const plugins = await kc.getAllPlugins();
|
|
19
|
+
const plugin = plugins.find((p) => p.id === pluginId);
|
|
20
|
+
if (plugin) {
|
|
21
|
+
const json = await kc.updatePlugin({ id: pluginId, fileKey });
|
|
22
|
+
if ('errors' in json && json.errors) {
|
|
23
|
+
console.error((json.errors.id?.messages ?? []).map((m) => `Error: ${m}`).join('\n'));
|
|
24
|
+
}
|
|
25
|
+
return { method: 'PUT' };
|
|
26
|
+
}
|
|
27
|
+
const result = await kc.addPlugin({ fileKey });
|
|
28
|
+
if ('code' in result) {
|
|
29
|
+
console.error(`Error: ${result.message}`);
|
|
30
|
+
}
|
|
31
|
+
return { method: 'POST' };
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* @kintone/plugin-uploaderを利用してプラグインをアップロードします
|
|
35
|
+
* APIを使用した方が高速ですが、2024年11月までは設定により無効になる可能性があるため、暫定的に残しています
|
|
36
|
+
* 使用するには@kintone/plugin-uploaderがインストールされている必要があります
|
|
37
|
+
*/
|
|
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の設定が不十分です。以下のパラメータは必須です
|
|
51
|
+
KINTONE_BASE_URL
|
|
52
|
+
KINTONE_USERNAME
|
|
53
|
+
KINTONE_PASSWORD`);
|
|
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);
|
|
64
|
+
};
|
|
65
|
+
*/
|
|
66
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,GAAW,EAA0B,EAAE;IAC3D,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,MAGlC,EAAuC,EAAE;IACxC,MAAM,EAAE,GAAG,E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AC;QACrB,OAAO,CAAC,KAAK,CAAC,UAAU,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC,CAAC;AAEF;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../../src/lib/webpack.ts"],"names":[],"mappings":"AAIA,OAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAItD,eAAO,MAAM,gBAAgB,GAAU,OAAO;IAC5C,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB,kBAsEA,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { cwd } from 'process';
|
|
4
|
+
import TerserPlugin from 'terser-webpack-plugin';
|
|
5
|
+
import webpack, {} from 'webpack';
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import { TsconfigPathsPlugin } from 'tsconfig-paths-webpack-plugin';
|
|
8
|
+
export const buildWithWebpack = async (props) => {
|
|
9
|
+
const { entries, outDir } = props;
|
|
10
|
+
const exclude = /node_modules/;
|
|
11
|
+
const styleLoader = MiniCssExtractPlugin.loader;
|
|
12
|
+
const tsConfigPath = path.join(cwd(), 'tsconfig.json');
|
|
13
|
+
console.group(chalk.blue('🚀 Building with Webpack...'));
|
|
14
|
+
console.log('🔧 tsconfig.json path:', tsConfigPath);
|
|
15
|
+
console.groupEnd();
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
webpack({
|
|
18
|
+
mode: 'production',
|
|
19
|
+
target: ['web', 'es2023'],
|
|
20
|
+
entry: entries,
|
|
21
|
+
resolve: {
|
|
22
|
+
extensions: ['.ts', '.tsx', '.js', '.json'],
|
|
23
|
+
fallback: {
|
|
24
|
+
path: false,
|
|
25
|
+
},
|
|
26
|
+
plugins: [new TsconfigPathsPlugin({ configFile: tsConfigPath })],
|
|
27
|
+
},
|
|
28
|
+
cache: { type: 'filesystem' },
|
|
29
|
+
output: { filename: '[name].js', path: path.resolve(outDir) },
|
|
30
|
+
module: {
|
|
31
|
+
rules: [
|
|
32
|
+
{ test: /\.tsx?$/, exclude, loader: 'ts-loader' },
|
|
33
|
+
{ test: /\.css$/, use: [styleLoader, 'css-loader'] },
|
|
34
|
+
{
|
|
35
|
+
test: /\.scss$/,
|
|
36
|
+
use: [
|
|
37
|
+
styleLoader,
|
|
38
|
+
'css-loader',
|
|
39
|
+
{ loader: 'sass-loader', options: { sassOptions: { outputStyle: 'expanded' } } },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
plugins: [new MiniCssExtractPlugin()],
|
|
45
|
+
optimization: {
|
|
46
|
+
minimize: true,
|
|
47
|
+
minimizer: [
|
|
48
|
+
new TerserPlugin({
|
|
49
|
+
terserOptions: { format: { comments: false } },
|
|
50
|
+
extractComments: false,
|
|
51
|
+
}),
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
}, (err, stats) => {
|
|
55
|
+
if (err) {
|
|
56
|
+
reject(err);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
if (stats?.compilation.errors.length) {
|
|
60
|
+
reject([
|
|
61
|
+
chalk.red('⚠ Build failed.'),
|
|
62
|
+
...stats.compilation.errors.map((error) => error.message),
|
|
63
|
+
].join('\n'));
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
resolve();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=webpack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack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AC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,OAAO,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip.d.ts","sourceRoot":"","sources":["../../src/lib/zip.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB,GAAU,UAAU,MAAM,CAAC,IAAI,CAAC,QAAQ,kBAyDrE,CAAC;AAEF,eAAO,MAAM,oBAAoB,gCAGhC,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,KAAK,MAAM,WAE/C,CAAC"}
|
package/dist/lib/zip.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import archiver from 'archiver';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import invariant from 'tiny-invariant';
|
|
5
|
+
import { PLUGIN_CONTENTS_DIRECTORY, PLUGIN_WORKSPACE_DIRECTORY } from './constants.js';
|
|
6
|
+
export const outputContentsZip = async (manifest) => {
|
|
7
|
+
const archive = archiver('zip', { zlib: { level: 9 } });
|
|
8
|
+
archive.on('warning', (error) => {
|
|
9
|
+
if (error.code === 'ENOENT') {
|
|
10
|
+
console.warn(error);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const outputZipPath = path.join(PLUGIN_WORKSPACE_DIRECTORY, 'contents.zip');
|
|
17
|
+
const outputZipStream = fs.createWriteStream(outputZipPath);
|
|
18
|
+
outputZipStream.on('close', () => {
|
|
19
|
+
console.log(`📦 ${archive.pointer()} total bytes`);
|
|
20
|
+
});
|
|
21
|
+
outputZipStream.on('end', function () {
|
|
22
|
+
console.log('📦 Data has been drained');
|
|
23
|
+
});
|
|
24
|
+
const filterLocalContent = (file) => {
|
|
25
|
+
return !/^https?:\/\//.test(file);
|
|
26
|
+
};
|
|
27
|
+
invariant(manifest.config?.html, 'manifest.config.html is required');
|
|
28
|
+
const targetFiles = [
|
|
29
|
+
'manifest.json',
|
|
30
|
+
...new Set([
|
|
31
|
+
manifest.icon,
|
|
32
|
+
manifest.config.html,
|
|
33
|
+
...(manifest.desktop?.js || []).filter(filterLocalContent),
|
|
34
|
+
...(manifest.desktop?.css || []).filter(filterLocalContent),
|
|
35
|
+
...(manifest.mobile?.js || []).filter(filterLocalContent),
|
|
36
|
+
...(manifest.mobile?.css || []).filter(filterLocalContent),
|
|
37
|
+
...(manifest.config.js || []).filter(filterLocalContent),
|
|
38
|
+
...(manifest.config.css || []).filter(filterLocalContent),
|
|
39
|
+
]),
|
|
40
|
+
];
|
|
41
|
+
console.group('📁 Target files');
|
|
42
|
+
targetFiles.forEach((file, i) => {
|
|
43
|
+
const prefix = i === targetFiles.length - 1 ? '└─' : '├─';
|
|
44
|
+
console.log(`${prefix} 📄 ${file}`);
|
|
45
|
+
});
|
|
46
|
+
console.groupEnd();
|
|
47
|
+
for (const file of targetFiles) {
|
|
48
|
+
const filePath = path.join(PLUGIN_CONTENTS_DIRECTORY, file);
|
|
49
|
+
if (!fs.existsSync(filePath)) {
|
|
50
|
+
throw new Error(`${filePath} does not exist`);
|
|
51
|
+
}
|
|
52
|
+
archive.file(filePath, { name: file });
|
|
53
|
+
}
|
|
54
|
+
archive.pipe(outputZipStream);
|
|
55
|
+
await archive.finalize();
|
|
56
|
+
await new Promise((resolve) => outputZipStream.on('close', resolve));
|
|
57
|
+
};
|
|
58
|
+
export const getContentsZipBuffer = async () => {
|
|
59
|
+
const outputZipPath = path.join(PLUGIN_WORKSPACE_DIRECTORY, 'contents.zip');
|
|
60
|
+
return fs.readFile(outputZipPath);
|
|
61
|
+
};
|
|
62
|
+
export const getZipFileNameSuffix = (env) => {
|
|
63
|
+
return env === 'prod' ? '' : `-${env}`;
|
|
64
|
+
};
|
|
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 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { program } from 'commander';
|
|
3
|
+
import build from './commands/plugin-build.js';
|
|
4
|
+
import esbuild from './commands/plugin-esbuild.js';
|
|
5
|
+
import dev from './commands/plugin-dev/index.js';
|
|
6
|
+
import genkey from './commands/plugin-genkey.js';
|
|
7
|
+
import init from './commands/plugin-init.js';
|
|
8
|
+
import manifest from './commands/manifest/index.js';
|
|
9
|
+
import test from './commands/test/index.js';
|
|
10
|
+
import zip from './commands/plugin-zip.js';
|
|
11
|
+
import lint from './commands/lint.js';
|
|
12
|
+
import tsup from './commands/plugin-tsup.js';
|
|
13
|
+
program.name('plugin').version('1.11.0').description('🍳 kintone kitchen 🍳 for kintone plugin');
|
|
14
|
+
build();
|
|
15
|
+
esbuild();
|
|
16
|
+
dev();
|
|
17
|
+
genkey();
|
|
18
|
+
init();
|
|
19
|
+
manifest();
|
|
20
|
+
test();
|
|
21
|
+
zip();
|
|
22
|
+
lint();
|
|
23
|
+
tsup();
|
|
24
|
+
program.parse(process.argv);
|
|
25
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,4BAA4B,CAAC;AAC/C,OAAO,OAAO,MAAM,8BAA8B,CAAC;AACnD,OAAO,GAAG,MAAM,gCAAgC,CAAC;AACjD,OAAO,MAAM,MAAM,6BAA6B,CAAC;AACjD,OAAO,IAAI,MAAM,2BAA2B,CAAC;AAC7C,OAAO,QAAQ,MAAM,8BAA8B,CAAC;AACpD,OAAO,IAAI,MAAM,0BAA0B,CAAC;AAC5C,OAAO,GAAG,MAAM,0BAA0B,CAAC;AAC3C,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,IAAI,MAAM,2BAA2B,CAAC;AAE7C,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,0CAA0C,CAAC,CAAC;AAEjG,KAAK,EAAE,CAAC;AACR,OAAO,EAAE,CAAC;AACV,GAAG,EAAE,CAAC;AACN,MAAM,EAAE,CAAC;AACT,IAAI,EAAE,CAAC;AACP,QAAQ,EAAE,CAAC;AACX,IAAI,EAAE,CAAC;AACP,GAAG,EAAE,CAAC;AACN,IAAI,EAAE,CAAC;AACP,IAAI,EAAE,CAAC;AAEP,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|