Explorar el Código

ビルド時間を対応

develop
sosuke.iwabuchi hace 2 años
padre
commit
b5824708e8
Se han modificado 6 ficheros con 36 adiciones y 11 borrados
  1. +2
    -0
      src/apps/入金予定結果/index.tsx
  2. +2
    -0
      src/apps/定期予約選考/index.ts
  3. +6
    -4
      src/mypage/lib.ts
  4. +1
    -0
      tsconfig.json
  5. +15
    -0
      types/env.d.ts
  6. +10
    -7
      webpack.config.js

+ 2
- 0
src/apps/入金予定結果/index.tsx Ver fichero

@@ -69,6 +69,8 @@ const getCallbackFillAmount = (record: 入金予定結果) => {
};

(() => {
console.info("script build at " + process.env.BUILD_TIME);

kintone.events.on("app.record.detail.show", (event) => {
const currentRecord = event.record as 入金予定結果;



+ 2
- 0
src/apps/定期予約選考/index.ts Ver fichero

@@ -110,6 +110,8 @@ const getCallBackHandleFinish = (currentRecord: 定期予約選考) => {
};

(() => {
console.info("script build at " + process.env.BUILD_TIME);

const events = ["app.record.create.show", "app.record.edit.show"];
kintone.events.on(events, (event) => {
const record = event.record as 定期予約選考;


+ 6
- 4
src/mypage/lib.ts Ver fichero

@@ -5,16 +5,18 @@ type MyPageApiResponse = {
};

export const getUrl = (apiId: MyPageApiID) => {
return [process.env.MYPAGE_BASE_URL ?? "", "api-from-kintone", apiId].join(
"/"
);
return [
process.env.VAR.MYPAGE_BASE_URL ?? "",
"api-from-kintone",
apiId,
].join("/");
};

export const send = async (apiId: MyPageApiID, data: object) => {
const url = getUrl(apiId);
const sendData = {
...data,
token: process.env.MYPAGE_TOKEN ?? "",
token: process.env.VAR.MYPAGE_TOKEN ?? "",
};
console.info("MyPageAPICall", url, data);



+ 1
- 0
tsconfig.json Ver fichero

@@ -19,6 +19,7 @@
},
"files": [
"./node_modules/@kintone/dts-gen/kintone.d.ts",
"./types/env.d.ts",
],
"include": [
"src/**/*"


+ 15
- 0
types/env.d.ts Ver fichero

@@ -0,0 +1,15 @@
declare global {
namespace NodeJS {
interface ProcessEnv {
NODE_ENV: "development" | "production" | "test";
// 他の環境変数も追加できます
VAR: {
MYPAGE_BASE_URL: string;
MYPAGE_TOKEN: string;
};
BUILD_TIME: string;
}
}
}

export {};

+ 10
- 7
webpack.config.js Ver fichero

@@ -6,9 +6,13 @@ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const Dotenv = require('dotenv-webpack');
const dotenv = require('dotenv');
const { format } = require('date-fns');

const basePath = path.resolve('src', 'apps');

const env = dotenv.config().parsed

// basePath配下の各ディレクトリを複数のentryとする
const entries = glob.sync('**/index.+(js|ts|tsx)', { cwd: basePath }).reduce(
(prev, file) => ({
@@ -63,7 +67,7 @@ module.exports = {
filename: '[name].js',
},
plugins: [
new Dotenv({ systemvars: true }),
// new Dotenv({ systemvars: true }),
new ForkTsCheckerWebpackPlugin(),
// new BundleAnalyzerPlugin(),
{
@@ -100,11 +104,10 @@ module.exports = {
);
},
},
// new webpack.DefinePlugin({
// 'process.env': {
// "MYPAGE_BASE_URL": JSON.stringify(process.env.MYPAGE_BASE_URL),
// "MYPAGE_TOKEN": JSON.stringify(process.env.MYPAGE_TOKEN),
// }
// }),
new webpack.DefinePlugin({
'process.env.VAR': JSON.stringify(env),
'process.env.BUILD_TIME': JSON.stringify(format(new Date(), 'yyyy-MM-dd HH:mm:ss')),

}),
],
};

Cargando…
Cancelar
Guardar