Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
oltionchampari committed May 6, 2020
1 parent 4fe7858 commit d5ec555
Show file tree
Hide file tree
Showing 12 changed files with 379 additions and 3 deletions.
2 changes: 1 addition & 1 deletion generators/_init-hybrid/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Generator extends Base {

default() {
const types = this.config.get('type').split('-');
this.composeWith(['phovea:_node', 'phovea:init-' + types[1], 'phovea:init-' + types[0]], {options: this.options})
this.composeWith(['phovea:_node', 'phovea:init-' + types[1], 'phovea:init-' + types[0]], {options: this.options, skipPrompting: this.options.skipPrompting, useDefaults: true})
}

end() {
Expand Down
32 changes: 32 additions & 0 deletions generators/change-type/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';
const Base = require('yeoman-generator');
const pluginTypes = ['lib', 'slib', 'lib-slib', 'lib-service', 'service', 'app', 'app-slib',]

class ChangeTypeGenerator extends Base {

constructor(args, options) {
super(args, options);
}

prompting() {
const type = this.config.get('type');
return this.prompt([{
type: 'checkbox',
name: 'type',
message: 'New Type',
default: ['slib'],
choices: pluginTypes
}]).then(({type}) => {
this.old = this.config.get('type')
this.log(type)
this.config.set('type', type[0]);

})
}
default() {
const type = this.config.get('type')
this.composeWith(`phovea:to-${type}-type`, {currentType: this.old, newType: this.config.get('type')})
}
}

module.exports = ChangeTypeGenerator;
49 changes: 49 additions & 0 deletions generators/to-lib-type/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'use strict';
const Base = require('yeoman-generator');

const diff = [
'buildPython.js',
'deploy/docker-compose.partial.yml',
'docker_packages.txt',
'docs/.gitignore',
'docs/_static/touch.txt',
'docs/_templates/touch.txt',
'docs/conf.py',
'docs/index.rst',
'requirements.txt',
'requirements_dev.txt',
'setup.cfg',
'setup.py',
'test/__init__.py',
'test/config.json',
'tox.ini',
]
const prefix = '../../';

class DowngradeLib extends Base {

constructor(args, options) {
super(args, options);
}

initializing() {
this.gitIgnorePath = this.templatePath(`${prefix}_init-web/templates/_gitignore`)
this.pathToConfigYml = this.templatePath(`${prefix}_init-web/templates/plain/.circleci/config.yml`)
this.pathToPackageJSON = this.templatePath(`${prefix}_init-web/templates/package.tmpl.json`)
}
_reversePackageJSON() {
const pkg = this.fs.readJSON(this.destinationPath('package.json'));
const {scripts, files} = this.fs.readJSON(this.pathToPackageJSON);
pkg.scripts = scripts;
pkg.files = files;
this.fs.writeJSON(this.destinationPath('package.json'), pkg);
}
writing() {
diff.forEach((file) => this.fs.delete(this.destinationPath(file)))
this.fs.copyTpl(this.gitIgnorePath, this.destinationPath('.gitignore'));
this.fs.copyTpl(this.pathToConfigYml, this.destinationPath('.circleci/config.yml'));
this._reversePackageJSON();
}
}

module.exports = DowngradeLib;
59 changes: 59 additions & 0 deletions generators/to-slib-type/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
'use strict';
const Base = require('yeoman-generator');
const {merge, omit, extend, template} = require('lodash');

const diff = [
'buildInfo.js',
'index.js',
'jest.config.js',
'phovea_registry.js',
'src/index.ts',
'src/phovea.ts',
'tests.webpack.js',
'tests/index.test.ts',
'tsconfig.json',
'tsconfig_dev.json',
'tsd.d.ts',
'tslint.json',
'typedoc.json',
'webpack.config.js'
]
const prefix = '../../';

class DowngradeSlib extends Base {

constructor(args, options) {
super(args, options);
}

initializing() {
this.gitIgnorePath = this.templatePath(`${prefix}_init-python/templates/_gitignore`)
this.pathToConfigYml = this.templatePath(`${prefix}_init-python/templates/plain/.circleci/config.yml`)
this.pathToPackageJSON = this.templatePath(`${prefix}_init-python/templates/package.tmpl.json`)
}

_reversePackageJSON() {
const config = this.config.getAll();
let pkg = this.fs.readJSON(this.destinationPath('package.json'));
const pkgPatch = JSON.parse(template(this.fs.read(this.pathToPackageJSON))(config));
pkg = omit(pkg, ['engines', 'dependencies', 'devDependencies']);
pkg = Object.assign(pkg, pkgPatch);
this.fs.writeJSON(this.destinationPath('package.json'), pkg);
}
_downgrade() {
diff.forEach((file) => this.fs.delete(this.destinationPath(file)))
this.fs.copyTpl(this.gitIgnorePath, this.destinationPath('.gitignore'));
this.fs.copyTpl(this.pathToConfigYml, this.destinationPath('.circleci/config.yml'));
this._reversePackageJSON();
}

_upgrade(){

}

writing() {
this._downgrade();
}
}

module.exports = DowngradeSlib;
32 changes: 32 additions & 0 deletions upgrade/app
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.circleci/config.yml
.editorconfig
.gitattributes
.gitignore
.yo-rc.json
ISSUE_TEMPLATE.md
LICENSE
README.md
buildInfo.js
deploy/Dockerfile
deploy/nginx-default.conf
jest.config.js
package.json
phovea_registry.js
src/404.html
src/app.ts
src/index.html
src/index.ts
src/language.ts
src/phovea.ts
src/robots.txt
src/style.scss
src/styles/_base.scss
tests.webpack.js
tests/app.test.ts
tsconfig.json
tsconfig_dev.json
tsd.d.ts
tslint.json
typedoc.json
webpack.config.js

46 changes: 46 additions & 0 deletions upgrade/app-slib
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.circleci/config.yml
.editorconfig
.gitattributes
.gitignore
.yo-rc.json
ISSUE_TEMPLATE.md
LICENSE
README.md
buildInfo.js
buildPython.js
deploy/Dockerfile
deploy/docker-compose.partial.yml
deploy/nginx-default.conf
docker_packages.txt
docs/.gitignore
docs/_static/touch.txt
docs/_templates/touch.txt
docs/conf.py
docs/index.rst
jest.config.js
package.json
phovea_registry.js
requirements.txt
requirements_dev.txt
setup.cfg
setup.py
src/404.html
src/app.ts
src/index.html
src/index.ts
src/language.ts
src/phovea.ts
src/robots.txt
src/style.scss
src/styles/_base.scss
test/__init__.py
test/config.json
tests.webpack.js
tests/app.test.ts
tox.ini
tsconfig.json
tsconfig_dev.json
tsd.d.ts
tslint.json
typedoc.json
webpack.config.js
23 changes: 23 additions & 0 deletions upgrade/lib
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.circleci/config.yml
.editorconfig
.gitattributes
.gitignore
.yo-rc.json
ISSUE_TEMPLATE.md
LICENSE
README.md
buildInfo.js
index.js
jest.config.js
package.json
phovea_registry.js
src/index.ts
src/phovea.ts
tests.webpack.js
tests/index.test.ts
tsconfig.json
tsconfig_dev.json
tsd.d.ts
tslint.json
typedoc.json
webpack.config.js
43 changes: 43 additions & 0 deletions upgrade/lib-service
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
.circleci/config.yml
.editorconfig
.gitattributes
.gitignore
.yo-rc.json
ISSUE_TEMPLATE.md
LICENSE
README.md
buildInfo.js
buildPython.js
deploy/Dockerfile
deploy/Dockerfile_dev
deploy/docker-compose-debug.partial.yml
deploy/docker-compose.partial.yml
docker_packages.txt
docs/.gitignore
docs/_static/touch.txt
docs/_templates/touch.txt
docs/conf.py
docs/index.rst
index.js
jest.config.js
package.json
phovea_registry.js
requirements.txt
requirements_dev.txt
setup.cfg
setup.py
src/index.ts
src/phovea.ts
test/__init__.py
test/config.json
test/server.py
tests.webpack.js
tests/index.test.ts
tests/test_server.py
tox.ini
tsconfig.json
tsconfig_dev.json
tsd.d.ts
tslint.json
typedoc.json
webpack.config.js
38 changes: 38 additions & 0 deletions upgrade/lib-slib
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.circleci/config.yml
.editorconfig
.gitattributes
.gitignore
.yo-rc.json
ISSUE_TEMPLATE.md
LICENSE
README.md
buildInfo.js
buildPython.js
deploy/docker-compose.partial.yml
docker_packages.txt
docs/.gitignore
docs/_static/touch.txt
docs/_templates/touch.txt
docs/conf.py
docs/index.rst
index.js
jest.config.js
package.json
phovea_registry.js
requirements.txt
requirements_dev.txt
setup.cfg
setup.py
src/index.ts
src/phovea.ts
test/__init__.py
test/config.json
tests.webpack.js
tests/index.test.ts
tox.ini
tsconfig.json
tsconfig_dev.json
tsd.d.ts
tslint.json
typedoc.json
webpack.config.js
29 changes: 29 additions & 0 deletions upgrade/service
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.circleci/config.yml
.editorconfig
.gitattributes
.gitignore
.yo-rc.json
ISSUE_TEMPLATE.md
LICENSE
README.md
buildPython.js
deploy/Dockerfile
deploy/Dockerfile_dev
deploy/docker-compose-debug.partial.yml
deploy/docker-compose.partial.yml
docker_packages.txt
docs/.gitignore
docs/_static/touch.txt
docs/_templates/touch.txt
docs/conf.py
docs/index.rst
package.json
requirements.txt
requirements_dev.txt
setup.cfg
setup.py
test/__init__.py
test/config.json
test/server.py
tests/test_server.py
tox.ini
24 changes: 24 additions & 0 deletions upgrade/slib
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.circleci/config.yml
.editorconfig
.gitattributes
.gitignore
.yo-rc.json
ISSUE_TEMPLATE.md
LICENSE
README.md
buildPython.js
deploy/docker-compose.partial.yml
docker_packages.txt
docs/.gitignore
docs/_static/touch.txt
docs/_templates/touch.txt
docs/conf.py
docs/index.rst
package.json
requirements.txt
requirements_dev.txt
setup.cfg
setup.py
test/__init__.py
test/config.json
tox.ini
Loading

0 comments on commit d5ec555

Please sign in to comment.