@po-ui/ng-sync 5.22.2 → 5.22.3
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 +22 -22
- package/bundles/po-ui-ng-sync.umd.js +2915 -2915
- package/bundles/po-ui-ng-sync.umd.js.map +1 -1
- package/esm2015/lib/index.js +15 -15
- package/esm2015/lib/models/index.js +6 -6
- package/esm2015/lib/models/po-data-message.model.js +57 -57
- package/esm2015/lib/models/po-data-transform.model.js +22 -22
- package/esm2015/lib/models/po-entity/po-entity.model.js +229 -229
- package/esm2015/lib/models/po-event-sourcing-error-response.model.js +17 -17
- package/esm2015/lib/models/po-network-status.model.js +44 -44
- package/esm2015/lib/models/po-network-type.enum.js +30 -30
- package/esm2015/lib/models/po-query-builder/po-query-builder.model.js +241 -241
- package/esm2015/lib/models/po-request-type.enum.js +16 -16
- package/esm2015/lib/po-sync.module.js +31 -31
- package/esm2015/lib/services/po-event-sourcing/enums/po-event-sourcing-operation.enum.js +17 -17
- package/esm2015/lib/services/po-event-sourcing/index.js +4 -4
- package/esm2015/lib/services/po-event-sourcing/interfaces/po-event-sourcing-item.interface.js +2 -2
- package/esm2015/lib/services/po-event-sourcing/interfaces/po-event-sourcing-summary-item.interface.js +2 -2
- package/esm2015/lib/services/po-event-sourcing/po-event-sourcing.service.js +411 -411
- package/esm2015/lib/services/po-http-client/interfaces/po-http-header-option.interface.js +11 -11
- package/esm2015/lib/services/po-http-client/interfaces/po-http-request-data.interface.js +2 -2
- package/esm2015/lib/services/po-http-client/interfaces/po-response-api.interface.js +2 -2
- package/esm2015/lib/services/po-http-client/po-http-client.service.js +147 -147
- package/esm2015/lib/services/po-http-client/po-http-request-type.enum.js +25 -25
- package/esm2015/lib/services/po-network/po-network.service.js +58 -58
- package/esm2015/lib/services/po-schema/index.js +4 -4
- package/esm2015/lib/services/po-schema/po-schema-definition/po-schema-definition.service.js +80 -80
- package/esm2015/lib/services/po-schema/po-schema-util/po-schema-util.model.js +124 -124
- package/esm2015/lib/services/po-schema/po-schema.service.js +198 -198
- package/esm2015/lib/services/po-sync/interfaces/po-sync-config.interface.js +2 -2
- package/esm2015/lib/services/po-sync/interfaces/po-sync-field-options.interface.js +2 -2
- package/esm2015/lib/services/po-sync/interfaces/po-sync-response.interface.js +2 -2
- package/esm2015/lib/services/po-sync/interfaces/po-sync-schema.interface.js +2 -2
- package/esm2015/lib/services/po-sync/po-sync.service.js +336 -336
- package/esm2015/lib/utils/utils.js +63 -63
- package/esm2015/po-ui-ng-sync.js +8 -8
- package/esm2015/public-api.js +2 -2
- package/fesm2015/po-ui-ng-sync.js +2047 -2047
- package/fesm2015/po-ui-ng-sync.js.map +1 -1
- package/lib/index.d.ts +14 -14
- package/lib/models/index.d.ts +5 -5
- package/lib/models/po-data-message.model.d.ts +46 -46
- package/lib/models/po-data-transform.model.d.ts +52 -52
- package/lib/models/po-entity/po-entity.model.d.ts +122 -122
- package/lib/models/po-event-sourcing-error-response.model.d.ts +20 -20
- package/lib/models/po-network-status.model.d.ts +25 -25
- package/lib/models/po-network-type.enum.d.ts +28 -28
- package/lib/models/po-query-builder/po-query-builder.model.d.ts +126 -126
- package/lib/models/po-request-type.enum.d.ts +14 -14
- package/lib/po-sync.module.d.ts +7 -7
- package/lib/services/po-event-sourcing/enums/po-event-sourcing-operation.enum.d.ts +11 -11
- package/lib/services/po-event-sourcing/index.d.ts +3 -3
- package/lib/services/po-event-sourcing/interfaces/po-event-sourcing-item.interface.d.ts +26 -26
- package/lib/services/po-event-sourcing/interfaces/po-event-sourcing-summary-item.interface.d.ts +16 -16
- package/lib/services/po-event-sourcing/po-event-sourcing.service.d.ts +71 -71
- package/lib/services/po-http-client/interfaces/po-http-header-option.interface.d.ts +15 -15
- package/lib/services/po-http-client/interfaces/po-http-request-data.interface.d.ts +24 -24
- package/lib/services/po-http-client/interfaces/po-response-api.interface.d.ts +14 -14
- package/lib/services/po-http-client/po-http-client.service.d.ts +75 -75
- package/lib/services/po-http-client/po-http-request-type.enum.d.ts +23 -23
- package/lib/services/po-network/po-network.service.d.ts +33 -33
- package/lib/services/po-schema/index.d.ts +3 -3
- package/lib/services/po-schema/po-schema-definition/po-schema-definition.service.d.ts +48 -48
- package/lib/services/po-schema/po-schema-util/po-schema-util.model.d.ts +79 -79
- package/lib/services/po-schema/po-schema.service.d.ts +95 -95
- package/lib/services/po-sync/interfaces/po-sync-config.interface.d.ts +24 -24
- package/lib/services/po-sync/interfaces/po-sync-field-options.interface.d.ts +15 -15
- package/lib/services/po-sync/interfaces/po-sync-response.interface.d.ts +20 -20
- package/lib/services/po-sync/interfaces/po-sync-schema.interface.d.ts +37 -37
- package/lib/services/po-sync/po-sync.service.d.ts +159 -159
- package/lib/utils/utils.d.ts +36 -36
- package/package.json +4 -4
- package/po-ui-ng-sync-5.22.3.tgz +0 -0
- package/po-ui-ng-sync.d.ts +8 -8
- package/public-api.d.ts +1 -1
- package/schematics/README.md +169 -169
- package/schematics/collection.json +15 -15
- package/schematics/migrations.json +25 -25
- package/schematics/ng-add/index.d.ts +7 -7
- package/schematics/ng-add/index.js +33 -33
- package/schematics/ng-add/index.spec.d.ts +1 -1
- package/schematics/ng-add/index.spec.js +62 -62
- package/schematics/ng-add/schema.json +7 -7
- package/schematics/ng-generate/schema/files/__path__/__name@dasherize__/__name@dasherize__.constants.ts.template +13 -13
- package/schematics/ng-generate/schema/index.d.ts +4 -4
- package/schematics/ng-generate/schema/index.js +12 -12
- package/schematics/ng-generate/schema/index.spec.d.ts +1 -1
- package/schematics/ng-generate/schema/index.spec.js +44 -44
- package/schematics/ng-generate/schema/schema.d.ts +3 -3
- package/schematics/ng-generate/schema/schema.js +2 -2
- package/schematics/ng-generate/schema/schema.json +31 -31
- package/schematics/ng-update/v2/changes.d.ts +8 -8
- package/schematics/ng-update/v2/changes.js +20 -20
- package/schematics/ng-update/v2/index.d.ts +5 -5
- package/schematics/ng-update/v2/index.js +101 -101
- package/schematics/ng-update/v3/changes.d.ts +2 -2
- package/schematics/ng-update/v3/changes.js +14 -14
- package/schematics/ng-update/v3/index.d.ts +1 -1
- package/schematics/ng-update/v3/index.js +16 -16
- package/schematics/ng-update/v4/changes.d.ts +2 -2
- package/schematics/ng-update/v4/changes.js +14 -14
- package/schematics/ng-update/v4/index.d.ts +1 -1
- package/schematics/ng-update/v4/index.js +15 -15
- package/schematics/ng-update/v5/changes.d.ts +2 -2
- package/schematics/ng-update/v5/changes.js +13 -13
- package/schematics/ng-update/v5/index.d.ts +1 -1
- package/schematics/ng-update/v5/index.js +15 -15
- package/po-ui-ng-sync-5.22.2.tgz +0 -0
package/schematics/README.md
CHANGED
|
@@ -1,169 +1,169 @@
|
|
|
1
|
-
# PO UI Sync
|
|
2
|
-
|
|
3
|
-
## Modo desenvolvimento
|
|
4
|
-
|
|
5
|
-
Para desenvolver novos schematics ou alterá-los é necessário executar o comando abaixo na raiz do projeto:
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
~ <caminho_do_repositorio>/po-angular
|
|
9
|
-
|
|
10
|
-
> npm run build:schematics
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Após executar o comando será criado a pasta `dist/ng-schematics` e você estará apto a utilizar a biblioteca
|
|
14
|
-
em modo de desenvolvimento para implementar novas melhorias/correções e etc.
|
|
15
|
-
|
|
16
|
-
# ng update @po-ui/ng-sync
|
|
17
|
-
|
|
18
|
-
Esse *schematic* é executado através do Angular CLI para oferecer suporte à atualização automática do PO UI em um projeto Angular.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
### Como funciona
|
|
22
|
-
|
|
23
|
-
No arquivo ```npm/@po-ui/ng-sync/package.json ```, é declarado a chave `ng-update`. Isso indica ao Angular CLI que este projeto possui um conjunto de *schematics* de migração.
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
"ng-update": {
|
|
27
|
-
"migrations": "./schematics/migrations.json",
|
|
28
|
-
"packageGroup": [
|
|
29
|
-
"@po-ui/ng-sync"
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Quando os schematics forem analisados, ele tentará determinar se algum script de migração deve ser executado com base nas definições. As definições de migração podem ser encontradas em nosso arquivo `projects/sync/schematics/src/migration.json`. A execução `ng update` procurará scripts com base nesta coleção. Veja documentação do Angular sobre [ng-update](https://github.com/angular/angular-cli/blob/master/docs/specifications/update.md).
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
### Como testar
|
|
38
|
-
|
|
39
|
-
Para poder testar localmente é necessário instalar [verdaccio](https://github.com/verdaccio/verdaccio), para termos um *npm registry* local,
|
|
40
|
-
onde publicaremos os pacotes para realizar o teste.
|
|
41
|
-
|
|
42
|
-
Após a instalação, devemos apontar o npm registry para o que iniciaremos localmente.
|
|
43
|
-
|
|
44
|
-
O comando abaixo subirá o npm local, no endereço http://localhost:4873.
|
|
45
|
-
|
|
46
|
-
``` > verdaccio ```
|
|
47
|
-
|
|
48
|
-
Em seguida, definiremos o *npm registry*, conforme o comando abaixo:
|
|
49
|
-
|
|
50
|
-
``` > npm set registry http://localhost:4873 ```
|
|
51
|
-
|
|
52
|
-
A partir de agora, os pacotes que publicaremos serão enviados ao nosso registry local.
|
|
53
|
-
|
|
54
|
-
> Para utilizar *npm registry* global novamente, execute o comando: `npm set registry https://registry.npmjs.org/`.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
Antes de testarmos o pacotes, devemos fazer duas configurações, são elas:
|
|
58
|
-
|
|
59
|
-
- Adicionar dentro do arquivo ```verdaccio/config.yaml``` a configuração: `max_body_size: 200mb`;
|
|
60
|
-
- Executar o comando: ``` npm adduser --registry http://localhost:4873 ```
|
|
61
|
-
|
|
62
|
-
Para testarmos o pacote, devemos incrementar a versão do mesmo,
|
|
63
|
-
caso for uma versão beta devemos alterar a versão também no arquivo `migrations.json`,
|
|
64
|
-
ter o npm registry local em execução, confirmando essas situações, podemos rodar o script abaixo:
|
|
65
|
-
|
|
66
|
-
`> npm run build:schematics`
|
|
67
|
-
`> npm run build:storage`
|
|
68
|
-
`> npm run build:sync`
|
|
69
|
-
|
|
70
|
-
`> npm run publish:sync:local`
|
|
71
|
-
`> npm run publish:storage:local`
|
|
72
|
-
`> npm run publish:schematics:local`
|
|
73
|
-
|
|
74
|
-
Por fim, execute os comandos abaixo no seu projeto Angular:
|
|
75
|
-
|
|
76
|
-
`> ng update @po-ui/ng-sync --next`
|
|
77
|
-
|
|
78
|
-
Pode ser utilizado o verdaccio para publicar os pacotes locais, como `@po-ui/ng-sync`, assim não precisamos instalar local e o fluxo fica mais próximo do oficial.
|
|
79
|
-
|
|
80
|
-
Se você precisar executar isso várias vezes, desfaça as alterações feitas pelo `ng update` para que o `package.json` volte ao número da versão original e execute `npm install` novamente antes de tentar outra atualização.
|
|
81
|
-
|
|
82
|
-
# ng add @po-ui/ng-sync
|
|
83
|
-
|
|
84
|
-
Esse *schematic* é executado através do Angular CLI para adicionar o sync em projetos Ionic.
|
|
85
|
-
|
|
86
|
-
## Como testar
|
|
87
|
-
|
|
88
|
-
Há duas possibilidades para execução de testes para os novos *schematics*:
|
|
89
|
-
|
|
90
|
-
### 1 - npm link
|
|
91
|
-
|
|
92
|
-
O comando **npm link** criará um link simbólico do pacote que deseja testar dentro do `node_modules` da aplicação. Desta forma, é possível executar *schematics* do `po-sync` diretamente em `./projects/app/src/app`.
|
|
93
|
-
|
|
94
|
-
Primeiramente, é necessária a alteração em `angular.json`:
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
...
|
|
98
|
-
"defaultProject": "app"
|
|
99
|
-
...
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Executar o build do projeto `po-schematic`, `po-sync` e `po-storage`:
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
> npm run build:schematics
|
|
106
|
-
> npm run build:storage
|
|
107
|
-
> npm run build:sync
|
|
108
|
-
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
Agora executaremos o comando de link:
|
|
112
|
-
|
|
113
|
-
```
|
|
114
|
-
> npm link dist/ng-sync
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
Por fim, executando o comando abaixo, o pacote `po-sync` será instalados e também serão adicionados os módulos `PoStorageModule` e `PoSyncModule` em `app.module.ts`:
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
> ng generate @po-ui/ng-sync:ng-add
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
> Pra remover posteriormente o pacote `po-sync` do `node_modules` execute `npm uninstall @po-ui/ng-sync`.
|
|
124
|
-
|
|
125
|
-
### 2 - verdaccio
|
|
126
|
-
|
|
127
|
-
Para poder testar localmente é necessário instalar [verdaccio](https://github.com/verdaccio/verdaccio), para termos um *npm registry* local,
|
|
128
|
-
onde publicaremos os pacotes para realizar o teste.
|
|
129
|
-
|
|
130
|
-
Após a instalação, devemos apontar o npm registry para o que iniciaremos localmente.
|
|
131
|
-
|
|
132
|
-
O comando abaixo subirá o npm local, no endereço http://localhost:4873.
|
|
133
|
-
|
|
134
|
-
```
|
|
135
|
-
> verdaccio
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
Em seguida, definiremos o *npm registry*, conforme o comando abaixo:
|
|
139
|
-
|
|
140
|
-
```
|
|
141
|
-
> npm set registry http://localhost:4873
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
A partir de agora, os pacotes que publicaremos serão enviados ao nosso registry local.
|
|
145
|
-
|
|
146
|
-
> Para utilizar *npm registry* global novamente, execute o comando: `npm set registry https://registry.npmjs.org/`.
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
Antes de testarmos o pacotes, devemos fazer duas configurações, são elas:
|
|
150
|
-
|
|
151
|
-
- Adicionar dentro do arquivo ```verdaccio/config.yaml``` a configuração: `max_body_size: 200mb`;
|
|
152
|
-
- Executar o comando: ``` npm adduser --registry http://localhost:4873 ```
|
|
153
|
-
|
|
154
|
-
Para testarmos o pacote, devemos incrementar a versão do mesmo e ter o npm registry local em execução. confirmando essas situações, podemos rodar o script abaixo:
|
|
155
|
-
|
|
156
|
-
```
|
|
157
|
-
> npm run build:schematics && npm run build:storage && npm run build:sync && npm run publish:sync:local && npm run publish:storage:local && npm run publish:schematics:local
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
```
|
|
161
|
-
> npm dist-tags add @po-ui/ng-sync@versaoTeste && npm dist-tags add @po-ui/ng-storage@versaoTeste && npm dist-tags add @po-ui/ng-schematics@versaoTeste
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
Por fim, execute os comando abaixo no seu projeto Angular:
|
|
166
|
-
|
|
167
|
-
```
|
|
168
|
-
> ng add @po-ui/ng-sync
|
|
169
|
-
```
|
|
1
|
+
# PO UI Sync
|
|
2
|
+
|
|
3
|
+
## Modo desenvolvimento
|
|
4
|
+
|
|
5
|
+
Para desenvolver novos schematics ou alterá-los é necessário executar o comando abaixo na raiz do projeto:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
~ <caminho_do_repositorio>/po-angular
|
|
9
|
+
|
|
10
|
+
> npm run build:schematics
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Após executar o comando será criado a pasta `dist/ng-schematics` e você estará apto a utilizar a biblioteca
|
|
14
|
+
em modo de desenvolvimento para implementar novas melhorias/correções e etc.
|
|
15
|
+
|
|
16
|
+
# ng update @po-ui/ng-sync
|
|
17
|
+
|
|
18
|
+
Esse *schematic* é executado através do Angular CLI para oferecer suporte à atualização automática do PO UI em um projeto Angular.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Como funciona
|
|
22
|
+
|
|
23
|
+
No arquivo ```npm/@po-ui/ng-sync/package.json ```, é declarado a chave `ng-update`. Isso indica ao Angular CLI que este projeto possui um conjunto de *schematics* de migração.
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
"ng-update": {
|
|
27
|
+
"migrations": "./schematics/migrations.json",
|
|
28
|
+
"packageGroup": [
|
|
29
|
+
"@po-ui/ng-sync"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Quando os schematics forem analisados, ele tentará determinar se algum script de migração deve ser executado com base nas definições. As definições de migração podem ser encontradas em nosso arquivo `projects/sync/schematics/src/migration.json`. A execução `ng update` procurará scripts com base nesta coleção. Veja documentação do Angular sobre [ng-update](https://github.com/angular/angular-cli/blob/master/docs/specifications/update.md).
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Como testar
|
|
38
|
+
|
|
39
|
+
Para poder testar localmente é necessário instalar [verdaccio](https://github.com/verdaccio/verdaccio), para termos um *npm registry* local,
|
|
40
|
+
onde publicaremos os pacotes para realizar o teste.
|
|
41
|
+
|
|
42
|
+
Após a instalação, devemos apontar o npm registry para o que iniciaremos localmente.
|
|
43
|
+
|
|
44
|
+
O comando abaixo subirá o npm local, no endereço http://localhost:4873.
|
|
45
|
+
|
|
46
|
+
``` > verdaccio ```
|
|
47
|
+
|
|
48
|
+
Em seguida, definiremos o *npm registry*, conforme o comando abaixo:
|
|
49
|
+
|
|
50
|
+
``` > npm set registry http://localhost:4873 ```
|
|
51
|
+
|
|
52
|
+
A partir de agora, os pacotes que publicaremos serão enviados ao nosso registry local.
|
|
53
|
+
|
|
54
|
+
> Para utilizar *npm registry* global novamente, execute o comando: `npm set registry https://registry.npmjs.org/`.
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
Antes de testarmos o pacotes, devemos fazer duas configurações, são elas:
|
|
58
|
+
|
|
59
|
+
- Adicionar dentro do arquivo ```verdaccio/config.yaml``` a configuração: `max_body_size: 200mb`;
|
|
60
|
+
- Executar o comando: ``` npm adduser --registry http://localhost:4873 ```
|
|
61
|
+
|
|
62
|
+
Para testarmos o pacote, devemos incrementar a versão do mesmo,
|
|
63
|
+
caso for uma versão beta devemos alterar a versão também no arquivo `migrations.json`,
|
|
64
|
+
ter o npm registry local em execução, confirmando essas situações, podemos rodar o script abaixo:
|
|
65
|
+
|
|
66
|
+
`> npm run build:schematics`
|
|
67
|
+
`> npm run build:storage`
|
|
68
|
+
`> npm run build:sync`
|
|
69
|
+
|
|
70
|
+
`> npm run publish:sync:local`
|
|
71
|
+
`> npm run publish:storage:local`
|
|
72
|
+
`> npm run publish:schematics:local`
|
|
73
|
+
|
|
74
|
+
Por fim, execute os comandos abaixo no seu projeto Angular:
|
|
75
|
+
|
|
76
|
+
`> ng update @po-ui/ng-sync --next`
|
|
77
|
+
|
|
78
|
+
Pode ser utilizado o verdaccio para publicar os pacotes locais, como `@po-ui/ng-sync`, assim não precisamos instalar local e o fluxo fica mais próximo do oficial.
|
|
79
|
+
|
|
80
|
+
Se você precisar executar isso várias vezes, desfaça as alterações feitas pelo `ng update` para que o `package.json` volte ao número da versão original e execute `npm install` novamente antes de tentar outra atualização.
|
|
81
|
+
|
|
82
|
+
# ng add @po-ui/ng-sync
|
|
83
|
+
|
|
84
|
+
Esse *schematic* é executado através do Angular CLI para adicionar o sync em projetos Ionic.
|
|
85
|
+
|
|
86
|
+
## Como testar
|
|
87
|
+
|
|
88
|
+
Há duas possibilidades para execução de testes para os novos *schematics*:
|
|
89
|
+
|
|
90
|
+
### 1 - npm link
|
|
91
|
+
|
|
92
|
+
O comando **npm link** criará um link simbólico do pacote que deseja testar dentro do `node_modules` da aplicação. Desta forma, é possível executar *schematics* do `po-sync` diretamente em `./projects/app/src/app`.
|
|
93
|
+
|
|
94
|
+
Primeiramente, é necessária a alteração em `angular.json`:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
...
|
|
98
|
+
"defaultProject": "app"
|
|
99
|
+
...
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Executar o build do projeto `po-schematic`, `po-sync` e `po-storage`:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
> npm run build:schematics
|
|
106
|
+
> npm run build:storage
|
|
107
|
+
> npm run build:sync
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Agora executaremos o comando de link:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
> npm link dist/ng-sync
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Por fim, executando o comando abaixo, o pacote `po-sync` será instalados e também serão adicionados os módulos `PoStorageModule` e `PoSyncModule` em `app.module.ts`:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
> ng generate @po-ui/ng-sync:ng-add
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
> Pra remover posteriormente o pacote `po-sync` do `node_modules` execute `npm uninstall @po-ui/ng-sync`.
|
|
124
|
+
|
|
125
|
+
### 2 - verdaccio
|
|
126
|
+
|
|
127
|
+
Para poder testar localmente é necessário instalar [verdaccio](https://github.com/verdaccio/verdaccio), para termos um *npm registry* local,
|
|
128
|
+
onde publicaremos os pacotes para realizar o teste.
|
|
129
|
+
|
|
130
|
+
Após a instalação, devemos apontar o npm registry para o que iniciaremos localmente.
|
|
131
|
+
|
|
132
|
+
O comando abaixo subirá o npm local, no endereço http://localhost:4873.
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
> verdaccio
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Em seguida, definiremos o *npm registry*, conforme o comando abaixo:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
> npm set registry http://localhost:4873
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
A partir de agora, os pacotes que publicaremos serão enviados ao nosso registry local.
|
|
145
|
+
|
|
146
|
+
> Para utilizar *npm registry* global novamente, execute o comando: `npm set registry https://registry.npmjs.org/`.
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
Antes de testarmos o pacotes, devemos fazer duas configurações, são elas:
|
|
150
|
+
|
|
151
|
+
- Adicionar dentro do arquivo ```verdaccio/config.yaml``` a configuração: `max_body_size: 200mb`;
|
|
152
|
+
- Executar o comando: ``` npm adduser --registry http://localhost:4873 ```
|
|
153
|
+
|
|
154
|
+
Para testarmos o pacote, devemos incrementar a versão do mesmo e ter o npm registry local em execução. confirmando essas situações, podemos rodar o script abaixo:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
> npm run build:schematics && npm run build:storage && npm run build:sync && npm run publish:sync:local && npm run publish:storage:local && npm run publish:schematics:local
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
> npm dist-tags add @po-ui/ng-sync@versaoTeste && npm dist-tags add @po-ui/ng-storage@versaoTeste && npm dist-tags add @po-ui/ng-schematics@versaoTeste
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
Por fim, execute os comando abaixo no seu projeto Angular:
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
> ng add @po-ui/ng-sync
|
|
169
|
+
```
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
-
"schematics": {
|
|
4
|
-
"ng-add": {
|
|
5
|
-
"description": "Add my library to the project.",
|
|
6
|
-
"factory": "./ng-add/index",
|
|
7
|
-
"schema": "./ng-add/schema.json"
|
|
8
|
-
},
|
|
9
|
-
"schema": {
|
|
10
|
-
"description": "Create a schema to sync a entity ",
|
|
11
|
-
"factory": "./ng-generate/schema/index",
|
|
12
|
-
"schema": "./ng-generate/schema/schema.json"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"ng-add": {
|
|
5
|
+
"description": "Add my library to the project.",
|
|
6
|
+
"factory": "./ng-add/index",
|
|
7
|
+
"schema": "./ng-add/schema.json"
|
|
8
|
+
},
|
|
9
|
+
"schema": {
|
|
10
|
+
"description": "Create a schema to sync a entity ",
|
|
11
|
+
"factory": "./ng-generate/schema/index",
|
|
12
|
+
"schema": "./ng-generate/schema/schema.json"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
-
"schematics": {
|
|
4
|
-
"migration-v2": {
|
|
5
|
-
"version": "2",
|
|
6
|
-
"description": "Atualiza @po-ui/ng-sync para v2",
|
|
7
|
-
"factory": "./ng-update/v2/index#updateToV2"
|
|
8
|
-
},
|
|
9
|
-
"migration-v3": {
|
|
10
|
-
"version": "3",
|
|
11
|
-
"description": "Atualiza @po-ui/ng-sync para v3",
|
|
12
|
-
"factory": "./ng-update/v3/index#updateToV3"
|
|
13
|
-
},
|
|
14
|
-
"migration-v4": {
|
|
15
|
-
"version": "4",
|
|
16
|
-
"description": "Atualiza @po-ui/ng-sync para v4",
|
|
17
|
-
"factory": "./ng-update/v4/index"
|
|
18
|
-
},
|
|
19
|
-
"migration-v5": {
|
|
20
|
-
"version": "5",
|
|
21
|
-
"description": "Atualiza @po-ui/ng-sync para v5",
|
|
22
|
-
"factory": "./ng-update/v5/index"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"migration-v2": {
|
|
5
|
+
"version": "2",
|
|
6
|
+
"description": "Atualiza @po-ui/ng-sync para v2",
|
|
7
|
+
"factory": "./ng-update/v2/index#updateToV2"
|
|
8
|
+
},
|
|
9
|
+
"migration-v3": {
|
|
10
|
+
"version": "3",
|
|
11
|
+
"description": "Atualiza @po-ui/ng-sync para v3",
|
|
12
|
+
"factory": "./ng-update/v3/index#updateToV3"
|
|
13
|
+
},
|
|
14
|
+
"migration-v4": {
|
|
15
|
+
"version": "4",
|
|
16
|
+
"description": "Atualiza @po-ui/ng-sync para v4",
|
|
17
|
+
"factory": "./ng-update/v4/index"
|
|
18
|
+
},
|
|
19
|
+
"migration-v5": {
|
|
20
|
+
"version": "5",
|
|
21
|
+
"description": "Atualiza @po-ui/ng-sync para v5",
|
|
22
|
+
"factory": "./ng-update/v5/index"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
-
/**
|
|
3
|
-
* Scaffolds the basics of the PO Sync, this includes:
|
|
4
|
-
* - Install dependencies;
|
|
5
|
-
* - Imports PoStorageModule and PoSyncModule to app root module;
|
|
6
|
-
*/
|
|
7
|
-
export default function (options: any): Rule;
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
/**
|
|
3
|
+
* Scaffolds the basics of the PO Sync, this includes:
|
|
4
|
+
* - Install dependencies;
|
|
5
|
+
* - Imports PoStorageModule and PoSyncModule to app root module;
|
|
6
|
+
*/
|
|
7
|
+
export default function (options: any): Rule;
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
4
|
-
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
5
|
-
const package_config_1 = require("@po-ui/ng-schematics/package-config");
|
|
6
|
-
const module_1 = require("@po-ui/ng-schematics/module/module");
|
|
7
|
-
/** PO Module name that will be inserted into app root module */
|
|
8
|
-
const poStorageModuleName = 'PoStorageModule.forRoot()';
|
|
9
|
-
const poStorageModuleSourcePath = '@po-ui/ng-storage';
|
|
10
|
-
const poPoSyncModuleName = 'PoSyncModule';
|
|
11
|
-
const poPoSyncModuleSourcePath = '@po-ui/ng-sync';
|
|
12
|
-
/**
|
|
13
|
-
* Scaffolds the basics of the PO Sync, this includes:
|
|
14
|
-
* - Install dependencies;
|
|
15
|
-
* - Imports PoStorageModule and PoSyncModule to app root module;
|
|
16
|
-
*/
|
|
17
|
-
function default_1(options) {
|
|
18
|
-
return schematics_1.chain([
|
|
19
|
-
addPoPackageAndInstall(),
|
|
20
|
-
module_1.addModuleImportToRootModule(options, poStorageModuleName, poStorageModuleSourcePath),
|
|
21
|
-
module_1.addModuleImportToRootModule(options, poPoSyncModuleName, poPoSyncModuleSourcePath)
|
|
22
|
-
]);
|
|
23
|
-
}
|
|
24
|
-
exports.default = default_1;
|
|
25
|
-
function addPoPackageAndInstall() {
|
|
26
|
-
return (tree, context) => {
|
|
27
|
-
package_config_1.addPackageToPackageJson(tree, '@po-ui/ng-sync', '5.22.
|
|
28
|
-
// install packages
|
|
29
|
-
context.addTask(new tasks_1.NodePackageInstallTask());
|
|
30
|
-
// Log de processamento
|
|
31
|
-
context.logger.info('Sync added successfully, please execute the command `ionic cordova plugin add cordova-plugin-network-information`');
|
|
32
|
-
};
|
|
33
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
4
|
+
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
5
|
+
const package_config_1 = require("@po-ui/ng-schematics/package-config");
|
|
6
|
+
const module_1 = require("@po-ui/ng-schematics/module/module");
|
|
7
|
+
/** PO Module name that will be inserted into app root module */
|
|
8
|
+
const poStorageModuleName = 'PoStorageModule.forRoot()';
|
|
9
|
+
const poStorageModuleSourcePath = '@po-ui/ng-storage';
|
|
10
|
+
const poPoSyncModuleName = 'PoSyncModule';
|
|
11
|
+
const poPoSyncModuleSourcePath = '@po-ui/ng-sync';
|
|
12
|
+
/**
|
|
13
|
+
* Scaffolds the basics of the PO Sync, this includes:
|
|
14
|
+
* - Install dependencies;
|
|
15
|
+
* - Imports PoStorageModule and PoSyncModule to app root module;
|
|
16
|
+
*/
|
|
17
|
+
function default_1(options) {
|
|
18
|
+
return schematics_1.chain([
|
|
19
|
+
addPoPackageAndInstall(),
|
|
20
|
+
module_1.addModuleImportToRootModule(options, poStorageModuleName, poStorageModuleSourcePath),
|
|
21
|
+
module_1.addModuleImportToRootModule(options, poPoSyncModuleName, poPoSyncModuleSourcePath)
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
exports.default = default_1;
|
|
25
|
+
function addPoPackageAndInstall() {
|
|
26
|
+
return (tree, context) => {
|
|
27
|
+
package_config_1.addPackageToPackageJson(tree, '@po-ui/ng-sync', '5.22.3');
|
|
28
|
+
// install packages
|
|
29
|
+
context.addTask(new tasks_1.NodePackageInstallTask());
|
|
30
|
+
// Log de processamento
|
|
31
|
+
context.logger.info('Sync added successfully, please execute the command `ionic cordova plugin add cordova-plugin-network-information`');
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
34
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
5
|
-
const path = require("path");
|
|
6
|
-
const collectionPath = path.join(__dirname, '../collection.json');
|
|
7
|
-
describe('Schematic: ng-add', () => {
|
|
8
|
-
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
9
|
-
const workspaceOptions = {
|
|
10
|
-
name: 'workspace',
|
|
11
|
-
newProjectRoot: 'projects',
|
|
12
|
-
version: '6.0.0'
|
|
13
|
-
};
|
|
14
|
-
const componentOptions = {
|
|
15
|
-
name: 'po'
|
|
16
|
-
};
|
|
17
|
-
let appTree;
|
|
18
|
-
let infoOutput;
|
|
19
|
-
beforeEach(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
appTree = yield runner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise();
|
|
21
|
-
appTree = yield runner
|
|
22
|
-
.runExternalSchematicAsync('@schematics/angular', 'application', componentOptions, appTree)
|
|
23
|
-
.toPromise();
|
|
24
|
-
infoOutput = [];
|
|
25
|
-
runner.logger.subscribe(e => {
|
|
26
|
-
if (e.level === 'info') {
|
|
27
|
-
infoOutput.push(e.message);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}));
|
|
31
|
-
describe('Dependencies:', () => {
|
|
32
|
-
it('should update package.json with @po-ui/ng-sync dependencies and run nodePackageInstall', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
-
const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
|
|
34
|
-
const packageJson = JSON.parse(getFileContent(tree, '/package.json'));
|
|
35
|
-
const dependencies = packageJson.dependencies;
|
|
36
|
-
const info = 'Sync added successfully, please execute the command `ionic cordova plugin add cordova-plugin-network-information`';
|
|
37
|
-
expect(dependencies['@po-ui/ng-sync']).toBeDefined();
|
|
38
|
-
expect(Object.keys(dependencies)).toEqual(Object.keys(dependencies).sort());
|
|
39
|
-
expect(runner.tasks.some(task => task.name === 'node-package')).toBe(true);
|
|
40
|
-
expect(infoOutput.length).toBe(1);
|
|
41
|
-
expect(infoOutput[0]).toMatch(new RegExp(`${info}`));
|
|
42
|
-
}));
|
|
43
|
-
});
|
|
44
|
-
describe('Imports:', () => {
|
|
45
|
-
it('should add the PoSyncModule and PoStorageModule to the project module', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
-
const poSyncModuleName = 'PoSyncModule';
|
|
47
|
-
const poStorageModuleName = 'PoStorageModule';
|
|
48
|
-
const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
|
|
49
|
-
const fileContent = getFileContent(tree, `projects/${componentOptions.name}/src/app/app.module.ts`);
|
|
50
|
-
expect(fileContent).toContain(poSyncModuleName);
|
|
51
|
-
expect(fileContent).toContain(poStorageModuleName);
|
|
52
|
-
}));
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
/** Gets the content of a specified file from a schematic tree. */
|
|
56
|
-
function getFileContent(tree, filePath) {
|
|
57
|
-
const contentBuffer = tree.read(filePath);
|
|
58
|
-
if (!contentBuffer) {
|
|
59
|
-
throw new Error(`Cannot read "${filePath}" because it does not exist.`);
|
|
60
|
-
}
|
|
61
|
-
return contentBuffer.toString();
|
|
62
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const collectionPath = path.join(__dirname, '../collection.json');
|
|
7
|
+
describe('Schematic: ng-add', () => {
|
|
8
|
+
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
9
|
+
const workspaceOptions = {
|
|
10
|
+
name: 'workspace',
|
|
11
|
+
newProjectRoot: 'projects',
|
|
12
|
+
version: '6.0.0'
|
|
13
|
+
};
|
|
14
|
+
const componentOptions = {
|
|
15
|
+
name: 'po'
|
|
16
|
+
};
|
|
17
|
+
let appTree;
|
|
18
|
+
let infoOutput;
|
|
19
|
+
beforeEach(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
appTree = yield runner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise();
|
|
21
|
+
appTree = yield runner
|
|
22
|
+
.runExternalSchematicAsync('@schematics/angular', 'application', componentOptions, appTree)
|
|
23
|
+
.toPromise();
|
|
24
|
+
infoOutput = [];
|
|
25
|
+
runner.logger.subscribe(e => {
|
|
26
|
+
if (e.level === 'info') {
|
|
27
|
+
infoOutput.push(e.message);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}));
|
|
31
|
+
describe('Dependencies:', () => {
|
|
32
|
+
it('should update package.json with @po-ui/ng-sync dependencies and run nodePackageInstall', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
|
|
34
|
+
const packageJson = JSON.parse(getFileContent(tree, '/package.json'));
|
|
35
|
+
const dependencies = packageJson.dependencies;
|
|
36
|
+
const info = 'Sync added successfully, please execute the command `ionic cordova plugin add cordova-plugin-network-information`';
|
|
37
|
+
expect(dependencies['@po-ui/ng-sync']).toBeDefined();
|
|
38
|
+
expect(Object.keys(dependencies)).toEqual(Object.keys(dependencies).sort());
|
|
39
|
+
expect(runner.tasks.some(task => task.name === 'node-package')).toBe(true);
|
|
40
|
+
expect(infoOutput.length).toBe(1);
|
|
41
|
+
expect(infoOutput[0]).toMatch(new RegExp(`${info}`));
|
|
42
|
+
}));
|
|
43
|
+
});
|
|
44
|
+
describe('Imports:', () => {
|
|
45
|
+
it('should add the PoSyncModule and PoStorageModule to the project module', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
+
const poSyncModuleName = 'PoSyncModule';
|
|
47
|
+
const poStorageModuleName = 'PoStorageModule';
|
|
48
|
+
const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
|
|
49
|
+
const fileContent = getFileContent(tree, `projects/${componentOptions.name}/src/app/app.module.ts`);
|
|
50
|
+
expect(fileContent).toContain(poSyncModuleName);
|
|
51
|
+
expect(fileContent).toContain(poStorageModuleName);
|
|
52
|
+
}));
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
/** Gets the content of a specified file from a schematic tree. */
|
|
56
|
+
function getFileContent(tree, filePath) {
|
|
57
|
+
const contentBuffer = tree.read(filePath);
|
|
58
|
+
if (!contentBuffer) {
|
|
59
|
+
throw new Error(`Cannot read "${filePath}" because it does not exist.`);
|
|
60
|
+
}
|
|
61
|
+
return contentBuffer.toString();
|
|
62
|
+
}
|
|
63
63
|
//# sourceMappingURL=index.spec.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"$id": "SchematicsNgAdd",
|
|
4
|
-
"title": "Ng Add Options Schema",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"required": []
|
|
7
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "SchematicsNgAdd",
|
|
4
|
+
"title": "Ng Add Options Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": []
|
|
7
|
+
}
|