generator-ehrcraft-script 1.1.0 → 1.2.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 CHANGED
@@ -1,5 +1,9 @@
1
- # generator-ehrcraft-script [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url]
2
- >
1
+ # generator-ehrcraft-script
2
+
3
+ ## Version log
4
+
5
+ 1.2.0 - simplified gulp and package dependencies
6
+
3
7
 
4
8
  ## Installation
5
9
 
@@ -7,8 +11,13 @@ First, install [Yeoman](http://yeoman.io) and generator-ehrcraft-script using [n
7
11
 
8
12
  ```bash
9
13
  npm install -g yo
10
- npm link
11
- # npm install -g generator-ehrcraft-script
14
+ ```
15
+
16
+ Then install this generator
17
+
18
+
19
+ ```bash
20
+ npm install -g generator-ehrcraft-script
12
21
  ```
13
22
 
14
23
  Then generate your new project:
@@ -17,6 +26,13 @@ Then generate your new project:
17
26
  yo ehrcraft-script
18
27
  ```
19
28
 
29
+ ## Development
30
+ If you want to test the generator during developement you might use npm link like this:
31
+
32
+ ```bash
33
+ npm link
34
+ ```
35
+
20
36
  ## Getting To Know Yeoman
21
37
 
22
38
  * Yeoman has a heart of gold.
@@ -30,7 +30,7 @@ module.exports = class extends Generator {
30
30
  type: "input",
31
31
  name: "form_scripts",
32
32
  message: "The folder where the script should be placed",
33
- default: "../../form_scripts"
33
+ default: "../../form-scripts"
34
34
  }
35
35
  ];
36
36
 
@@ -1,73 +1,42 @@
1
- var gulp = require('gulp');
2
- var ts = require('gulp-typescript');
3
- var browserify = require('browserify');
4
- var tap = require('gulp-tap');
5
- const babel = require('gulp-babel');
6
- var rename = require('gulp-rename');
7
- var inject = require('gulp-inject-string');
1
+ // Gulp is the library/tool to automate slow, repetitive workflows and compose them into efficient build pipelines.
2
+ const gulp = require("gulp");
3
+ const { series, watch } = require('gulp');
4
+ const inject = require('gulp-inject-string');
5
+ // used to minify javascript
6
+ const terser = require('gulp-terser');
7
+ // used to compile typescript source code
8
+ const ts = require('gulp-typescript');
9
+ // used to rename files in the pipes of compilation, budle, renaming, etc.
10
+ const rename = require('gulp-rename');
11
+ // used to bundle the generated javascript code to one file
12
+ const browserify = require('browserify');
13
+
14
+ // used for the pipes working with the files. vinyl is a meta-defintion of a file.
15
+ // See: https://github.com/gulpjs/vinyl
16
+ const source = require('vinyl-source-stream');
17
+ const buffer = require('vinyl-buffer');
18
+ const through = require('through');
19
+
20
+ /* Used for configuration */
8
21
  const YAML = require('yaml');
22
+ /* Used to read configuration */
9
23
  const fs = require('fs');
10
- const { watch,series,parallel } = require('gulp');
11
- const del = require('del');
12
- var through = require('through');
13
- var log = require('gulplog');
14
- let uglify = require('gulp-uglify-es').default;
15
- var source = require('vinyl-source-stream');
16
- var buffer = require('vinyl-buffer');
17
- var bundler = require('./bundle');
18
24
 
19
- var buffer = require('vinyl-buffer');
20
- var transformEhrCraftPackage = require('./removeEhrCraftPackage');
25
+ const full_deploy_series = series(compile, injectBootStrapLine, bundle, minify, deploy);
21
26
 
22
27
 
23
- function getFolderAndName() {
24
- const file = fs.readFileSync('./ehrcraft.config.yml','utf8');
25
- let n = YAML.parse(file);
26
- return n;
27
-
28
- }
29
-
30
-
31
-
32
- //ehrcraft_form_api_1.
33
- function compress() {
34
- return gulp.src('./build/js/*.js')
35
- .pipe(uglify(/* options */))
36
- .pipe(gulp.dest('./build/dist'))
37
-
38
-
39
- }
40
28
 
41
29
  /**
42
- * Typescript compiler filene
43
- */
44
- function compile() {
45
- return gulp.src('src/**/*.ts')
46
- .pipe(ts({
47
- target: "es3",
48
- noImplicitAny: true,
49
- module: "commonjs",
50
- outDir: "ehrcraft"
51
- }))
52
- .pipe(babel({
53
- presets: ["@babel/typescript"],
54
- plugins: ["@babel/proposal-class-properties",
55
- "@babel/proposal-object-rest-spread"]
56
- }))
57
- .pipe(gulp.dest('./build'))
58
-
59
- };
60
-
61
- /**
62
- * Dette er trikset som gjør at FormRenderer starter scriptet vårt ved lasting.
63
- * Ved å kalle funksjonen main(api) i index.js
64
- *
65
- * NOTE:
30
+ * Defines the injected function call to main.
31
+ * * NOTE:
66
32
  * Change or modify this if you need ctx and/or http for your script
67
33
  * i.e.
68
34
  * main(api, ctx, http)
69
35
  * main(api, ctx)
70
36
  *
37
+ * Since version 2.3.x there is support for terminology search and system configuration - they are exposed as "terminology" and "config".
38
+ * main(api,ctx,terminology, config)
39
+ *
71
40
  * NOTE:
72
41
  * If you want to use api2, the second generation of script api delivered with DIPS Arena 22.2, add the following:
73
42
  *
@@ -75,98 +44,130 @@ function compile() {
75
44
  *
76
45
  * Then you have to changes the export function main(......) in index.ts as well
77
46
  */
78
- function setup() {
79
- let boot = "main(api);";
80
- return gulp.src("./build/index.js")
81
- .pipe(inject.append(boot))
82
- .pipe(gulp.dest("./build"));
83
-
84
- };
47
+ const boot = 'main(api,ctx,terminology, config);';
85
48
 
86
49
  /**
87
- * Benytter browserify for å bundle sammen javascript filene til en fil.
50
+ * Task to compile source as typescript
51
+ * @param {*} cb
52
+ * @returns
88
53
  */
89
- function oldbundle() {
90
- return gulp.src('./build/index.js',{ read: true })
91
- .pipe(tap(function (file) {
92
- log.info('bundling ' + file.path);
93
- // replace file contents with browserify's bundle stream
94
- file.contents = browserify(file.path,{
95
- debug: true,
96
- transform: [
97
- // removeEhrCraftFormRequire,
98
- // removeEhrCraftPackage,
99
- removeEhrCraftFormRequire2,
100
- removeEhrCraftPackage2
101
- ]
102
- }).bundle();
103
-
104
- })).pipe(gulp.dest('./build/js'));
105
- };
106
-
107
- function bundle(cb) {
108
- return browserify('./build/index.js')
109
- //.transform(bundler.removeEhrCraftPackage)
110
- .transform(transformEhrCraftPackage)
111
- .bundle()
112
- .pipe(source('index.js'))
113
- .pipe(buffer())
114
- .pipe(gulp.dest('./build/bundle'));
115
- }
116
-
117
- function olderbundle(cb) {
118
- bundler.bundleScript("./build/index.js","./build/bundle.js")
119
- .then(result => {
120
- console.log("Bundled finsihed");
121
- cb();
122
- }).catch(error => {
123
- console.error("Error bundling");
124
- })
125
-
54
+ function compile(cb) {
55
+ return gulp.src('src/**/*.ts')
56
+ .pipe(ts({
57
+ target: "es5",
58
+ noImplicitAny: true,
59
+ removeComments: false,
60
+ module: "commonjs"
61
+ }))
62
+
63
+ .pipe(gulp.dest('./dist'))
126
64
  }
127
-
128
-
129
65
  /**
130
- * Kopierer den kompilerte fila til form_scripts folderen definert i ehrcraft.config.yml
131
- * @param {*} cb
66
+ * Task to inject the call to main method
67
+ * See boot variable above.
68
+ *
69
+ * @returns
132
70
  */
133
- function deployBundledFileToFormScripts(cb) {
134
- let n = getFolderAndName();
135
- let formScriptsFolder = n.form_scripts;
136
- let formName = n.form_name;
137
- console.log("Deploy to folder " + formScriptsFolder + ", file: " + formName + ".js");
138
- if (formScriptsFolder && formName) {
139
- return gulp.src('./build/bundle/index.js')
140
- .pipe(rename(formName + ".js"))
141
- .pipe(gulp.dest(formScriptsFolder));
142
- }
143
- else {
144
- cb();
145
- }
71
+ function injectBootStrapLine(cb) {
146
72
 
147
- };
73
+ return gulp.src("./dist/index.js")
74
+ .pipe(inject.append(boot))
75
+ .pipe(inject.append(`console.log("Script kompilert dato: ${new Date().toISOString()}");`))
76
+ .pipe(gulp.dest("./dist"));
148
77
 
149
- function cleanBuild() {
150
- return del('./build');
78
+ };
151
79
 
80
+ /**
81
+ * Task to minify the generated javascript.
82
+ * This task is optional. The idea is to reduce the size of the generated javascript.
83
+ * @param {*} cb
84
+ * @returns
85
+ */
86
+ function minify(cb) {
87
+ return gulp.src("./build/app.js")
88
+ .pipe(terser())
89
+ .pipe(gulp.dest("./build"));
152
90
  }
153
91
 
154
- function cleanDist() {
155
- return del('./dist');
92
+ /**
93
+ * Task to bundle all compiled javascript files into a single bundle.
94
+ * Will also remove package names from the EHR Craft API.
95
+ * @param {*} cb
96
+ * @returns
97
+ */
98
+ function bundle(cb) {
99
+ var b = browserify({
100
+ entries: './dist/index.js',
101
+ debug: false,
102
+ transform: [removeEhrCraftPackage]
103
+ });
104
+ return b.bundle()
105
+ .pipe(source('app.js'))
106
+ .pipe(buffer())
107
+ .pipe(gulp.dest('./build'));
108
+
109
+
110
+ function removeEhrCraftPackage(file) {
111
+ var data = '';
112
+ var stream = through(write, end);
113
+ return stream;
114
+
115
+ function write(buf) {
116
+ data += buf.toString('utf8')
117
+ .replace(/(var ehrcraft_form_api_1)/gm, "// Kommentert ut av byggescript")
118
+ .replace(/(ehrcraft_form_api_1\.)/gm, "");
119
+ ;
120
+ }
121
+ function end() {
122
+ process(file, data, function (result) {
123
+ stream.queue(result);
124
+ stream.queue(null);
125
+ });
126
+ }
127
+ function process(file, data, callback) {
128
+ //console.log(`Processing file ${file}`)
129
+ callback(data);
130
+ }
131
+
132
+ }
156
133
  }
157
- //exports.uglify = compress;
158
- //exports.bundle = series(this.clean,this.compile,this.setup,this.bundle);
159
- exports.build = series(compile,setup);
160
- exports.bundle = bundle;
161
- exports.clean = parallel(cleanBuild,cleanDist);
162
- exports.deploy = series(this.clean,compile,setup,bundle,compress,deployBundledFileToFormScripts);
163
- exports.default = function () {
164
- //watch('./src/*.ts',series(compile,setup,bundle,compress,deployBundledFileToFormScripts));
165
- //watch('./src/**/*.ts',series(compile,setup,bundle,compress,deployBundledFileToFormScripts));
166
- watch('./src/**/*.ts',series(compile,setup,bundle,deployBundledFileToFormScripts));
134
+ /**
135
+ * Task to deploy the bundled javascript file to form script folder of EHR Craft.
136
+ * Uses the configuration defined un ehrcraft.config.yml
137
+ * @param {*} cb
138
+ * @returns
139
+ */
140
+ function deploy(cb) {
141
+ const ehrCraftConfig = loadEhrCraftConfigAsYaml();
142
+ const formScriptsFolder = ehrCraftConfig.form_scripts;
143
+ const formName = ehrCraftConfig.form_name;
144
+ console.log("Deploy to folder " + formScriptsFolder + ", file: " + formName + ".js");
145
+ if (formScriptsFolder && formName) {
146
+ return gulp
147
+ .src('./build/app.js')
148
+ .pipe(rename(formName + ".js"))
149
+ .pipe(gulp.dest(formScriptsFolder));
150
+ }
151
+ else {
152
+ cb();
153
+ }
154
+
155
+ function loadEhrCraftConfigAsYaml() {
156
+ const file = fs.readFileSync('./ehrcraft.config.yml', 'utf8');
157
+ let n = YAML.parse(file);
158
+ return n;
159
+
160
+ }
161
+ }
162
+ /**
163
+ * Task to watch for changes in typescript and start the full serie of compile, bundle, deploy
164
+ * @param {*} cb
165
+ */
166
+ function watchForChanges(cb) {
167
+ watch('./src/**/*.ts', full_deploy_series);
168
+ cb();
167
169
  }
168
170
 
169
- exports.justdeploy = deployBundledFileToFormScripts;
170
-
171
-
172
- //
171
+ exports.default = watchForChanges;
172
+ exports.deploy = full_deploy_series;
173
+ exports.bundle = series(compile, bundle)
@@ -1,60 +1,34 @@
1
- {
2
- "name": "<%= appname %>",
3
- "version": "1.0.0",
4
- "description": "<%= appname %>",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "ts-mocha test/**/*.spec.ts"
8
- },
9
- "keywords": [
10
- "openEHR",
11
- "<%= appname %>",
12
- "BIFROST",
13
- "Arena"
14
- ],
15
- "author": "Bjørn Næss <bna@dips.no>",
16
- "license": "ISC",
17
- "devDependencies": {
18
- "@babel/cli": "^7.6.4",
19
- "@babel/core": "^7.6.4",
20
- "@babel/plugin-proposal-class-properties": "^7.5.5",
21
- "@babel/plugin-proposal-object-rest-spread": "^7.6.2",
22
- "@babel/preset-typescript": "^7.6.0",
23
- "@types/adm-zip": "^0.4.32",
24
- "@types/chai": "^4.2.3",
25
- "@types/mocha": "^8.2.0",
26
- "@types/node": "^14.0.0",
27
- "@types/voca": "^1.4.0",
28
- "adm-zip": "^0.5.2",
29
- "aliasify": "^2.1.0",
30
- "chai": "^4.2.0",
31
- "del": "^6.0.0",
32
- "gulp": "^4.0.2",
33
- "gulp-babel": "^8.0.0",
34
- "gulp-browserify": "^0.5.1",
35
- "gulp-buffer": "0.0.2",
36
- "gulp-concat": "^2.6.1",
37
- "gulp-copy": "^4.0.1",
38
- "gulp-inject-string": "^1.1.2",
39
- "gulp-rename": "^2.0.0",
40
- "gulp-tap": "^2.0.0",
41
- "gulp-typescript": "^5.0.1",
42
- "gulp-uglify": "^3.0.2",
43
- "gulp-uglify-es": "^2.0.0",
44
- "gulp-watch": "^5.0.1",
45
- "gulplog": "^1.0.0",
46
- "mocha": "^8.0.0",
47
- "nyc": "^15.0.0",
48
- "ts-mocha": "^8.0.0",
49
- "ts-mockito": "^2.5.0",
50
- "ts-node": "^9.1.1",
51
- "typescript": "^4.0.0",
52
- "vinyl-buffer": "^1.0.1",
53
- "vinyl-source-stream": "^2.0.0",
54
- "voca": "^1.4.0"
55
- },
56
- "dependencies": {
57
- "ehrcraft-form-api": "^2",
58
- "yaml": "^1.7.2"
59
- }
60
- }
1
+ {
2
+ "name": "<%= appname %>",
3
+ "version": "1.0.0",
4
+ "description": "<%= appname %>",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "ts-mocha test/**/*.spec.ts"
8
+ },
9
+ "keywords": [
10
+ "openEHR",
11
+ "<%= appname %>",
12
+ "BIFROST",
13
+ "Arena"
14
+ ],
15
+ "author": "Bjørn Næss <bna@dips.no>",
16
+ "license": "ISC",
17
+ "devDependencies": {
18
+ "browserify": "^17.0.0",
19
+ "ehrcraft-form-api": "^2.3.9",
20
+ "gulp": "^4.0.0",
21
+ "gulp-inject-string": "^1.1.2",
22
+ "gulp-rename": "^2.0.0",
23
+ "gulp-terser": "^2.1.0",
24
+ "gulp-typescript": "^6.0.0-alpha.1",
25
+ "mocha": "^10.2.0",
26
+ "through": "^2.3.8",
27
+ "ts-mocha": "^10.0.0",
28
+ "typescript": "^4.9.5",
29
+ "vinyl-buffer": "^1.0.1",
30
+ "vinyl-source-stream": "^2.0.0",
31
+ "yaml": "^2.2.1"
32
+ },
33
+ "dependencies": {}
34
+ }
package/package.json CHANGED
@@ -1,87 +1,86 @@
1
- {
2
- "name": "generator-ehrcraft-script",
3
- "version": "1.1.0",
4
- "description": "A code generator for DIPS Forms typescript",
5
- "homepage": "https://dev.azure.com/dips/DIPS%20Configured%20Products/_git/generator-ehrcraft-script",
6
- "author": {
7
- "name": "Bjørn Næss",
8
- "email": "bna@dips.no",
9
- "url": "https://dev.azure.com/dips/DIPS%20Configured%20Products/_git/generator-ehrcraft-script"
10
- },
11
- "files": [
12
- "generators"
13
- ],
14
- "main": "generators/index.js",
15
- "keywords": [
16
- "",
17
- "yeoman-generator"
18
- ],
19
- "devDependencies": {
20
- "@types/chai": "^4.0.0",
21
- "@types/mocha": "^8.0.0",
22
- "chai": "^4.2.0",
23
- "coveralls": "^3.0.7",
24
- "ehrcraft-form-api": "^1.0.0",
25
- "eslint": "^7.0.0",
26
- "eslint-config-prettier": "^7.0.0",
27
- "eslint-plugin-prettier": "^3.1.1",
28
- "husky": "^4.0.0",
29
- "jest": "^26.0.0",
30
- "lint-staged": "^10.0.0",
31
- "mocha": "^8.2.1",
32
- "prettier": "^2.0.0",
33
- "ts-mockito": "^2.6.1",
34
- "yeoman-assert": "^3.1.0",
35
- "yeoman-test": "^4.0.0"
36
- },
37
- "engines": {
38
- "npm": ">= 4.0.0"
39
- },
40
- "dependencies": {
41
- "chalk": "^4.0.0",
42
- "loadash": "^1.0.0",
43
- "lodash": "^4.17.20",
44
- "yeoman-generator": "^4.0.0",
45
- "yosay": "^2.0.1"
46
- },
47
- "jest": {
48
- "testEnvironment": "node"
49
- },
50
- "lint-staged": {
51
- "*.js": [
52
- "eslint --fix",
53
- "git add"
54
- ],
55
- "*.json": [
56
- "prettier --write",
57
- "git add"
58
- ]
59
- },
60
- "husky": {
61
- "hooks": {
62
- "pre-commit": "lint-staged"
63
- }
64
- },
65
- "eslintConfig": {
66
- "extends": [
67
- "xo",
68
- "prettier"
69
- ],
70
- "env": {
71
- "jest": true,
72
- "node": true
73
- },
74
- "rules": {
75
- "prettier/prettier": "error"
76
- },
77
- "plugins": [
78
- "prettier"
79
- ]
80
- },
81
- "scripts": {
82
- "pretest": "eslint .",
83
- "test": "jest"
84
- },
85
- "repository": "ehrforce/generator-ehrcraft-script",
86
- "license": "MIT"
87
- }
1
+ {
2
+ "name": "generator-ehrcraft-script",
3
+ "version": "1.2.0",
4
+ "description": "A code generator for DIPS Forms typescript",
5
+ "homepage": "https://dev.azure.com/dips/DIPS%20Configured%20Products/_git/generator-ehrcraft-script",
6
+ "author": {
7
+ "name": "Bjørn Næss",
8
+ "email": "bna@dips.no",
9
+ "url": "https://dev.azure.com/dips/DIPS%20Configured%20Products/_git/generator-ehrcraft-script"
10
+ },
11
+ "files": [
12
+ "generators"
13
+ ],
14
+ "main": "generators/index.js",
15
+ "keywords": [
16
+ "",
17
+ "yeoman-generator"
18
+ ],
19
+ "devDependencies": {
20
+ "@types/chai": "^4.3.4",
21
+ "@types/mocha": "^10.0.1",
22
+ "chai": "^4.3.7",
23
+ "coveralls": "^3.1.1",
24
+ "ehrcraft-form-api": "^2.3.4",
25
+ "eslint": "^8.31.0",
26
+ "eslint-config-prettier": "^8.6.0",
27
+ "eslint-plugin-prettier": "^4.2.1",
28
+ "husky": "^4.3.8",
29
+ "jest": "^29.3.1",
30
+ "lint-staged": "^13.1.0",
31
+ "mocha": "^10.2.0",
32
+ "prettier": "^2.8.2",
33
+ "ts-mockito": "^2.6.1",
34
+ "yeoman-assert": "^3.1.1",
35
+ "yeoman-test": "^7.2.0"
36
+ },
37
+ "engines": {
38
+ "npm": ">= 4.0.0"
39
+ },
40
+ "dependencies": {
41
+ "chalk": "^5.2.0",
42
+ "loadash": "^1.0.0",
43
+ "lodash": "^4.17.21",
44
+ "yeoman-generator": "^5.7.0",
45
+ "yosay": "^2.0.2"
46
+ },
47
+ "jest": {
48
+ "testEnvironment": "node"
49
+ },
50
+ "lint-staged": {
51
+ "*.js": [
52
+ "eslint --fix",
53
+ "git add"
54
+ ],
55
+ "*.json": [
56
+ "prettier --write",
57
+ "git add"
58
+ ]
59
+ },
60
+ "husky": {
61
+ "hooks": {
62
+ "pre-commit": "lint-staged"
63
+ }
64
+ },
65
+ "eslintConfig": {
66
+ "extends": [
67
+ "eslint:recommended"
68
+ ],
69
+ "env": {
70
+ "jest": true,
71
+ "node": true
72
+ },
73
+ "rules": {
74
+ "prettier/prettier": "error"
75
+ },
76
+ "plugins": [
77
+ "prettier"
78
+ ]
79
+ },
80
+ "scripts": {
81
+ "pretest": "eslint .",
82
+ "test": "jest"
83
+ },
84
+ "repository": "ehrforce/generator-ehrcraft-script",
85
+ "license": "MIT"
86
+ }
@@ -1,62 +0,0 @@
1
- var browserify = require('browserify');
2
- var through = require('through');
3
- const fs = require('fs');
4
-
5
- /**
6
- * Denne fila er ikke i bruk - ligger her fordi den ble brukt for å teste ut funksjonene som brukes for å fjerne ehrcraft spesifikke forhold
7
- */
8
-
9
- const regexptest = function () {
10
- var data = '';
11
- return through(write,end);
12
- function write(buf) {
13
- data += buf.toString('utf8').replace(/(ehrcraft_form_api_1\.)/gm,"");
14
- }
15
- function end() {
16
- this.queue(data);
17
- this.queue(null);
18
- }
19
- }
20
- const removerequire = function () {
21
- var data = '';
22
- return through(write,end);
23
- function write(buf) {
24
- data += buf.toString('utf8').replace(/(var ehrcraft_form_api_1)/gm,"// Kommentert ut av byggescript");
25
- }
26
- function end() {
27
- this.queue(data);
28
- this.queue(null);
29
- }
30
- }
31
-
32
-
33
- /**
34
- *
35
- * @param {string} inFile - the js file to bundle
36
- * @param {string} outFile - the bundled js file to write to
37
- */
38
- const bundleFile = function (inFile,outFile) {
39
- return new Promise((resolve,reject) => {
40
- try {
41
- var b = browserify();
42
- b.add(inFile);
43
- b.transform(regexptest);
44
- b.transform(removerequire);
45
- b.bundle()
46
- .pipe(fs.createWriteStream(outFile));
47
- resolve("OK");
48
- } catch (error) {
49
- reject(err);
50
- }
51
- });
52
-
53
-
54
-
55
- }
56
-
57
-
58
-
59
- exports.bundleScript = bundleFile;
60
- exports.removeEhrCraftPackage = this.removeEhrCraftPackage;
61
- exports.removeEhrCraftRequire = this.removeEhrCraftRequire;
62
-
@@ -1,28 +0,0 @@
1
- var through = require('through');
2
- var path = require('path');
3
- function process(file,data,callback) {
4
- //console.log(`Processing file ${file}`)
5
- callback(data);
6
- }
7
-
8
- function transform(file) {
9
- var data = '',stream = through(write,end);
10
-
11
- return stream;
12
-
13
- function write(buf) {
14
- //data += buf;
15
- data += buf.toString('utf8')
16
- .replace(/(var ehrcraft_form_api_1)/gm,"// Kommentert ut av byggescript")
17
- .replace(/(ehrcraft_form_api_1\.)/gm,"");
18
- ;
19
- }
20
- function end() {
21
- process(file,data,function (result) {
22
- stream.queue(result);
23
- stream.queue(null);
24
- });
25
- }
26
- return through();
27
- }
28
- module.exports = transform;