Skip to content

Commit 4660a4d

Browse files
author
stabris
committed
Changed build scripts for platform packages
1 parent 7cee704 commit 4660a4d

File tree

22 files changed

+81
-91
lines changed

22 files changed

+81
-91
lines changed

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"liveServer.settings.root": "/"
2+
"liveServer.settings.root": "/site"
33
}

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@
2727
},
2828
"scripts": {
2929
"start": "webpack serve --config ./webpack.config.dev.js",
30+
"start:react": "webpack serve --config ./webpack.config.react.dev.js",
31+
"build": "webpack",
3032
"build:ko": "webpack --config ./webpack.config.ko.js",
3133
"build:react": "webpack --config ./webpack.config.react.js",
32-
"build": "webpack",
33-
"build:types": "tsc sources/index.ts --declaration --emitDeclarationOnly --skipLibCheck --target es5 --moduleResolution node --experimentalDecorators true --outFile site/dist/abris-components.d.ts && echo \"declare module '@abris-lab/components' { import main = require('index'); export = main; }\" >> site/dist/abris-components.d.ts",
34+
"build:types": "tsc sources/index.ts --declaration --emitDeclarationOnly --skipLibCheck --target es5 --moduleResolution node --experimentalDecorators true --outFile site/dist/standalone/abris-components.d.ts && echo \"declare module '@abris-lab/abris-components' { import main = require('index'); export = main; }\" >> site/dist/standalone/abris-components.d.ts",
35+
"build:types:ko": "tsc sources/knockout/index.ts --declaration --emitDeclarationOnly --skipLibCheck --target es5 --moduleResolution node --experimentalDecorators true --outFile site/dist/knockout/abris-components.d.ts && echo \"declare module '@abris-lab/abris-components-knockout' { import main = require('knockout/index'); export = main; }\" >> site/dist/knockout/abris-components.d.ts",
36+
"build:types:react": "tsc sources/react/index.ts --declaration --emitDeclarationOnly --skipLibCheck --jsx react --target es5 --moduleResolution node --experimentalDecorators true --outFile site/dist/react/abris-components.d.ts && echo \"declare module '@abris-lab/abris-components-react' { import main = require('react/index'); export = main; }\" >> site/dist/react/abris-components.d.ts",
3437
"test": "jest",
3538
"test:dev": "jest --watch",
3639
"doc:gen": "typedoc ./sources/index.ts --out ./site/docs --readme ./publish/doc-index.md --name '@abris/components' --includeVersion --customCss ./publish/abris-theme.css --plugin ./publish/abris-theme.js --hideGenerator",

public/index.html

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
</title>
88
<meta charset="utf-8">
99
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
10+
<!-- <script src="../site/dist/standalone/abris-components.js"></script>
11+
<link href="../site/dist/standalone/abris-components.css" rel="stylesheet"> -->
1012
</head>
1113

1214
<body>

public/index.react.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
<script src="https://unpkg.com/[email protected]/umd/react.development.js"></script>
1111
<script src="https://unpkg.com/[email protected]/umd/react-dom.development.js"></script>
1212
<script src="https://unpkg.com/@babel/[email protected]/babel.js"></script>
13-
<script src="../dist/react/abris-components.js"></script>
14-
<link href="../dist/react/abris-components.css" rel="stylesheet">
13+
<!-- <script src="../site/dist/react/abris-components.js"></script>
14+
<link href="../site/dist/react/abris-components.css" rel="stylesheet"> -->
1515
</head>
1616

1717
<body>

site/examples/basic-edit/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<meta charset="utf-8">
77
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
88
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap" rel="stylesheet">
9-
<script src="/dist/abris-components.js"></script>
10-
<link href="/dist/abris-components.css" rel="stylesheet">
9+
<script src="/dist/standalone/abris-components.js"></script>
10+
<link href="/dist/standalone/abris-components.css" rel="stylesheet">
1111
</head>
1212

1313
<body>

site/examples/basic-merged/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<meta charset="utf-8">
77
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
88
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap" rel="stylesheet">
9-
<script src="/dist/abris-components.js"></script>
10-
<link href="/dist/abris-components.css" rel="stylesheet">
9+
<script src="/dist/standalone/abris-components.js"></script>
10+
<link href="/dist/standalone/abris-components.css" rel="stylesheet">
1111
</head>
1212

1313
<body>

site/examples/basic-search/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<meta charset="utf-8">
77
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
88
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap" rel="stylesheet">
9-
<script src="/dist/abris-components.js"></script>
10-
<link href="/dist/abris-components.css" rel="stylesheet">
9+
<script src="/dist/standalone/abris-components.js"></script>
10+
<link href="/dist/standalone/abris-components.css" rel="stylesheet">
1111
</head>
1212

1313
<body>

site/examples/basic-summary/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<meta charset="utf-8">
77
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
88
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap" rel="stylesheet">
9-
<script src="/dist/abris-components.js"></script>
10-
<link href="/dist/abris-components.css" rel="stylesheet">
9+
<script src="/dist/standalone/abris-components.js"></script>
10+
<link href="/dist/standalone/abris-components.css" rel="stylesheet">
1111
</head>
1212

1313
<body>

site/examples/basic-two/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<meta charset="utf-8">
77
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
88
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap" rel="stylesheet">
9-
<script src="/dist/abris-components.js"></script>
10-
<link href="/dist/abris-components.css" rel="stylesheet">
9+
<script src="/dist/standalone/abris-components.js"></script>
10+
<link href="/dist/standalone/abris-components.css" rel="stylesheet">
1111
</head>
1212

1313
<body>

site/examples/basic/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<meta charset="utf-8">
77
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
88
<!-- <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap" rel="stylesheet"> -->
9-
<script src="/dist/abris-components.js"></script>
10-
<link href="/dist/abris-components.css" rel="stylesheet">
9+
<script src="/dist/standalone/abris-components.js"></script>
10+
<link href="/dist/standalone/abris-components.css" rel="stylesheet">
1111
<link href="index.css" rel="stylesheet">
1212
</head>
1313

site/examples/color-cell/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<meta charset="utf-8">
77
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
88
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap" rel="stylesheet">
9-
<script src="/dist/abris-components.js"></script>
10-
<link href="/dist/abris-components.css" rel="stylesheet">
9+
<script src="/dist/standalone/abris-components.js"></script>
10+
<link href="/dist/standalone/abris-components.css" rel="stylesheet">
1111
</head>
1212

1313
<body>

site/examples/color-row/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<meta charset="utf-8">
77
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
88
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap" rel="stylesheet">
9-
<script src="/dist/abris-components.js"></script>
10-
<link href="/dist/abris-components.css" rel="stylesheet">
9+
<script src="/dist/standalone/abris-components.js"></script>
10+
<link href="/dist/standalone/abris-components.css" rel="stylesheet">
1111
</head>
1212

1313
<body>

site/examples/selection-cell/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
88

99
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap" rel="stylesheet">
10-
<script src="/dist/abris-components.js"></script>
11-
<link href="/dist/abris-components.css" rel="stylesheet">
10+
<script src="/dist/standalone/abris-components.js"></script>
11+
<link href="/dist/standalone/abris-components.css" rel="stylesheet">
1212
</head>
1313

1414
<body>

site/examples/selection-row/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<meta charset="utf-8">
77
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
88
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap" rel="stylesheet">
9-
<script src="/dist/abris-components.js"></script>
10-
<link href="/dist/abris-components.css" rel="stylesheet">
9+
<script src="/dist/standalone/abris-components.js"></script>
10+
<link href="/dist/standalone/abris-components.css" rel="stylesheet">
1111
</head>
1212

1313
<body>

site/examples/server-basic/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<meta charset="utf-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
77
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap" rel="stylesheet">
8-
<script src="/dist/abris-components.js"></script>
9-
<link href="/dist/abris-components.css" rel="stylesheet">
8+
<script src="/dist/standalone/abris-components.js"></script>
9+
<link href="/dist/standalone/abris-components.css" rel="stylesheet">
1010
</head>
1111
<body>
1212
<div id="table-container" style="height: 80vh;"></div>

sources/find.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,13 @@ export interface IAggregate {
3030
func: string,
3131
field: string,
3232
}
33-
33+
3434
export interface IFindLogic {
3535
strict: boolean;
3636
operands: IFindOperand[];
3737
aggregate?: IAggregate[];
3838
}
3939

40-
export interface IFindProperty {
41-
operation: KnockoutObservable<string>;
42-
val1: KnockoutObservable<any>;
43-
val2: KnockoutObservable<any>;
44-
}
45-
4640
export var operationsMap: { [index: string]: IFindOperation[] } = {};
4741

4842
var defaultOperationsMap = {

sources/knockout/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export * from "..";
2424
export const KnockoutInstance = ko;
2525

2626
export class KnockoutHashTableStorage extends HashTableStorage {
27-
private linkArrayToObservable(observableArray: ko.ObservableArray) {
27+
private linkArrayToObservable(observableArray: KnockoutObservableArray<any>) {
2828
const result = [].concat(observableArray());
2929
["pop", "push", "splice", "slice", "shift", "unshift"].forEach(funcName => {
3030
result[funcName] = function () {
@@ -46,7 +46,7 @@ export class KnockoutHashTableStorage extends HashTableStorage {
4646
this.hash[name] = this.createObservable(value);
4747
}
4848
const observable = this.hash[name];
49-
if(ko.isObservableArray(observable)) {
49+
if((ko as any).isObservableArray(observable)) { // TODO - remove any cast
5050
return this.linkArrayToObservable(observable);
5151
}
5252
return observable();

webpack.config.dev.js

+6-15
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
1-
const _ = require('underscore');
2-
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
31
const HtmlWebpackPlugin = require('html-webpack-plugin');
42

53
const [ dev, prod ] = require('./webpack.config.js');
64

7-
const DEV_CFG = _.extend({}, dev, {
8-
plugins: [
9-
new HtmlWebpackPlugin({
10-
inject: 'head',
11-
template: './public/index.html',
12-
scriptLoading: "blocking"
13-
}),
14-
new MiniCssExtractPlugin(
15-
{ filename: '[name].css' }
16-
)
17-
],
18-
});
5+
dev.plugins.push(new HtmlWebpackPlugin({
6+
inject: 'head',
7+
template: './public/index.html',
8+
scriptLoading: "blocking"
9+
}));
1910

20-
module.exports = [DEV_CFG];
11+
module.exports = [dev];

webpack.config.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const _ = require('underscore');
22
const webpack = require('webpack');
33
const packageJson = require('./package.json');
44
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
5+
const CopyPlugin = require("copy-webpack-plugin");
56

67
const libraryName = 'AbrisComponents';
78
const banner = [
@@ -44,14 +45,6 @@ const BASE_CFG = {
4445
}
4546
]
4647
},
47-
// externals: {
48-
// knockout: {
49-
// root: "ko",
50-
// commonjs2: "knockout",
51-
// commonjs: "knockout",
52-
// amd: "knockout"
53-
// },
54-
// },
5548
entry: {
5649
[packageJson.name]: './sources/knockout/index.ts',
5750
}
@@ -68,7 +61,7 @@ const DEV_CFG = _.extend({}, BASE_CFG, {
6861
library: libraryName,
6962
libraryTarget: 'umd',
7063
umdNamedDefine: true,
71-
path: __dirname + '/site/dist',
64+
path: __dirname + '/site/dist/standalone',
7265
filename: '[name].js'
7366
},
7467
devtool: 'inline-source-map'
@@ -80,13 +73,18 @@ const PROD_CFG = _.extend({}, BASE_CFG, {
8073
new MiniCssExtractPlugin(
8174
{ filename: '[name].min.css' }
8275
),
76+
new CopyPlugin({
77+
patterns: [
78+
{ from: "publish/doc-index.md", to: "README.md" }
79+
],
80+
})
8381
//new webpack.optimize.UglifyJsPlugin()
8482
],
8583
output: {
8684
library: libraryName,
8785
libraryTarget: 'umd',
8886
umdNamedDefine: true,
89-
path: __dirname + '/site/dist',
87+
path: __dirname + '/site/dist/standalone',
9088
filename: '[name].min.js'
9189
}
9290
});

webpack.config.ko.js

+18-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
1-
const _ = require('underscore');
21
const packageJson = require('./package.json');
32
const publishPackageJson = require('./publish/package.json');
43
const GeneratePackageJsonPlugin = require('generate-package-json-webpack-plugin');
5-
const CopyPlugin = require("copy-webpack-plugin");
4+
65
const [ dev, prod ] = require('./webpack.config.js');
76

87
publishPackageJson.name = "@abris-lab/abris-components-knockout";
98
publishPackageJson.version = packageJson.version;
9+
publishPackageJson.dependencies = {
10+
"knockout": "^3.5.0"
11+
}
12+
13+
const externals = {
14+
knockout: {
15+
root: "ko",
16+
commonjs2: "knockout",
17+
commonjs: "knockout",
18+
amd: "knockout"
19+
},
20+
}
21+
22+
dev.externals = externals;
23+
prod.externals = externals;
1024

11-
dev.output.path = __dirname + '/dist/knockout';
12-
prod.output.path = __dirname + '/dist/knockout';
25+
dev.output.path = __dirname + '/site/dist/knockout';
26+
prod.output.path = __dirname + '/site/dist/knockout';
1327

1428
prod.plugins.push(new GeneratePackageJsonPlugin(publishPackageJson));
15-
prod.plugins.push(new CopyPlugin({
16-
patterns: [
17-
{ from: "publish/doc-index.md", to: "README.md" }
18-
],
19-
})
20-
);
2129

2230
module.exports = [ dev, prod ];

webpack.config.react.dev.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const HtmlWebpackPlugin = require('html-webpack-plugin');
2+
3+
const [ dev, prod ] = require('./webpack.config.react.js');
4+
5+
dev.plugins.push(new HtmlWebpackPlugin({
6+
inject: 'head',
7+
template: './public/index.react.html',
8+
scriptLoading: "blocking"
9+
}));
10+
11+
module.exports = [dev];

webpack.config.react.js

+3-20
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
const _ = require('underscore');
21
const packageJson = require('./package.json');
32
const publishPackageJson = require('./publish/package.json');
43
const GeneratePackageJsonPlugin = require('generate-package-json-webpack-plugin');
5-
const CopyPlugin = require("copy-webpack-plugin");
6-
const [ dev, prod ] = require('./webpack.config.js');
74

8-
const libraryName = 'AbrisComponents';
5+
const [ dev, prod ] = require('./webpack.config.js');
96

107
publishPackageJson.name = "@abris-lab/abris-components-react";
118
publishPackageJson.version = packageJson.version;
@@ -35,29 +32,15 @@ const externals = {
3532
}
3633
}
3734

38-
const output = {
39-
library: libraryName,
40-
libraryTarget: 'umd',
41-
umdNamedDefine: true,
42-
path: __dirname + '/dist/react',
43-
filename: '[name].js'
44-
};
45-
4635
dev.entry = entry;
4736
prod.entry = entry;
4837

4938
dev.externals = externals;
5039
prod.externals = externals;
5140

52-
dev.output = _.extend({}, output);
53-
prod.output = _.extend({}, output, {filename: '[name].rect.min.js'});
41+
dev.output.path = __dirname + '/site/dist/react';
42+
prod.output.path = __dirname + '/site/dist/react';
5443

5544
prod.plugins.push(new GeneratePackageJsonPlugin(publishPackageJson));
56-
prod.plugins.push(new CopyPlugin({
57-
patterns: [
58-
{ from: "publish/doc-index.md", to: "README.md" }
59-
],
60-
})
61-
);
6245

6346
module.exports = [ dev, prod ];

0 commit comments

Comments
 (0)