Skip to content

Commit

Permalink
Added survey-creator package
Browse files Browse the repository at this point in the history
  • Loading branch information
tsv2013 committed Apr 8, 2019
1 parent a926e2a commit 44edd13
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules/*
.idea
*.cmd
package/*
build/*
tmp/*
/src/*.js
/tests/*.js
Expand Down
3 changes: 3 additions & 0 deletions deploy_npm.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
cd package
printf "//registry.npmjs.org/:_authToken=${NPM_TOKEN}\n" >> ./.npmrc
npm publish .
cd ../build
printf "//registry.npmjs.org/:_authToken=${NPM_TOKEN}\n" >> ./.npmrc
npm publish .
6 changes: 3 additions & 3 deletions npmREADME.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Use **surveyjs Editor** to create or edit JSON for surveyjs library.
Use **SurveyJS Creator** to create or edit JSON for SurveyJS library.

##Getting started

Build a survey JSON using [Visual Editor](https://surveyjs.io/Editor/Editor/).
Build a survey JSON using [SurveyJS Creator](https://surveyjs.io/Overview/Builder).

Go to [SurveyJS Editor Website](https://surveyjs.io/Overview/Editor/) to get the instruction for adding survey editor into your page.
Go to [SurveyJS Creator Website](https://surveyjs.io/Overview/Builder) to get the instruction for adding survey creator into your page.

To find our more about the surveyjs library go to the [surveyjs.io site](https://surveyjs.io/Overview/Library/).
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"testcafe": "concurrently \"http-server -p 7777\" \"testcafe chrome testCafe/tests/custom_widgets.js\"",
"testcafe_ci": "http-server -p 7777 --silent & testcafe chrome:headless --reporter minimal testCafe/",
"release": "standard-version --message \"Release: %s\"",
"build_dev": "webpack --env.buildType dev",
"build_prod": "npm run build_dev && webpack --env.buildType prod",
"build_dev": "webpack --env.buildType dev --env.libraryName SurveyCreator && webpack --env.buildType dev",
"build_prod": "webpack --env.buildType dev --env.libraryName SurveyCreator && webpack --env.buildType prod --env.libraryName SurveyCreator && webpack --env.buildType dev && webpack --env.buildType prod",
"watch_dev": "webpack --env.buildType dev --watch"
},
"dependencies": {
Expand Down
4 changes: 3 additions & 1 deletion src/entries/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Version = `${process.env.VERSION}`;

export { enStrings } from "../localization/english";
export { editorLocalization, defaultStrings } from "../editorLocalization";
export { editorLocalization as localization } from "../editorLocalization";

export { DragDropHelper } from "../dragdrophelper";
export {
Expand Down Expand Up @@ -107,12 +108,13 @@ export {
} from "../surveyjsObjects";
export { Extentions } from "../extentions";
export { SurveyEditor } from "../editor";
export { SurveyEditor as SurveyCreator } from "../editor";

export { SurveysManager } from "../manage";

export { StylesManager } from "../stylesmanager";

//editorLocalization
//localization
import "../localization/danish";
import "../localization/french";
import "../localization/german";
Expand Down
94 changes: 87 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ var svgStoreUtils = require(path.resolve(
));

var banner = [
"surveyjs Builder(Editor) v" + packageJson.version,
"SurveyJS Creator v" + packageJson.version,
"(c) Devsoft Baltic O� - http://surveyjs.io/",
"Github: https://github.com/surveyjs/editor",
"Github: https://github.com/surveyjs/survey-creator",
"License: https://surveyjs.io/Licenses#BuildSurvey"
].join("\n");

var dts_banner = [
"Type definitions for Surveyjs Builder(Editor) JavaScript library v" +
"Type definitions for SurveyJS Creator JavaScript library v" +
packageJson.version,
"(c) Devsoft Baltic O� - http://surveyjs.io/",
"Github: https://github.com/surveyjs/editor",
"Github: https://github.com/surveyjs/survey-creator",
"License: https://surveyjs.io/Licenses#BuildSurvey",
""
].join("\n");
Expand All @@ -34,8 +34,15 @@ var packagePlatformJson = {
name: "surveyjs-editor",
version: packageJson.version,
description:
"Use surveyjs Builder(Editor) to create or edit JSON for surveyjs library.",
keywords: ["Survey", "JavaScript", "Editor", "Builder", "surveyjs"],
"Use SurveyJS Creator to create or edit JSON for SurveyJS Library.",
keywords: [
"Survey",
"Creator",
"JavaScript",
"Editor",
"Builder",
"surveyjs"
],
homepage: "https://surveyjs.io/Builder",
license: "https://surveyjs.io/Licenses#BuildSurvey",
files: [
Expand Down Expand Up @@ -67,8 +74,53 @@ var packagePlatformJson = {
devDependencies: {}
};

var buildPlatformJson = {
name: "survey-creator",
version: packageJson.version,
description:
"Use SurveyJS Creator to create or edit JSON for SurveyJS Library.",
keywords: [
"Survey",
"Creator",
"JavaScript",
"Editor",
"Builder",
"surveyjs"
],
homepage: "https://surveyjs.io/Builder",
license: "https://surveyjs.io/Licenses#BuildSurvey",
files: [
"survey-creator.css",
"survey-creator.min.css",
"survey-creator.js",
"survey-creator.d.ts",
"survey-creator.min.js"
],
main: "survey-creator.js",
repository: {
type: "git",
url: "https://github.com/surveyjs/survey-creator.git"
},
engines: {
node: ">=0.10.0"
},
typings: "survey-creator.d.ts",
peerDependencies: {
bootstrap: "^3.3.6",
jquery: "^3.1.1",
"ace-builds": "^1.2.2"
},
dependencies: {
"survey-knockout": "^" + packageJson.version,
knockout: "^3.4.0",
"@types/knockout": "^3.4.0"
},
devDependencies: {}
};

module.exports = function(options) {
var packagePath = "./package/";
var buildPath = "./build/";
var extractCSS = new ExtractTextPlugin({
filename:
packagePath +
Expand Down Expand Up @@ -130,6 +182,34 @@ module.exports = function(options) {
fs.createWriteStream(packagePath + "README.md")
);
}

if (options.libraryName === "SurveyCreator") {
if (!fs.existsSync(buildPath)) {
fs.mkdirSync(buildPath);
}
function copyToBuild(oldFile, newFile) {
fs.createReadStream(packagePath + oldFile).pipe(
fs.createWriteStream(buildPath + newFile)
);
}

if (options.buildType === "prod") {
copyToBuild("surveyeditor.min.js", "survey-creator.min.js");
copyToBuild("surveyeditor.min.css", "survey-creator.min.css");
copyToBuild("surveyeditor.d.ts", "survey-creator.d.ts");
fs.createReadStream("./npmREADME.md").pipe(
fs.createWriteStream(buildPath + "README.md")
);
fs.writeFileSync(
buildPath + "package.json",
JSON.stringify(buildPlatformJson, null, 2),
"utf8"
);
} else {
copyToBuild("surveyeditor.js", "survey-creator.js");
copyToBuild("surveyeditor.css", "survey-creator.css");
}
}
}
};

Expand Down Expand Up @@ -191,7 +271,7 @@ module.exports = function(options) {
"[name]" +
(options.buildType === "prod" ? ".min" : "") +
".js",
library: "SurveyEditor",
library: options.libraryName || "SurveyEditor",
libraryTarget: "umd",
umdNamedDefine: true
},
Expand Down

0 comments on commit 44edd13

Please sign in to comment.