@docsvision/management-console-extension-build 1.0.0

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/README.md ADDED
@@ -0,0 +1,10 @@
1
+ # @docsvision/management-console-extension-build
2
+
3
+ > Файлы описания типов TypeScript для Консоли управления, входящей в состав [Docsvision](https://docsvision.com).
4
+
5
+
6
+ ## Установка
7
+
8
+ ```sh
9
+ npm install --save-dev @docsvision/management-console-extension-build
10
+ ```
package/gulpfile.js ADDED
@@ -0,0 +1,34 @@
1
+ const gulp = require('gulp');
2
+ const del = require('del');
3
+
4
+ module.exports = {};
5
+
6
+
7
+ module.exports.prepare = function() {
8
+ return gulp.task('prepare', gulp.series('clean', 'copy-static-files', 'copy-react-library', 'copy-react-dom-library'));
9
+ };
10
+
11
+
12
+
13
+ /* others */
14
+ gulp.task('clean', function () {
15
+ return del([
16
+ 'dist/**/*',
17
+ ]);
18
+ });
19
+
20
+ gulp.task('copy-static-files', function() {
21
+ return gulp.src('./StaticFiles/**/*')
22
+ .pipe(gulp.dest('./dist/'));
23
+ });
24
+
25
+ gulp.task('copy-react-library', function() {
26
+ return gulp.src('./node_modules/react/umd/react.production.min.js')
27
+ .pipe(gulp.dest('./dist/libs/react'));
28
+ });
29
+
30
+ gulp.task('copy-react-dom-library', function() {
31
+ return gulp.src('./node_modules/react-dom/umd/react-dom.production.min.js')
32
+ .pipe(gulp.dest('./dist/libs/react-dom'));
33
+ });
34
+
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@docsvision/management-console-extension-build",
3
+ "version": "1.0.0",
4
+ "description": "Helper tools for building Management Console extensions.",
5
+ "scripts": {},
6
+ "dependencies": {
7
+ "autoprefixer": "9.8.5",
8
+ "postcss-custom-properties": "9.1.1",
9
+ "rollup": "2.56.3",
10
+ "rollup-plugin-includepaths": "0.2.3",
11
+ "rollup-plugin-postcss": "3.1.2",
12
+ "rollup-plugin-terser": "6.1.0",
13
+ "tslib": "2.3.1",
14
+ "typescript": "4.7.4",
15
+ "@types/react": "17.0.3",
16
+ "@types/react-dom": "17.0.3",
17
+ "@rollup/plugin-commonjs": "12.0.0",
18
+ "@rollup/plugin-node-resolve": "8.0.0",
19
+ "@rollup/plugin-replace": "2.3.3",
20
+ "@rollup/plugin-typescript": "8.2.5",
21
+ "del": "5.1.0",
22
+ "gulp": "4.0.2"
23
+ },
24
+ "keywords": [
25
+ "typescript",
26
+ "typings",
27
+ "docsvision",
28
+ "scripts",
29
+ "management-console"
30
+ ],
31
+ "author": "Docsvision",
32
+ "license": "ISC"
33
+ }
@@ -0,0 +1,79 @@
1
+ const typescript = require("@rollup/plugin-typescript");
2
+ const commonjs = require("@rollup/plugin-commonjs");
3
+ const { nodeResolve } = require('@rollup/plugin-node-resolve');
4
+ const replace = require("@rollup/plugin-replace");
5
+ const { terser } = require("rollup-plugin-terser");
6
+ const includePaths = require("rollup-plugin-includepaths");
7
+ const postcss = require("rollup-plugin-postcss");
8
+ const path = require("path");
9
+ const autoprefixer = require("autoprefixer");
10
+ const postcssCustomProperties = require("postcss-custom-properties");
11
+
12
+
13
+ const NODE_ENV_PRODUCTION = "production";
14
+ module.exports = {};
15
+
16
+
17
+ module.exports.getBaseConfig = function(name, inputFileName, outputFileName, outputCssFileName, globals, paths, external) {
18
+ if (!name) {
19
+ throw "name is empty";
20
+ }
21
+
22
+ if (!inputFileName) {
23
+ throw "inputFileName is empty"
24
+ }
25
+
26
+ if (!outputFileName) {
27
+ throw "outputFileName is empty";
28
+ }
29
+
30
+ if (!outputCssFileName) {
31
+ throw "outputCssFileName is empty";
32
+ }
33
+
34
+ const isProd = process.env.NODE_ENV == NODE_ENV_PRODUCTION;
35
+
36
+
37
+ const plugins = [];
38
+ plugins.push(nodeResolve());
39
+ plugins.push(replace(
40
+ { "process.env.NODE_ENV": `"${process.env.NODE_ENV}"`,
41
+ "/assets/": "/bundle/assets/"
42
+ }));
43
+ plugins.push(includePaths({ paths: ["./src"] }));
44
+ plugins.push(commonjs({
45
+ include: /node_modules/,
46
+ }));
47
+ plugins.push(postcss({
48
+ extract: path.resolve(outputCssFileName),
49
+ plugins: [ autoprefixer(), postcssCustomProperties() ],
50
+ minimize: isProd,
51
+ sourceMap: true,
52
+ use: [
53
+ ["sass", {
54
+ includePaths: [
55
+ "./node_modules"
56
+ ]
57
+ }]
58
+ ]
59
+ }));
60
+ plugins.push(typescript({ }));
61
+
62
+ if (isProd) {
63
+ plugins.push(terser());
64
+ }
65
+
66
+ return {
67
+ external: external || [],
68
+ input: inputFileName,
69
+ output: {
70
+ file: outputFileName,
71
+ format: "umd",
72
+ globals: globals || {},
73
+ paths: paths || {},
74
+ name: name,
75
+ sourcemap: true
76
+ },
77
+ plugins: plugins
78
+ };
79
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "compileOnSave": true,
3
+ "compilerOptions": {
4
+ "module": "esnext",
5
+ "moduleResolution": "node",
6
+ "noImplicitAny": false,
7
+ "removeComments": false,
8
+ "preserveConstEnums": true,
9
+ "sourceMap": true,
10
+ "target": "es5",
11
+ "jsx": "react",
12
+ "experimentalDecorators": true,
13
+ "lib": [ "dom", "es2018", "es2021" ],
14
+ "allowSyntheticDefaultImports": true,
15
+ "skipLibCheck": true
16
+ },
17
+ "include": [
18
+ "./src/*"
19
+ ],
20
+ }
package/variables.js ADDED
@@ -0,0 +1,11 @@
1
+ module.exports = {};
2
+
3
+ module.exports.globals = {
4
+ 'react': 'React',
5
+ 'react-dom': 'ReactDOM'
6
+ };
7
+
8
+ module.exports.external = [
9
+ 'react',
10
+ 'react-dom'
11
+ ];