@awayfl/awayfl-player 0.2.36 → 0.2.38
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/LICENSE +201 -201
- package/README.md +36 -36
- package/awayfl.config.js +85 -85
- package/builtins/playerglobal.json +2752 -2752
- package/builtins/playerglobal_new.json +4169 -4169
- package/bundle/awayfl-player.umd.js +30 -161
- package/bundle/awayfl-player.umd.js.gz +0 -0
- package/bundle/awayfl-player.umd.js.map +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.js +9 -9
- package/dist/lib/AVM1Player.d.ts +4 -4
- package/dist/lib/AVM1Player.js +13 -13
- package/dist/lib/AVM2Player.d.ts +4 -4
- package/dist/lib/AVM2Player.js +14 -14
- package/dist/lib/AVMDebugInterface.d.ts +21 -21
- package/dist/lib/AVMDebugInterface.js +279 -279
- package/dist/lib/AVMPlayer.d.ts +6 -6
- package/dist/lib/AVMPlayer.js +27 -27
- package/dist/src/Main.d.ts +1 -1
- package/dist/src/Main.js +19 -19
- package/index.ts +9 -9
- package/lib/AVM1Player.ts +9 -9
- package/lib/AVM2Player.ts +12 -12
- package/lib/AVMDebugInterface.ts +345 -345
- package/lib/AVMPlayer.ts +29 -29
- package/package.json +97 -97
- package/rollup.config.js +30 -30
- package/scripts/copyVersionToIndex.js +33 -33
- package/scripts/initAwayDev_mac.sh +177 -177
- package/scripts/initAwayDev_mac_pnpm.sh +177 -177
- package/scripts/initAwayDev_win.bat +198 -198
- package/scripts/unlinkAwayDev_mac.sh +140 -140
- package/scripts/unlinkAwayDev_mac_pnpm.sh +140 -140
- package/scripts/unlinkAwayDev_win.bat +140 -140
- package/scripts/updateAwayDev_mac.sh +86 -90
- package/scripts/updateAwayDev_win.bat +69 -69
- package/scripts/updateAway_any.bat +73 -73
- package/tsconfig.json +12 -12
- package/webpack.config.js +496 -450
package/lib/AVMPlayer.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { AVMStage, AVMEvent, AVMVERSION, release } from "@awayfl/swf-loader";
|
|
2
|
-
import { AVMDebug } from "./AVMDebugInterface";
|
|
3
|
-
|
|
4
|
-
import { AVM1Handler } from '@awayfl/avm1';
|
|
5
|
-
import { AVM2Handler } from '@awayfl/avm2';
|
|
6
|
-
import { PlayerGlobal } from "@awayfl/playerglobal";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export class AVMPlayer extends AVMStage {
|
|
10
|
-
private _debug: AVMDebug;
|
|
11
|
-
constructor(gameConfig) {
|
|
12
|
-
super(gameConfig);
|
|
13
|
-
this.registerAVMStageHandler(new AVM1Handler());
|
|
14
|
-
this.registerAVMStageHandler(new AVM2Handler(new PlayerGlobal()));
|
|
15
|
-
this.addEventListener(AVMEvent.AVM_COMPLETE, (event: AVMEvent) => this.onAVMAvailable(event));
|
|
16
|
-
|
|
17
|
-
// export player api
|
|
18
|
-
//if(!release) {
|
|
19
|
-
this._debug = new AVMDebug(this);
|
|
20
|
-
//}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
protected onAVMAvailable(event: AVMEvent) {
|
|
24
|
-
if(this._debug) {
|
|
25
|
-
this._debug.onAvmInit(event.avmVersion === AVMVERSION.AVM1 ? 1 : 2);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
1
|
+
import { AVMStage, AVMEvent, AVMVERSION, release } from "@awayfl/swf-loader";
|
|
2
|
+
import { AVMDebug } from "./AVMDebugInterface";
|
|
3
|
+
|
|
4
|
+
import { AVM1Handler } from '@awayfl/avm1';
|
|
5
|
+
import { AVM2Handler } from '@awayfl/avm2';
|
|
6
|
+
import { PlayerGlobal } from "@awayfl/playerglobal";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export class AVMPlayer extends AVMStage {
|
|
10
|
+
private _debug: AVMDebug;
|
|
11
|
+
constructor(gameConfig) {
|
|
12
|
+
super(gameConfig);
|
|
13
|
+
this.registerAVMStageHandler(new AVM1Handler());
|
|
14
|
+
this.registerAVMStageHandler(new AVM2Handler(new PlayerGlobal()));
|
|
15
|
+
this.addEventListener(AVMEvent.AVM_COMPLETE, (event: AVMEvent) => this.onAVMAvailable(event));
|
|
16
|
+
|
|
17
|
+
// export player api
|
|
18
|
+
//if(!release) {
|
|
19
|
+
this._debug = new AVMDebug(this);
|
|
20
|
+
//}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
protected onAVMAvailable(event: AVMEvent) {
|
|
24
|
+
if(this._debug) {
|
|
25
|
+
this._debug.onAvmInit(event.avmVersion === AVMVERSION.AVM1 ? 1 : 2);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
package/package.json
CHANGED
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@awayfl/awayfl-player",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Flash Player emulator for executing SWF files (published for FP versions 6 and up) in javascript",
|
|
5
|
-
"main": "bundle/awayfl-player.umd.js",
|
|
6
|
-
"module": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"url": "http://www.away3d.com",
|
|
9
|
-
"author": "Rob Bateman",
|
|
10
|
-
"scripts": {
|
|
11
|
-
"rimraf": "rimraf",
|
|
12
|
-
"rollup": "rollup -c",
|
|
13
|
-
"tsc": "tsc",
|
|
14
|
-
"tsc:build": "npm run tsc || exit 0",
|
|
15
|
-
"webpack": "webpack",
|
|
16
|
-
"clean": "npm run rimraf -- dist bundle",
|
|
17
|
-
"clean:bin": "npm run rimraf -- bin",
|
|
18
|
-
"preclean:install": "npm run clean",
|
|
19
|
-
"clean:install": "npm set progress=false && npm install",
|
|
20
|
-
"preclean:start": "npm run clean",
|
|
21
|
-
"clean:start": "npm start",
|
|
22
|
-
"watch": "npm run tsc -- --w",
|
|
23
|
-
"build": "npm run build:dev",
|
|
24
|
-
"prebuild:dev": "npm run clean:bin",
|
|
25
|
-
"build:dev": "webpack --config webpack.config.js --progress",
|
|
26
|
-
"prebuild:prod": "npm run clean:bin",
|
|
27
|
-
"build:prod": "webpack --config webpack.config.js --progress --env prod",
|
|
28
|
-
"server": "npm run server:dev",
|
|
29
|
-
"server:dev": "webpack-dev-server --config webpack.config.js --progress",
|
|
30
|
-
"server:dev:hmr": "npm run server:dev -- --hot",
|
|
31
|
-
"server:prod": "http-server bin --cors",
|
|
32
|
-
"start": "npm run server:dev",
|
|
33
|
-
"start:hmr": "npm run server:dev:hmr",
|
|
34
|
-
"yarnImport": "npm run rimraf -- yarn.lock && yarn import && git add ./yarn.lock && git commit -m \"update yarn.lock file\" || exit 0",
|
|
35
|
-
"copyVersionToIndex": "node ./scripts/copyVersionToIndex.js ./index.ts && git add ./index.ts && git commit -m \"update version number in index.ts\"",
|
|
36
|
-
"preversion": "npm run clean",
|
|
37
|
-
"version": "npm run yarnImport && npm run copyVersionToIndex && npm run tsc:build && npm run rollup",
|
|
38
|
-
"postversion": "git push && git push --tags && npm publish"
|
|
39
|
-
},
|
|
40
|
-
"keywords": [
|
|
41
|
-
"AwayFL",
|
|
42
|
-
"Flash",
|
|
43
|
-
"Emulator",
|
|
44
|
-
"2D",
|
|
45
|
-
"Graphics",
|
|
46
|
-
"WebGL",
|
|
47
|
-
"Typescript"
|
|
48
|
-
],
|
|
49
|
-
"license": "Apache-2.0",
|
|
50
|
-
"bugs": {
|
|
51
|
-
"url": "https://github.com/awayfl/awayfl-player/issues"
|
|
52
|
-
},
|
|
53
|
-
"homepage": "https://github.com/awayfl/awayfl-player#readme",
|
|
54
|
-
"peerDependencies": {
|
|
55
|
-
"@awayfl/avm1": "^0.2.0",
|
|
56
|
-
"@awayfl/avm2": "^0.2.0",
|
|
57
|
-
"@awayfl/playerglobal": "^0.2.0",
|
|
58
|
-
"@awayfl/swf-loader": "^0.4.0",
|
|
59
|
-
"@awayjs/core": "^0.9.0",
|
|
60
|
-
"@awayjs/graphics": "^0.5.0",
|
|
61
|
-
"@awayjs/materials": "^0.6.0",
|
|
62
|
-
"@awayjs/renderer": "^0.11.0",
|
|
63
|
-
"@awayjs/scene": "^0.13.0",
|
|
64
|
-
"@awayjs/stage": "^0.11.0",
|
|
65
|
-
"@awayjs/view": "^0.6.0",
|
|
66
|
-
"tslib": "^2.3.0"
|
|
67
|
-
},
|
|
68
|
-
"devDependencies": {
|
|
69
|
-
"@awayfl/avm1": "^0.2.0",
|
|
70
|
-
"@awayfl/avm2": "^0.2.0",
|
|
71
|
-
"@awayfl/playerglobal": "^0.2.0",
|
|
72
|
-
"@awayfl/swf-loader": "^0.4.0",
|
|
73
|
-
"@awayjs/core": "^0.9.0",
|
|
74
|
-
"@awayjs/graphics": "^0.5.0",
|
|
75
|
-
"@awayjs/materials": "^0.6.0",
|
|
76
|
-
"@awayjs/renderer": "^0.11.0",
|
|
77
|
-
"@awayjs/scene": "^0.13.0",
|
|
78
|
-
"@awayjs/stage": "^0.11.0",
|
|
79
|
-
"@awayjs/view": "^0.6.0",
|
|
80
|
-
"@rollup/plugin-commonjs": "^18.0.0",
|
|
81
|
-
"@rollup/plugin-node-resolve": "^11.2.1",
|
|
82
|
-
"copy-webpack-plugin": "^11.0.0",
|
|
83
|
-
"html-webpack-plugin": "^5.5.0",
|
|
84
|
-
"rimraf": "^4.4.0",
|
|
85
|
-
"rollup": "^2.79.1",
|
|
86
|
-
"rollup-plugin-gzip": "^3.1.0",
|
|
87
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
88
|
-
"terser-webpack-plugin": "^5.3.7",
|
|
89
|
-
"ts-loader": "^9.4.2",
|
|
90
|
-
"tslib": "^2.3.0",
|
|
91
|
-
"typescript": "^4.9.5",
|
|
92
|
-
"webpack": "^5.76.2",
|
|
93
|
-
"webpack-cli": "^5.0.1",
|
|
94
|
-
"webpack-dev-server": "^4.12.0",
|
|
95
|
-
"webpack-merge": "^5.8.0"
|
|
96
|
-
}
|
|
97
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@awayfl/awayfl-player",
|
|
3
|
+
"version": "0.2.38",
|
|
4
|
+
"description": "Flash Player emulator for executing SWF files (published for FP versions 6 and up) in javascript",
|
|
5
|
+
"main": "bundle/awayfl-player.umd.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"url": "http://www.away3d.com",
|
|
9
|
+
"author": "Rob Bateman",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"rimraf": "rimraf",
|
|
12
|
+
"rollup": "rollup -c",
|
|
13
|
+
"tsc": "tsc",
|
|
14
|
+
"tsc:build": "npm run tsc || exit 0",
|
|
15
|
+
"webpack": "webpack",
|
|
16
|
+
"clean": "npm run rimraf -- dist bundle",
|
|
17
|
+
"clean:bin": "npm run rimraf -- bin",
|
|
18
|
+
"preclean:install": "npm run clean",
|
|
19
|
+
"clean:install": "npm set progress=false && npm install",
|
|
20
|
+
"preclean:start": "npm run clean",
|
|
21
|
+
"clean:start": "npm start",
|
|
22
|
+
"watch": "npm run tsc -- --w",
|
|
23
|
+
"build": "npm run build:dev",
|
|
24
|
+
"prebuild:dev": "npm run clean:bin",
|
|
25
|
+
"build:dev": "webpack --config webpack.config.js --progress",
|
|
26
|
+
"prebuild:prod": "npm run clean:bin",
|
|
27
|
+
"build:prod": "webpack --config webpack.config.js --progress --env prod",
|
|
28
|
+
"server": "npm run server:dev",
|
|
29
|
+
"server:dev": "webpack-dev-server --config webpack.config.js --progress",
|
|
30
|
+
"server:dev:hmr": "npm run server:dev -- --hot",
|
|
31
|
+
"server:prod": "http-server bin --cors",
|
|
32
|
+
"start": "npm run server:dev",
|
|
33
|
+
"start:hmr": "npm run server:dev:hmr",
|
|
34
|
+
"yarnImport": "npm run rimraf -- yarn.lock && yarn import && git add ./yarn.lock && git commit -m \"update yarn.lock file\" || exit 0",
|
|
35
|
+
"copyVersionToIndex": "node ./scripts/copyVersionToIndex.js ./index.ts && git add ./index.ts && git commit -m \"update version number in index.ts\"",
|
|
36
|
+
"preversion": "npm run clean",
|
|
37
|
+
"version": "npm run yarnImport && npm run copyVersionToIndex && npm run tsc:build && npm run rollup",
|
|
38
|
+
"postversion": "git push && git push --tags && npm publish"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"AwayFL",
|
|
42
|
+
"Flash",
|
|
43
|
+
"Emulator",
|
|
44
|
+
"2D",
|
|
45
|
+
"Graphics",
|
|
46
|
+
"WebGL",
|
|
47
|
+
"Typescript"
|
|
48
|
+
],
|
|
49
|
+
"license": "Apache-2.0",
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/awayfl/awayfl-player/issues"
|
|
52
|
+
},
|
|
53
|
+
"homepage": "https://github.com/awayfl/awayfl-player#readme",
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"@awayfl/avm1": "^0.2.0",
|
|
56
|
+
"@awayfl/avm2": "^0.2.0",
|
|
57
|
+
"@awayfl/playerglobal": "^0.2.0",
|
|
58
|
+
"@awayfl/swf-loader": "^0.4.0",
|
|
59
|
+
"@awayjs/core": "^0.9.0",
|
|
60
|
+
"@awayjs/graphics": "^0.5.0",
|
|
61
|
+
"@awayjs/materials": "^0.6.0",
|
|
62
|
+
"@awayjs/renderer": "^0.11.0",
|
|
63
|
+
"@awayjs/scene": "^0.13.0",
|
|
64
|
+
"@awayjs/stage": "^0.11.0",
|
|
65
|
+
"@awayjs/view": "^0.6.0",
|
|
66
|
+
"tslib": "^2.3.0"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@awayfl/avm1": "^0.2.0",
|
|
70
|
+
"@awayfl/avm2": "^0.2.0",
|
|
71
|
+
"@awayfl/playerglobal": "^0.2.0",
|
|
72
|
+
"@awayfl/swf-loader": "^0.4.0",
|
|
73
|
+
"@awayjs/core": "^0.9.0",
|
|
74
|
+
"@awayjs/graphics": "^0.5.0",
|
|
75
|
+
"@awayjs/materials": "^0.6.0",
|
|
76
|
+
"@awayjs/renderer": "^0.11.0",
|
|
77
|
+
"@awayjs/scene": "^0.13.0",
|
|
78
|
+
"@awayjs/stage": "^0.11.0",
|
|
79
|
+
"@awayjs/view": "^0.6.0",
|
|
80
|
+
"@rollup/plugin-commonjs": "^18.0.0",
|
|
81
|
+
"@rollup/plugin-node-resolve": "^11.2.1",
|
|
82
|
+
"copy-webpack-plugin": "^11.0.0",
|
|
83
|
+
"html-webpack-plugin": "^5.5.0",
|
|
84
|
+
"rimraf": "^4.4.0",
|
|
85
|
+
"rollup": "^2.79.1",
|
|
86
|
+
"rollup-plugin-gzip": "^3.1.0",
|
|
87
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
88
|
+
"terser-webpack-plugin": "^5.3.7",
|
|
89
|
+
"ts-loader": "^9.4.2",
|
|
90
|
+
"tslib": "^2.3.0",
|
|
91
|
+
"typescript": "^4.9.5",
|
|
92
|
+
"webpack": "^5.76.2",
|
|
93
|
+
"webpack-cli": "^5.0.1",
|
|
94
|
+
"webpack-dev-server": "^4.12.0",
|
|
95
|
+
"webpack-merge": "^5.8.0"
|
|
96
|
+
}
|
|
97
|
+
}
|
package/rollup.config.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
2
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
-
import { terser } from 'rollup-plugin-terser';
|
|
4
|
-
import gzip from 'rollup-plugin-gzip';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
input: './dist/index.js',
|
|
8
|
-
output: {
|
|
9
|
-
name: 'awayflplayer',
|
|
10
|
-
sourcemap: true,
|
|
11
|
-
format: 'iife',
|
|
12
|
-
file: './bundle/awayfl-player.umd.js',
|
|
13
|
-
},
|
|
14
|
-
plugins: [
|
|
15
|
-
nodeResolve(),
|
|
16
|
-
// {
|
|
17
|
-
// transform(code, id) {
|
|
18
|
-
// return code.replace(/\/\*\* @class \*\//g, "\/*@__PURE__*\/");
|
|
19
|
-
// }
|
|
20
|
-
// },
|
|
21
|
-
commonjs(),
|
|
22
|
-
terser({
|
|
23
|
-
// mangle: {
|
|
24
|
-
// properties: {
|
|
25
|
-
// reserved: ['startPokiGame', 'userAgent', 'Number', '__constructor__', 'prototype']
|
|
26
|
-
// }
|
|
27
|
-
// }
|
|
28
|
-
}),
|
|
29
|
-
gzip()
|
|
30
|
-
]
|
|
1
|
+
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
2
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
+
import { terser } from 'rollup-plugin-terser';
|
|
4
|
+
import gzip from 'rollup-plugin-gzip';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
input: './dist/index.js',
|
|
8
|
+
output: {
|
|
9
|
+
name: 'awayflplayer',
|
|
10
|
+
sourcemap: true,
|
|
11
|
+
format: 'iife',
|
|
12
|
+
file: './bundle/awayfl-player.umd.js',
|
|
13
|
+
},
|
|
14
|
+
plugins: [
|
|
15
|
+
nodeResolve(),
|
|
16
|
+
// {
|
|
17
|
+
// transform(code, id) {
|
|
18
|
+
// return code.replace(/\/\*\* @class \*\//g, "\/*@__PURE__*\/");
|
|
19
|
+
// }
|
|
20
|
+
// },
|
|
21
|
+
commonjs(),
|
|
22
|
+
terser({
|
|
23
|
+
// mangle: {
|
|
24
|
+
// properties: {
|
|
25
|
+
// reserved: ['startPokiGame', 'userAgent', 'Number', '__constructor__', 'prototype']
|
|
26
|
+
// }
|
|
27
|
+
// }
|
|
28
|
+
}),
|
|
29
|
+
gzip()
|
|
30
|
+
]
|
|
31
31
|
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
var fs = require("fs");
|
|
4
|
-
var path = require("path");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// read in the ts-file at filePath
|
|
8
|
-
|
|
9
|
-
// use regex to find a console log for printing the version and update it for the new version
|
|
10
|
-
|
|
11
|
-
// update ts-file at filePath with the new content
|
|
12
|
-
|
|
13
|
-
//console.log(process.env.npm_package_version);
|
|
14
|
-
//console.log(process.env.INIT_CWD);
|
|
15
|
-
const args = process.argv.slice(2);
|
|
16
|
-
if (!args[0]) {
|
|
17
|
-
console.log("copyVersionToIndex - no path was provided")
|
|
18
|
-
}
|
|
19
|
-
let filePath = path.join(process.env.INIT_CWD, args[0]);
|
|
20
|
-
|
|
21
|
-
console.log("update ", filePath, " with version:", process.env.npm_package_version);
|
|
22
|
-
|
|
23
|
-
fs.readFile(filePath, 'utf8', function (err, data) {
|
|
24
|
-
if (err) throw err;
|
|
25
|
-
var re = /(.*[a-zA-Z0-9]\s\-\s)(.*)(\"\)\;.*)/;
|
|
26
|
-
//console.log("before", data)
|
|
27
|
-
data = data.replace(re, "$1" + process.env.npm_package_version + "$3");//#BUILD_VIA_NPM_VERSION_PATCH_TO_DISPLAY_VERSION_HERE#", process.env.npm_package_version);
|
|
28
|
-
//console.log("after", data)
|
|
29
|
-
fs.writeFile(filePath, data, function (err) {
|
|
30
|
-
if (err) throw err;
|
|
31
|
-
console.log("Updated ", filePath, " with inserted version ", process.env.npm_package_version);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
var fs = require("fs");
|
|
4
|
+
var path = require("path");
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
// read in the ts-file at filePath
|
|
8
|
+
|
|
9
|
+
// use regex to find a console log for printing the version and update it for the new version
|
|
10
|
+
|
|
11
|
+
// update ts-file at filePath with the new content
|
|
12
|
+
|
|
13
|
+
//console.log(process.env.npm_package_version);
|
|
14
|
+
//console.log(process.env.INIT_CWD);
|
|
15
|
+
const args = process.argv.slice(2);
|
|
16
|
+
if (!args[0]) {
|
|
17
|
+
console.log("copyVersionToIndex - no path was provided")
|
|
18
|
+
}
|
|
19
|
+
let filePath = path.join(process.env.INIT_CWD, args[0]);
|
|
20
|
+
|
|
21
|
+
console.log("update ", filePath, " with version:", process.env.npm_package_version);
|
|
22
|
+
|
|
23
|
+
fs.readFile(filePath, 'utf8', function (err, data) {
|
|
24
|
+
if (err) throw err;
|
|
25
|
+
var re = /(.*[a-zA-Z0-9]\s\-\s)(.*)(\"\)\;.*)/;
|
|
26
|
+
//console.log("before", data)
|
|
27
|
+
data = data.replace(re, "$1" + process.env.npm_package_version + "$3");//#BUILD_VIA_NPM_VERSION_PATCH_TO_DISPLAY_VERSION_HERE#", process.env.npm_package_version);
|
|
28
|
+
//console.log("after", data)
|
|
29
|
+
fs.writeFile(filePath, data, function (err) {
|
|
30
|
+
if (err) throw err;
|
|
31
|
+
console.log("Updated ", filePath, " with inserted version ", process.env.npm_package_version);
|
|
32
|
+
});
|
|
33
|
+
});
|