Skip to content

Commit 6daf5e9

Browse files
committed
npm install'able
1 parent c0a86cb commit 6daf5e9

File tree

24 files changed

+606
-3
lines changed

24 files changed

+606
-3
lines changed

.github/workflows/release.yaml

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ jobs:
171171
with:
172172
name: sqlite-regex-windows-wheels
173173
path: dist/release/wheels/*.whl
174-
upload-release-assets:
174+
upload-extensions:
175175
name: Upload release assets
176176
needs:
177177
[
@@ -194,7 +194,55 @@ jobs:
194194
script: |
195195
const script = require('.github/workflows/upload.js')
196196
await script({github, context})
197-
upload_pypi:
197+
upload-npm:
198+
needs:
199+
[
200+
build-macos-extension,
201+
build-macos-arm-extension,
202+
build-ubuntu-extension,
203+
build-windows-extension,
204+
]
205+
runs-on: ubuntu-latest
206+
steps:
207+
- uses: actions/checkout@v3
208+
- name: Download workflow artifacts
209+
uses: actions/download-artifact@v2
210+
- run: |
211+
cp sqlite-regex-ubuntu/regex0.so npm/sqlite-regex-linux-x64/lib/regex0.so
212+
cp sqlite-regex-macos/regex0.dylib npm/sqlite-regex-darwin-x64/lib/regex0.dylib
213+
cp sqlite-regex-macos-arm/regex0.dylib npm/sqlite-regex-darwin-arm64/lib/regex0.dylib
214+
cp sqlite-regex-windows/regex0.dll npm/sqlite-regex-windows-x64/lib/regex0.dll
215+
- name: Install node
216+
uses: actions/setup-node@v3
217+
with:
218+
node-version: "16"
219+
registry-url: "https://registry.npmjs.org"
220+
- name: Publish NPM sqlite-regex-linux-x64
221+
working-directory: npm/sqlite-regex-linux-x64
222+
run: npm publish --access public
223+
env:
224+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
225+
- name: Publish NPM sqlite-regex-darwin-x64
226+
working-directory: npm/sqlite-regex-darwin-x64
227+
run: npm publish --access public
228+
env:
229+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
230+
- name: Publish NPM sqlite-regex-darwin-arm64
231+
working-directory: npm/sqlite-regex-darwin-arm64
232+
run: npm publish --access public
233+
env:
234+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
235+
- name: Publish NPM sqlite-regex-windows-x64
236+
working-directory: npm/sqlite-regex-windows-x64
237+
run: npm publish --access public
238+
env:
239+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
240+
- name: Publish NPM sqlite-regex
241+
working-directory: npm/sqlite-regex
242+
run: npm publish --access public
243+
env:
244+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
245+
upload-pypi:
198246
needs:
199247
[
200248
build-ubuntu-python,

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ datasette-release: $(TARGET_WHEELS_RELEASE) python/datasette_sqlite_regex/setup.
9494
rm $(TARGET_WHEELS_RELEASE)/datasette* || true
9595
pip3 wheel python/datasette_sqlite_regex/ --no-deps -w $(TARGET_WHEELS_RELEASE)
9696

97+
npm: VERSION npm/platform-package.README.md.tmpl npm/platform-package.package.json.tmpl npm/sqlite-regex/package.json.tmpl scripts/npm_generate_platform_packages.sh
98+
scripts/npm_generate_platform_packages.sh
99+
97100
Cargo.toml: VERSION
98101
cargo set-version `cat VERSION`
99102

@@ -107,6 +110,7 @@ version:
107110
make Cargo.toml
108111
make python/sqlite_regex/sqlite_regex/version.py
109112
make python/datasette_sqlite_regex/datasette_sqlite_regex/version.py
113+
make npm
110114

111115

112116
format:
@@ -136,9 +140,13 @@ test-loadable:
136140
test-python:
137141
$(PYTHON) tests/test-python.py
138142

143+
test-npm:
144+
node npm/sqlite-regex/test.js
145+
139146
test:
140147
make test-loadable
141148
make test-python
149+
make test-npm
142150

143151
.PHONY: clean \
144152
test test-loadable test-python \
@@ -147,4 +155,5 @@ test:
147155
datasette datasette-release \
148156
static static-release \
149157
debug release \
150-
version
158+
format version \
159+
npm

npm/.gitignore

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
.pnpm-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# Bower dependency directory (https://bower.io/)
33+
bower_components
34+
35+
# node-waf configuration
36+
.lock-wscript
37+
38+
# Compiled binary addons (https://nodejs.org/api/addons.html)
39+
build/Release
40+
41+
# Dependency directories
42+
node_modules/
43+
jspm_packages/
44+
45+
# Snowpack dependency directory (https://snowpack.dev/)
46+
web_modules/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Optional stylelint cache
58+
.stylelintcache
59+
60+
# Microbundle cache
61+
.rpt2_cache/
62+
.rts2_cache_cjs/
63+
.rts2_cache_es/
64+
.rts2_cache_umd/
65+
66+
# Optional REPL history
67+
.node_repl_history
68+
69+
# Output of 'npm pack'
70+
*.tgz
71+
72+
# Yarn Integrity file
73+
.yarn-integrity
74+
75+
# dotenv environment variable files
76+
.env
77+
.env.development.local
78+
.env.test.local
79+
.env.production.local
80+
.env.local
81+
82+
# parcel-bundler cache (https://parceljs.org/)
83+
.cache
84+
.parcel-cache
85+
86+
# Next.js build output
87+
.next
88+
out
89+
90+
# Nuxt.js build / generate output
91+
.nuxt
92+
dist
93+
94+
# Gatsby files
95+
.cache/
96+
# Comment in the public line in if your project uses Gatsby and not Next.js
97+
# https://nextjs.org/blog/next-9-1#public-directory-support
98+
# public
99+
100+
# vuepress build output
101+
.vuepress/dist
102+
103+
# vuepress v2.x temp and cache directory
104+
.temp
105+
.cache
106+
107+
# Docusaurus cache and generated files
108+
.docusaurus
109+
110+
# Serverless directories
111+
.serverless/
112+
113+
# FuseBox cache
114+
.fusebox/
115+
116+
# DynamoDB Local files
117+
.dynamodb/
118+
119+
# TernJS port file
120+
.tern-port
121+
122+
# Stores VSCode versions used for testing VSCode extensions
123+
.vscode-test
124+
125+
# yarn v2
126+
.yarn/cache
127+
.yarn/unplugged
128+
.yarn/build-state.yml
129+
.yarn/install-state.gz
130+
.pnp.*
131+
132+
# not needed for libraries, right? running into some issues in ci with this, so gonna yeet
133+
package-lock.json

npm/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# sqlite-regex on npm
2+
3+
`sqlite-regex` is also available for download through [`npm`](https://www.npmjs.com/) for Node.js developers. See the [`sqlite-regex` NPM package README](./sqlite-regex/README.md) for details.
4+
5+
The other NPM packages in this folder (`sqlite-regex-darwin-x64`, `sqlite-regex-windows-x64` etc.) are autogenerated platform-specific packages. See [Supported Platforms](./sqlite-regex/README.md#supported-platforms) for details.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!--- Generated with the npm_generate_platform_packages.sh script, don't edit by hand -->
2+
3+
# ${PACKAGE_NAME}
4+
5+
A `${PACKAGE_NAME_BASE}` platform-specific package for `${PLATFORM_OS}-${PLATFORM_ARCH}`.
6+
7+
When `${PACKAGE_NAME_BASE}` is installed and the host computer has a `${PLATFORM_OS}` operating system with `${PLATFORM_ARCH}` architecture, then this package is downloaded with the pre-compiled SQLite extension bundled under `lib/${EXTENSION_NAME}.${EXTENSION_SUFFIX}`. At runtime, the `${PACKAGE_NAME_BASE}` package will resolve to this platform-specific package for use with [`better-sqlite3`](https://github.com/WiseLibs/better-sqlite3)' or [`node-sqlite3`](https://github.com/TryGhost/node-sqlite3).
8+
9+
See the `${PACKAGE_NAME_BASE}` package for more details.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"//": "Autogenerated by the npm_generate_platform_packages.sh script, do not edit by hand",
3+
"name": "${PACKAGE_NAME}",
4+
"version": "${VERSION}",
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/asg017/${PACKAGE_NAME_BASE}.git",
8+
"directory": "npm/${PACKAGE_NAME}"
9+
},
10+
"author": "Alex Garcia <alexsebastian.garcia@gmail.com>",
11+
"os": [
12+
"${PLATFORM_OS}"
13+
],
14+
"cpu": [
15+
"${PLATFORM_ARCH}"
16+
]
17+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!--- Generated with the npm_generate_platform_packages.sh script, don't edit by hand -->
2+
3+
# sqlite-regex-darwin-arm64
4+
5+
A `sqlite-regex` platform-specific package for `darwin-arm64`.
6+
7+
When `sqlite-regex` is installed and the host computer has a `darwin` operating system with `arm64` architecture, then this package is downloaded with the pre-compiled SQLite extension bundled under `lib/regex0.dylib`. At runtime, the `sqlite-regex` package will resolve to this platform-specific package for use with [`better-sqlite3`](https://github.com/WiseLibs/better-sqlite3)' or [`node-sqlite3`](https://github.com/TryGhost/node-sqlite3).
8+
9+
See the `sqlite-regex` package for more details.

npm/sqlite-regex-darwin-arm64/lib/.gitkeep

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"//": "Autogenerated by the npm_generate_platform_packages.sh script, do not edit by hand",
3+
"name": "sqlite-regex-darwin-arm64",
4+
"version": "0.2.2",
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/asg017/sqlite-regex.git",
8+
"directory": "npm/sqlite-regex-darwin-arm64"
9+
},
10+
"author": "Alex Garcia <alexsebastian.garcia@gmail.com>",
11+
"os": [
12+
"darwin"
13+
],
14+
"cpu": [
15+
"arm64"
16+
]
17+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!--- Generated with the npm_generate_platform_packages.sh script, don't edit by hand -->
2+
3+
# sqlite-regex-darwin-x64
4+
5+
A `sqlite-regex` platform-specific package for `darwin-x64`.
6+
7+
When `sqlite-regex` is installed and the host computer has a `darwin` operating system with `x64` architecture, then this package is downloaded with the pre-compiled SQLite extension bundled under `lib/regex0.dylib`. At runtime, the `sqlite-regex` package will resolve to this platform-specific package for use with [`better-sqlite3`](https://github.com/WiseLibs/better-sqlite3)' or [`node-sqlite3`](https://github.com/TryGhost/node-sqlite3).
8+
9+
See the `sqlite-regex` package for more details.

0 commit comments

Comments
 (0)