Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
perxis-js
Manage
Activity
Members
Labels
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
perxis
perxis-js
Commits
285afd04
Commit
285afd04
authored
2 years ago
by
ko_oler
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
03353761
No related branches found
No related tags found
1 merge request
!1
Добавлена генерация файлов для frontend в Makefile и публикацию npm-пакета
Pipeline
#19450
passed with stage
Stage:
in 39 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+2
-2
2 additions, 2 deletions
.gitlab-ci.yml
Makefile
+3
-1
3 additions, 1 deletion
Makefile
config/generate.sh
+6
-25
6 additions, 25 deletions
config/generate.sh
with
11 additions
and
28 deletions
.gitlab-ci.yml
+
2
−
2
View file @
285afd04
...
@@ -10,13 +10,13 @@ publish_npm:
...
@@ -10,13 +10,13 @@ publish_npm:
-
apk add --update make bash protobuf-dev yarn
-
apk add --update make bash protobuf-dev yarn
-
npm install -g ts-proto@1.115.5
-
npm install -g ts-proto@1.115.5
-
npm install -g typescript@4.7.4
-
npm install -g typescript@4.7.4
-
npm i protobufjs@6.11.3
rules
:
rules
:
-
if
:
'
$CI_
COMMIT_BRANCH
==
$CI_DEFAULT_BRANCH
'
-
if
:
'
$CI_
PIPELINE_SOURCE
==
"merge_request_event"
'
changes
:
changes
:
-
config/package.json
-
config/package.json
script
:
script
:
-
mkdir config/dist
-
make proto
-
make proto
-
cd ./config
-
cd ./config
-
|
-
|
...
...
This diff is collapsed.
Click to expand it.
Makefile
+
3
−
1
View file @
285afd04
...
@@ -4,6 +4,7 @@ SHELL = /bin/bash -o pipefail
...
@@ -4,6 +4,7 @@ SHELL = /bin/bash -o pipefail
PROTODIR
=
perxis-proto/proto
PROTODIR
=
perxis-proto/proto
DSTDIR
=
config/dist
DSTDIR
=
config/dist
ALLPROTO
?=
$(
shell find
$(
PROTODIR
)
-name
'*.proto'
)
ALLPROTO
?=
$(
shell find
$(
PROTODIR
)
-name
'*.proto'
)
PROTOFILES
=
$(
filter-out proto/status/status.proto,
$(
ALLPROTO
))
PROTOFILES
=
$(
filter-out proto/status/status.proto,
$(
ALLPROTO
))
PROTOTSFILES
=
$(
ALLPROTO:.proto
=
.ts
)
PROTOTSFILES
=
$(
ALLPROTO:.proto
=
.ts
)
...
@@ -13,6 +14,7 @@ PROTOC_MINOR_VERSION=$(shell protoc --version | awk '{print $$2;}' | cut -d. -f2
...
@@ -13,6 +14,7 @@ PROTOC_MINOR_VERSION=$(shell protoc --version | awk '{print $$2;}' | cut -d. -f2
TSC_MAJOR_VERSION
=
$(
shell tsc
--version
|
awk
'{print $$2;
}
'
|
cut
-d
.
-f1
)
TSC_MAJOR_VERSION
=
$(
shell tsc
--version
|
awk
'{print $$2;
}
'
|
cut
-d
.
-f1
)
TSC_MINOR_VERSION
=
$(
shell tsc
--version
|
awk
'{print $$2;
}
'
|
cut
-d
.
-f2
)
TSC_MINOR_VERSION
=
$(
shell tsc
--version
|
awk
'{print $$2;
}
'
|
cut
-d
.
-f2
)
TSC_MIC_VERSION
=
$(
shell tsc
--version
|
awk
'{print $$2;
}
'
|
cut
-d
.
-f3
)
TSC_MIC_VERSION
=
$(
shell tsc
--version
|
awk
'{print $$2;
}
'
|
cut
-d
.
-f3
)
$(
shell
mkdir
$(
DSTDIR
))
# Генерация
# Генерация
proto
:
protoc-check js-check $(PROTOTSFILES) generate-ts generate-js
proto
:
protoc-check js-check $(PROTOTSFILES) generate-ts generate-js
...
@@ -71,4 +73,4 @@ ifneq ($(shell expr $(TSC_MINOR_VERSION) \>= 7), 1)
...
@@ -71,4 +73,4 @@ ifneq ($(shell expr $(TSC_MINOR_VERSION) \>= 7), 1)
endif
endif
ifneq
($(shell expr $(TSC_MIC_VERSION) \>= 4), 1)
ifneq
($(shell expr $(TSC_MIC_VERSION) \>= 4), 1)
$(
error
"Current version is lower than 4.7.4 Please update typescript
\n
"
)
$(
error
"Current version is lower than 4.7.4 Please update typescript
\n
"
)
endif
endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
config/generate.sh
+
6
−
25
View file @
285afd04
...
@@ -23,26 +23,20 @@ generate_index() {
...
@@ -23,26 +23,20 @@ generate_index() {
if
[
"
$segment
"
==
"
$base
"
]
;
then
if
[
"
$segment
"
==
"
$base
"
]
;
then
exp
=
"export * from './
$exac
'"
exp
=
"export * from './
$exac
'"
if
grep
-Fxq
"
$exp
"
"
$dir
"
/index.ts
;
then
if
!
grep
-Fxq
"
$exp
"
"
$dir
"
/index.ts
;
then
echo
"
$exp
"
"-> current expression-string already exist in index.ts"
else
echo
"
$exp
"
|
tee
-a
"
$dir
"
/index.ts
echo
"
$exp
"
|
tee
-a
"
$dir
"
/index.ts
fi
fi
p
=
""
p
=
""
elif
[
"
$segment
"
==
"
$exac
"
]
;
then
elif
[
"
$segment
"
==
"
$exac
"
]
;
then
exp
=
"export * as
$segment
from './
$segment
'"
exp
=
"export * as
$segment
from './
$segment
'"
if
grep
-Fxq
"
$exp
"
"
$p
"
/index.ts
;
then
if
!
grep
-Fxq
"
$exp
"
"
$p
"
/index.ts
;
then
echo
"
$exp
"
"-> current expression-string already exist in index.ts"
echo
"
$exp
"
|
tee
-a
"
$p
"
/index.ts
else
echo
"
$exp
"
|
tee
-a
"
$p
"
/index.ts
fi
fi
p+
=
"
$segment
"
p+
=
"
$segment
"
p+
=
"/"
p+
=
"/"
else
else
exp
=
"export * as
$segment
from './
$segment
'"
exp
=
"export * as
$segment
from './
$segment
'"
if
grep
-Fxq
"
$exp
"
"
$p
"
index.ts
;
then
if
!
grep
-Fxq
"
$exp
"
"
$p
"
index.ts
;
then
echo
"
$exp
"
"-> current expression-string already exist in index.ts"
else
echo
"
$exp
"
|
tee
-a
"
$p
"
index.ts
echo
"
$exp
"
|
tee
-a
"
$p
"
index.ts
fi
fi
p+
=
"
$segment
"
p+
=
"
$segment
"
...
@@ -53,29 +47,16 @@ generate_index() {
...
@@ -53,29 +47,16 @@ generate_index() {
done
done
}
}
echo
"---deleting existing *.d.ts, *.d.ts.map, *.js, *.js.map files"
find ./config/dist/
*
/
**
/
-path
'*.d.ts'
-delete
find ./config/dist/
*
/
**
/
-path
'*.d.ts.map'
-delete
find ./config/dist/
*
/
**
/
-path
'*.js'
-delete
find ./config/dist/
*
/
**
/
-path
'*.js.map'
-delete
find ./config/dist/
*
/
**
/
-path
'*.ts.bak'
-delete
find ./config/dist
-path
'*.d.ts'
-delete
find ./config/dist
-path
'*.d.ts.map'
-delete
find ./config/dist
-path
'*.js'
-delete
find ./config/dist
-path
'*.js.map'
-delete
find ./config/dist
-path
'*.ts.bak'
-delete
echo
"Generate index.ts files"
echo
"Generate index.ts files"
ts_files
=
$(
find ./config/dist/
**
/
-name
'*.ts'
)
ts_files
=
$(
find ./config/dist/
**
/
-name
'*.ts'
)
ts_files_array
=(
$ts_files
)
ts_files_array
=(
$ts_files
)
generate_index
"
${
ts_files_array
[@]
}
"
generate_index
"
${
ts_files_array
[@]
}
"
echo
"---generating *.d.ts, *.d.ts.map, *.js, *.js.map files"
echo
"Generate *.d.ts, *.d.ts.map, *.js, *.js.map files"
npm i protobufjs@6.11.3
tsc
--project
./config
--declaration
--declarationMap
--sourceMap
--rootDir
./config/dist
tsc
--project
./config
--declaration
--declarationMap
--sourceMap
--rootDir
./config/dist
echo
"---deleting created tmp files"
echo
"Delete created tmp files"
npm uninstall protobufjs@6.11.3
find ./config/dist
-name
'index.ts'
-delete
find ./config/dist
-name
'index.ts'
-delete
find ./config/dist/
*
/
**
-name
'index.ts'
-delete
find ./config/dist/
*
/
**
-name
'index.ts'
-delete
find ./config/
-maxdepth
1
-name
'index.ts'
-delete
find ./config/
-maxdepth
1
-name
'index.ts'
-delete
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment