Fixing building of typings

This commit is contained in:
David Négrier 2021-06-29 17:31:01 +02:00
parent 1cd18db560
commit 285712bfc7
3 changed files with 13 additions and 9 deletions

View File

@ -13,10 +13,6 @@ jobs:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- name: Edit tsconfig.json to add declarations
run: "sed -i 's/\"declaration\": false/\"declaration\": true/g' tsconfig.json"
working-directory: "front"
- name: Replace version number
run: 'sed -i "s#VERSION_PLACEHOLDER#${GITHUB_REF/refs\/tags\//}#g" package.json'
working-directory: "front/packages/iframe-api-typings"

View File

@ -52,6 +52,7 @@
"scripts": {
"start": "TS_NODE_PROJECT=\"tsconfig-for-webpack.json\" webpack serve --open",
"build": "TS_NODE_PROJECT=\"tsconfig-for-webpack.json\" NODE_ENV=production webpack",
"build-typings": "TS_NODE_PROJECT=\"tsconfig-for-webpack.json\" NODE_ENV=production NODE_ENV=production BUILD_TYPINGS=1 webpack",
"test": "TS_NODE_PROJECT=\"tsconfig-for-jasmine.json\" ts-node node_modules/jasmine/bin/jasmine --config=jasmine.json",
"lint": "node_modules/.bin/eslint src/ . --ext .ts",
"fix": "node_modules/.bin/eslint --fix src/ . --ext .ts"

View File

@ -10,14 +10,18 @@ import NodePolyfillPlugin from 'node-polyfill-webpack-plugin';
import {DISPLAY_TERMS_OF_USE} from "./src/Enum/EnvironmentVariable";
const mode = process.env.NODE_ENV ?? 'development';
const buildNpmTypingsForApi = !!process.env.BUILD_TYPINGS;
const isProduction = mode === 'production';
const isDevelopment = !isProduction;
let entries: { [key: string]: string; } = {};
if (!buildNpmTypingsForApi) {
entries.main = './src/index.ts';
}
entries.iframe_api = './src/iframe_api.ts';
module.exports = {
entry: {
'main': './src/index.ts',
'iframe_api': './src/iframe_api.ts'
},
entry: entries,
mode: mode,
devtool: isDevelopment ? 'inline-source-map' : 'source-map',
devServer: {
@ -40,7 +44,10 @@ module.exports = {
exclude: /node_modules/,
loader: 'ts-loader',
options: {
transpileOnly: true,
transpileOnly: !buildNpmTypingsForApi,
compilerOptions: {
declaration: buildNpmTypingsForApi
}
},
},
{