Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 911c8c4

Browse filesBrowse files
committed
Auto-generated commit
1 parent d26a1ee commit 911c8c4
Copy full SHA for 911c8c4

File tree

2 files changed

+202
-0
lines changed
Filter options

2 files changed

+202
-0
lines changed

‎.github/.keepalive

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2022-02-02T17:00:45.439Z

‎.github/workflows/bundle.yml

Copy file name to clipboard
+201Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2022 The Stdlib Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#/
18+
19+
# Workflow name:
20+
name: bundle
21+
22+
# Workflow triggers:
23+
on:
24+
workflow_dispatch:
25+
push:
26+
27+
# Workflow jobs:
28+
jobs:
29+
deno:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v2
33+
- name: Copy files to deno directory
34+
run: |
35+
mkdir -p deno
36+
cp README.md LICENSE CONTRIBUTORS NOTICE ./deno
37+
38+
# Copy TypeScript definitions to deno directory:
39+
if [ -d index.d.ts ]; then
40+
cp index.d.ts ./deno/index.d.ts
41+
fi
42+
if [ -e ./docs/types/index.d.ts ]; then
43+
cp ./docs/types/index.d.ts ./deno/mod.d.ts
44+
fi
45+
- uses: actions/setup-node@v2
46+
with:
47+
node-version: 16
48+
timeout-minutes: 5
49+
- name: Install production and development dependencies
50+
id: install
51+
run: |
52+
npm install || npm install || npm install
53+
timeout-minutes: 15
54+
- name: Bundle package for Deno
55+
id: deno-bundle
56+
uses: stdlib-js/bundle-action@main
57+
with:
58+
target: 'deno'
59+
- name: Rewrite file contents
60+
run: |
61+
# Replace links to other packages with links to the deno branch:
62+
find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/";
63+
64+
# Replace reference to `@stdlib/types` with deno.land link:
65+
find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ <reference types=\"@stdlib\/types\"\/>/\/\/\/ <reference types=\"https:\/\/deno.land\/x\/stdlib_types\/index.d.ts\"\/>/g"
66+
67+
# Change wording of project description to avoid reference to JavaScript and Node.js:
68+
find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g"
69+
70+
# Rewrite all `require()`s to use jsDelivr links:
71+
find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// {
72+
s/(var|let|const)\s+([a-z0-9]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i
73+
s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/
74+
s/';/@deno\/mod.js';/
75+
}"
76+
77+
# Remove `installation`, `cli`, and `c` sections:
78+
find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"installation\">[^<]+<\/section>//g;"
79+
find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"cli\">[\s\S]+<\!\-\- \/.cli \-\->//g"
80+
find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"c\">[\s\S]+<\!\-\- \/.c \-\->//g"
81+
82+
- name: Publish to deno branch
83+
uses: peaceiris/actions-gh-pages@v3
84+
with:
85+
github_token: ${{ secrets.GITHUB_TOKEN }}
86+
publish_dir: ./deno
87+
publish_branch: deno
88+
keep_files: true
89+
user_name: 'stdlib-bot'
90+
user_email: 'noreply@stdlib.io'
91+
commit_message: 'Auto-generated commit'
92+
enable_jekyll: true
93+
umd:
94+
runs-on: ubuntu-latest
95+
steps:
96+
- uses: actions/checkout@v2
97+
- name: Copy files to umd directory
98+
run: |
99+
mkdir -p umd
100+
cp README.md LICENSE CONTRIBUTORS NOTICE ./umd
101+
- uses: actions/setup-node@v2
102+
with:
103+
node-version: 16
104+
timeout-minutes: 5
105+
- name: Install production and development dependencies
106+
id: install
107+
run: |
108+
npm install || npm install || npm install
109+
timeout-minutes: 15
110+
- name: Create Universal Module Definition (UMD) bundle
111+
id: umd-bundle
112+
uses: stdlib-js/bundle-action@main
113+
with:
114+
target: 'umd'
115+
- name: Rewrite file contents
116+
run: |
117+
118+
# Remove `installation`, `cli`, and `c` sections:
119+
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"installation\">[^<]+<\/section>//g;"
120+
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"cli\">[\s\S]+<\!\-\- \/.cli \-\->//g"
121+
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"c\">[\s\S]+<\!\-\- \/.c \-\->//g"
122+
123+
- name: Publish to umd branch
124+
uses: peaceiris/actions-gh-pages@v3
125+
with:
126+
github_token: ${{ secrets.GITHUB_TOKEN }}
127+
publish_dir: ./umd
128+
publish_branch: umd
129+
keep_files: true
130+
user_name: 'stdlib-bot'
131+
user_email: 'noreply@stdlib.io'
132+
commit_message: 'Auto-generated commit'
133+
enable_jekyll: true
134+
esm:
135+
runs-on: ubuntu-latest
136+
steps:
137+
- uses: actions/checkout@v2
138+
- name: Copy files to umd directory
139+
run: |
140+
mkdir -p esm
141+
cp README.md LICENSE CONTRIBUTORS NOTICE ./esm
142+
143+
# Copy TypeScript definitions to esm directory:
144+
if [ -e ./docs/types/index.d.ts ]; then
145+
cp ./docs/types/index.d.ts ./esm/index.d.ts
146+
fi
147+
if [ -d index.d.ts ]; then
148+
cp index.d.ts ./esm/index.d.ts
149+
fi
150+
- uses: actions/setup-node@v2
151+
with:
152+
node-version: 16
153+
timeout-minutes: 5
154+
- name: Install production and development dependencies
155+
id: install
156+
run: |
157+
npm install || npm install || npm install
158+
timeout-minutes: 15
159+
- name: Create ES Module (ESM) bundle
160+
id: esm-bundle
161+
uses: stdlib-js/bundle-action@main
162+
with:
163+
target: 'esm'
164+
- name: Rewrite file contents
165+
run: |
166+
167+
# Replace links to other packages with links to the esm branch:
168+
find ./esm -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/esm/";
169+
170+
# Replace reference to `@stdlib/types` with esm link:
171+
find ./esm -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ <reference types=\"@stdlib\/types\"\/>/\/\/\/ <reference types=\"https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/types@esm\/index.d.ts\"\/>/g"
172+
173+
# Change wording of project description to avoid reference to JavaScript and Node.js:
174+
find ./esm -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g"
175+
176+
# Rewrite all `require()`s to use jsDelivr links:
177+
find ./esm -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// {
178+
s/(var|let|const)\s+([a-z0-9]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i
179+
s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/
180+
s/';/@esm\/index.mjs';/
181+
}"
182+
183+
# Remove `installation`, `cli`, and `c` sections:
184+
find ./esm -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"installation\">[^<]+<\/section>//g;"
185+
find ./esm -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"cli\">[\s\S]+<\!\-\- \/.cli \-\->//g"
186+
find ./esm -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<section class=\"c\">[\s\S]+<\!\-\- \/.c \-\->//g"
187+
188+
# Rewrite examples section to be a HTML file:
189+
find ./esm -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\#\# Examples([\s\S]*)\`\`\`javascript([\s\S]+?)\`\`\`/\#\# Examples\1\`\`\`html\n<\!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<script type=\"module\">\n\2\n<\/script>\n<\/head>\n<\/html>\n\`\`\`/g"
190+
191+
- name: Publish to esm branch
192+
uses: peaceiris/actions-gh-pages@v3
193+
with:
194+
github_token: ${{ secrets.GITHUB_TOKEN }}
195+
publish_dir: ./esm
196+
publish_branch: esm
197+
keep_files: true
198+
user_name: 'stdlib-bot'
199+
user_email: 'noreply@stdlib.io'
200+
commit_message: 'Auto-generated commit'
201+
enable_jekyll: true

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.