Skip to content

Commit

Permalink
#9001 Made project branch parametric (#9002)
Browse files Browse the repository at this point in the history
* Made project branch parametric

* Updated doc for createProject script
  • Loading branch information
offtherailz authored Jul 26, 2023
1 parent 68fb6d0 commit a00d669
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
7 changes: 6 additions & 1 deletion createProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ const paramsDesc = [{
name: 'projectType',
"default": 'standard',
validate: () => true
}, {
label: 'MapStore base branch (master):',
name: 'branch',
"default": 'master',
validate: () => true
}, {
label: 'Project Name: ',
name: 'projectName',
Expand Down Expand Up @@ -95,7 +100,7 @@ function doWork(params) {
})
.then(() => {
process.stdout.write('git init\n');
return project.updateSubmoduleBranch(params.outFolder);
return project.updateSubmoduleBranch(params.outFolder, params.branch);
})
.then(() => {
return project.createFirstCommit(params.outFolder);
Expand Down
15 changes: 12 additions & 3 deletions docs/developer-guide/project-creation-script.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ npm install
Finally, to create the project, use the following command:

```sh
node ./createProject.js <projectType> <projectName> <projectVersion> <projectDescription> <gitRepositoryUrl> <outputFolder>
node ./createProject.js
```

Note that projectName and outputFolder are mandatory:
The command line will ask some questions about the project to create. (You can press enter to accept the default value, indicated between parenthesis, or type a new one):

* **projectName**: short project name that will be used as the repository name on github, webapp path and name in package.json
* **branch/tag**: the base branch/tag to use for the project (e.g. v2022.02.02, or master)
* **projectType**: type of project to create, currently one type of projects is supported:
* **standard**: is a copy of the standard MapStore project, ready to be used and customized
* **projectVersion**: project version in package.json (X.Y.Z)
Expand All @@ -53,7 +54,15 @@ Note that projectName and outputFolder are mandatory:
Usage:

```sh
node ./createProject.js standard MyProject "1.0.0" "this is my awesome project" "" ../MY_PROJECT_NAME
node ./createProject.js

Project Type (standard):
MapStore base branch (master):v2023.01.01
Project Name: my_project
Project Version (1.0.0):
Project Description (Project Name):
Repository URL:
Output folder: ../my_project
```

At the end of the script execution, the given outputFolder will be populated by all the configuration files needed to start working on the project. Moreover, the local git repository will be initialized and the MapStore sub-module added and downloaded.
Expand Down
4 changes: 2 additions & 2 deletions utility/projects/projectLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ const createFirstCommit = (outFolder) => {
* @param {string} outFolder the folder where to apply the checkout
* @return {Promise} the promise to continue the flow of project creation
*/
const updateSubmoduleBranch = (outFolder) => {
const updateSubmoduleBranch = (outFolder, branch) => {
const git = require('simple-git')();
const gitProjectMs2 = require('simple-git')(`${outFolder}/MapStore2`);

const stableBranch = "2022.02.xx";
const stableBranch = branch || "2023.01.xx";

return new Promise((resolve, reject) => {
try {
Expand Down

0 comments on commit a00d669

Please sign in to comment.