Fixing building of typings
This commit is contained in:
parent
1cd18db560
commit
285712bfc7
4
.github/workflows/push-to-npm.yml
vendored
4
.github/workflows/push-to-npm.yml
vendored
@ -13,10 +13,6 @@ jobs:
|
|||||||
node-version: '14.x'
|
node-version: '14.x'
|
||||||
registry-url: 'https://registry.npmjs.org'
|
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
|
- name: Replace version number
|
||||||
run: 'sed -i "s#VERSION_PLACEHOLDER#${GITHUB_REF/refs\/tags\//}#g" package.json'
|
run: 'sed -i "s#VERSION_PLACEHOLDER#${GITHUB_REF/refs\/tags\//}#g" package.json'
|
||||||
working-directory: "front/packages/iframe-api-typings"
|
working-directory: "front/packages/iframe-api-typings"
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "TS_NODE_PROJECT=\"tsconfig-for-webpack.json\" webpack serve --open",
|
"start": "TS_NODE_PROJECT=\"tsconfig-for-webpack.json\" webpack serve --open",
|
||||||
"build": "TS_NODE_PROJECT=\"tsconfig-for-webpack.json\" NODE_ENV=production webpack",
|
"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",
|
"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",
|
"lint": "node_modules/.bin/eslint src/ . --ext .ts",
|
||||||
"fix": "node_modules/.bin/eslint --fix src/ . --ext .ts"
|
"fix": "node_modules/.bin/eslint --fix src/ . --ext .ts"
|
||||||
|
@ -10,14 +10,18 @@ import NodePolyfillPlugin from 'node-polyfill-webpack-plugin';
|
|||||||
import {DISPLAY_TERMS_OF_USE} from "./src/Enum/EnvironmentVariable";
|
import {DISPLAY_TERMS_OF_USE} from "./src/Enum/EnvironmentVariable";
|
||||||
|
|
||||||
const mode = process.env.NODE_ENV ?? 'development';
|
const mode = process.env.NODE_ENV ?? 'development';
|
||||||
|
const buildNpmTypingsForApi = !!process.env.BUILD_TYPINGS;
|
||||||
const isProduction = mode === 'production';
|
const isProduction = mode === 'production';
|
||||||
const isDevelopment = !isProduction;
|
const isDevelopment = !isProduction;
|
||||||
|
|
||||||
|
let entries: { [key: string]: string; } = {};
|
||||||
|
if (!buildNpmTypingsForApi) {
|
||||||
|
entries.main = './src/index.ts';
|
||||||
|
}
|
||||||
|
entries.iframe_api = './src/iframe_api.ts';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: entries,
|
||||||
'main': './src/index.ts',
|
|
||||||
'iframe_api': './src/iframe_api.ts'
|
|
||||||
},
|
|
||||||
mode: mode,
|
mode: mode,
|
||||||
devtool: isDevelopment ? 'inline-source-map' : 'source-map',
|
devtool: isDevelopment ? 'inline-source-map' : 'source-map',
|
||||||
devServer: {
|
devServer: {
|
||||||
@ -40,7 +44,10 @@ module.exports = {
|
|||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
loader: 'ts-loader',
|
loader: 'ts-loader',
|
||||||
options: {
|
options: {
|
||||||
transpileOnly: true,
|
transpileOnly: !buildNpmTypingsForApi,
|
||||||
|
compilerOptions: {
|
||||||
|
declaration: buildNpmTypingsForApi
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user