Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
to
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
matrix
to
Commits
604dda73
Commit
604dda73
authored
4 years ago
by
Bruno Windels
Browse files
Options
Downloads
Patches
Plain Diff
create apple-app-site-association during build
parent
e8e2f04f
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
package.json
+4
-0
4 additions, 0 deletions
package.json
scripts/build.js
+41
-19
41 additions, 19 deletions
scripts/build.js
scripts/serve-local.js
+7
-5
7 additions, 5 deletions
scripts/serve-local.js
src/open/clients/Element.js
+2
-0
2 additions, 0 deletions
src/open/clients/Element.js
with
54 additions
and
24 deletions
package.json
+
4
−
0
View file @
604dda73
{
{
"version"
:
"0.0.1"
,
"version"
:
"0.0.1"
,
"type"
:
"module"
,
"engines"
:
{
"node"
:
">= 14.0.0"
},
"scripts"
:
{
"scripts"
:
{
"start"
:
"node scripts/serve-local.js"
,
"start"
:
"node scripts/serve-local.js"
,
"build"
:
"node scripts/build.js"
"build"
:
"node scripts/build.js"
...
...
This diff is collapsed.
Click to expand it.
scripts/build.js
+
41
−
19
View file @
604dda73
...
@@ -15,32 +15,34 @@ See the License for the specific language governing permissions and
...
@@ -15,32 +15,34 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
const
cheerio
=
require
(
"
cheerio
"
);
import
cheerio
from
"
cheerio
"
;
const
fsRoot
=
require
(
"
fs
"
);
import
fs
from
"
fs/promises
"
;
const
fs
=
fsRoot
.
promises
;
import
path
from
"
path
"
;
const
path
=
require
(
"
path
"
);
import
xxhash
from
'
xxhashjs
'
;
const
xxhash
=
require
(
'
xxhashjs
'
);
import
{
rollup
}
from
'
rollup
'
;
const
{
rollup
}
=
require
(
'
rollup
'
);
import
postcss
from
"
postcss
"
;
const
postcss
=
require
(
"
postcss
"
);
import
postcssImport
from
"
postcss-import
"
;
const
postcssImport
=
require
(
"
postcss-import
"
);
// needed for legacy bundle
// needed for legacy bundle
cons
t
babel
=
require
(
'
@rollup/plugin-babel
'
)
;
impor
t
babel
from
'
@rollup/plugin-babel
'
;
// needed to find the polyfill modules in the main-legacy.js bundle
// needed to find the polyfill modules in the main-legacy.js bundle
cons
t
{
nodeResolve
}
=
require
(
'
@rollup/plugin-node-resolve
'
)
;
impor
t
{
nodeResolve
}
from
'
@rollup/plugin-node-resolve
'
;
// needed because some of the polyfills are written as commonjs modules
// needed because some of the polyfills are written as commonjs modules
cons
t
commonjs
=
require
(
'
@rollup/plugin-commonjs
'
)
;
impor
t
commonjs
from
'
@rollup/plugin-commonjs
'
;
// multi-entry plugin so we can add polyfill file to main
// multi-entry plugin so we can add polyfill file to main
cons
t
multi
=
require
(
'
@rollup/plugin-multi-entry
'
)
;
impor
t
multi
from
'
@rollup/plugin-multi-entry
'
;
cons
t
{
terser
}
=
require
(
"
rollup-plugin-terser
"
)
;
impor
t
{
terser
}
from
"
rollup-plugin-terser
"
;
cons
t
replace
=
require
(
"
@rollup/plugin-replace
"
)
;
impor
t
replace
from
"
@rollup/plugin-replace
"
;
// replace urls of asset names with content hashed version
// replace urls of asset names with content hashed version
const
postcssUrl
=
require
(
"
postcss-url
"
);
import
postcssUrl
from
"
postcss-url
"
;
import
cssvariables
from
"
postcss-css-variables
"
;
import
autoprefixer
from
"
autoprefixer
"
;
import
flexbugsFixes
from
"
postcss-flexbugs-fixes
"
;
const
cssvariables
=
require
(
"
postcss-css-variables
"
);
import
{
createClients
}
from
"
../src/open/clients/index.js
"
;
const
autoprefixer
=
require
(
"
autoprefixer
"
);
const
flexbugsFixes
=
require
(
"
postcss-flexbugs-fixes
"
);
const
projectDir
=
path
.
join
(
__dirname
,
"
../
"
);
import
{
fileURLToPath
}
from
'
url
'
;
import
{
dirname
}
from
'
path
'
;
const
projectDir
=
path
.
join
(
dirname
(
fileURLToPath
(
import
.
meta
.
url
)),
"
../
"
);
async
function
build
()
{
async
function
build
()
{
// get version number
// get version number
...
@@ -56,6 +58,8 @@ async function build() {
...
@@ -56,6 +58,8 @@ async function build() {
await
assets
.
write
(
`bundle-esm.js`
,
await
buildJs
(
"
src/main.js
"
,
assets
));
await
assets
.
write
(
`bundle-esm.js`
,
await
buildJs
(
"
src/main.js
"
,
assets
));
await
assets
.
write
(
`bundle-legacy.js`
,
await
buildJsLegacy
(
"
src/main.js
"
,
assets
,
[
"
src/polyfill.js
"
]));
await
assets
.
write
(
`bundle-legacy.js`
,
await
buildJsLegacy
(
"
src/main.js
"
,
assets
,
[
"
src/polyfill.js
"
]));
await
assets
.
write
(
`bundle.css`
,
await
buildCss
(
"
css/main.css
"
,
assets
));
await
assets
.
write
(
`bundle.css`
,
await
buildCss
(
"
css/main.css
"
,
assets
));
await
assets
.
writeUnhashed
(
"
apple-app-site-association
"
,
buildAppleAssociatedAppsFile
(
createClients
()));
const
globalHash
=
assets
.
hashForAll
();
const
globalHash
=
assets
.
hashForAll
();
await
buildHtml
(
assets
);
await
buildHtml
(
assets
);
...
@@ -132,6 +136,24 @@ async function buildJsLegacy(mainFile, assets, extraFiles = []) {
...
@@ -132,6 +136,24 @@ async function buildJsLegacy(mainFile, assets, extraFiles = []) {
return
code
;
return
code
;
}
}
function
buildAppleAssociatedAppsFile
(
clients
)
{
const
appIds
=
clients
.
map
(
c
=>
c
.
appleAssociatedAppId
).
filter
(
id
=>
!!
id
);
return
JSON
.
stringify
({
"
applinks
"
:
{
"
apps
"
:
[],
"
details
"
:
appIds
.
map
(
id
=>
{
return
{
"
appID
"
:
id
,
"
paths
"
:
[
"
*
"
]
};
}),
},
"
webcredentials
"
:
{
"
apps
"
:
appIds
}
});
}
async
function
buildCss
(
entryPath
,
assets
)
{
async
function
buildCss
(
entryPath
,
assets
)
{
entryPath
=
path
.
join
(
projectDir
,
entryPath
);
entryPath
=
path
.
join
(
projectDir
,
entryPath
);
const
assetUrlMapper
=
({
absolutePath
})
=>
{
const
assetUrlMapper
=
({
absolutePath
})
=>
{
...
...
This diff is collapsed.
Click to expand it.
scripts/serve-local.js
+
7
−
5
View file @
604dda73
...
@@ -14,14 +14,16 @@ See the License for the specific language governing permissions and
...
@@ -14,14 +14,16 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
const
finalhandler
=
require
(
'
finalhandler
'
)
import
finalhandler
from
"
finalhandler
"
const
http
=
require
(
'
http
'
)
import
http
from
"
http
"
const
serveStatic
=
require
(
'
serve-static
'
)
import
serveStatic
from
"
serve-static
"
const
path
=
require
(
'
path
'
);
import
path
from
"
path
"
import
{
fileURLToPath
}
from
"
url
"
;
const
projectDir
=
path
.
resolve
(
path
.
dirname
(
fileURLToPath
(
import
.
meta
.
url
)),
"
../
"
);
// Serve up parent directory with cache disabled
// Serve up parent directory with cache disabled
const
serve
=
serveStatic
(
const
serve
=
serveStatic
(
p
ath
.
resolve
(
__dirname
,
"
../
"
)
,
p
rojectDir
,
{
{
etag
:
false
,
etag
:
false
,
setHeaders
:
res
=>
{
setHeaders
:
res
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/open/clients/Element.js
+
2
−
0
View file @
604dda73
...
@@ -32,6 +32,8 @@ export class Element {
...
@@ -32,6 +32,8 @@ export class Element {
];
];
}
}
get
appleAssociatedAppId
()
{
return
"
7J4U792NQT.im.vector.app
"
;
}
get
description
()
{
return
'
Fully-featured Matrix client, used by millions.
'
;
}
get
description
()
{
return
'
Fully-featured Matrix client, used by millions.
'
;
}
get
homepage
()
{
return
"
https://element.io
"
;
}
get
homepage
()
{
return
"
https://element.io
"
;
}
...
...
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