nodefony 7.0.0-beta.2 → 7.0.0-beta.21
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/CHANGELOG.md +534 -8028
- package/README.md +33 -30
- package/autoloader.es6 +46 -48
- package/builder.es6 +66 -76
- package/cli/builder/bundles/bundle.js +57 -63
- package/cli/builder/bundles/controller.js +34 -38
- package/cli/builder/bundles/users-bundle/Command/fixtureTask.js +11 -12
- package/cli/builder/bundles/users-bundle/Command/usersCommand.js +23 -24
- package/cli/builder/bundles/users-bundle/Entity/mongoose/userEntity.js +25 -30
- package/cli/builder/bundles/users-bundle/Entity/sequelize/userEntity.js +42 -31
- package/cli/builder/bundles/users-bundle/Fixtures/users.js +24 -26
- package/cli/builder/bundles/users-bundle/Fixtures/usersFixtures.js +28 -29
- package/cli/builder/bundles/users-bundle/Resources/config/config.js +4 -3
- package/cli/builder/bundles/users-bundle/Resources/config/routing.js +2 -2
- package/cli/builder/bundles/users-bundle/Resources/config/security.js +9 -8
- package/cli/builder/bundles/users-bundle/Resources/config/webpack/webpack.dev.config.js +3 -3
- package/cli/builder/bundles/users-bundle/Resources/config/webpack/webpack.prod.config.js +4 -3
- package/cli/builder/bundles/users-bundle/Resources/config/webpack.config.js +74 -75
- package/cli/builder/bundles/users-bundle/Resources/scss/awesome/font-awesome.config.js +9 -9
- package/cli/builder/bundles/users-bundle/Resources/swagger/openapi/login.js +13 -13
- package/cli/builder/bundles/users-bundle/Resources/swagger/openapi/users.js +14 -14
- package/cli/builder/bundles/users-bundle/controller/api/graphql/graphqlController.js +13 -15
- package/cli/builder/bundles/users-bundle/controller/api/graphql/userResolver.js +29 -29
- package/cli/builder/bundles/users-bundle/controller/api/graphql/usertype.js +2 -2
- package/cli/builder/bundles/users-bundle/controller/api/openapi/loginApiController.js +34 -36
- package/cli/builder/bundles/users-bundle/controller/api/openapi/restUserController.js +32 -36
- package/cli/builder/bundles/users-bundle/controller/loginController.js +30 -34
- package/cli/builder/bundles/users-bundle/controller/usersController.js +54 -60
- package/cli/builder/bundles/users-bundle/package.json +27 -25
- package/cli/builder/bundles/users-bundle/pnpm-lock.yaml +4262 -0
- package/cli/builder/bundles/users-bundle/readme.md +7 -7
- package/cli/builder/bundles/users-bundle/services/usersService.js +97 -102
- package/cli/builder/bundles/users-bundle/src/providers/mongoose/userProvider.js +6 -8
- package/cli/builder/bundles/users-bundle/src/providers/sequelize/userProvider.js +9 -10
- package/cli/builder/bundles/users-bundle/tests/loginTest.js +119 -70
- package/cli/builder/bundles/users-bundle/usersBundle.js +2 -3
- package/cli/builder/microService/microService.js +139 -141
- package/cli/builder/microService/skeletons/package.json +23 -22
- package/cli/builder/project/project.js +228 -181
- package/cli/builder/project/skeletons/README.md +33 -30
- package/cli/builder/project/skeletons/bin/dev-deploy.sh +5 -0
- package/cli/builder/project/skeletons/bin/prod-deploy.sh +3 -0
- package/cli/builder/project/skeletons/config/config.js.skeleton +1 -0
- package/cli/builder/project/skeletons/config/pm2.config.js.skeleton +41 -17
- package/cli/builder/project/skeletons/eslintignore.skeleton +15 -0
- package/cli/builder/project/skeletons/eslintrc.js.skeleton +97 -0
- package/cli/builder/project/skeletons/gitignore.skeleton +1 -0
- package/cli/builder/project/skeletons/migrations/2022.12.25T17.37.37.entity-user.js +137 -0
- package/cli/builder/project/skeletons/migrations/2022.12.25T17.37.38.entity-session.js +97 -0
- package/cli/builder/project/skeletons/migrations/2022.12.25T17.37.39.entity-requests.js +115 -0
- package/cli/builder/project/skeletons/migrations/2022.12.25T17.37.40.entity-jwts.js +97 -0
- package/cli/builder/project/skeletons/migrations/migrations.skeleton.js +0 -2
- package/cli/builder/project/skeletons/package.json.twig +70 -0
- package/cli/builder/react/reactBuilder.js +59 -65
- package/cli/builder/sandbox/sandBoxBuilder.js +132 -134
- package/cli/builder/skeletons/app/appKernel.js +120 -2
- package/cli/builder/skeletons/config/config.js +1 -1
- package/cli/builder/skeletons/config/nodefony/framework-bundle.js +2 -1
- package/cli/builder/skeletons/config/nodefony/http-bundle.js +1 -0
- package/cli/builder/skeletons/config/nodefony/mongoose-bundle.js +38 -12
- package/cli/builder/skeletons/config/nodefony/monitoring-bundle.js +21 -2
- package/cli/builder/skeletons/config/nodefony/sequelize-bundle.js +122 -13
- package/cli/builder/skeletons/package.json.twig +57 -0
- package/cli/builder/skeletons/unittest/testFile.js +44 -45
- package/cli/builder/vue/skeletons/vue.config.js +84 -10
- package/cli/builder/vue/vueBuilder.js +116 -114
- package/cli/generate/generate.es6 +38 -39
- package/cli/install/install.js +45 -58
- package/cli/sequelize/sequelize.js +50 -39
- package/cli/start.js +353 -347
- package/cli/tools/pm2.es6 +55 -57
- package/cli/tools/tools.es6 +36 -37
- package/cli.es6 +280 -228
- package/container.es6 +51 -59
- package/error.es6 +25 -27
- package/fileClass.es6 +53 -55
- package/finder/file.es6 +5 -4
- package/finder/fileResult.es6 +23 -22
- package/finder/finder2.es6 +46 -54
- package/finder.es6 +88 -97
- package/kernel/annotations/annotations.es6 +44 -46
- package/kernel/api/api.es6 +6 -8
- package/kernel/api/graphqlApi.es6 +21 -21
- package/kernel/api/jsonApi.es6 +40 -45
- package/kernel/api/openApi.es6 +9 -11
- package/kernel/api/schemas/openApiSchema.js +61 -32
- package/kernel/babylon.es6 +31 -38
- package/kernel/bundle.es6 +252 -220
- package/kernel/cliKernel.es6 +157 -170
- package/kernel/command.es6 +17 -20
- package/kernel/commands/nodefonyCommand.es6 +111 -58
- package/kernel/commands/tasks/bundlesTask.es6 +14 -19
- package/kernel/controllers/controller.es6 +167 -180
- package/kernel/fixture.es6 +4 -7
- package/kernel/injections/injections.es6 +97 -103
- package/kernel/kernel.es6 +476 -384
- package/kernel/kernelWatcher.es6 +64 -54
- package/kernel/orm/entity.es6 +10 -12
- package/kernel/orm/orm.es6 +68 -48
- package/kernel/reader.es6 +45 -47
- package/kernel/security/encoder.es6 +8 -6
- package/kernel/security/factories/factory.es6 +34 -37
- package/kernel/security/factories/passeportFactory.es6 +13 -14
- package/kernel/security/provider.es6 +11 -13
- package/kernel/security/providers/chainProvider.es6 +13 -28
- package/kernel/security/providers/memoryProvider.es6 +7 -11
- package/kernel/security/providers/providerManager.es6 +11 -14
- package/kernel/security/providers/userEntityProvider.es6 +7 -8
- package/kernel/security/role.es6 +3 -3
- package/kernel/security/secureArea.es6 +143 -149
- package/kernel/security/tokens/token.es6 +30 -32
- package/kernel/security/user.es6 +19 -19
- package/kernel/serviceRealTime.es6 +5 -7
- package/kernel/services/connectionsService.es6 +20 -22
- package/kernel/services/cron/cronService.es6 +14 -16
- package/kernel/task.es6 +20 -26
- package/kernel/templates.es6 +4 -5
- package/kernel/templating/twig.es6 +56 -47
- package/kernel/tests/cliTest.js +7 -11
- package/kernel/tests/containerTest.js +25 -37
- package/kernel/tests/kernelTest.js +9 -16
- package/nodefony.es6 +279 -256
- package/notificationsCenter.es6 +28 -20
- package/package.json +40 -40
- package/protocol.es6 +19 -21
- package/protocols/bayeux.es6 +35 -38
- package/protocols/jsonRpc/jsonrpc.es6 +12 -14
- package/result.es6 +11 -12
- package/service.es6 +62 -62
- package/syslog/pdu.es6 +99 -91
- package/syslog/syslog.es6 +101 -102
- package/watcher.es6 +21 -20
- package/cli/builder/project/skeletons/jshintignore.skeleton +0 -1
- package/cli/builder/project/skeletons/jshintrc.skeleton +0 -60
- package/cli/builder/project/skeletons/package.json.skeleton +0 -52
- package/cli/builder/skeletons/package.json +0 -61
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const {
|
|
3
|
+
Sequelize,
|
|
4
|
+
DataTypes,
|
|
5
|
+
Model
|
|
6
|
+
} = require('sequelize');
|
|
7
|
+
|
|
8
|
+
class Migrate extends nodefony.Service {
|
|
9
|
+
constructor(kernel) {
|
|
10
|
+
super("Migrate", kernel.container);
|
|
11
|
+
this.entityName = "requests"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async up({
|
|
15
|
+
name,
|
|
16
|
+
context: queryInterface
|
|
17
|
+
}) {
|
|
18
|
+
let descriptions = null
|
|
19
|
+
try {
|
|
20
|
+
descriptions = await queryInterface.describeTable(this.entityName)
|
|
21
|
+
} catch (e) {
|
|
22
|
+
this.log(`Migrate file : ${name}`)
|
|
23
|
+
}
|
|
24
|
+
const exist = await queryInterface.tableExists(this.entityName)
|
|
25
|
+
if (exist) {
|
|
26
|
+
this.log(`Entity ${this.entityName} already exist`);
|
|
27
|
+
return descriptions
|
|
28
|
+
}
|
|
29
|
+
let transaction = null
|
|
30
|
+
try {
|
|
31
|
+
transaction = await queryInterface.sequelize.transaction();
|
|
32
|
+
let res = await queryInterface.createTable(this.entityName, {
|
|
33
|
+
id: {
|
|
34
|
+
type: DataTypes.INTEGER,
|
|
35
|
+
primaryKey: true,
|
|
36
|
+
autoIncrement: true
|
|
37
|
+
},
|
|
38
|
+
remoteAddress: {
|
|
39
|
+
type: DataTypes.STRING
|
|
40
|
+
},
|
|
41
|
+
userAgent: {
|
|
42
|
+
type: DataTypes.STRING
|
|
43
|
+
},
|
|
44
|
+
url: {
|
|
45
|
+
type: DataTypes.TEXT
|
|
46
|
+
},
|
|
47
|
+
route: {
|
|
48
|
+
type: DataTypes.STRING
|
|
49
|
+
},
|
|
50
|
+
method: {
|
|
51
|
+
type: DataTypes.STRING
|
|
52
|
+
},
|
|
53
|
+
state: {
|
|
54
|
+
type: DataTypes.STRING
|
|
55
|
+
},
|
|
56
|
+
protocol: {
|
|
57
|
+
type: DataTypes.STRING
|
|
58
|
+
},
|
|
59
|
+
scheme: {
|
|
60
|
+
type: DataTypes.STRING
|
|
61
|
+
},
|
|
62
|
+
time: {
|
|
63
|
+
type: DataTypes.FLOAT
|
|
64
|
+
},
|
|
65
|
+
data: {
|
|
66
|
+
type: DataTypes.TEXT
|
|
67
|
+
},
|
|
68
|
+
createdAt: {
|
|
69
|
+
allowNull: false,
|
|
70
|
+
type: DataTypes.DATE
|
|
71
|
+
},
|
|
72
|
+
updatedAt: {
|
|
73
|
+
allowNull: false,
|
|
74
|
+
type: DataTypes.DATE
|
|
75
|
+
},
|
|
76
|
+
username: {
|
|
77
|
+
type: DataTypes.STRING(126),
|
|
78
|
+
references: {
|
|
79
|
+
model: 'user',
|
|
80
|
+
key: 'username'
|
|
81
|
+
},
|
|
82
|
+
onUpdate: "CASCADE",
|
|
83
|
+
onDelete: "CASCADE",
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
transaction
|
|
87
|
+
});
|
|
88
|
+
return await transaction.commit();
|
|
89
|
+
} catch (e) {
|
|
90
|
+
if (transaction && !transaction.finished) {
|
|
91
|
+
this.log(e, "ERROR")
|
|
92
|
+
this.log(`Rollback transaction on table ${this.entityName}`);
|
|
93
|
+
await transaction.rollback();
|
|
94
|
+
}
|
|
95
|
+
this.log("Rollback Transaction already finished", "WARNING")
|
|
96
|
+
throw e
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async down({
|
|
101
|
+
name,
|
|
102
|
+
context: queryInterface,
|
|
103
|
+
context: sequelize
|
|
104
|
+
}) {
|
|
105
|
+
try {
|
|
106
|
+
const descriptions = await queryInterface.describeTable(this.entityName)
|
|
107
|
+
return await queryInterface.dropTable(this.entityName);
|
|
108
|
+
} catch (e) {
|
|
109
|
+
this.log(`Entity ${this.entityName} not exist`, "WARNING")
|
|
110
|
+
throw e
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
module.exports = new Migrate(kernel);
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const {
|
|
3
|
+
Sequelize,
|
|
4
|
+
DataTypes,
|
|
5
|
+
Model
|
|
6
|
+
} = require('sequelize');
|
|
7
|
+
|
|
8
|
+
class Migrate extends nodefony.Service {
|
|
9
|
+
constructor(kernel) {
|
|
10
|
+
super("Migrate", kernel.container);
|
|
11
|
+
this.entityName = "jwts"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async up({
|
|
15
|
+
name,
|
|
16
|
+
context: queryInterface
|
|
17
|
+
}) {
|
|
18
|
+
let descriptions = null
|
|
19
|
+
try {
|
|
20
|
+
descriptions = await queryInterface.describeTable(this.entityName)
|
|
21
|
+
} catch (e) {
|
|
22
|
+
this.log(`Migrate file : ${name}`)
|
|
23
|
+
}
|
|
24
|
+
const exist = await queryInterface.tableExists(this.entityName)
|
|
25
|
+
if (exist) {
|
|
26
|
+
this.log(`Entity ${this.entityName} already exist`);
|
|
27
|
+
return descriptions
|
|
28
|
+
}
|
|
29
|
+
let transaction = null
|
|
30
|
+
try {
|
|
31
|
+
transaction = await queryInterface.sequelize.transaction();
|
|
32
|
+
let res = await queryInterface.createTable(this.entityName, {
|
|
33
|
+
id: {
|
|
34
|
+
type: DataTypes.INTEGER,
|
|
35
|
+
autoIncrement: true,
|
|
36
|
+
primaryKey: true
|
|
37
|
+
},
|
|
38
|
+
refreshToken: {
|
|
39
|
+
type: DataTypes.TEXT,
|
|
40
|
+
allowNull: false
|
|
41
|
+
},
|
|
42
|
+
token: {
|
|
43
|
+
type: DataTypes.TEXT,
|
|
44
|
+
},
|
|
45
|
+
active: {
|
|
46
|
+
type: DataTypes.BOOLEAN,
|
|
47
|
+
defaultValue: true
|
|
48
|
+
},
|
|
49
|
+
createdAt: {
|
|
50
|
+
allowNull: false,
|
|
51
|
+
type: DataTypes.DATE
|
|
52
|
+
},
|
|
53
|
+
updatedAt: {
|
|
54
|
+
allowNull: false,
|
|
55
|
+
type: DataTypes.DATE
|
|
56
|
+
},
|
|
57
|
+
username: {
|
|
58
|
+
type: DataTypes.STRING(126),
|
|
59
|
+
references: {
|
|
60
|
+
model: 'user',
|
|
61
|
+
key: 'username'
|
|
62
|
+
},
|
|
63
|
+
onUpdate: "CASCADE",
|
|
64
|
+
onDelete: "CASCADE",
|
|
65
|
+
},
|
|
66
|
+
}, {
|
|
67
|
+
transaction
|
|
68
|
+
});
|
|
69
|
+
return await transaction.commit();
|
|
70
|
+
} catch (e) {
|
|
71
|
+
if (transaction && !transaction.finished) {
|
|
72
|
+
this.log(e, "ERROR")
|
|
73
|
+
this.log(`Rollback transaction on table ${this.entityName}`);
|
|
74
|
+
await transaction.rollback();
|
|
75
|
+
}
|
|
76
|
+
this.log("Rollback Transaction already finished", "WARNING")
|
|
77
|
+
throw e
|
|
78
|
+
}
|
|
79
|
+
//`username` VARCHAR(126) REFERENCES `user` (`username`) ON DELETE CASCADE ON UPDATE CASCADE);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async down({
|
|
83
|
+
name,
|
|
84
|
+
context: queryInterface,
|
|
85
|
+
context: sequelize
|
|
86
|
+
}) {
|
|
87
|
+
try {
|
|
88
|
+
const descriptions = await queryInterface.describeTable(this.entityName)
|
|
89
|
+
return await queryInterface.dropTable(this.entityName);
|
|
90
|
+
} catch (e) {
|
|
91
|
+
this.log(`Entity ${this.entityName} not exist`, "WARNING")
|
|
92
|
+
throw e
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
module.exports = new Migrate(kernel);
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "{{description}}",
|
|
5
|
+
"main": "nodefony",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"nodefony": "nodefony",
|
|
8
|
+
"pm2": "pm2",
|
|
9
|
+
"start": "nodefony start",
|
|
10
|
+
"dev": "nodefony dev",
|
|
11
|
+
"build": "nodefony build",
|
|
12
|
+
"rebuild": "nodefony rebuild",
|
|
13
|
+
"stop": "nodefony stop",
|
|
14
|
+
"prod": "nodefony prod",
|
|
15
|
+
"kill": "nodefony kill",
|
|
16
|
+
"test": "nodefony test",
|
|
17
|
+
"help": "nodefony -h",
|
|
18
|
+
"changelog": "conventional-changelog -p conventionalcommits -i CHANGELOG.md -s -r 0",
|
|
19
|
+
"dev-deploy": "bash bin/dev-deploy.sh",
|
|
20
|
+
"prod-deploy": "bash bin/prod-deploy.sh",
|
|
21
|
+
"lint": "eslint ."
|
|
22
|
+
},
|
|
23
|
+
"private": true,
|
|
24
|
+
"keywords": [
|
|
25
|
+
"Node.js",
|
|
26
|
+
"nodefony"
|
|
27
|
+
],
|
|
28
|
+
"repository": {},
|
|
29
|
+
"bugs": {},
|
|
30
|
+
"license": "{{licence}}",
|
|
31
|
+
"os": [
|
|
32
|
+
"darwin",
|
|
33
|
+
"linux",
|
|
34
|
+
"freebsd",
|
|
35
|
+
"win32"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=12"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"graphql": "16.8.1",
|
|
42
|
+
"mongoose": "7.6.1",
|
|
43
|
+
"nodefony": "{{version}}",
|
|
44
|
+
"pm2": "5.3.0",
|
|
45
|
+
"pm2-logrotate": "^2.7.0",
|
|
46
|
+
"sequelize": "6.33.0",
|
|
47
|
+
"webpack": "5.88.2",
|
|
48
|
+
"webpack-dev-server": "4.15.1"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@babel/core": "7.23.0",
|
|
52
|
+
"@babel/eslint-parser": "7.22.15",
|
|
53
|
+
"@mapbox/node-pre-gyp": "1.0.11",
|
|
54
|
+
"conventional-changelog-cli": "4.1.0",
|
|
55
|
+
"eslint": "8.51.0",
|
|
56
|
+
"eslint-config-standard": "17.1.0",
|
|
57
|
+
"eslint-plugin-html": "7.1.0",
|
|
58
|
+
"eslint-plugin-import": "2.28.1",
|
|
59
|
+
"eslint-plugin-markdown": "3.0.1",
|
|
60
|
+
"eslint-plugin-node": "11.1.0",
|
|
61
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
62
|
+
"eslint-plugin-vue": "9.17.0",
|
|
63
|
+
"markdown-eslint-parser": "1.2.1",
|
|
64
|
+
"node-gyp": "9.4.0",
|
|
65
|
+
"vue-eslint-parser": "9.3.2"
|
|
66
|
+
},
|
|
67
|
+
"author": "{{authorFullName}} <{{authorMail}}>",
|
|
68
|
+
"readmeFilename": "README.md",
|
|
69
|
+
"contributors": [{}]
|
|
70
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
class React extends nodefony.builders.sandbox {
|
|
2
|
-
constructor(cli, cmd, args, options) {
|
|
3
|
-
super(cli, cmd, args, nodefony.extend(true, {},options,{
|
|
2
|
+
constructor (cli, cmd, args, options) {
|
|
3
|
+
super(cli, cmd, args, nodefony.extend(true, {}, options, {
|
|
4
4
|
addons: {
|
|
5
5
|
webpack: false,
|
|
6
6
|
bootstrap: false
|
|
@@ -10,49 +10,42 @@ class React extends nodefony.builders.sandbox {
|
|
|
10
10
|
this.cliReact = this.getCli();
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
run() {
|
|
13
|
+
run () {
|
|
14
14
|
return super.run(false);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
generate(response, force) {
|
|
17
|
+
generate (response, force) {
|
|
18
18
|
return this.buiReact()
|
|
19
|
-
.then((dir) =>
|
|
20
|
-
|
|
21
|
-
.then(() =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
26
|
-
})
|
|
27
|
-
.catch((e) => {
|
|
28
|
-
throw e;
|
|
29
|
-
});
|
|
30
|
-
});
|
|
19
|
+
.then((dir) => this.ejectReact(dir, this.cli.response)
|
|
20
|
+
.then(() => super.generate(response, force)
|
|
21
|
+
.then(() => this.response))
|
|
22
|
+
.catch((e) => {
|
|
23
|
+
throw e;
|
|
24
|
+
}));
|
|
31
25
|
}
|
|
32
26
|
|
|
33
|
-
builderProject() {
|
|
27
|
+
builderProject () {
|
|
34
28
|
try {
|
|
35
29
|
return {
|
|
36
30
|
name: "app",
|
|
37
31
|
type: "directory",
|
|
38
32
|
childs: [{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
]
|
|
33
|
+
name: "appKernel.js",
|
|
34
|
+
type: "file",
|
|
35
|
+
skeleton: path.resolve(this.globalSkeleton, "app", "appKernel.js"),
|
|
36
|
+
params: this.response
|
|
37
|
+
},
|
|
38
|
+
this.generateController(),
|
|
39
|
+
this.generateConfig(false, true),
|
|
40
|
+
this.generateRessources()]
|
|
48
41
|
};
|
|
49
42
|
} catch (e) {
|
|
50
43
|
throw e;
|
|
51
44
|
}
|
|
52
45
|
}
|
|
53
46
|
|
|
54
|
-
builderBundle() {
|
|
55
|
-
|
|
47
|
+
builderBundle () {
|
|
48
|
+
const bundle = [];
|
|
56
49
|
bundle.push({
|
|
57
50
|
name: `${this.response.name}Bundle.js`,
|
|
58
51
|
type: "file",
|
|
@@ -72,7 +65,7 @@ class React extends nodefony.builders.sandbox {
|
|
|
72
65
|
return bundle;
|
|
73
66
|
}
|
|
74
67
|
|
|
75
|
-
buiReact() {
|
|
68
|
+
buiReact () {
|
|
76
69
|
let name = null;
|
|
77
70
|
let location = null;
|
|
78
71
|
switch (this.cli.response.command) {
|
|
@@ -86,9 +79,9 @@ class React extends nodefony.builders.sandbox {
|
|
|
86
79
|
break;
|
|
87
80
|
}
|
|
88
81
|
return new Promise((resolve, reject) => {
|
|
89
|
-
//console.log(this.bundleName)
|
|
90
|
-
|
|
91
|
-
this.log(
|
|
82
|
+
// console.log(this.bundleName)
|
|
83
|
+
const args = [name];
|
|
84
|
+
this.log(`install React cli : create-react-app ${args.join(" ")}`);
|
|
92
85
|
let cmd = null;
|
|
93
86
|
try {
|
|
94
87
|
cmd = this.cli.spawn(this.cliReact, args, {
|
|
@@ -96,8 +89,8 @@ class React extends nodefony.builders.sandbox {
|
|
|
96
89
|
stdio: "inherit"
|
|
97
90
|
}, (code) => {
|
|
98
91
|
if (code === 1) {
|
|
99
|
-
|
|
100
|
-
return reject(new Error(
|
|
92
|
+
// .cleanTmp();
|
|
93
|
+
return reject(new Error(`install React cli create-react-app new error : ${code}`));
|
|
101
94
|
}
|
|
102
95
|
if (this.cli.response.command === "project") {
|
|
103
96
|
return resolve(path.resolve(this.location, name));
|
|
@@ -106,18 +99,18 @@ class React extends nodefony.builders.sandbox {
|
|
|
106
99
|
});
|
|
107
100
|
} catch (e) {
|
|
108
101
|
this.log(e, "ERROR");
|
|
109
|
-
//this.cleanTmp();
|
|
102
|
+
// this.cleanTmp();
|
|
110
103
|
return reject(e);
|
|
111
104
|
}
|
|
112
105
|
});
|
|
113
106
|
}
|
|
114
107
|
|
|
115
|
-
async ejectReact(dir) {
|
|
108
|
+
async ejectReact (dir) {
|
|
116
109
|
await this.stach(dir);
|
|
117
110
|
let err = null;
|
|
118
111
|
return new Promise(async (resolve, reject) => {
|
|
119
|
-
|
|
120
|
-
this.log(
|
|
112
|
+
const args = ["run", "eject"];
|
|
113
|
+
this.log(` eject webpack config React : ${args.join(" ")}`);
|
|
121
114
|
try {
|
|
122
115
|
return this.cli.packageManager(args, dir)
|
|
123
116
|
.then(async () => {
|
|
@@ -125,12 +118,12 @@ class React extends nodefony.builders.sandbox {
|
|
|
125
118
|
return resolve(path.resolve(this.location));
|
|
126
119
|
})
|
|
127
120
|
.catch(async (error) => {
|
|
128
|
-
//this.cleanTmp();
|
|
121
|
+
// this.cleanTmp();
|
|
129
122
|
await this.stachPop();
|
|
130
|
-
return reject(new Error(
|
|
123
|
+
return reject(new Error(`React eject error : ${error}`));
|
|
131
124
|
});
|
|
132
125
|
} catch (e) {
|
|
133
|
-
//this.cleanTmp();
|
|
126
|
+
// this.cleanTmp();
|
|
134
127
|
err = e;
|
|
135
128
|
}
|
|
136
129
|
if (err) {
|
|
@@ -139,57 +132,59 @@ class React extends nodefony.builders.sandbox {
|
|
|
139
132
|
return reject(err);
|
|
140
133
|
}
|
|
141
134
|
});
|
|
142
|
-
|
|
143
135
|
}
|
|
144
136
|
|
|
145
|
-
async stach() {
|
|
137
|
+
async stach () {
|
|
146
138
|
let gitP, cwd, gitS, gitC;
|
|
147
139
|
try {
|
|
148
140
|
cwd = path.resolve(this.response.path);
|
|
149
|
-
gitP = require(
|
|
141
|
+
gitP = require("simple-git");
|
|
150
142
|
gitS = gitP(cwd);
|
|
151
143
|
gitC = gitP(this.location);
|
|
152
144
|
} catch (e) {
|
|
153
145
|
throw e;
|
|
154
146
|
}
|
|
155
|
-
|
|
156
|
-
if (!
|
|
147
|
+
const res = await gitC.checkIsRepo();
|
|
148
|
+
if (!res) {
|
|
157
149
|
return Promise.resolve(this.location);
|
|
158
150
|
}
|
|
159
151
|
await gitC.add(path.resolve(this.location, "*"))
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
152
|
+
.then(() => {
|
|
153
|
+
this.log("git add ");
|
|
154
|
+
return cwd;
|
|
155
|
+
})
|
|
156
|
+
.catch((err) => {
|
|
164
157
|
this.log(err, "ERROR");
|
|
165
|
-
|
|
158
|
+
});
|
|
166
159
|
await gitC.commit(`create bundle ${this.response.bundleName}`)
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
160
|
+
.then(() => {
|
|
161
|
+
this.log("git commit");
|
|
162
|
+
return cwd;
|
|
163
|
+
})
|
|
164
|
+
.catch((err) => {
|
|
171
165
|
this.log(err, "ERROR");
|
|
172
|
-
|
|
166
|
+
});
|
|
173
167
|
return gitS.stash(["-u"])
|
|
174
168
|
.then(() => {
|
|
175
169
|
this.log("git stash");
|
|
176
170
|
return cwd;
|
|
177
|
-
})
|
|
178
|
-
|
|
171
|
+
})
|
|
172
|
+
.catch((err) => {
|
|
173
|
+
this.log(err, "ERROR");
|
|
179
174
|
});
|
|
180
175
|
}
|
|
181
176
|
|
|
182
|
-
async stachPop() {
|
|
177
|
+
async stachPop () {
|
|
183
178
|
let gitP, cwd, git;
|
|
184
179
|
try {
|
|
185
180
|
cwd = path.resolve(this.response.path);
|
|
186
|
-
gitP = require(
|
|
181
|
+
gitP = require("simple-git");
|
|
187
182
|
git = gitP(cwd);
|
|
188
183
|
} catch (e) {
|
|
189
184
|
throw e;
|
|
190
185
|
}
|
|
191
|
-
|
|
192
|
-
if (!
|
|
186
|
+
const res = await git.checkIsRepo();
|
|
187
|
+
if (!res) {
|
|
193
188
|
return Promise.resolve(this.location);
|
|
194
189
|
}
|
|
195
190
|
return git.stash(["pop"])
|
|
@@ -198,11 +193,11 @@ class React extends nodefony.builders.sandbox {
|
|
|
198
193
|
return cwd;
|
|
199
194
|
})
|
|
200
195
|
.catch((err) => {
|
|
201
|
-
|
|
196
|
+
this.log(err, "ERROR");
|
|
202
197
|
});
|
|
203
198
|
}
|
|
204
199
|
|
|
205
|
-
getCli() {
|
|
200
|
+
getCli () {
|
|
206
201
|
let cliPath = null;
|
|
207
202
|
try {
|
|
208
203
|
cliPath = path.resolve(__dirname, "..", "..", "..", "node_modules", ".bin", "create-react-app");
|
|
@@ -224,7 +219,6 @@ class React extends nodefony.builders.sandbox {
|
|
|
224
219
|
}
|
|
225
220
|
return cliPath;
|
|
226
221
|
}
|
|
227
|
-
|
|
228
222
|
}
|
|
229
223
|
nodefony.builders.react = React;
|
|
230
224
|
module.exports = React;
|